Skip to content

Commit 2b93838

Browse files
t-tangboriel
authored andcommitted
Add udg support to print42
1 parent 77d8417 commit 2b93838

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

src/lib/arch/zx48k/stdlib/print42.bas

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@ asm
3939
LOCAL examineChar
4040
examineChar:
4141
LD A,(HL) ; Grab the character at our pointer position
42-
CP 128 ; Too high to print?
42+
CP 165 ; Too high to print?
4343
JR NC, nextChar ; Then we go to the next
4444

45+
CP 144
46+
JR NC, prn ; char is a UDG
47+
48+
CP 128
49+
JR NC, nextChar ; char is a block graphic
50+
4551
CP 22 ; Is this an AT?
4652
JR NZ, isNewline ; If not jump over the AT routine to isNewline
4753

@@ -130,6 +136,9 @@ printachar:
130136
PUSH HL ; Store H'L' where we can get it.
131137
EXX
132138

139+
CP 144
140+
jr nc,printudg
141+
133142
ld c, a ; Put a copy of the character in C
134143
ld h, 0
135144
ld l, a ; Put the Character in HL
@@ -148,6 +157,19 @@ printachar:
148157
ld c, l ; Copy our character data address into BC
149158
jr printdata ; We have our data source, so we print it.
150159

160+
LOCAL printudg
161+
printudg
162+
sub 144 ; get the udg offset
163+
ld hl,$5C7B ; examine system variables for udg address
164+
ld e,(hl) ; lsb for udg address
165+
inc hl
166+
ld d,(hl) ; mbs for udg address
167+
ld l,a ; character offset for udg
168+
call mult8 ; multiplies L by 8 and adds in DE [so HL points at our table entry]
169+
ld b, h
170+
ld c, l ; Copy our character data address into BC
171+
jr printdata ; We have our data source, so we print it.
172+
151173
LOCAL calcChar
152174
calcChar: ; this is the calculate from the ROM data option
153175
; a holds the column kill data

0 commit comments

Comments
 (0)