; ;VDU section for JMON ;label wr$a ;displays char [A] on VDU, preserves all other registers ; ;MicroBee memory mapped VDU version, with hardware scroll ;This version uses the vswpc ; ;Default video attributes vd$lin equ 80 ;No of chars per line vd$pag equ 80*24 ;No of chars per page ; ; ;Start ;Snk=0 Normal ; non ctrl ; ctrl ; cr,lf,bs,bel,cls,del,nul ; wr$a: push bc push de push hl push af ld c,a ;C=char v$pos equ $+1 ld a,00h ld b,a ;B=column v$csr equ $+1 ld hl,0F000h ;HL=cursor address ;Expand control codes v0snk: ld a,c cp 20h jr c,vctrl ;Put char to screen vput: ld (hl),a ;Move cursor pointer, column pointer, and test if line wrap needed inc hl inc b ;Set cursor, column pointer to HL,B vsccp: res 3,h ld (v$csr+poff),hl ld a,vd$lin neg add a,b jr c,vlwp ld a,b vlwp: ld (v$pos+poff),a ;Test if scroll needed, skip if no scroll wanted ld hl,(v$csr+poff) v$tlc equ $+1 ld de,0F000h or a set 3,h sbc hl,de ld de,vd$pag res 3,h or a sbc hl,de jr c,vscsr ;Fill bottom line with non-masked blanks ld de,(v$tlc+poff) ld hl,vd$pag add hl,de ld a,vd$lin ld b,a vfbl1: res 3,h ld (hl),' ' inc hl djnz vfbl1 ;Move screen display pointers by line length ld hl,vd$lin ld h,b add hl,de ;Set display start to current top left corner location vstlc: res 3,h ld (v$tlc+poff),hl ld a,0Ch call poff+vscrtc ;Set cursor to current cursor location, with overscan check vscsr: ld hl,(v$csr+poff) ld de,(v$tlc+poff) or a push hl sbc hl,de pop hl jr nc,vnovsc set 3,h vnovsc: ld a,0Eh call poff+vscrtc ; vxt0: pop af pop hl pop de pop bc ret ; ;Expand control codes from a table vctrl: ld de,poff+vcttbl call poff+vswpc jr vsccp ;Default 0 snk vnul: pop hl jr vxt0 ;Bell vbel: ld c,50 vbel0: in a,(0Ch) and c jr nz,vbel0 in a,(02h) vbel1: xor 40h out (02h),a ld b,82 vbel2: djnz vbel2 dec c jr nz,vbel1 jr vnul ;Carriage return vcr: inc hl inc b set 3,h vcr1: dec hl djnz vcr1 res 3,h ret ;Line feed vlf: ld de,vd$lin ld d,0 add hl,de ret ;Backspace vbs: inc b djnz vbs1 ex de,hl ld hl,(v$tlc+poff) or a sbc hl,de ex de,hl jr z,vnul ld a,vd$lin ld b,a vbs1: dec b set 3,h dec hl ret ;Clear Screen and Home vcls: ld hl,vd$pag dec hl ld b,h ld c,l ld de,0F000h add hl,de ld d,h ld e,l dec de ld (hl),' ' lddr ld (v$csr+poff),hl ld a,b ld (v$pos+poff),a pop de jp vstlc+poff ; ;Set CRTC registers [A,A+1] with [L,H] vscrtc: ld c,0Dh out (0Ch),a res 4,h out (c),h inc a out (0Ch),a out (c),l ret ; ;Get HL=tlc+pag vhlbnl: ld hl,vd$pag ld bc,(v$tlc+poff) add hl,bc res 3,h ret ; ;Control code table ; vcttbl: db 0Dh dw poff+vcr db 0Ah dw poff+vlf db 08h dw poff+vbs db 09h dw poff+vbel db 1Ah dw poff+vcls db 80h dw poff+vnul ;end of include file