Code: Select all
device zxspectrum48
org $c000
drawtext:
ld hl,text
ld de,18432+(3*32) ; start pos
textloop:
ld a,(hl)
and a
ret z
push hl ; store text address
ld bc,$3C00 ; rom font
ld h,c
add a,a
ld l,a
add hl,hl
add hl,hl
add hl,bc
; keep screen address
push de
ld b,8
charloop:
ld a,(hl) ; value
ld c,a ; keep for later
;look for 2 contiguous bits
bitloop:
cp #C0
jr nc,twobits
add a,a
jr nz,bitloop
scf
jr secondline
twobits: ; found two bits together, display previous line
dec hl
ld c,(hl) ; get next line above instead
inc hl
secondline:
ld a,c
ld (de),a ; write
call linedown
ld a,(hl)
ld (de),a
call linedown
linedone:
inc hl ; next byte
djnz charloop
pop de
inc de
pop hl
inc hl
jr textloop
linedown:
inc d ; one line down
ld a,d
and 7
ret nz
ld a,e ; else add 32
add a,32
ld e,a
ret c
ld a,d ; else sub 8 from h
sub 8
ld d,a
ret
text:
defb "Loading ",0x22,"ChuckieEgg",0x22," Please Wait",0
savetap "bitfont.tap",drawtext