Skip to content

Commit 1bf2eda

Browse files
committed
refact: optimize PRINT routine
1 parent bc8f428 commit 1bf2eda

6 files changed

Lines changed: 111 additions & 133 deletions

File tree

examples/inputexample.bas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <input.bas>
2-
2+
border 1: cls
33
print at 10, 5; "Type something: ";
44
a$ = input(20)
55
print
66
print "You typed: "; a$
7-

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
;; Clears the user screen (24 rows)
22

3-
#include once <sposn.asm>
43
#include once <sysvars.asm>
54

65
push namespace core
@@ -10,19 +9,21 @@ CLS:
109

1110
ld hl, 0
1211
ld (COORDS), hl
13-
ld hl, 1821h
12+
ld hl, SCR_SIZE
1413
ld (S_POSN), hl
1514
ld hl, (SCREEN_ADDR)
15+
ld (DFCC), hl
1616
ld (hl), 0
1717
ld d, h
1818
ld e, l
1919
inc de
20-
ld bc, 6144
20+
ld bc, 6143
2121
ldir
2222

2323
; Now clear attributes
2424

2525
ld hl, (SCREEN_ATTR_ADDR)
26+
ld (DFCCL), hl
2627
ld d, h
2728
ld e, l
2829
inc de
@@ -35,4 +36,3 @@ CLS:
3536
ENDP
3637

3738
pop namespace
38-

src/arch/zx48k/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)