Code: Select all
*
* *
* *
* *
**
**
Code: Select all
*
* *
* *
* *
**
**
Code: Select all
charloop:
push hl ; save screen pos
dec ix ; read string backwards
ld a, (ix+0) ; get char
ld d, c ; save length temporarily
ld e, 6 ; assume char is 6px initially
ld hl, check_table
ld bc, 2 ; compare two chars
cpir ; check if char is Q or j
jr nz, skip_inc_e
inc e
skip_inc_e:
ld l, check_table+2
ld c, 5 ; compare five chars
cpir ; check if char is g p q y ,
pop hl ; restore screen pos
push hl ; save it again
jr nz, skip_inc_h
inc h
skip_inc_h:
ld b, e ; load counter for height
ld c, d ; restore length
ld d, font_hi
ld e, a ; put character into e
; ... rest of code ...
check_table:
db 'Q', 'j', 'g', 'p', 'q', 'y', ','
Code: Select all
charloop:
ld d, font_hi
push hl ; save screen pos
dec ix ; read string backwards
ld a, (ix+0) ; get char
ld b, 6 ; assume char is 6px initially
cp 'g'
jr z, inc_h
cp 'p'
jr z, inc_h
cp 'q'
jr z, inc_h
cp 'y'
jr z, inc_h
cp ','
jr z, inc_h
cp 'Q'
jr z, inc_b
cp 'j'
jr nz, skip_inc
inc_b:
inc b
jr skip_inc
inc_h:
inc h
skip_inc:
; ... rest of code ...
That sounds like an excellent idea, though I don't have any great ideas on what to use those bits for, other than signaling vertical displacement.djnzx48 wrote: ↑Fri Feb 23, 2018 4:41 am About wasted bits in the font data, what about sticking in a RES 4, (HL) at nextrow just after the font row has been written to the screen? This would ensure that only the first three bits of each character are printed, allowing for the spare bits to be used as flags for other code.
Nice language selection screen.Alessandro wrote: ↑Mon Feb 26, 2018 1:56 pm Thanks a lot @utz, but your font is great too, and more flexible than mine - it's got lower case characters
I also employ it for the language selection screen for the disk multi-language edition of several of my games. Here is the one from Sophia (notice my attempt at a Cyrillic variant):
Code: Select all
charloop:
ld d, font_hi ; construct font address
push hl ; save screen pos
dec c ; any more chars?
ret m ; done
ld a, c ; number of chars left to print
or a ; clear carry for scroll
rra ; divide by two (64 chars to 32)
add a, l ; calculate new screen address
ld l, a
ld b, 6 ; loop 6 rows
dec ix ; read string backwards
if 1
ld e, (ix+0) ; get character
srl e ; check value of LSB
else
db $DD, $CB, $00, $3B ; ld e, srl (ix+0)
; saves one byte and 4 Ts
; Only use for temporary strings
; (string becomes corrupted)
endif
rowloop:
inc h ; next screen line (skipping first row)
ld a, (de) ; get graphic
rrd ; rotate onto screen
jr c, nextrow ; done printing?
rrd ; rotate again into A
ld (hl), a ; display on screen
nextrow:
inc d ; next graphic
djnz rowloop ; loop for all rows
nextchar:
pop hl ; restore screen pos
jr charloop ; loop back round
Code: Select all
charloop:
ld d, font_hi ; construct font address
push hl ; save screen pos
dec c ; any more chars?
ret m ; done
ld a, c ; number of chars left to print
srl a ; divide by two (64 chars to 32)
add a, l ; calculate new screen address
ld l, a
ld a, (bc) ; read string backwards
ld e, a ; get character
srl e ; check value of LSB
push bc ; save message address
ld b, 6 ; loop 6 rows
rowloop:
inc h ; next screen line (skipping first row)
ld a, (de) ; get graphic
rrd ; rotate onto screen
jr c, nextrow ; done printing?
rrd ; rotate again into A
ld (hl), a ; display on screen
nextrow:
inc d ; next graphic
djnz rowloop ; loop for all rows
nextchar:
pop bc ; restore message address
pop hl ; restore screen pos
jr charloop ; loop back round
Cannot really say, I am unable to distinguish between them because my knowledge of the language is basic to say the least. However, since the initial translations were kindly provided by Brazilian native speakers (Einar, Marcus Garrett Chiado), I guess it's closer to Brazilian, although I suppose the reforms and agreements achieved since 1990 made the two variants more similar than in the past.
The picture does not have 4:3 proportions, hence the slight misalignment, which is more evident here; when you watch it on a monitor/TV full screen, it's less noticeable.
I may have not explained myself well enough.Alessandro wrote: ↑Tue Feb 27, 2018 8:06 am ...The picture does not have 4:3 proportions, hence the slight misalignment, which is more evident here; when you watch it on a monitor/TV full screen, it's less noticeable.
Nice ...
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
Code: Select all
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 z ;RET if 0FAh detected
push bc ;save MSG position
ld b,04h ;counter
ld a,01h ;set space line with end marker
pr_lp0:
push hl
sra l
and a ;clear Carry
init0:
inc h
rl (hl) ;bit into (HL)
add a,a ;next data BIT
jr nz,init0 ;repeat if not 00
pop hl ;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
inc l ;next SCR addr
jr s_rpt ;next CHR rpt.
Code: Select all
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 z ;RET if 0FAh detected
ld (hl),04h
ld a,01h ;set space line with end marker
pr_lp0:
push hl ;save HL SCReen address
sra l ;/2 L
and a ;clear Carry
init0:
inc h
rl (hl) ;bit into (HL)
add a,a ;next data BIT
jr nz,init0 ;repeat if not 00
pop hl ;restore SCReen address
ld a,(de) ;get data byte
inc e ;next
dec (hl)
jr nz,pr_lp0
inc bc ;next CHR byte
inc l ;next SCR addr
jr s_rpt ;next CHR rpt.
Code: Select all
direct_dat:
db 31h,49h,7dh,49h,31h,49h,31h,0f9h,31h,0f9h,0a1h,81h,0f1h,09h,0f9h,21h
db 0f9h,61h,0f9h,49h,31h,49h,79h,0a1h,79h,61h,79h,41h,39h,0f9h,0a9h,51h
db 0a9h,51h,51h,51h,71h,89h,89h,0f1h,09h,0f1h,0f9h,89h,71h,89h,0b9h,0f9h
db 0a9h,89h,0f9h,89h,0f9h,09h,09h,0f9h,21h,0d9h,21h,0d9h,0f9h,81h,79h,19h
db 79h,85h,01h,85h,79h,71h,89h,71h,09h,79h,0f9h,0a1h,41h,0a9h,71h,09h
db 71h,0a9h,71h,0a9h,11h,71h,99h,69h,0f9h,0a1h,59h,21h,59h,69h,49h,0a9h
db 91h,81h,0f9h,81h,0a9h,41h,0c1h,39h,0c1h,01h,0c1h,99h,0a9h,0c9h,31h,49h
db 49h,31h,59h,69h,01h,79h,0a1h,35h,55h,79h,31h,49h,0f9h,41h,39h,01h
db 0b9h,01h,39h,41h,25h,0b9h,01h,0f1h,49h,29h,69h,51h,75h,15h,79h,99h
db 0a9h,49h,89h,0a9h,51h,0e1h,21h,79h,0e9h,0a9h,91h,99h,0a1h,0c1h,01h,0e9h
db 01h,09h,01h,49h,01h,01h,01h,05h,09h,21h,21h,21h,71h,21h,0f9h,21h,59h
;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