Skip to content

Commit 821eca5

Browse files
committed
feat: implement optimizations for ZX Next runtime
1 parent 2db3316 commit 821eca5

6 files changed

Lines changed: 272 additions & 198 deletions

File tree

src/arch/zxnext/library-asm/attr.asm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ SET_ATTR:
3838
call __IN_SCREEN
3939
ret nc
4040

41+
call __ATTR_ADDR
42+
4143
__SET_ATTR:
4244
; Internal __FASTCALL__ Entry used by printing routines
45+
; HL contains the address of the ATTR cell to set
4346
PROC
4447

45-
call __ATTR_ADDR
46-
4748
__SET_ATTR2: ; Sets attr from ATTR_T to (HL) which points to the scr address
4849
ld de, (ATTR_T) ; E = ATTR_T, D = MASK_T
4950

src/arch/zxnext/library-asm/cls.asm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,21 @@ CLS:
1010

1111
ld hl, 0
1212
ld (COORDS), hl
13-
ld hl, 1821h
13+
ld hl, SCR_SIZE
1414
ld (S_POSN), hl
1515
ld hl, (SCREEN_ADDR)
16+
ld (DFCC), hl
1617
ld (hl), 0
1718
ld d, h
1819
ld e, l
1920
inc de
20-
ld bc, 6144
21+
ld bc, 6143
2122
ldir
2223

2324
; Now clear attributes
2425

2526
ld hl, (SCREEN_ATTR_ADDR)
27+
ld (DFCCL), hl
2628
ld d, h
2729
ld e, l
2830
inc de
@@ -35,4 +37,3 @@ CLS:
3537
ENDP
3638

3739
pop namespace
38-

src/arch/zxnext/library-asm/in_screen.asm

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55

66
__IN_SCREEN:
77
; Returns NO carry if current coords (D, E)
8-
; are OUT of the screen limits (MAXX, MAXY)
8+
; are OUT of the screen limits
99

1010
PROC
1111
LOCAL __IN_SCREEN_ERR
1212

13-
ld hl, MAXX
13+
ld hl, SCR_SIZE
1414
ld a, e
15-
cp (hl)
15+
cp l
1616
jr nc, __IN_SCREEN_ERR ; Do nothing and return if out of range
1717

1818
ld a, d
19-
inc hl
20-
cp (hl)
19+
cp h
2120
ret c ; Return if carry (OK)
2221

2322
__IN_SCREEN_ERR:

0 commit comments

Comments
 (0)