From 9d90c5ed9054978d274d33d739311ed9eecad323 Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Mon, 10 Feb 2014 10:18:41 -0800 Subject: [PATCH] Antoine's original text engine code. --- Platform/Apple/virtual/src/font/code.s | 674 ++++++++++++++++++++++ Platform/Apple/virtual/src/font/equates.s | 52 ++ Platform/Apple/virtual/src/font/font.s | 142 +++++ Platform/Apple/virtual/src/font/main.s | 0 Platform/Apple/virtual/src/font/tables.s | 93 +++ Platform/Apple/virtual/src/font/test.s | 150 +++++ Platform/Apple/virtual/src/font/xform.rb | 33 ++ 7 files changed, 1144 insertions(+) create mode 100644 Platform/Apple/virtual/src/font/code.s create mode 100644 Platform/Apple/virtual/src/font/equates.s create mode 100644 Platform/Apple/virtual/src/font/font.s delete mode 100644 Platform/Apple/virtual/src/font/main.s create mode 100644 Platform/Apple/virtual/src/font/tables.s create mode 100644 Platform/Apple/virtual/src/font/test.s create mode 100755 Platform/Apple/virtual/src/font/xform.rb diff --git a/Platform/Apple/virtual/src/font/code.s b/Platform/Apple/virtual/src/font/code.s new file mode 100644 index 00000000..701921f4 --- /dev/null +++ b/Platform/Apple/virtual/src/font/code.s @@ -0,0 +1,674 @@ +* +* Code +* +* (c) 2013, Brutal Deluxe Software +* + + org $6000 + lst off + + mx %11 + + use LL.Equates + +*--------------------------- +* +* STR: draws a Pascal string +* CSTR: draws a C string (null terminated) +* CHAR: draws a single char +* + +*--------------------------- + + jmp printSTR ; print a Pascal string + jmp printSTACK ; print a Pascal string by the stack + jmp printCSTR ; print a C string + jmp printCSTACK ; print a C string by the stack +printCHAR jmp drawCHAR ; pointer to 1/2 HGR printing + jmp tabXY ; sets the X/Y coordinates + jmp setFONT ; sets the font pointer + jmp displayMODE ; sets the display mode + jmp drawMODE ; sets inverse/normal writing mode +scrollWIN jmp scrollWINDOW ; scrolls the 'text' window + +*--------------------------- + +* printSTR +* Outputs a Pascal string +* Input: +* X: high pointer to Pascal string +* Y: low pointer to Pascal string + +printSTR = * + + sty dpSTR + stx dpSTR+1 + +printSSTR = * ; Entry point for stack + +printSTR1 jsr getCHAR ; Get length of string + bne printSTR2 + rts +printSTR2 sta strLENGTH ; Save it for later + +]lp jsr getCHAR ; Get a character + jsr printCHAR ; Print it out + + lda strLENGTH ; Next character + bne ]lp ; Until end of string + rts + +*--------------------------- + +* printCSTR +* Outputs a C string (null terminated) +* Input: +* X: high pointer to C string +* Y: low pointer to C string + +printCSTR = * + + sty dpSTR + stx dpSTR+1 + +printSCSTR = * ; Entry point for stack + +]lp jsr getCHAR ; Get a character + + cmp #charNULL + beq printCSTR1 ; end of string... + + jsr printCHAR ; Print it out + + clc ; force BRanch Always + bcc ]lp ; if 65c02, put a BRA instead + +printCSTR1 rts + +*--------------------------- + +* printSTACK +* Displays a Pascal string through the stack + +printSTACK = * + + pla ; get the stack pointer + sta dpSTR + pla + sta dpSTR+1 + + jsr getCHAR ; Move the pointer + + jsr printSSTR ; call entry point for Pascal string + +printSTACK1 = * ; Share the same return code + + dec dpSTR ; Decrement string pointer + lda dpSTR + cmp #$ff + bne printSTACK2 + dec dpSTR+1 + +printSTACK2 lda dpSTR+1 ; Push it to the stack + pha + lda dpSTR + pha + rts ; return + +*--------------------------- + +* printCSTACK +* Displays a C string through the stack + +printCSTACK = * + + pla ; get the stack pointer + sta dpSTR + pla + sta dpSTR+1 + + jsr getCHAR ; Move the pointer + + jsr printSCSTR ; call entry point for C string + + jmp printSTACK1 ; return code + +*--------------------------- +* Sub-routines +*--------------------------- + +* WNDLFT = $20 ; left edge of the window +* WNDWDTH = WNDLFT+1 ; width of text window +* WNDTOP = WNDWDTH+1 ; top of text window +* WNDBTM = WNDTOP+1 ; bottom+1 of text window + +* calcNEXT +* Calculates the next display position + +calcNEXT = * ; Calculates the next char position + + inc CH ; next column + + lda CH ; did we reach the rightmost one? + cmp WNDWDTH + bcc calcNEXT9 + beq calcNEXT9 + +nextLINE = * + + lda WNDLFT ; yes, next line + sta CH + +*--- + + inc CV + + lda CV ; did we reach the end of the area? + cmp WNDBTM + bcc calcNEXT9 + beq calcNEXT9 + + dec CV + + jsr scrollWIN ; yes, scroll + +calcNEXT9 rts + +*--------------------------- + +* scrollWINDOW +* Scroll one HGR window + +scrollWINDOW = * + +* WNDLFT = $20 ; left edge of the window +* WNDWDTH = WNDLFT+1 ; width of text window +* WNDTOP = WNDWDTH+1 ; top of text window +* WNDBTM = WNDTOP+1 ; bottom+1 of text window + + lda WNDBTM ; 23 => 24 * 8 = 192 + clc + adc #1 + asl + asl + asl ; *8 + sta maxLINE ; the max line + + lda #8 ; loop + +scrollIT1 = * + + pha + + lda WNDTOP + asl + asl + asl ; *8 + tax + +scrollIT5 lda tblHGRl,x + sta dpTO + lda tblHGRh,x + ora HPAG + sta dpTO+1 + + inx + lda tblHGRl,x + sta dpFROM + lda tblHGRh,x + ora HPAG + sta dpFROM+1 + + ldy WNDLFT ; Copy a line +]lp lda (dpFROM),y + sta (dpTO),y + iny + cpy WNDWDTH + bcc ]lp + beq ]lp + + cpx maxLINE + bne scrollIT5 + + ldy WNDLFT ; Put a blank line + lda #0 +]lp sta (dpTO),y + iny + cpy WNDWDTH + bcc ]lp + beq ]lp + + pla ; next loop + sec + sbc #1 + bne scrollIT1 + rts + +*--------------------------- + +* scroll2WINDOW +* Scroll two HGR window + +scroll2WINDOW = * + +* WNDLFT = $20 ; left edge of the window +* WNDWDTH = WNDLFT+1 ; width of text window +* WNDTOP = WNDWDTH+1 ; top of text window +* WNDBTM = WNDTOP+1 ; bottom+1 of text window + + lda WNDBTM ; 23 => 24 * 8 = 192 + clc + adc #1 + asl + asl + asl ; *8 + sta maxLINE ; the max line + + lda #8 ; loop + +scroll2IT1 = * + + pha + + lda WNDTOP + asl + asl + asl ; *8 + tax + +scroll2IT5 lda tblHGRl,x + sta dpTO + sta dpTO2 + lda tblHGRh,x + ora HPAG + sta dpTO+1 + clc + adc #pHGR1 + sta dpTO2+1 + + inx + lda tblHGRl,x + sta dpFROM + lda tblHGRh,x + ora HPAG + sta dpFROM+1 + + ldy WNDLFT ; Copy a line +]lp lda (dpFROM),y + sta (dpTO),y + sta (dpTO2),y + iny + cpy WNDWDTH + bcc ]lp + beq ]lp + + cpx maxLINE + bne scroll2IT5 + + ldy WNDLFT ; Put a blank line + lda #0 +]lp sta (dpTO),y + sta (dpTO2),y + iny + cpy WNDWDTH + bcc ]lp + beq ]lp + + pla ; next loop + sec + sbc #1 + bne scroll2IT1 + rts + +*--------------------------- + +* getCHAR +* Gets the character +* Input: +* dpSTR: pointer to the string +* Output: +* A: character + +getCHAR = * ; Gets the character + + ldy #0 + lda (dpSTR),y + + dec strLENGTH + + inc dpSTR + bne getCHAR1 + inc dpSTR+1 +getCHAR1 rts + +*--------------------------- + +* calcPOS +* Calculates the HGR coordinates +* Input: +* Uses CH and CV +* Output: +* X: first HGR line of char +* Y: last HGR line of char + +calcPOS = * ; Calculates the X/Y coordinate of a char + + lda CV ; from a text row + asl + asl + asl ; *8 + tax ; to a HGR one + + clc + adc #8 ; height of a character + tay ; max line + sty theY + rts + +*---------- +* Calculate the HGR coordinates + +calcPOS1 = * + + lda tblHGRl,x + sta BASL ; HGR + sta GBASL ; double HGR + lda tblHGRh,x + ora HPAG + sta BASH + clc + adc #pHGR1 ; for printing + sta GBASH ; on both HGR page + rts + +*--------------------------- + +* tabXY +* Sets the X/Y coordinates +* Input: +* X: X coordinate +* Y: Y coordinate + +tabXY stx CH + sty CV + rts + +*--------------------------- + +* setFONT +* Sets the font pointer +* Input: +* X: high pointer of font data +* Y: low pointer of font data + +setFONT = * ; Sets the font pointer + + sty fontPTR + stx fontPTR+1 + rts + +*--------------------------- + +* displayMODE +* Sets writing to 1 or 2 HGR page(s) +* Input: +* A: #$20 for HGR1, #$40 for HGR2, #$60 for both pages + +displayMODE = * ; Sets writing to 1 or 2 HGR page(s) + +* Prepare scroll window routine + + ldx #>scrollWINDOW + stx scrollWIN+2 + ldy #scrollWINDOW + sty scrollWIN+1 + + ldx #>drawCHAR + ldy #drawCHAR + + cmp #pHGR3 ; Do we ask for HGR1+HGR2 printing? + bne dispMODE1 + +* We want to display/scroll on both pages + + ldx #>scroll2WINDOW + stx scrollWIN+2 + ldy #scroll2WINDOW + sty scrollWIN+1 + + lda #pHGR1 + ldx #>draw2CHAR + ldy #draw2CHAR + +dispMODE1 sta HPAG ; Page to draw a char + sty printCHAR+1 + stx printCHAR+2 + rts + +*--------------------------- + +* drawMODE +* Sets drawing method +* Input: +* A: #$00 for normal, #$FF for inverse + +drawMODE = * ; Sets drawing method + + sta INVFLG + rts + +*--------------------------- + +* handleCHAR +* Handles command chars +* Output: +* Y: low pointer to font data +* X: high pointer to font data + +handleCHAR = * ; Handles command chars + + cmp #charCMD + bcs handleCHAR2 + + cmp #charRET ; any Return to handle? + bne handleCHAR1 + + jsr nextLINE ; Yes! + sec + rts + +handleCHAR1 and #%0111_1111 + sec ; subtract + sbc #charSPACE ; #$20 space + +* Prepare a *8 multiplication + + sta fontIDX + + lda #0 + sta fontIDX+1 + + asl fontIDX ; *2 + rol fontIDX+1 + asl fontIDX ; *4 + rol fontIDX+1 + asl fontIDX ; *8 + rol fontIDX+1 + +* Now, calculate the char data address + + lda fontIDX + clc + adc fontPTR + tay + + lda fontIDX+1 + adc fontPTR+1 + tax + +* The old routine with a table (faster but more room) +* tax ; calculate the pointer +* lda fontINDEXl,x +* clc ; to the font data +* adc fontPTR +* tay +* +* lda fontINDEXh,x +* adc fontPTR+1 +* tax + + clc ; character to print + rts + +*--- We have a command code +* +* #$80: tabXY +* #$81: setFONT +* #$82: displayMODE +* #$83: drawMODE +* #$84: call routine + +handleCHAR2 = * + + and #%0000_0111 ; Must change if more commands + asl + tax + lda tblCOMMANDS,x + sta handleCHAR3+1 + lda tblCOMMANDS+1,x + sta handleCHAR3+2 + +handleCHAR3 jsr $bdbd + sec + rts + +tblCOMMANDS da doCMD0,doCMD1,doCMD2,doCMD3 + da doCMD4,doCMD0,doCMD0,doCMD0 + +*--- tabXY + +doCMD0 jsr getCHAR + tax + jsr getCHAR + tay + jsr tabXY + rts + +*--- setFONT + +doCMD1 jsr getCHAR + sta fontPTR + jsr getCHAR + sta fontPTR+1 + rts + +*--- displayMODE + +doCMD2 jsr getCHAR ; HGR page + jsr displayMODE + rts + +*--- drawMODE + +doCMD3 jsr getCHAR ; FF: inverse, 00:normal + sta INVFLG + rts + +*--- execute code (useful for protection) + +doCMD4 jsr getCHAR + sta doCMD45+1 + jsr getCHAR + sta doCMD45+2 +doCMD45 jmp $bdbd + +*--------------------------- +* Graphic code +*--------------------------- + +* drawCHAR +* Draws a character on 1 HGR page +* Input: +* A: the character to draw + +drawCHAR = * ; Draws a char on HGR + + jsr handleCHAR ; Sets the font data pointer + bcc drawCHAR1 + rts + +drawCHAR1 sty drawCHAR2+1 + stx drawCHAR2+2 + + jsr calcPOS ; calculate min/max of lines + + ldy CH ; get the Y + +]lp jsr calcPOS1 ; calculate HGR coordinates + +drawCHAR2 lda $bdbd ; pointer to font data + eor INVFLG + sta (BASL),y ; output on HGR screen + + inc drawCHAR2+1 + inx ; loop until 8 lines + cpx theY + bne ]lp + + jsr calcNEXT ; Prepare next position + + rts + +*--------------------------- + +* draw2CHAR +* Draws a character on 2 HGR pages +* Input: +* A: the character to draw + +draw2CHAR = * ; Draws one char on 2 pages + + jsr handleCHAR ; Sets the font data pointer + bcc draw2CHAR1 + rts + +draw2CHAR1 sty draw2CHAR2+1 + stx draw2CHAR2+2 + + jsr calcPOS ; calculate min/max of lines + + ldy CH ; get the Y + +]lp jsr calcPOS1 ; calculate HGR coordinates + +draw2CHAR2 lda $bdbd ; pointer to font data + eor INVFLG + sta (BASL),y ; output on HGR screen + sta (GBASL),y ; ditto + + inc draw2CHAR2+1 + + inx ; loop until 8 lines + cpx theY + bne ]lp + + jsr calcNEXT ; Prepare next position + rts + +*--------------------------- +* Some data +*--------------------------- + +theY ds 1 ; save Y coordinate +maxLINE ds 1 ; max line number for scrolling + +fontIDX ds 2 ; index to char data +fontPTR ds 2 ; font data pointer + +strLENGTH ds 1 ; length of string + +*--------------------------- +* End of the code... +*--------------------------- + + put LL.Tables diff --git a/Platform/Apple/virtual/src/font/equates.s b/Platform/Apple/virtual/src/font/equates.s new file mode 100644 index 00000000..83165f92 --- /dev/null +++ b/Platform/Apple/virtual/src/font/equates.s @@ -0,0 +1,52 @@ +* +* Equates +* + +pHGR1 = $20 +pHGR2 = $40 +pHGR3 = $60 + +pNORMAL = $00 +pINVERSE = $FF + +charNULL = $00 +charRET = $0d +charSPACE = $20 +charCMD = $80 + +* +* Zero page usage +* + +WNDLFT = $20 ; left edge of the window +WNDWDTH = WNDLFT+1 ; width of text window +WNDTOP = WNDWDTH+1 ; top of text window +WNDBTM = WNDTOP+1 ; bottom+1 of text window + +CH = WNDBTM+1 ; Cursor H-pos 0-39 +CV = CH+1 ; Cursor V-pos 0-23 => 0-191 + +BASL = $28 ; Text base address +BASH = BASL+1 +GBASL = BASH+1 ; Second text base address +GBASH = GBASL+1 + +dpFROM = BASL +dpTO = dpFROM+2 +dpTO2 = dpTO+2 + +INVFLG = $32 ; Inverse flag (FF: normal, 7F: flash, 3F: inverse) + +dpSTR = $fe ; Pointer to source string + +CSWL = $36 ; Char output hook +CSWH = CSWL+1 + +HPAG = $E6 ; $20 for HGR1, $40 for HGR2 + +* +* Monitor routines +* + +HGR2 = $f3d8 +HGR = $f3e2 diff --git a/Platform/Apple/virtual/src/font/font.s b/Platform/Apple/virtual/src/font/font.s new file mode 100644 index 00000000..cf71eeea --- /dev/null +++ b/Platform/Apple/virtual/src/font/font.s @@ -0,0 +1,142 @@ +* +* Font +* + + org $7000 + lst off + + HEX 0000000000000000 ; A0 space + HEX 1818181818001800 ; A1 ! + HEX 361B000000000000 ; A2 " + HEX 00247E363F120000 ; A3 # + HEX 180C1E331B0F3E00 ; A4 $ + HEX 0C1E003333331E00 ; A5 % + HEX 0C160C6E3B336E00 ; A6 & + HEX 180C000000000000 ; A7 ' + HEX 380C0606060C3800 ; A8 ( + HEX 0E18303030180E00 ; A9 ) + HEX 00361C3E1C360000 ; AA * + HEX 0008083E08080000 ; AB + + HEX 0000000000180C00 ; AC , + HEX 0000007E00000000 ; AD - + HEX 0000000000000C00 ; AE . + HEX 2030180C06030100 ; AF / + HEX 1E30333333331E00 ; B0 0 + HEX 1E00181818181800 ; B1 1 + HEX 1F00301E03033E00 ; B2 2 + HEX 1F00301C30301F00 ; B3 3 + HEX 030303333F303000 ; B4 4 + HEX 3F00031F30301F00 ; B5 5 + HEX 1C06031B33331E00 ; B6 6 + HEX 3F00180C0C0C0C00 ; B7 7 + HEX 1E30331E33331E00 ; B8 8 + HEX 3E33333630303000 ; B9 9 + HEX 00000C000C000000 ; BA : + HEX 00000C00000C0600 ; BB ; + HEX 30180C060C183000 ; BC < + HEX 00003E003E000000 ; BD = + HEX 060C1830180C0600 ; BE > + HEX 3C66603018001800 ; BF ? + HEX 060C1E331B0F3E00 ; C0 @ + HEX 1E30333B33333300 ; C1 A + HEX 1F30331B33331F00 ; C2 B + HEX 3E00030303033E00 ; C3 C + HEX 1F30333333331F00 ; C4 D + HEX 3F00031B03033F00 ; C5 E + HEX 3F00031B03030300 ; C6 F + HEX 3E00033B33333E00 ; C7 G + HEX 3333333B33333300 ; C8 H + HEX 3F000C0C0C0C3F00 ; C9 I + HEX 3030303033331E00 ; CA J + HEX 331B0F070F1B3300 ; CB K + HEX 0303030303033F00 ; CC L + HEX 3F30333333333300 ; CD M + HEX 3333373F3B333300 ; CE N + HEX 1E30333333331E00 ; CF O + HEX 1F30331F03030300 ; D0 P + HEX 1E303333333B3E00 ; D1 Q + HEX 1F30331F0F1B3300 ; D2 R + HEX 3E00031E30301F00 ; D3 S + HEX 3F000C0C0C0C0C00 ; D4 T + HEX 3333333333331E00 ; D5 U + HEX 3333331E1E0C0C00 ; D6 V + HEX 33333333333F3300 ; D7 W + HEX 33331E0C1E333300 ; D8 X + HEX 3333331E0C0C0C00 ; D9 Y + HEX 3F00180C06033F00 ; DA Z + HEX 000000000000007F ; DB [ + HEX 060E1C3870600000 ; DC \ + HEX 3C30303030303C00 ; DD ] + HEX 000000081C366300 ; DE ^ + HEX 0000000000007F00 ; DF _ + HEX 0000000000007E03 ; E0 ` + HEX 00001E3333337E00 ; E1 a + HEX 03031F3333331F00 ; E2 b + HEX 00001E3303331E00 ; E3 c + HEX 38303E3333333E00 ; E4 d + HEX 00001E331B0F3E00 ; E5 e + HEX 3C0606061F060606 ; E6 f + HEX 00603E33331E033E ; E7 g + HEX 03031B3733333300 ; E8 h + HEX 0C000E0C0C0C1E00 ; E9 i + HEX 300030303030331E ; EA j + HEX 0303331B37333300 ; EB k + HEX 0E0C0C0C0C0C1E00 ; EC l + HEX 0000333F33333300 ; ED m + HEX 00001B3733333300 ; EE n + HEX 00001E3333331E00 ; EF o + HEX 00001F33331F0303 ; F0 p + HEX 00003E33333E3030 ; F1 q + HEX 00003B0F07030300 ; F2 r + HEX 00003E031E301F00 ; F3 s + HEX 063F060606361C00 ; F4 t + HEX 0000333333331E00 ; F5 u + HEX 00003333331E0C00 ; F6 v + HEX 00003333333F3300 ; F7 w + HEX 000033331E333300 ; F8 x + HEX 00003333333E301E ; F9 y + HEX 00003F180C063F00 ; FA z + HEX 0000000000000F18 ; FB { + HEX 1818181818181818 ; FC | + HEX 181818181818180F ; FD } + HEX 030303030303037E ; FE ~ + HEX 0303030303030303 ; FF # + + HEX 63AAF0768D63AA8E ; + HEX 5DAAD0DCA20ADD40 ; + HEX A9F005CAD0F8F0B6 ; + HEX BD4AA930470D65AA ; + HEX 8D65AACA8E64AA20 ; + HEX B9A1B0A2AD64AA0A ; + HEX 0AA8A545D009A544 ; + HEX D955A9908CA545D9 ; + HEX 58A9900BD083A544 ; + HEX D957A99002D0F5AD ; + HEX 63AAD094984AA8A5 ; + HEX 459967AAA5449966 ; + HEX AA4CE8A048A9800D ; + HEX 65AA8D65AA68297F ; + HEX 0D74AA8D74AAD0E9 ; + HEX F09C2080A14C839F ; + HEX 205BA720AEA1AD5F ; + HEX AAAABD1F9D48BD1E ; + HEX 9D4860AE5DAABD00 ; + HEX 02C98DF006E88E5D ; + HEX AAC9AC602093A1F0 ; + HEX FAC9A0F0F760A900 ; + HEX A01699BAB588D0FA ; + HEX 60A9008544854520 ; + HEX A4A108C9A4F03C28 ; + HEX 4CCEA120A4A1D006 ; + HEX A644A545186038E9 ; + HEX B03021C90AB01D20 ; + HEX FEA16544AAA90065 ; + HEX 45A820FEA120FEA1 ; + HEX 8A65448544986545 ; + HEX 854590CF38600000 ; + HEX 0000000000000000 ; + HEX 6B7F6B086B7F6300 ; + HEX 637F6B086B7F6B00 ; + HEX 7777223F22777700 ; + HEX 637F6B086B7F6B00 ; + HEX 00000000000000 ; diff --git a/Platform/Apple/virtual/src/font/main.s b/Platform/Apple/virtual/src/font/main.s deleted file mode 100644 index e69de29b..00000000 diff --git a/Platform/Apple/virtual/src/font/tables.s b/Platform/Apple/virtual/src/font/tables.s new file mode 100644 index 00000000..153f786e --- /dev/null +++ b/Platform/Apple/virtual/src/font/tables.s @@ -0,0 +1,93 @@ +* +* Tables +* + +* TEXT line addresses + +tblTEXTl HEX 0080008000800080 + HEX 28A828A828A828A8 + HEX 50D050D050D050D0 + +tblTEXTh HEX 0000010102020303 + HEX 0000010102020303 + HEX 0000010102020303 + +* HGR line addresses + +tblHGRl HEX 0000000000000000 + HEX 8080808080808080 + HEX 0000000000000000 + HEX 8080808080808080 + HEX 0000000000000000 + HEX 8080808080808080 + HEX 0000000000000000 + HEX 8080808080808080 + HEX 2828282828282828 + HEX A8A8A8A8A8A8A8A8 + HEX 2828282828282828 + HEX A8A8A8A8A8A8A8A8 + HEX 2828282828282828 + HEX A8A8A8A8A8A8A8A8 + HEX 2828282828282828 + HEX A8A8A8A8A8A8A8A8 + HEX 5050505050505050 + HEX D0D0D0D0D0D0D0D0 + HEX 5050505050505050 + HEX D0D0D0D0D0D0D0D0 + HEX 5050505050505050 + HEX D0D0D0D0D0D0D0D0 + HEX 5050505050505050 + HEX D0D0D0D0D0D0D0D0 + +tblHGRh HEX 0004080C1014181C + HEX 0004080C1014181C + HEX 0105090D1115191D + HEX 0105090D1115191D + HEX 02060A0E12161A1E + HEX 02060A0E12161A1E + HEX 03070B0F13171B1F + HEX 03070B0F13171B1F + HEX 0004080C1014181C + HEX 0004080C1014181C + HEX 0105090D1115191D + HEX 0105090D1115191D + HEX 02060A0E12161A1E + HEX 02060A0E12161A1E + HEX 03070B0F13171B1F + HEX 03070B0F13171B1F + HEX 0004080C1014181C + HEX 0004080C1014181C + HEX 0105090D1115191D + HEX 0105090D1115191D + HEX 02060A0E12161A1E + HEX 02060A0E12161A1E + HEX 03070B0F13171B1F + HEX 03070B0F13171B1F + +* Font character indexes + +*fontINDEXl HEX 00081018202830384048505860687078 +* HEX 80889098A0A8B0B8C0C8D0D8E0E8F0F8 +* HEX 00081018202830384048505860687078 +* HEX 80889098A0A8B0B8C0C8D0D8E0E8F0F8 +* HEX 00081018202830384048505860687078 +* HEX 80889098A0A8B0B8C0C8D0D8E0E8F0F8 +* HEX 00081018202830384048505860687078 +* HEX 80889098A0A8B0B8C0C8D0D8E0E8F0F8 +* HEX 00081018202830384048505860687078 +* HEX 80889098A0A8B0B8C0C8D0D8E0E8F0F8 +* HEX 00081018202830384048505860687078 +* HEX 80889098A0A8B0B8C0C8D0D8E0E8F0F8 +* +*fontINDEXh HEX 00000000000000000000000000000000 +* HEX 00000000000000000000000000000000 +* HEX 01010101010101010101010101010101 +* HEX 01010101010101010101010101010101 +* HEX 02020202020202020202020202020202 +* HEX 02020202020202020202020202020202 +* HEX 03030303030303030303030303030303 +* HEX 03030303030303030303030303030303 +* HEX 04040404040404040404040404040404 +* HEX 04040404040404040404040404040404 +* HEX 05050505050505050505050505050505 +* HEX 05050505050505050505050505050505 diff --git a/Platform/Apple/virtual/src/font/test.s b/Platform/Apple/virtual/src/font/test.s new file mode 100644 index 00000000..a21f5e82 --- /dev/null +++ b/Platform/Apple/virtual/src/font/test.s @@ -0,0 +1,150 @@ +* +* How to use the code +* +* (c) 2013, Brutal Deluxe Software +* + + org $1000 + lst off + + mx %11 + + use LL.Equates + +*--------------------------- +* +* STR: draws a Pascal string +* CSTR: draws a C string (null terminated) +* CHAR: draws a single char +* + +*--------------------------- + +stringCODE = $6000 +printSTR = stringCODE +printSSTR = printSTR+3 +printCSTR = printSSTR+3 +printSCSTR = printCSTR+3 +printCHAR = printSCSTR+3 +tabXY = printCHAR+3 +setFONT = tabXY+3 +displayMODE = setFONT+3 +drawMODE = displayMODE+3 +scrollWINDOW = drawMODE+3 + +fontDATA = $7000 + +*--------------------------- +* We assume the following: +* +* Code at $6000 +* Font at $7000 + + sta $c050 + sta $c052 + sta $c054 + sta $C057 + + ldx #>fontDATA ; set font data + ldy #fontDATA + jsr setFONT + +*--- Set our frame + + lda #0 ; (0,0) TO (39,23) + sta WNDLFT + sta CH + lda #39 + sta WNDWDTH + lda #0 + sta WNDTOP + sta CV + lda #23 + sta WNDBTM + +*--- + + lda #pHGR1 ; HGR1 page active + jsr displayMODE + + ldx #2 + ldy #1 + jsr tabXY + + lda #pNORMAL + jsr drawMODE + + ldx #>string1 + ldy #string1 + jsr printSTR + +*--- + + lda #2 ; (2,4) TO (19,20) + sta WNDLFT + sta CH + lda #19 + sta WNDWDTH + lda #4 + sta WNDTOP + sta CV + lda #20 + sta WNDBTM + + ldx #2 + ldy #10 + jsr tabXY + + lda #pINVERSE + jsr drawMODE + + jsr printSSTR + str 'Please press a key...' + + +*--- + + jsr $fd0c + + lda #22 ; (28,4) TO (38,20) + sta WNDLFT + sta CH + lda #37 + sta WNDWDTH + lda #6 + sta WNDTOP + sta CV + lda #16 + sta WNDBTM + + lda #pNORMAL + jsr drawMODE + + lda #pHGR3 ; Both pages active + jsr displayMODE + + ldx #>string3 + ldy #string3 + jsr printCSTR + +*- + + jsr $fd0c + sta $c055 + jsr $fd0c + + sta $c054 + sta $c056 + sta $c051 + rts + +*---------------------------- + +string1 str 'What time is it?' + +string3 asc 'This is printed on both pages.'0d0d + asc 'A very long text in both '83ff'inverse'8300 + asc ' and normal fontface.'0d + asc 'This text will be long and will let the window scroll...'0d + asc 'Yes, I promise it will scroll a lot... and a lot..'0d + asc 83FF'Antoine'830000 diff --git a/Platform/Apple/virtual/src/font/xform.rb b/Platform/Apple/virtual/src/font/xform.rb new file mode 100755 index 00000000..7fb3458d --- /dev/null +++ b/Platform/Apple/virtual/src/font/xform.rb @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +require 'optparse' + +# Parse the command-line +options = {} +optparse = OptionParser.new do |opts| + opts.banner = "Usage: #{$0} [inFile] [outFile]" +end +optparse.parse! +if ARGV.length != 2 then + puts optparse + exit 1 +end +inFileName, outFileName = ARGV + +File.open(inFileName, "r") do |inFile| + File.open(outFileName, "w") do |outFile| + until inFile.eof? + b = inFile.read(1).unpack("C")[0] + if b == 0xA0 then + outFile.print "\t" + next + end + b &= 0x7f + if b == 13 then + outFile.print "\n" + next + end + outFile.print b.chr + end + end +end