And heres the code, actually commented this time! Well, I suppose theres always a first time for everything!
Code: Select all
;15 bit 64 column format
;
;super compact 5 byte high characters
;
;BC holds screen address, HI-byte -1
;DE is message address
;End of Message byte is any value with BIT 7 set
;message must be an even number of characters long (padded with space if reqd.)
;Call routine at 0FA00h (64000d)
;
;97 bytes if we include the trailing 00h,00h (space CHR)
;95 bytes otherwise
;
;Characters A-Z...0-9..spc.
;
;Arkannoyed March 2018
;
;Special Thanks to Einar!
org 0f9fah
ld de,example_message
ld bc,3f00h ;screen address hi-byte must start -1
start:
ld a,(de) ;CHR byte into A
ld (get_bytes+1),a;write it to direct input (HL) load
inc de ;next CHR
add a,a ;test bit 7 for end marker
ret c ;RET if end of message
sbc a,h ;useless instruction!!
push bc ;together these 2 instructions create CHR 3 (9Ch,C5h)
;db %10011100,%11000101 ;3 code 56h ;9ch,0c5h
;3 = code 07h
get_bytes:
ld hl,(0fa00h) ;get 2 data bytes
lp0:
inc b ;down 1 screen line
ld a,(bc) ;SCReen byte into A
or 10h ;set the marker for 4 bits
add a,a ;add the space between chars
lp1:
add hl,hl ;propagate the data into the Carry
rla ;and then the result into A
jr nc,lp1 ;repeat if we've not put the marker into the Carry
ld (bc),a ;replace the SCReen byte
bit 2,b ;test if we've done 5 bytes
jr z,lp0 ;repeat if not
pop bc ;restore SCReen address
ld a,e ;message address LO byte into A
and 01h ;test if odd or even
add a,c ;add the result to A
ld c,a ;update the SCReen address
;db %11000110,%01110011 ;E code 20h ;0c6h,73h
add a,73h ;code for CHR E = doesn't do anything to affect the routine
db 18h ;jr start vector DCh which is the first byte of CHR D
db %11011100,%11010110 ;D code 23h ;0dch,0d6h
db %11011010,%01010111 ;A code 25h ;0dah,57h
db %01011100,%11010111 ;B code 27h ;5ch,0d7h
db %01000110,%01110010 ;C code 29h ;46h,72h
db %00100100,%01001001 ;I code 2bh * ;24h,49h
db %01110011 ;F code 2ch ;49h,73h
db %11010100,%01010110 ;O code 2eh * ;0d4h,56h
db %01110010 ;G code 2fh ;56h,72h
db %11011010,%10110111 ;H code 31h ;0dah,0b7h
db %00100100,%11101001 ;T code 33h * ;24h,0e9h
db %10110110 ;V code 34h ;0e9h,0b6h
db %11011100,%11100100 ;J code 36h ;0dch,0e4h
db %01011010,%10110111 ;K code 38h ;5ah,0b7h
db %01001110,%10010010 ;L code 3ah ;4eh,92h
db %11011010,%10111111 ;M code 3ch ;0dah,0bfh
db %01001000,%11010111 ;P code 3eh ;48h,0d7h
db %01011010,%11010111 ;R code 40h * ;5ah,0d7h
db %01010110 ;Q code 41h ;0d7h,56h
db %00011100,%01110001 ;S code 43h ;1ch,71h
db %11010100,%10110110 ;U code 45h ;0d4h,0b6h
db %11111010,%10110111 ;W code 47h ;0fah,0b7h
db %01011010,%10110101 ;X code 49h ;5ah,0b5h
db %00100100,%10110101 ;Y code 4bh ;24h,0b5h
db %01001110,%11100101 ;Z code 4dh ;4eh,0e5h
db %11011010,%11010110 ;N code 4fh * ;0dah,0d6h
db %11010110 ;0 code 50h ;0d6h,0d6h
db %00101110,%01011001 ;1 code 52h ;2eh,59h
db %01001110,%11000101 ;2 code 54h ;4eh,0c5h
db %00011100,%11110011 ;5 code 56h * ;1ch,0f3h
db %10010010 ;4 code 57h ;0f3h,92h
db %10100100,%11100100 ;7 code 59h ;0a4h,0e4h
db %10010100,%01010101 ;9 code 5bh * ;9ch,55h
db %01010101 ;8 code 5ch * ;55h,55h
db %01010011 ;6 code 5dh * ;55h,53h
db %00000000,%00000000 ;spc cd 5fh ;00h,00h
example_message:
db 25h,27h,29h,23h,20h,2ch,2fh,31h,2bh,36h,38h,3ah,3ch,4fh,2eh,3eh,41h,40h,43h,33h,45h,34h,47h,49h,4bh,4dh,50h,52h,54h,07h,57h,56h,5dh,59h,5ch,5bh,5fh,0ffh