-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcomloadcode.src
More file actions
149 lines (130 loc) · 2.13 KB
/
comloadcode.src
File metadata and controls
149 lines (130 loc) · 2.13 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
; comloadcode - load .com executable
;
; Copyright (C) 1992-2004 Matthias Reichl <hias@horus.com>
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
.LOCAL
.if .def PICOBOOT
JSR RREAD
LDX #2 ; skip first two bytes ($FF, $FF)
.else
COMLD = RREND
* = COMLD
TXA
PHA
JSR CLRMEM
PLA
TAX
.endif
JSR GETBYT
STA ADR
STA 736
JSR GETBYT
STA ADR+1
STA 737
?XXX JSR GETBYT ; End-Adr LO
SEC
SBC ADR
STA BLEN
PHP
JSR GETBYT ; End-Adr HI
PLP
SBC ADR+1
STA BLEN+1
INC BLEN
INC BLEN+1
LDY #0
?MLOOP CPX BYTES
BNE ?NRRD
?DORD JSR RREAD
LDA BLEN+1
CMP #2
BCC ?NRRD
LDA BYTES
CMP SECBYTE
BNE ?NRRD
; use fast copy routine in case of a full (125/253 bytes) sector
TYA
CLC
ADC ADR
STA ADR
BCC ?NI01
INC ADR+1
?NI01 LDY SECBYTE
DEY
?COP4 LDA BUF,Y
STA (ADR),Y
DEY
LDA BUF,Y
STA (ADR),Y
DEY
LDA BUF,Y
STA (ADR),Y
DEY
LDA BUF,Y
STA (ADR),Y
DEY
BNE ?COP4
LDA BUF,Y
STA (ADR),Y
CLC
LDA ADR
ADC SECBYTE
STA ADR
BCC ?NI02
INC ADR+1
?NI02 SEC
LDA BLEN
BNE ?NEN1
INC BLEN+1
?NEN1 SBC SECBYTE
STA BLEN
BNE ?NEN2
DEC BLEN+1
?NEN2 BCS ?ND01
DEC BLEN+1
?ND01 JMP ?DORD
?NRRD LDA BUF,X
INX
STA (ADR),Y
DEC BLEN
BNE ?ADPLUS
DEC BLEN+1
BEQ ?ENDBLK
?ADPLUS INY
BNE ?MLOOP
INC ADR+1
BNE ?MLOOP
?ENDBLK LDA 739
CMP #>ENDX
BEQ ?GT
?XINIT STX XREG
JSR INADJ ; und init!
?WTSYNC LDA $D40B
BNE ?WTSYNC
LDX XREG
LDA #<ENDX
STA 738
LDA #>ENDX
STA 739
?GT JSR GETBYT ; Start LO
STA ADR
JSR GETBYT ; Start HI
STA ADR+1
AND ADR
CMP #$FF
BEQ ?GT
JMP ?XXX
COMLEND = *