-
Notifications
You must be signed in to change notification settings - Fork 82
/
ldcopy
65 lines (65 loc) · 1.65 KB
/
ldcopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
;******************************
;
; DISK COPY LOAD OVER-LAY
;
DSKCPY
LDX #02 ;CHECK RAM TO SEE IF
LDA #$AA ;THE FORMATTER PUT
DSKCPA ;COPY CODE THERE
CMP CPYRAM,X ;PATTERN IS AA55AA
BNE DSKCP1
EOR #$FF ;CHECK NEXT BYTE
DEX ;END OF LOOP ?
BPL DSKCPA ;BRIF IF NOT
LDA #00 ;END OF LOOP AND COPY
STA CPYRAM ;MEM. ZERO ONE BYTE
JMP CPYRAM+3 ;EXECUTE
DSKCP1
LDA #0 ;INIT DRIVE 0
STA DRVNUM ;*
JSR INITDR ;*
JSR HDLDTS ;GET DIR. T & S
LDA #22 ;BUFFER 22 = 1F00
STA HDTMP1
JSR HDRDB1 ;READ DIR. INTO 1F00
LDA DIR+34 ;CHECK FILE TYPE
CMP #$82 ;MAKE SURE CORRECT FILE TYPE
BEQ DSKCP3 ;BRIF OK
DSKCP2
LDA #FLNTFD ;FILE NOT FOUND ERROR
JMP CMDERR ;*
DSKCP3
LDA DIR+35 ;GET BEGINNING TRACK
STA TRACK ;*
LDA DIR+36 ;AND SECTOR
STA SECTOR ;*
JSR OPNIRD ;OPEN INTERNAL READ CHNL
;
; FILE FOUND & OPEN BEGIN READING
;
JSR GIBYTE ;GET LO LOAD ADDR
LDA DATA ;*
CMP #$00 ;CHECK LOAD ADDR
BNE DSKCP2 ;BRIF NOT GOOD LOAD ADDR
STA TEMP+2 ;*
JSR GIBYTE ;GET HI LOAD ADDR
LDA DATA ;*
CMP #$38 ;CHECK IT
BNE DSKCP2 ;BRIF NOT GOOD ADDR
STA TEMP+3 ;WORDS
DSKCP4
JSR GIBYTE ; GET NEXT BYTE
LDA DATA ;*
LDY #0 ;INDEX = 0
STA (TEMP+2),Y ;PUT IT AWAY
INC TEMP+2 ;BUMP TO NEXT BYTE
BNE DSKCP5 ;BRIF NOT WRAPPED
INC TEMP+3 ;BUMP HIGH BYTE
DSKCP5
LDA #LRF ;END OF FILE ?
JSR TSTFLG ;*
BEQ DSKCP4 ;BRIF NOT EOF
LDA #00 ;FORCE RELOAD OF COPY
STA CPYRAM ;ON NEXT COPY CMD
JMP CPYRAM+3 ;EXECUTE COPY
.END