In the standard interrupt routine there is a mechanism to automatically copy
data into VDC registers at the next VSYNC. Simply put the number of bytes to
copy into 07Fh at external RAM. Put a pointer to the first register at 07Eh.
The bytes to put into the ascending registers are stored in descending order at
07Dh. After that begin again with a new byte count or put a 0 at the end. The
table is activated when irq_table = bit 7 of
iram_irqctrl = 03Fh in internal RAM is set. At the next
VSYNC interrupt the table is copied into the registers. The VDC and external
RAM share the same address space, so there are two routines to switch to VDC
(vdcenable = 00E7h) or to RAM
(extramenable = 00ECh).
All routines using tables in the BIOS use R0 as a pointer to the next free
byte of the table. The routine tableprintchar = 0197h
puts the register contents to print a char or quad into the table, you have to
fill in the number of bytes to copy and the register pointer. The other
parameters are identical to those of printchar. The routine
tableend = 0132h puts the end marker into the table and
activates it. So here is another demo program. It
prints "HELLO WORLD", too, but this time with tables and in green.
start
call extramenable ; the table is in extram
mov r0,#07Fh ; begin of table
mov a,#02Ch ; 4 bytes / char * 0Bh
movx @r0,a ; into table
dec r0 ; next byte in table
mov a,#vdc_char0 ; first register
movx @r0,a ; into table
dec r0 ; next byte in table
mov r3,#20h ; x-position
mov r4,#20h ; y-position
mov r2,#0Bh ; length
mov r1,#hellostr & 0FFh ; the string to print
; must be in the same page
loop mov a,r1 ; get pointer
movp a,@a ; get char
mov r5,a ; into the right register
inc r1 ; advance pointer
mov r6,#col_chr_green ; colour green
call tableprintchar ; put it into table
djnz r2,loop ; do it again
call tableend ; activate the table
stop jmp stop ; Thats all
hellostr db 1Dh, 12h, 0Eh, 0Eh, 17h, 0Ch
db 11h, 17h, 13h, 0Eh, 1Ah