CharacterWidth: ;Returns the width in B of a character A ld h,0 ld l,a add hl,hl ;2x ld d,h ld e,l add hl,hl ;4x add hl,de ;6x ld de,FontSet-(30*6) add hl,de ld b,(hl) ret VPutStr: ld a,(hl) or a inc hl ret z push hl call VPutMap pop hl jr VPutStr VPutMap_CallVector: ;Put code here to handle external programs and custom characters VPutMap: bit cursorEnabled,(iy+miscFlags) jr z,VPutMap_CursorIsOff push af call Cursor_Clear pop af VPutMap_CursorIsOff: cp 129 jr nc,VPutMap_CallVector ;Now we must lookup the character and set IX to its bitmap ;For lowercase g,j,p,q ld c,a ;save for our lowercase check later ld h,0 ld l,a add hl,hl ;2x ld d,h ld e,l add hl,hl ;4x add hl,de ;6x ld de,FontSet-(30*6) add hl,de push hl pop ix ld a,(cursorX) add a,(ix) cp 95 ccf ret c push ix inc ix ld a,(cursorY) ld h,00 ld l,a add hl,hl ;2x add hl,hl ;4x ld d,h ld e,l add hl,hl ;8x add hl,de ;12x ld de,plotsscreen add hl,de ;HL now is the row of where to put the font ld de,12 ld a,c cp 'g' call z,VPutMap_MoveRowDownOne cp 'j' call z,VPutMap_MoveRowDownOne cp 'p' call z,VPutMap_MoveRowDownOne cp 'q' call z,VPutMap_MoveRowDownOne ld a,(ix-1) ;Get the width ld (spriteMask),a ld a,(cursorX) srl a srl a srl a ld d,0 ld e,a add hl,de ;HL now points to the first byte ld b,5 VPutMap_Loop: push bc ;Set up the mask for the sprite ld a,(spriteMask) ld c,0FFh ld b,a inc b VPutMap_Mask_Loop: srl c djnz VPutMap_Mask_Loop ;C now is a mask ld d,0 ld a,(cursorX) and 7 ld b,a ld d,(ix) ld e,b ld a,b or a jr z,VPutMap_RotateSkip VPutMap_Rotate1: srl d scf rr c djnz VPutMap_Rotate1 VPutMap_RotateSkip: ld a,c and (hl) or d ld (hl),a inc hl ;Now for second part ld a,e or a jr z,VPutMap_Skip ld a,(spriteMask) ld c,0FFh ld b,a inc b VPutMap_Mask_Loop2: srl c djnz VPutMap_Mask_Loop2 ld a,8 sub e ld b,a ld d,(ix) VPutMap_Rotate2: sla d scf rl c djnz VPutMap_Rotate2 ld a,c and (hl) or d ld (hl),a VPutMap_Skip: inc ix pop bc dec b jr z,VPutMap_End ld de,11 add hl,de jr VPutMap_Loop VPutMap_End: pop ix ld a,(cursorX) add a,(ix) inc a ld (cursorX),a ret VPutMap_MoveRowDownOne: add hl,de ret FontSet: ;ALPHA character - 1Eh DB 5 DB 11111000b DB 11011000b DB 10101000b DB 10001000b DB 10101000b ;White box character - 1Fh DB 5 DB 0,0,0,0,0 ;Space character - 20h DB 2 DB 0,0,0,0,0 ;Exclamation mark - 21h DB 1 DB 10000000b DB 10000000b DB 10000000b DB 00000000b DB 10000000b ;Quote mark - 22h DB 3 DB 10100000b DB 10100000b DB 10100000b DB 0 DB 0 ;# symbol - 23h DB 5 DB 01010000b DB 11111000b DB 01010000b DB 11111000b DB 01010000b ;Dollar symbol - 24h DB 5 DB 01110000b DB 10100000b DB 01110000b DB 00101000b DB 11110000b ;Percent symbol - 25h DB 5 DB 10001000b DB 00010000b DB 00100000b DB 01000000b DB 10001000b ;Ampersand - 26h DB 4 DB 01000000b DB 10100000b DB 01000000b DB 10100000b DB 01010000b ;Apostrophe - 27h DB 1 DB 10000000b DB 10000000b DB 10000000b DB 00000000b DB 00000000b ;Left parenthesis - 28h DB 3 DB 00100000b DB 01000000b DB 10000000b DB 01000000b DB 00100000b ;Right parenthesis - 29h DB 3 DB 10000000b DB 01000000b DB 00100000b DB 01000000b DB 10000000b ;Asterick - 2Ah DB 5 DB 00100000b DB 10101000b DB 01110000b DB 10101000b DB 00100000b ;Plus sign - 2Bh DB 5 DB 00100000b DB 00100000b DB 11111000b DB 00100000b DB 00100000b ;Comma - 2Ch DB 2 DB 00000000b DB 00000000b DB 01000000b DB 01000000b DB 10000000b ;Minus sign - 2Dh DB 4 DB 00000000b DB 00000000b DB 11110000b DB 00000000b DB 00000000b ;Period - 2Eh DB 1 DB 00000000b DB 00000000b DB 00000000b DB 00000000b DB 10000000b ;Slash - 2Fh DB 5 DB 00001000b DB 00010000b DB 00100000b Db 01000000b DB 10000000b ;Zero - 30h DB 5 DB 01110000b DB 10011000b DB 10101000b DB 11001000b DB 01110000b ;One - 31h DB 3 DB 01000000b DB 11000000b DB 01000000b DB 01000000b DB 11100000b ;Two - 32h DB 4 DB 01100000b DB 10010000b DB 00100000b DB 01000000b DB 11110000b ;Three - 33h DB 4 DB 11100000b DB 00010000b DB 11100000b DB 00010000b DB 11100000b ;Four - 34h DB 5 DB 10010000b DB 10010000b DB 11111000b DB 00010000b DB 00010000b ;Five - 35h DB 4 DB 11110000b DB 10000000b DB 11100000b DB 00010000b DB 11100000b ;Six - 36h DB 5 DB 01111000b DB 10000000b DB 11110000b DB 10001000b DB 01110000b ;Seven - 37h DB 5 DB 11111000b DB 00001000b DB 00010000b DB 00100000b DB 01000000b ;Eight - 38h DB 4 DB 01100000b DB 10010000b DB 01100000b DB 10010000b DB 01100000b ;Nine - 39h DB 5 DB 01110000b DB 10001000b DB 01111000b DB 00001000b DB 01110000b ;Colon - 3Ah DB 1 DB 00000000b DB 10000000b DB 00000000b DB 10000000b DB 00000000b ;Semicolon - 3Bh DB 2 DB 00000000b DB 01000000b DB 00000000b DB 01000000b DB 10000000b ;Less than sign - 3Ch DB 3 DB 00100000b DB 01000000b DB 10000000b DB 01000000b DB 00100000b ;Equal sign - 3Dh DB 4 DB 0 DB 11110000b DB 00000000b DB 11110000b DB 0 ;Greater than sign - 3Eh DB 3 DB 10000000b DB 01000000b DB 00100000b DB 01000000b DB 10000000b ;Question mark - 3Fh DB 4 DB 11100000b DB 00010000b DB 00100000b DB 00000000b DB 00100000b ;At symbol - 40h DB 5 DB 01110000b DB 00001000b DB 01101000b DB 10101000b DB 01111000b ;A - 41h DB 5 DB 00100000b DB 01010000b DB 01110000b DB 10001000b DB 10001000b ;B - 42h DB 4 DB 11100000b DB 10010000b DB 11100000b DB 10010000b DB 11100000b ;C - 43h DB 4 DB 01110000b DB 10000000b DB 10000000b DB 10000000b DB 01110000b ;D - 44h DB 4 DB 11100000b DB 10010000b DB 10010000b DB 10010000b DB 11100000b ;E - 45h DB 4 DB 11110000b DB 10000000b DB 11110000b DB 10000000b DB 11110000b ;F - 46 DB 4 DB 11110000b DB 10000000b DB 11100000b DB 10000000b DB 10000000b ;G - 47h DB 4 DB 01110000b DB 10000000b DB 10110000b DB 10010000b DB 01110000b ;H - 48h DB 4 DB 10010000b DB 10010000b DB 11110000b DB 10010000b DB 10010000b ;I - 49h DB 5 DB 11111000b DB 00100000b DB 00100000b DB 00100000b DB 11111000b ;J - 4Ah DB 4 DB 00010000b DB 00010000b DB 00010000b DB 10010000b DB 01100000b ;K - 4Bh DB 4 DB 10010000b DB 10100000b DB 11000000b DB 10100000b DB 10010000b ;L - 4Ch DB 4 DB 10000000b DB 10000000b DB 10000000b DB 10000000b DB 11110000b ;M - 4Dh DB 5 DB 10001000b DB 11011000b DB 10101000b Db 10001000b DB 10001000b ;N - 4Eh DB 5 DB 10001000b DB 11001000b DB 10101000b DB 10011000b DB 10001000b ;O - 4Fh DB 5 DB 01110000b DB 10001000b DB 10001000b DB 10001000b DB 01110000b ;P - 50h DB 4 DB 11100000b DB 10010000b DB 11100000b DB 10000000b DB 10000000b ;Q - 51h DB 5 DB 01100000b DB 10010000b DB 10010000b DB 10010000b DB 01101000b ;R - 52h DB 4 DB 11100000b DB 10010000b DB 11100000b DB 10100000b DB 10010000b ;S - 53h DB 4 DB 01110000b DB 01000000b DB 00100000b DB 00010000b DB 11100000b ;T - 54h DB 5 DB 11111000b DB 00100000b DB 00100000b DB 00100000b DB 00100000b ;U - 55h DB 4 DB 10010000b DB 10010000b DB 10010000b DB 10010000b DB 01100000b ;V - 56h DB 5 DB 10001000b DB 01010000b DB 01010000b DB 00100000b DB 00100000b ;W - 57h DB 5 DB 10001000b DB 10001000b DB 10101000b DB 11011000b DB 10001000b ;X - 58h DB 5 DB 10001000b DB 01010000b DB 00100000b DB 01010000b DB 10001000b ;Y - 59h DB 5 DB 10001000b DB 10001000b DB 01010000b DB 00100000b DB 00100000b ;Z - 5Ah DB 5 DB 11111000b DB 00010000b DB 00100000b DB 01000000b DB 11111000b ;Left bracket - 5Bh DB 3 DB 11100000b DB 10000000b DB 10000000b DB 10000000b DB 11100000b ;Backslash - 5Ch DB 5 DB 10000000b DB 01000000b DB 00100000b DB 00010000b DB 000010000b ;Right bracket - 5Dh DB 3 DB 11100000b DB 00100000b DB 00100000b DB 00100000b DB 11100000b ;Caret - 5Eh DB 3 DB 01000000b DB 10100000b DB 0 DB 0 DB 0 ;Underscore - 5Fh DB 4 DB 0 DB 0 DB 0 DB 0 DB 11110000b ;60h DB 2 DB 10000000b DB 01000000b DB 0 DB 0 DB 0 ;a - 61h DB 3 DB 0 DB 01100000b DB 10100000b DB 10100000b DB 01100000b ;b - 62h DB 4 DB 10000000b DB 10000000b DB 11100000b DB 10010000b DB 11100000b ;c - 63h DB 3 DB 0 DB 01100000b DB 10000000b DB 10000000b DB 01100000b ;d - 64h DB 4 DB 00010000b DB 00010000b DB 01110000b DB 10010000b DB 01110000b ;e - 65h DB 3 DB 0 DB 01000000b DB 10100000b DB 11000000b DB 01100000b ;f - 66h DB 2 DB 01000000b DB 10000000b DB 11000000b DB 10000000b DB 10000000b ;g - 67h DB 3 DB 01100000b DB 10100000b DB 01100000b DB 00100000b DB 11000000b ;h - 68h DB 3 DB 10000000b DB 11000000b DB 10100000b DB 10100000b DB 10100000b ;i - 69h DB 1 DB 10000000b DB 00000000b DB 10000000b DB 10000000b DB 10000000b ;j - 6Ah DB 3 DB 00100000b DB 00000000b DB 00100000b DB 10100000b DB 01000000b ;k - 6Bh DB 3 DB 10000000b DB 10000000b DB 10100000b DB 11000000b DB 10100000b ;l - 6Ch DB 3 DB 10000000b DB 10000000b DB 10000000b DB 10100000b DB 11000000b ;m - 6Dh DB 5 DB 0 DB 11010000b DB 10101000b DB 10101000b DB 10001000b ;n - 6Eh DB 3 DB 0 DB 11000000b DB 10100000b DB 10100000b DB 10100000b ;o - 6Fh DB 4 DB 0 DB 01100000b DB 10010000b DB 10010000b DB 01100000b ;p - 70h DB 3 DB 11000000b DB 10100000b DB 11000000b DB 10000000b DB 10000000b ;q - 71h DB 3 DB 01100000b DB 10100000b DB 01100000b DB 00100000b DB 00100000b ;r - 72h DB 3 DB 0 DB 10100000b DB 11000000b DB 10000000b DB 10000000b ;s - 73h DB 2 DB 0 DB 11000000b DB 10000000b DB 01000000b DB 11000000b ;t - 74h DB 3 DB 01000000b DB 11100000b DB 01000000b DB 01000000b DB 00100000b ;u - 75h DB 3 DB 0 DB 10100000b DB 10100000b DB 10100000b DB 11100000b ;v - 76h DB 3 DB 0 DB 10100000b DB 10100000b DB 01000000b DB 01000000b ;w - 77h DB 5 DB 0 DB 10001000b DB 10101000b DB 10101000b DB 01010000b ;x - 78h DB 3 DB 0 DB 10100000b DB 01000000b DB 01000000b DB 10100000b ;y - 79h DB 3 DB 0 DB 10100000b DB 10100000b DB 01000000b DB 10000000b ;z - 7Ah DB 4 DB 0 DB 11110000b Db 00100000b DB 01000000b DB 11110000b ;Left brace - 7Bh DB 4 DB 00110000b DB 01000000b DB 11000000b DB 01000000b DB 00110000b ;Bar - 7Ch DB 1 DB 10000000b DB 10000000b DB 10000000b DB 10000000b DB 10000000b ;Right brace - 7Dh DB 4 DB 11000000b DB 00100000b DB 00110000b DB 00100000b DB 11000000b ;Tilde - 7Eh DB 4 DB 0 DB 01010000b DB 10100000b DB 0 DB 0 ;Delete character - 7Fh ;Since this is nonprintable I'll put a box in DB 5 DB 11111000b DB 11111000b DB 11111000b DB 11111000b DB 11111000b