Skip to content

Commit 2db3316

Browse files
committed
refact: implement own scroll routine
This way we get rid of ROM (less dependency).
1 parent 1bf2eda commit 2db3316

1 file changed

Lines changed: 80 additions & 5 deletions

File tree

src/arch/zx48k/library-asm/print.asm

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ __PRINTCHAR: ; Print character store in accumulator (A register)
5656
LOCAL __PRINT_UDG
5757
LOCAL __PRGRAPH
5858
LOCAL __PRINT_START
59-
LOCAL __ROM_SCROLL_SCR
60-
61-
__ROM_SCROLL_SCR EQU 0DFEh
6259

6360
PRINT_JUMP_STATE EQU __PRINT_JUMP + 2
6461

@@ -83,7 +80,7 @@ __PRINT_CHR:
8380
#ifndef __ZXB_DISABLE_SCROLL
8481
inc h
8582
push hl
86-
call __ROM_SCROLL_SCR
83+
call __SCROLL_SCR
8784
pop hl
8885
#else
8986
ld h, SCR_ROWS - 1
@@ -201,7 +198,7 @@ __PRINT_0Dh: ; Called WHEN printing CHR$(13)
201198
#ifndef __ZXB_DISABLE_SCROLL
202199
inc h
203200
push hl
204-
call __ROM_SCROLL_SCR
201+
call __SCROLL_SCR
205202
pop hl
206203
#else
207204
ld h, SCR_ROWS - 1
@@ -412,6 +409,84 @@ __ITALIC:
412409
ret
413410
#endif
414411

412+
#ifndef __ZXB_DISABLE_SCROLL
413+
LOCAL __SCROLL_SCR
414+
415+
# ifdef __ZXB_ENABLE_BUFFER_SCROLL
416+
__SCROLL_SCR: ;; Scrolls screen and attrs 1 row up
417+
ld de, (SCREEN_ADDR)
418+
ld b, 3
419+
3:
420+
push bc
421+
ld a, 8
422+
1:
423+
ld hl, 32
424+
add hl, de
425+
ld bc, 32 * 7
426+
push de
427+
ldir
428+
pop de
429+
inc d
430+
dec a
431+
jr nz, 1b
432+
push hl
433+
ld bc, -32 - 256 * 7
434+
add hl, bc
435+
ex de, hl
436+
ld a, 8
437+
2:
438+
ld bc, 32
439+
push hl
440+
push de
441+
ldir
442+
pop de
443+
pop hl
444+
inc d
445+
inc h
446+
dec a
447+
jr nz, 2b
448+
pop de
449+
pop bc
450+
djnz 3b
451+
452+
dec de
453+
ld h, d
454+
ld l, e
455+
ld a, 8
456+
3:
457+
push hl
458+
push de
459+
ld (hl), b
460+
dec de
461+
ld bc, 31
462+
lddr
463+
pop de
464+
pop hl
465+
dec d
466+
dec h
467+
dec a
468+
jr nz, 3b
469+
470+
ld de, (SCREEN_ATTR_ADDR)
471+
ld hl, 32
472+
add hl, de
473+
ld bc, 32 * 23
474+
ldir
475+
476+
ld h, d
477+
ld l, e
478+
ld a, (ATTR_P)
479+
ld (hl), a
480+
inc de
481+
ld bc, 31
482+
ldir
483+
ret
484+
# else
485+
__SCROLL_SCR EQU 0DFEh ; Use ROM SCROLL
486+
# endif
487+
#endif
488+
489+
415490
PRINT_COMMA:
416491
call __LOAD_S_POSN
417492
ld a, e

0 commit comments

Comments
 (0)