-
Notifications
You must be signed in to change notification settings - Fork 0
/
scroll.asm
454 lines (368 loc) · 5.73 KB
/
scroll.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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
; Copyright (C) 2006 Remy Glaser
;
; 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 3
; 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
; gpl-3.0.txt for more details.
;
SIMPLE_SCROLL:
ld hl,(cursor_adress)
dec hl
ld (Min_adress),hl
ld b,3
OUTPUT_PAGE:
bcall(_grbufclr)
xor a
ld (penrow),a
ld (pencol),a
OUTPUT_PAGE_LOOP:
ld hl,(cursor_adress)
ld a,(hl)
cp tag_Return
jp z,NEXT_LINE
cp tag_freetext
jp z,FREETEXT
cp tag_invert
jp z,INVERSE
cp tag_tab
jp z,TAB
cp tag_picture
jp z,PIC
cp tag_page_end
jp z,SCROLL_KEY
cp tag_Square
jp z,CUSTOM_SQUARE
cp tag_line
jp z,CUSTOM_LINE
res 2,(iy+textflags)
bcall(_vputmap)
ld a,(iy+textflags)
; ld a,($942B)
; and a
; jp z,STRANGE_ERROR
call INCCURSOR
jp OUTPUT_PAGE_LOOP
;STRANGE_ERROR:
; jp _ERRLINKXMIT
INVERSE:
ld a,(iy+Textflags)
xor %00001000
ld (iy+textFlags),a
call INCCURSOR
jp OUTPUT_PAGE_LOOP
FREETEXT:
ld hl,(pencol)
exx
call INCCURSOR
ld a,(hl)
add a,255-94
jp c,_ERRDOMAIN
ld a,(hl)
ld (penrow),a
call INCCURSOR
ld a,(hl)
add a,255-63
jp c,_ERRDOMAIN
ld a,(hl)
ld (pencol),a
FREETEXTLOOP:
call INCCURSOR
ld a,(hl)
cp tag_invert
jp z,FREE_INVERSE
cp tag_freetext
jp z,FREE_END
bcall(_vputmap)
jp FREETEXTLOOP
FREE_INVERSE:
ld a,(iy+Textflags)
xor %00001000
ld (iy+textFlags),a
jp FREETEXTLOOP
FREE_END:
exx
ld (pencol),hl
call INCCURSOR
jp OUTPUT_PAGE_LOOP
PIC:
call INCCURSOR
ld a,(hl)
ld l,a
ld h,0
ld a,8
bcall(_divhlbya)
ld a,l
ld (x),a
call INCCURSOR
ld a,(hl)
ld (y),a
call INCCURSOR
ld a,(hl)
ld l,a
ld h,0
ld a,8
bcall(_divhlbya)
and a
jp nz,_ERRDIMENSION
ld a,l
ld (width),a
call INCCURSOR
ld a,(hl)
ld (height),a
ld a,(x)
ld b,a
ld a,(width)
add a,b
add a,255-12
jp c,_ERRDOMAIN
ld a,(y)
ld b,a
ld a,(height)
add a,b
add a,255-64
jp c,_ERRDOMAIN
ld a,(y)
ld l,a
ld h,12
bcall(_htimesl)
ld a,(x)
dec a
cp $FF
call z,A_0
add a,l
call c,INC_H
ld l,a
ld de,plotsscreen
add hl,de
bcall(_cphlde)
call z,DEC_HL
ld (pic_current),hl
ld a,(y)
ld b,a
ld a,(height)
add a,b
dec a
ld l,a
ld h,12
bcall(_htimesl)
ld a,(x)
ld b,a
ld a,(width)
add a,b
ld b,l
add a,b
ld l,a
call c,INC_H
ld de,plotsscreen
add hl,de
ld (PIC_MAX),hl
DRAW_LOOP:
ld a,(width)
ld b,a
DRAW_MINILOOP:
call INCCURSOR
ld a,(hl)
call PIC_INC
ld c,(hl)
or c ; Transparency
ld (hl),a
djnz DRAW_MINILOOP
ld a,(width)
ld b,a
ld a,12
sub b
and a
jp z,DRAW_LOOP
ld b,a
DRAW_SKIPLOOP:
call PIC_INC
djnz DRAW_SKIPLOOP
jp DRAW_LOOP
PIC_EXIT:
pop hl
ld b,4
PIC_EXITLOOP:
call INCCURSOR
djnz PIC_EXITLOOP
jp OUTPUT_PAGE_LOOP
INC_H:
inc h
ret
DEC_HL:
dec hl
ret
A_0:
xor a
ret
PIC_INC:
ld hl,(PIC_MAX)
ex de,hl
ld hl,(PIC_CURRENT)
inc hl
bcall(_cphlde)
jp z,PIC_EXIT
ld (PIC_CURRENT),hl
ret
; Vector support
CUSTOM_SQUARE:
call INCCURSOR
ld b,(hl)
call INCCURSOR
ld c,(hl)
call INCCURSOR
ld d,(hl)
push de
call INCCURSOR
pop de
ld e,(hl)
push de
call INCCURSOR)
ld h,(hl)
pop de
call SQUARE
jp OUTPUT_PAGE_LOOP
CUSTOM_LINE:
call INCCURSOR
ld b,(hl)
call INCCURSOR
ld c,(hl)
ld a,63
sub c
ld c,a
call INCCURSOR
ld d,(hl)
push de
call INCCURSOR
pop de
ld e,(hl)
ld a,63
sub e
ld e,a
push de
call INCCURSOR
ld h,(hl)
pop de
bcall(_Iline)
call INCCURSOR
jp OUTPUT_PAGE_LOOP
TAB:
ld a,(pencol)
add a,255-24
jp c,LARGERTHAN24
ld a,24
jp END_TAB
LARGERTHAN24:
ld a,(pencol)
add a,255-48
jp c,LARGERTHAN48
ld a,48
jp END_TAB
LARGERTHAN48:
ld a,(pencol)
add a,255-72
jp c,END_TAB
ld a,72
END_TAB:
ld (pencol),a
call INCCURSOR
jp OUTPUT_PAGE_LOOP
INCCURSOR:
call file.readByte
jp c,RETTO__SCROLL_KEY
ret
RETTO__SCROLL_KEY:
pop hl
jp SCROLL_KEY
NEXT_LINE:
call INCCURSOR
ld a,(penrow)
add a,6
ld b,255-58
add a,b
jp c,OUTPUT_PAGE_LOOP
sub b
ld (penrow),a
xor a
ld (pencol),a
jp OUTPUT_PAGE_LOOP
SCROLL_KEY:
bcall(_grbufcpy_v)
ld a,(iy+textflags)
ld (asave),a
res textinverse,(iy+textflags)
SCROLL_KEYLOOP:
call BETAKEY
cp key_up
jp z,UP
cp key_down
jp z,DOWN
cp key_enter
jp z,SCROLL_BETASHELL
jp SCROLL_KEYLOOP
DOWN:
ld a,(asave)
ld (iy+textflags),a
call INCCURSOR
jp OUTPUT_PAGE
UP:
ld a,(asave)
ld (iy+textflags),a
ld b,2
ld hl,(cursor_adress)
ld a,(hl)
cp tag_picture
jp z,SKIP_PICTURE
UP_LOOP:
call DECCURSOR
ld a,(hl)
cp tag_picture
jp z,SKIP_PICTURE
cp tag_page_end
jp nz,up_loop
djnz UP_LOOP
call INCCURSOR
jp OUTPUT_PAGE
SKIP_PICTURE:
call DECCURSOR
ld a,(hl)
ld c,a
call DECCURSOR
ld a,(hl)
ld b,a
SKIP_PIC_LOOP:
call DECCURSOR
dec bc
ld d,b
ld e,c
ld hl,0
bcall(_cphlde)
jp nz,SKIP_PIC_LOOP
ld b,5
DECCURSOR_LOOP:
call DECCURSOR
djnz DECCURSOR_LOOP
jp UP_LOOP
DECCURSOR:
ld hl,(min_adress)
ex de,hl
ld hl,(cursor_adress)
dec hl
bcall(_cphlde)
jp z,RETTO__OUTPUT_PAGE
ld (cursor_adress),hl
ret
RETTO__OUTPUT_PAGE:
pop hl
jp OUTPUT_PAGE
ScreenVPutMap:
res textwrite,(iy+sgrflags)
bcall(_vputmap)
set textwrite,(iy+sgrflags)
ret
SCROLL_BETASHELL:
jp betashell