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
org 0fa00h
direct_dat:
db 19h,25h,3fh,25h,19h,25h,19h,7dh,19h,7dh,51h,41h,79h,05h,7dh,11h
db 7dh,31h,7dh,25h,19h,25h,3dh,51h,3dh,31h,3dh,21h,1dh,7dh,55h,29h
db 55h,29h,29h,29h,39h,45h,45h,79h,05h,79h,7dh,45h,39h,45h,5dh,7dh
db 55h,45h,7dh,45h,7dh,05h,05h,7dh,11h,6dh,11h,6dh,7dh,41h,3dh,0dh
db 3dh,43h,01h,43h,3dh,39h,45h,39h,05h,3dh,7dh,51h,21h,55h,39h,05h
db 39h,55h,39h,55h,09h,39h,4dh,35h,7dh,51h,2dh,11h,2dh,35h,25h,55h
db 49h,41h,7dh,41h,55h,21h,61h,1dh,61h,01h,61h,4dh,55h,65h,19h,25h
db 25h,19h,2dh,35h,01h,3dh,51h,1bh,2bh,3dh,19h,25h,7dh,21h,1dh,01h
db 5dh,01h,1dh,21h,13h,5dh,01h,79h,25h,15h,35h,29h,3bh,0bh,3dh,4dh
db 55h,25h,45h,55h,29h,71h,11h,3dh,75h,55h,49h,4dh,51h,61h,01h,75h
db 01h,05h,01h,25h,01h,01h,01h,03h,05h,11h,11h,11h,39h,11h,7dh,11h,2dh
;177 bytes CHR set
;A=16,B=1d,C=24,D=2a,E=2f,F=09,G=2c,H=0e,I=31,J=25,K=37,L=34,M=10,N=3c,O=45,P=4a,Q=55,R=58,S=5e,T=61,U=0c,V=27,W=07,X=39,Y=66,Z=6b
;a=14,b=12,c=6e,d=7a,e=71,f=74,g=77,h=7c,i=7f,j=84,k=b0,l=0b,m=18,n=1a,o=04,p=02,q=00,r=81,s=89,t=86,u=47,v=4e,w=3e,x=5a,y=8c,z=5c
;0=50,1=33,2=8f,3=92,4=95,5=98,6=52,7=9b,8=1f,9=4c
;!=9e,"=68,.=a0,,=a6,:=a2,+=ab,-=a9,(=40,)=42,==21,?=63,SPC=a4
start:
ld d,0fah ;Hi-byte of CHR set+ EOM marker
s_rpt:
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
pr_lp0:
and a ;clear Carry
ld c,h ;save SCReen position
init0:
inc h
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.
target:
ld hl,3f00h ;SCReen address
ld bc,message ;MSG address
call start
ret
message: ;example message 'Hi To All At Spectrum Computing'
db 0eh,7fh,0a4h,61h,04h,0a4h,16h,0bh,0bh,0a4h,16h,86h,0a4h,5eh,02h,71h,6eh,86h,81h,47h,18h,0a4h,24h,04h,18h,02h,47h,86h,7fh,1ah,77h,0fah
I'll have a further faff around with the character map and see if I can gain a few more bytes