-
Notifications
You must be signed in to change notification settings - Fork 4
/
DSAV.ASM
262 lines (213 loc) · 3.18 KB
/
DSAV.ASM
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
begn equ $0a00
load equ $480
opt h+
org $2e0
dta a(begn)
*************************************
sect equ $04
p0 equ $80
len equ p0+00 ;+01
addr equ p0+02 ;+03
cntr equ p0+04 ;+05
dunit equ $301
dcmmd equ $302
dbufa equ $304 ;(2)
daux1 equ $30a
daux2 equ $30b
disk equ $e453
*************************************
org load
dta b($9b),b($03)
dta a(load)
dta a($f556)
jsr halt
ldx #7
i lda ldat,x
sta $d300,x
lda mess,x
sta $bc78,x
cpx #2
bcs c
lda data,x
sta daux1,x
lda data+2,x
sta dbufa,x
lda data+4,x
sta $2e0,x
c dex
bpl i
asl $bc42
lda #$3c
sta $d302
stx cntr
stx $d300 ;-pic
stx 764 ;-pic
inx
stx $d018 ;-pic
stx 559
stx $41
stx $d40a ;-pic
tsx
inc 88 ;-pic
stx ldat
jsr halt ;-pic
lod1 jsr getb
sta addr
cmp #$ff
beq lod1
jsr getb
sta addr+1
tax
beq tbad
and addr
cmp #$ff
beq lod1
jsr getb
sta len
jsr getb
sta len+1
lda <rts
sta $2e2
lda >rts
sta $2e3
bne lod3 ;-jmp
lod2 inc addr
bne *+4
inc addr+1
lod3 jsr getb
ldy #0
sta (addr),y
lda addr+1
cmp len+1
bne lod2
lda addr
cmp len
bne lod2
jsr inij
jmp lod1
inij jmp ($2e2)
error ldx ldat
txs
lda daux1
cmp #$cc
bne *+6
cpy #$90
beq *+4
clc
rts
jmp ($2e0)
tbad lda #$cc
sta daux1
lda #$02
sta daux2
jsr halt
jmp gets
getb ldx cntr
bpl gtb1
gets jsr disk
bmi error
inc daux1
bne *+5
inc daux2
ldx #0
gtb1 lda secb,x
eor load,x
inx
stx cntr
rts rts
data dta a(4)
dta a(secb)
dta a(rts)
dta a($f556) ;-pic
ldat dta B($FF),B($FF),c'0<',B($FF),B($FF),c'0<'
mess dta d'loading:'
halt lda 20
cmp 20
beq *-2
rts
endldr equ *
secb equ load+$180
*************************************
opt h-
org begn
dta a(begn)
dta a(buff-9)
jsr $f556
jsr $f2fd
* zapisz loader
lda <load
sta dbufa
lda >load
sta dbufa+1
lda <1
sta daux1
lda >1
sta daux2
lda <3
sta cntr
lda >3
sta cntr+1
jsr save
* koduj plik
lda <buff
sta addr
lda >buff
sta addr+1
ldx #0
ldy #0
kodu lda (addr),y
eor load,x
sta (addr),y
inx
bpl *+4
ldx #0
iny
bne kodu
inc addr+1
lda addr+1
cmp >$bb00
bcc kodu
* zapisz plik
lda <buff
sta dbufa
lda >buff
sta dbufa+1
lda #0
sta cntr+1
sec
lda >$bc00
sbc >buff
asl @
rol cntr+1
sta cntr
save equ *
lda #'P'
sta dcmmd
lda #1
sta dunit
lda dcmmd
cmp #'P'
bne save
sav1 jsr disk
bmi savx
clc
lda dbufa
adc #128
sta dbufa
bcc *+5
inc dbufa+1
inc daux1
bne *+5
inc daux2
dec cntr
bne sav1
dec cntr+1
bpl save
ldy #1
savx rts
dta a($ffff)
dta a(buff)
dta a($c000)
buff equ *
org endldr
END