I like the creative use of RRD/RLD. I just wish they were faster instructions!
Anyway, I thought I'd throw my hat into the ring sort of thing.
I use a method of encoding the characters that stores vertical lines, then adding a vertical 'space' between each character.
Its a similar way to how I store the font in my proportional scroller.
So, routine needs HL with screen address and BC with the message address when CALLed.
the combined print routine and 74 character 'font' based upon the one posted earlier here, is 210 bytes currently, but could be optimised probably a little more.
Code: Select all
;177 bytes CHR set
ld d,0fah ;Hi-byte of CHR set+ EOM marker
ld a,(bc) ;get CHR code
ld e,a ;CHR code is x3 to save having to do it in routine
cp d ;SUB 0FAh, use D reg value to mark the string end
ret nc ;RET if 0FAh detected
push bc ;save MSG position
ld b,04h ;counter
ld a,01h ;set space line with end marker
and a ;clear Carry
ld c,h ;save SCReen position
rl (hl) ;bit into (HL)
add a,a ;next data BIT
jr nz,init0 ;repeat if not 00
ld h,c ;restore SCReen address
ld a,(de) ;get data byte
inc e ;next
djnz pr_lp0 ;next line
pop bc ;restore MGS address
inc bc ;next CHR byte
ld a,c ;check
and 01h ;mask BIT 0
add a,l ;add result to L
ld l,a ;INC 1 or 0
jr s_rpt ;next CHR rpt.
ld hl,3f00h ;SCReen address
ld bc,message ;MSG address
message: ;example message 'Hi To All At Spectrum Computing'
I'll have a further faff around with the character map and see if I can gain a few more bytes