Implemented scroll-lock mode in font engine, in support of story mode.

This commit is contained in:
Martin Haye 2019-01-24 09:51:56 -08:00
parent 0139adca30
commit 023c33218f
3 changed files with 80 additions and 10 deletions

View File

@ -140,6 +140,9 @@ GetScreenLine JMP GetScLn
;Advance to next line on the screen
NextScreenLine JMP NxtScLn
;Set or clear scroll-lock mode
SetScrollLock JMP SetScLk
;If you know which of the {0..110} bitmapped characters
;you want plotted, you can bypass testing for control
;codes, making this a faster way to plot.
@ -171,6 +174,7 @@ CursRow !byte 0 ;vertical Y-position {0..191}
ChrWdth !byte 0 ;character width (number of pixels)
PltChar !byte 0 ;character to be plotted {0..110}
AscChar !byte 0 ;Ascii Char value {$80..$FF}
ScrlLck_Flg !byte 0 ;Non-zero to prevent scrolling during parse
;Just record the font address.
DoSetFont STA Font0
@ -808,6 +812,10 @@ CpWnd2 LDA (GBasL),Y
BEQ CpWnd1
RTS
;Routine: set or clear the scroll-lock flag (prevents scrolling during parse)
SetScLk STA ScrlLck_Flg
RTS
;Routine: parser w/auto line break
DoParse STA PrsAdrL
STY PrsAdrH
@ -860,7 +868,22 @@ Pa_Tskp LDA AscChar
INY
BNE Pa_Lp1
Pa_ToFr !if DEBUG { +prChr '+' }
LDA Pa_WdCt ;if we didn't print any words yet, then it's
; MH: Added scroll lock checking
LDA ScrlLck_Flg ;check for scroll-lock mode
BEQ Pa_CBig ;if not locked, skip check for scroll
LDA CursRow ;current vertical coord
CLC
ADC #9 ;increment by 9 lines, down
CMP CursYb ;check if it's past the window end
BCC Pa_CBig ;if not then continue
LDY PrsAdrH ;calc adr of next word that would display
LDA PrsAdrL
CLC
ADC Pa_iSv
BCC +
INY
+ RTS ;and return early without scrolling
Pa_CBig LDA Pa_WdCt ;if we didn't print any words yet, then it's
BEQ Pa_BgWd ; a word too big for line: split it
Pa_ToF2 LDA #$8D
STA AscChar
@ -912,6 +935,8 @@ Pa_Dn4 LDY Pa_iSv
INY
JMP Pa_Lp0
ParsDn !if DEBUG { +prChr '<' : +crout : BIT $C053 }
LDA #0 ;return null to indicate all chars parsed
TAY
RTS
;

View File

@ -46,4 +46,5 @@ CalcWidth = DisplayStr+3
GetCursor = CalcWidth+3
GetStr = GetCursor+3
GetScreenLine = GetStr+3
NextScreenLine = GetScreenLine+3
NextScreenLine = GetScreenLine+3
SetScrollLock = NextScreenLine+3

View File

@ -17,14 +17,50 @@ include "playtype.plh"
predef _story_mode(enable, portraitNum)#1, _story_display(storyNum)#1
word[] funcTbl = @_story_mode, @_story_display
///////////////////////////////////////////////////////////////////////////////////////////////////
// Definitions used by assembly code
asm __defs
; Use hi-bit ASCII for Apple II
!convtab "../../include/hiBitAscii.ct"
; Headers
!source "../../include/global.i"
!source "../../include/plasma.i"
!source "../../include/mem.i"
!source "../../include/fontEngine.i"
; General use
tmp = $2
pTmp = $4
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Display a string using the font engine, but prevent scrolling, and return the address of the
// next character that would have been displayed after scrolling (or NULL if no scroll needed)
asm displayStrNoScroll(str)#1
+asmPlasmRet 1
pha
lda #1
jsr SetScrollLock
pla
jsr DisplayStr
pha
lda #0
jsr SetScrollLock
pla
rts
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def setBlock1()#0
setWindow(0, 192, 7, 133)
setWindow(0, 189, 7, 133)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def setBlock2()#0
setWindow(135, 192, 140, 266)
setWindow(135, 189, 140, 266)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -44,13 +80,21 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Display string on a blank screen, with blanking follow-up
def _story_display(storyNum)#1
displayStr("\n\nHe heh hee lorem ipsum Blah blah blah. Also blah blah blah blah and blah.")
displayStr(" Blah blah blah. Blah blah blah blah and blah. Blah blah.")
displayStr("\n\nHe heh hee lorem ipsum Blah blah blah. Also blah blah blah blah and blah.")
displayStr(" Blah blah blah. Blah blah blah blah and blah. Blah blah.")
word p
p = displayStrNoScroll("\n\nHe heh hee lorem ipsum Blah blah blah. Also blah blah blah blah and blah.")
printf1("p=$%x\n", p)
p = displayStrNoScroll(" Blah blah blah. Blah blah blah blah and blah. Blah blah.")
printf1("p=$%x\n", p)
p = displayStrNoScroll("\n\nHe heh hee lorem ipsum Blah blah blah. Also blah blah blah blah and blah.")
printf1("p=$%x\n", p)
p = displayStrNoScroll(" Blah blah blah. Blah blah blah blah and blah. Blah blah, blah and blah blah ABC ***.")
printf1("p=$%x\n", p)
^$c051
rdkey
^$c050
setBlock2
displayStr("More story goes here. Blah blah blah. Also blah blah blah blah and blah.")
displayStr(" Blah blah blah. Blah blah blah blah and blah. Blah blah, blah blabh.")
p = displayStrNoScroll("More story goes here. Blah blah blah. Also blah blah blah blah and blah.")
p = displayStrNoScroll(" Blah blah blah. Blah blah blah blah and blah. Blah blah, blah blabh.")
getUpperKey
return 0
end