move DrawPage inline

This commit is contained in:
4am 2021-10-18 16:13:05 -04:00
parent 5a865d64de
commit 622e65929b
6 changed files with 86 additions and 91 deletions

View File

@ -7,7 +7,7 @@
;
; LC RAM BANK 1
; D000..E789 - persistent data structures (gGlobalPrefsStore, gGamesListStore)
; E979..FFF1 - main program code
; E95E..FFF1 - main program code
; FFF2..FFF9 - API functions and global constants available for main program
; code, prelaunchers, transition effects, &c.
; (Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)
@ -16,8 +16,8 @@
; LC RAM BANK 2
; D000..D3FF - ProRWTS data
; D400..D66F - ProRWTS code
; D670..DB91 - HGR font code & ProRWTS glue code
; DB4D..DB5C - backup of stack (during gameplay and self-running demos)
; D670..DB2D - HGR font code & ProRWTS glue code
; DB2E..DB3D - backup of stack (during gameplay and self-running demos)
; ...unused...
; DBB4..DBFF - (de)acceleration function
; DC00..DFFF - HGR font data

View File

@ -209,35 +209,35 @@
; various language card configurations
!macro READ_RAM1_NO_WRITE {
bit $C088
sta $C088
}
!macro READ_RAM1_WRITE_RAM1 {
bit $C08B
bit $C08B
sta $C08B
sta $C08B
}
!macro READ_RAM2_NO_WRITE {
bit $C080
sta $C080
}
!macro READ_RAM2_WRITE_RAM2 {
bit $C083
bit $C083
sta $C083
sta $C083
}
!macro READ_ROM_WRITE_RAM1 {
bit $C089
bit $C089
sta $C089
sta $C089
}
!macro READ_ROM_WRITE_RAM2 {
bit $C081
bit $C081
sta $C081
sta $C081
}
!macro READ_ROM_NO_WRITE {
bit $C082
sta $C082
}
; requires setting zpCharMask in zero page to #$FF or #$DF before use

View File

@ -283,6 +283,7 @@ DrawGameTitleInActionSlideshow
ldy gPathname
sta gPathname,y
+LDADDR gPathname
+ST16 PTR
sec
jsr DrawString
@fallthroughForDHGR

View File

@ -4,46 +4,10 @@
; credits page
;
; Public functions
; - Credits
; - Help
; - Credits
;
;------------------------------------------------------------------------------
; Credits
; display credits page and wait
;
; in: none
; out: C clear
; all other flags and registers clobbered
;------------------------------------------------------------------------------
Credits
jsr LoadFile ; load credits text into $8000
!word kRootDirectory
!word kCreditsFile
!word $8000
.clearAndDisplayHelp
jsr ForceHGRMode
jsr ClearOffscreen
ldx #0
.displayHelp
lda OffscreenPage
ror ; draw on offscreen page
+LDADDR $8000
jsr DrawPage ; draw credits
jsr ShowOtherPage ; show credits
jsr WaitForKeyFor30Seconds; wait
bit CLEARKBD ; don't care about key
cmp #$81 ; Ctrl-A = about
beq Credits
cmp #$90 ; Ctrl-P = launch joystick calibration program
bne +
jmp Joystick
+ cmp #$83 ; Ctrl-C = toggle cheat mode
bne +
jsr ToggleCheat
+ sec ; if called from search mode, tell caller to refresh
rts
;------------------------------------------------------------------------------
; Help
; display per-game or global help page and wait
@ -83,3 +47,71 @@ Help
jsr LoadHelpOffscreen ; load fancy backdrop
ldx #7
bne .displayHelp ; always branches
;------------------------------------------------------------------------------
; Credits
; display credits page and wait
;
; in: none
; out: C clear
; all other flags and registers clobbered
;------------------------------------------------------------------------------
Credits
jsr LoadFile ; load credits text into $8000
!word kRootDirectory
!word kCreditsFile
!word $8000
.clearAndDisplayHelp
jsr ForceHGRMode
jsr ClearOffscreen
ldx #0 ; left margin (0 for credits, different for global help)
.displayHelp
lda OffscreenPage
ror ; draw on offscreen page
+LDADDR $8000
+ST16 PTR
;DrawPageInternal inlined here
;
; PTR contains address of array of length-prefixed strings
; length #$FF terminates
; X contains 0-indexed left margin (HTAB)
; carry bit clear -> draw on page 1
; carry bit set -> draw on page 2
; drawing starts at VTAB 0
; each line starts at column X which was passed in (0-indexed)
; clobbers $FF
; clobbers A/X/Y
; preserves C, other flags clobbered
stx $FF
ldx #0
stx VTAB
php ; save C, but Z=1 because of ldx #0
@drawLine
lda $FF
sta HTAB
jsr DrawString
bmi @donePage
clc
adc PTR
sta PTR
bcc +
inc PTR+1
+ plp ; restore C to whatever it was on entry
php
beq @drawLine ; always branches
@donePage
plp
;end inline
jsr ShowOtherPage ; show credits
jsr WaitForKeyFor30Seconds; wait
bit CLEARKBD ; don't care about key
cmp #$81 ; Ctrl-A = about
beq Credits
cmp #$90 ; Ctrl-P = launch joystick calibration program
bne +
jmp Joystick
+ cmp #$83 ; Ctrl-C = toggle cheat mode
bne +
jsr ToggleCheat
+ sec ; if called from search mode, tell caller to refresh
rts

View File

@ -7,20 +7,15 @@
; that live in LC RAM 2 now.
;
; Public functions
; - DrawPage
; - Draw40Chars
; - DrawCenteredString
; - DrawString
;
DrawString
jsr StoreAYAndSwitchToBank2
jsr SwitchToBank2
jsr DrawStringInternal
bne JmpSwitch ; always
DrawPage
jsr StoreAYAndSwitchToBank2
jsr DrawPageInternal
; /!\ execution falls through here to JmpSwitch
JmpSwitch
jmp SwitchToBank1

View File

@ -8,39 +8,6 @@
; which handle bank switching for you.
;
DrawPageInternal
; PTR contains address of array of length-prefixed strings
; length #$FF terminates
; X contains 0-indexed left margin (HTAB)
; carry bit clear -> draw on page 1
; carry bit set -> draw on page 2
; drawing starts at VTAB 0
; each line starts at column X which was passed in (0-indexed)
; clobbers PTR
; clobbers $FF
; clobbers A/X/Y
; preserves C, other flags clobbered
stx $FF
ldx #0
stx VTAB
php ; save C, but Z=1 because of ldx #0
@drawLine
lda $FF
sta HTAB
jsr DrawStringInternal
bmi @donePage
clc
adc PTR
sta PTR
bcc +
inc PTR+1
+ plp ; restore C to whatever it was on entry
php
beq @drawLine ; always branches
@donePage
plp
rts
Draw40CharsInternal
; A/Y contains address of character buffer
; carry bit clear -> draw on page 1