Moving Data

Discuss software for the Apple 1/replica 1

Moving Data

Postby Mojoseph_12 » Sep Fri 14, 2007 9:05 pm

How would you move large blocks of data? For example if I wanted to move data at 1000.1FFF to A000.AFFF.
Mojoseph_12
 
Posts: 46
Joined: Jan Fri 05, 2007 4:07 pm
Location: New Mexico,USA

Postby vbriel » Sep Fri 14, 2007 10:15 pm

Here's a little program I use to copy the EPROM in the replica 1 to an EEPROM at A000:

Code: Select all
10 R=-8192:B=-24576
20 FOR I=1 TO 8192
30 A= PEEK (R): POKE B,A
40 FOR J=1 TO 2: NEXT J
50 R=R+1:B=B+1
60 NEXT I
70 PRINT "VERIFYING EEPROM"
80 R=-8192:B=-24576
90 FOR I=1 TO 8192
100 X= PEEK (R):Y= PEEK (B)
110 IF X=Y THEN 130
111 V=PEEK(R):M=PEEK(B)
112 IF V=M THEN 130
120 PRINT "NEW EEPROM ";B;" ROM =";X;" BLANK =";Y;" MASTER ";R
130 R=R+1:B=B+1
140 NEXT I
150 PRINT "FINISHED"
160 END


Since it's a utility for me I just have it give me a notice of failure to write at a location. Usually it is just a timing issue. I have this thing burn through a EEPROM pretty quick.

You didn't specify if you needed this in assembly but I had this laying around.

Vince
User avatar
vbriel
Site Admin
 
Posts: 1184
Joined: Jul Tue 19, 2005 1:10 pm
Location: Ohio

Postby Kallikak » Sep Fri 14, 2007 11:43 pm

You can also use the memory move routine in Krusader as described in section 8.3 of the Krusader manual.

First work out non-overlapping source and destination addresses – call these srcL, srcH, destL and destH, and then the size of memory to move – sizeL and sizeH ... drop into the monitor ... and enter:
50: srcL srcH destL destH sizeL sizeH to set the parameters, and F20ER to do the move.


The actual adress depends on the version of Krusader you are running. That example uses the address for Krusader 1.2. Just check the manual you have.

Ken
Kallikak
 
Posts: 172
Joined: Jan Sun 29, 2006 7:42 pm
Location: Sydney

Postby Mojoseph_12 » Sep Sat 15, 2007 12:19 am

Is there a program that's in assembly?
Mojoseph_12
 
Posts: 46
Joined: Jan Fri 05, 2007 4:07 pm
Location: New Mexico,USA

Postby Kallikak » Sep Sat 15, 2007 12:52 am

To code it in assembly I'd use something like the following
Code: Select all
; CHECK THIS ADDRESS FOR
; YOUR ROM VERSION
MOVE   .=  $F20E

SRC    .=  $3000
DEST   .=  $5000
SIZE   .=  $200

SRCL   .=  $50
SRCH   .=  $51
DESTL  .=  $52
DESTH  .=  $53
SIZEL  .=  $54
SIZEH  .=  $55

; LOAD AND STORE THE SOURCE
; ADDRESS

       LDA #<SRC
       STA SRCL
       LDA #>SRC
       STA SRCH

; LOAD AND STORE THE
; DESTINATION ADDRESS

       LDA #<DEST
       STA DESTL
       LDA #>DEST
       STA DESTH

; LOAD AND STORE THE SIZE

       LDA #<SIZE
       STA SIZEL
       LDA #>SIZE
       STA SIZEH

; AND DO THE MOVE

       JMP MOVE


Also, Krusader source is available. The routines are
Code: Select all
; ****************************************
;   Memory moving routines
;  From http://www.6502.org/source/general/memory_move.html
; ****************************************

; Some aliases for the following two memory move routines

FROM   =MISCL      ; move from MISCL,H
TO   =MISC2L      ; to MISCL2,H
SIZEL   =TEMP1
SIZEH   =TEMP2

MOVEDN         ; Move memory down
   LDY #$00
   LDX SIZEH
   BEQ .MD2
.MD1   LDA (FROM),Y ; move a page at a time
   STA (TO),Y
   INY
   BNE .MD1
   INC FROM+1
   INC TO+1
   DEX
   BNE .MD1
.MD2   LDX SIZEL
   BEQ .MD4
.MD3   LDA (FROM),Y ; move the remaining bytes
   STA (TO),Y
   INY
   DEX
   BNE .MD3
.MD4   RTS
   
MOVEUP         ; Move memory up
   LDX SIZEH   ; the last byte must be moved first
   CLC      ; start at the final pages of FROM and TO
   TXA
   ADC FROM+1
   STA FROM+1
   CLC
   TXA
   ADC TO+1
   STA TO+1
   INX      ; allows the use of BNE after the DEX below
   LDY SIZEL
   BEQ .MU3
   DEY      ; move bytes on the last page first
   BEQ .MU2
.MU1   LDA (FROM),Y
   STA (TO),Y
   DEY
   BNE .MU1
.MU2   LDA (FROM),Y   ; handle Y = 0 separately
   STA (TO),Y
.MU3   DEY
   DEC FROM+1   ; move the next page (if any)
   DEC TO+1
   DEX
   BNE .MU1
   RTS
Kallikak
 
Posts: 172
Joined: Jan Sun 29, 2006 7:42 pm
Location: Sydney

Postby Mojoseph_12 » Sep Mon 17, 2007 1:04 pm

On this line, what does the"<" mean?
Code: Select all
 LDA #<SRC
Mojoseph_12
 
Posts: 46
Joined: Jan Fri 05, 2007 4:07 pm
Location: New Mexico,USA

Postby Kallikak » Sep Mon 17, 2007 6:24 pm

You need to read the Krusader manual section on expressions. Although basically simple, there are some subtleties associated with that particular operator.
Kallikak
 
Posts: 172
Joined: Jan Sun 29, 2006 7:42 pm
Location: Sydney


Return to Software

Who is online

Users browsing this forum: No registered users and 2 guests

cron