From 9e2c0fc3fe9b41f49ea4e3ccc22f89220c63257b Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Thu, 11 Jun 2015 11:02:02 -0700 Subject: [PATCH] New font from Seth, and fixed a few font engine bugs that I introduced. --- Platform/Apple/virtual/src/font/font.s | 64 +++++++++---------- Platform/Apple/virtual/src/font/fontEngine.s | 39 +++++++++-- .../Apple/virtual/src/include/fontEngine.i | 3 +- .../Apple/virtual/src/plasma/gameloop.pla | 21 +++++- 4 files changed, 87 insertions(+), 40 deletions(-) diff --git a/Platform/Apple/virtual/src/font/font.s b/Platform/Apple/virtual/src/font/font.s index 6cfaa129..9d1c64cd 100644 --- a/Platform/Apple/virtual/src/font/font.s +++ b/Platform/Apple/virtual/src/font/font.s @@ -9,7 +9,7 @@ !byte 2,$03,$03,$03,$00,$00,$00,$00,$00,$00 ;7 single quote !byte 4,$0C,$06,$03,$03,$03,$06,$0C,$00,$00 ;8 left parenthesis !byte 4,$03,$06,$0C,$0C,$0C,$06,$03,$00,$00 ;9 right parenthesis - !byte 7,$08,$6B,$3E,$1C,$3E,$6B,$08,$00,$00 ;10 asterisk + !byte 7,$08,$1C,$7F,$3E,$1C,$3E,$36,$00,$00 ;10 asterisk !byte 4,$00,$00,$06,$0F,$06,$00,$00,$00,$00 ;11 plus !byte 3,$00,$00,$00,$00,$00,$06,$06,$03,$00 ;12 comma !byte 3,$00,$00,$00,$07,$00,$00,$00,$00,$00 ;13 minus @@ -17,14 +17,14 @@ !byte 4,$00,$0C,$0C,$06,$06,$03,$03,$00,$00 ;15 right slash !byte 5,$0E,$1B,$1B,$1B,$1B,$1B,$0E,$00,$00 ;16 0 !byte 5,$0C,$0E,$0E,$0C,$0C,$1E,$1E,$00,$00 ;17 1 - !byte 5,$0F,$1B,$18,$0C,$06,$13,$1F,$00,$00 ;18 2 - !byte 5,$0F,$1B,$18,$0C,$18,$1B,$0F,$00,$00 ;19 3 - !byte 5,$1B,$1B,$1F,$1E,$18,$18,$18,$00,$00 ;20 4 - !byte 5,$1F,$1B,$03,$0F,$18,$1B,$0F,$00,$00 ;21 5 - !byte 5,$1E,$1B,$03,$0F,$1B,$1B,$0E,$00,$00 ;22 6 - !byte 5,$1F,$1B,$18,$0C,$0C,$06,$06,$00,$00 ;23 7 - !byte 5,$0E,$1B,$1B,$0E,$1B,$1B,$0E,$00,$00 ;24 8 - !byte 5,$0E,$1B,$1B,$1E,$18,$18,$18,$00,$00 ;25 9 + !byte 6,$1F,$3B,$38,$0C,$36,$3F,$3F,$00,$00 ;18 2 + !byte 6,$1F,$3B,$30,$1C,$30,$3B,$1F,$00,$00 ;19 3 + !byte 5,$33,$33,$33,$3E,$30,$30,$30,$00,$00 ;20 4 + !byte 6,$3F,$33,$03,$1F,$38,$3B,$1F,$00,$00 ;21 5 + !byte 6,$1E,$1B,$03,$1F,$33,$33,$1E,$00,$00 ;22 6 + !byte 6,$3F,$3B,$18,$0C,$0C,$06,$06,$00,$00 ;23 7 + !byte 7,$1C,$36,$77,$3E,$62,$63,$3E,$00,$00 ;24 8 + !byte 5,$1E,$1B,$1B,$1E,$18,$18,$18,$00,$00 ;25 9 !byte 2,$00,$03,$03,$00,$03,$03,$00,$00,$00 ;26 colon !byte 3,$00,$00,$06,$00,$00,$06,$06,$03,$00 ;27 semicolon !byte 4,$00,$0C,$06,$03,$06,$0C,$00,$00,$00 ;28 less than @@ -32,30 +32,30 @@ !byte 4,$00,$03,$06,$0C,$06,$03,$00,$00,$00 ;30 greater than !byte 5,$0E,$1B,$18,$0C,$0C,$00,$0C,$00,$00 ;31 question mark !byte 6,$1E,$33,$3B,$3B,$3B,$03,$1E,$00,$00 ;32 at sign - !byte 5,$0E,$1F,$1B,$1F,$1B,$1B,$1B,$00,$00 ;33 A - !byte 5,$0F,$1B,$1B,$0F,$1B,$1B,$0F,$00,$00 ;34 B + !byte 7,$1C,$3E,$36,$3E,$23,$77,$77,$00,$00 ;33 A + !byte 5,$0F,$1B,$1B,$1F,$33,$33,$1F,$00,$00 ;34 B !byte 5,$0E,$1B,$1B,$03,$1B,$1B,$0E,$00,$00 ;35 C - !byte 5,$0F,$1B,$1B,$1B,$1B,$1B,$0F,$00,$00 ;36 D + !byte 6,$0F,$1B,$33,$33,$33,$33,$1F,$00,$00 ;36 D !byte 5,$1F,$1B,$03,$07,$03,$1B,$1F,$00,$00 ;37 E !byte 5,$1F,$1B,$03,$0F,$03,$03,$03,$00,$00 ;38 F - !byte 6,$3E,$33,$03,$3B,$3B,$33,$3E,$00,$00 ;39 G - !byte 5,$1B,$1B,$1B,$1F,$1F,$1B,$1B,$00,$00 ;40 H + !byte 7,$3E,$33,$03,$7B,$7B,$33,$3E,$00,$00 ;39 G + !byte 7,$77,$77,$36,$3E,$3E,$77,$77,$00,$00 ;40 H !byte 4,$0F,$0F,$06,$06,$06,$0F,$0F,$00,$00 ;41 I - !byte 5,$3F,$1B,$18,$18,$1B,$1B,$0E,$00,$00 ;42 J - !byte 5,$1B,$1B,$0F,$07,$0F,$1B,$1B,$00,$00 ;43 K + !byte 6,$3F,$1B,$18,$18,$1B,$1B,$0E,$00,$00 ;42 J + !byte 6,$1B,$1B,$0F,$07,$1F,$3B,$33,$00,$00 ;43 K !byte 5,$03,$03,$03,$03,$03,$1B,$1F,$00,$00 ;44 L - !byte 8,$C3,$E7,$DB,$C3,$C3,$E7,$E7,$00,$00 ;45 M - !byte 6,$3B,$37,$37,$3F,$3B,$3B,$33,$00,$00 ;46 N + !byte 8,$C3,$E7,$DB,$DB,$C3,$E7,$E7,$00,$00 ;45 M + !byte 7,$73,$77,$67,$7F,$7B,$73,$63,$00,$00 ;46 N !byte 5,$0E,$1B,$1B,$1B,$1B,$1B,$0E,$00,$00 ;47 O - !byte 5,$0F,$1B,$1B,$0F,$03,$03,$03,$00,$00 ;48 P + !byte 5,$0F,$1B,$1B,$1B,$0B,$03,$03,$00,$00 ;48 P !byte 6,$0E,$1B,$1B,$1B,$1F,$1B,$3E,$30,$00 ;49 Q - !byte 5,$0F,$1B,$1B,$0F,$0F,$1B,$1B,$00,$00 ;50 R + !byte 5,$0F,$1B,$1B,$0F,$1F,$1B,$3B,$00,$00 ;50 R !byte 6,$1E,$1B,$03,$0E,$18,$1B,$0F,$00,$00 ;51 S - !byte 6,$3F,$3F,$0C,$0C,$0C,$0C,$0C,$00,$00 ;52 T + !byte 8,$FF,$FF,$DB,$18,$18,$18,$3C,$00,$00 ;52 T !byte 5,$1B,$1B,$1B,$1B,$1B,$1F,$0E,$00,$00 ;53 U !byte 5,$1B,$1B,$1B,$1B,$1B,$0E,$06,$00,$00 ;54 V !byte 8,$E7,$E7,$C3,$DB,$DB,$DB,$66,$00,$00 ;55 W - !byte 5,$1B,$1B,$1B,$0E,$1B,$1B,$1B,$00,$00 ;56 X + !byte 6,$33,$33,$1E,$0C,$0E,$33,$33,$00,$00 ;56 X !byte 6,$33,$33,$33,$1E,$0C,$0C,$0C,$00,$00 ;57 Y !byte 5,$1F,$1B,$1C,$0E,$07,$1B,$1F,$00,$00 ;58 Z !byte 4,$0F,$03,$03,$03,$03,$03,$0F,$00,$00 ;59 left sqr bracket @@ -64,24 +64,24 @@ !byte 5,$04,$0E,$1B,$00,$00,$00,$00,$00,$00 ;62 carrot !byte 4,$00,$00,$00,$00,$00,$00,$1F,$00,$00 ;63 underscore !byte 3,$03,$03,$06,$00,$00,$00,$00,$00,$00 ;64 left single quote - !byte 5,$00,$00,$1E,$1B,$1B,$1B,$3E,$00,$00 ;65 a - !byte 5,$07,$03,$0F,$1B,$1B,$1B,$0F,$00,$00 ;66 b + !byte 5,$00,$00,$1E,$1B,$1B,$1B,$1E,$00,$00 ;65 a + !byte 5,$03,$03,$0F,$1B,$1B,$1B,$0F,$00,$00 ;66 b !byte 5,$00,$00,$0E,$1B,$03,$1B,$0E,$00,$00 ;67 c - !byte 5,$18,$18,$1E,$1B,$1B,$1B,$3E,$00,$00 ;68 d + !byte 5,$18,$18,$1E,$1B,$1B,$1B,$1E,$00,$00 ;68 d !byte 5,$00,$00,$0E,$1B,$1F,$03,$0E,$00,$00 ;69 e !byte 5,$0C,$1E,$06,$1F,$06,$06,$06,$00,$00 ;70 f - !byte 5,$00,$00,$3E,$1B,$1B,$1B,$1E,$18,$0F ;71 g - !byte 5,$03,$03,$0F,$1B,$1B,$1B,$3B,$00,$00 ;72 h + !byte 6,$00,$00,$3E,$1B,$1B,$1B,$1E,$18,$0F ;71 g + !byte 5,$03,$03,$0F,$1B,$1B,$1B,$1B,$00,$00 ;72 h !byte 2,$03,$00,$03,$03,$03,$03,$03,$00,$00 ;73 i - !byte 4,$0C,$00,$1C,$0C,$0C,$0C,$0C,$0F,$06 ;74 j + !byte 4,$0C,$00,$0C,$0C,$0C,$0C,$0C,$0F,$06 ;74 j !byte 5,$03,$03,$1B,$0F,$07,$0F,$1B,$00,$00 ;75 k - !byte 2,$03,$03,$03,$03,$03,$03,$07,$00,$00 ;76 l + !byte 3,$03,$03,$03,$03,$03,$03,$07,$00,$00 ;76 l !byte 8,$00,$00,$67,$DB,$DB,$DB,$C3,$00,$00 ;77 m - !byte 5,$00,$00,$0F,$1B,$1B,$1B,$3B,$00,$00 ;78 n + !byte 5,$00,$00,$0F,$1B,$1B,$1B,$1B,$00,$00 ;78 n !byte 5,$00,$00,$0E,$1B,$1B,$1B,$0E,$00,$00 ;79 o !byte 5,$00,$00,$0F,$1B,$1B,$1B,$0F,$03,$03 ;80 p - !byte 5,$00,$00,$2E,$1B,$1B,$1B,$1E,$18,$38 ;81 q - !byte 4,$00,$00,$0F,$17,$03,$03,$03,$00,$00 ;82 r + !byte 6,$00,$00,$2E,$1B,$1B,$1B,$1E,$18,$18 ;81 q + !byte 4,$00,$00,$0F,$07,$03,$03,$03,$00,$00 ;82 r !byte 4,$00,$00,$0E,$03,$06,$0C,$07,$00,$00 ;83 s !byte 4,$00,$06,$0F,$06,$06,$06,$0C,$00,$00 ;84 t !byte 5,$00,$00,$1B,$1B,$1B,$1B,$1E,$00,$00 ;85 u diff --git a/Platform/Apple/virtual/src/font/fontEngine.s b/Platform/Apple/virtual/src/font/fontEngine.s index 60cdbafd..ca2b4db5 100644 --- a/Platform/Apple/virtual/src/font/fontEngine.s +++ b/Platform/Apple/virtual/src/font/fontEngine.s @@ -70,6 +70,9 @@ SetWindow JMP SetWnd ;API call address ;Clear the window ClearWindow JMP ClrHome ;API call address +;Copy the window pg 1 to pg 2 +CopyWindow JMP CpWnd ;API call address + ;Display a character, including interpreting special codes DisplayChar JMP DoPlAsc @@ -654,6 +657,26 @@ ClrChkF LDA BkgColor ClrChk1 STA ClrFlpF RTS +;Routine: copy hi-res page 1 to page 2, the window area only +CpWnd LDX TpMrgn +CpWnd1 LDA HgrTbHi,X ;(ie. the mem address of the left edge + STA GBasH ;of the HGR screen) + EOR #$60 ;turn off $20 bit, turn on $40 bit to get page 2 + STA H_Adr + LDA HgrTbLo,X ;using a look-up table 192 bytes long x2 + STA GBasL + STA L_Adr + LDY LfMrgn +CpWnd2 LDA (GBasL),Y + STA (L_Adr),Y + INY + CPY RtMrgn + BNE CpWnd2 + INX + CPX BtMrgn + BNE CpWnd1 + RTS + ;Routine: parser w/auto line break DoParse STA PrsAdrL STY PrsAdrH @@ -697,11 +720,14 @@ Pa_Tskp LDA AscChar LDY Pa_iSv INY JMP Pa_Lp1 -Pa_ToFr LDY Pa_iSv ;if word too big - CPY Pa_iBgn ; for one line - BEQ Pa_Spc ; then split the word +Pa_ToFr !if DEBUG { +prChr '+' } + ;MH: I added this, but it doesn't actually work. Skips first char on line sometimes. + ;LDY Pa_iSv ;if word too big + ;CPY Pa_iBgn ; for one line + ;BEQ Pa_Spc ; then split the word LDA #$8D STA AscChar + !if DEBUG { +prChr '!' : ora #$80 : jsr cout } JSR TestChr LDY #0 STY TtlWdth @@ -716,6 +742,7 @@ Pa_Spc LDY Pa_iSv Pa_Lp2 STY Pa_iSv LDA (PrsAdrL),Y ;Get the character STA AscChar ;**add code + !if DEBUG { ora #$80 : jsr cout } JSR TestChr ;if space & at left then don't plot LDY Pa_iSv INY @@ -732,7 +759,8 @@ Pa_Dn2b LDA TtlWdth LDA (PrsAdrL),Y ;Get the character CMP #$8D BEQ Pa_Dn3 - STA AscChar + STA AscChar + !if DEBUG { +prChr '>' : ora #$80 : jsr cout } JSR TestChr JMP Pa_Dn4 Pa_Dn3 LDY Pa_iSv @@ -742,7 +770,8 @@ Pa_Dn3 LDY Pa_iSv Pa_Dn4 LDY Pa_iSv INY JMP Pa_Lp0 -ParsDn RTS +ParsDn !if DEBUG { +prChr '<' : +crout : BIT $C053 } + RTS ; LinWdth !byte 112 ;max line width TtlWdth !byte $00 ;total word width diff --git a/Platform/Apple/virtual/src/include/fontEngine.i b/Platform/Apple/virtual/src/include/fontEngine.i index 7d21084b..fdb99f06 100644 --- a/Platform/Apple/virtual/src/include/fontEngine.i +++ b/Platform/Apple/virtual/src/include/fontEngine.i @@ -7,5 +7,6 @@ fontEngine = $E000 SetFont = fontEngine SetWindow = SetFont+3 ClearWindow = SetWindow+3 -DisplayChar = ClearWindow+3 +CopyWindow = ClearWindow+3 +DisplayChar = CopyWindow+3 DisplayStr = DisplayChar+3 diff --git a/Platform/Apple/virtual/src/plasma/gameloop.pla b/Platform/Apple/virtual/src/plasma/gameloop.pla index 3456fcf5..c3e238ba 100644 --- a/Platform/Apple/virtual/src/plasma/gameloop.pla +++ b/Platform/Apple/virtual/src/plasma/gameloop.pla @@ -503,6 +503,16 @@ asm clearWindow jmp ClearWindow end +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Use the font engine to copy the current text window to hi-res page 2 +// Params: None +asm copyWindow + +asmPlasm 0 + bit setLcRW+lcBank2 + bit setLcRW+lcBank2 + jmp CopyWindow +end + /////////////////////////////////////////////////////////////////////////////////////////////////// // Display a character using the font engine. // Params: ch @@ -746,10 +756,11 @@ def fakeChars() displayStr("Name Life Gun\n") displayChar('L'-$40) displayStr("Black Bart 12 4\n") - displayStr("Wyld Bill 8 2\n") + displayStr("Wyld Bill 8 2\n") displayStr("Lucy Lawless ") - displayChar('H'-$40) + displayChar('H'-$40) // back 1 pixel displayStr("9 6") + if mapIs3D; copyWindow(); fin setWindow2() end @@ -846,6 +857,7 @@ def moveForward() if val > 0 if !mapIs3D render() + if textDrawn and mapIs3D; copyWindow(); fin needRender = FALSE else needRender = TRUE @@ -855,6 +867,7 @@ def moveForward() // If we're on a new map tile, clear text from script(s) on the old tile. if val >= 2 and textDrawn clearWindow() + if textDrawn and mapIs3D; copyWindow(); fin textDrawn = FALSE fin @@ -1035,6 +1048,7 @@ def kbdLoop() fin if needRender render() + if textDrawn and mapIs3D; copyWindow(); fin needRender = FALSE fin loop @@ -1058,6 +1072,7 @@ def setScriptInfo(mapName, trigTbl) displayChar('Y'-$40) // center mode displayStr(mapName) displayChar('N'-$40) // normal mode + if mapIs3D; copyWindow(); fin // Back to the main text window. setWindow2() @@ -1081,6 +1096,7 @@ def getYN() return 1 elsif key == 'N' clearWindow() + if textDrawn and mapIs3D; clearWindow(); fin textDrawn = FALSE return 0 fin @@ -1128,6 +1144,7 @@ end // Clear the displayed portrait drawing def clrPortrait() render() + if textDrawn and mapIs3D; copyWindow(); fin needRender = FALSE end