4cade/src/ui.credits.a

118 lines
3.3 KiB
Plaintext
Raw Normal View History

2019-07-10 17:37:59 +00:00
;license:MIT
2021-10-08 06:28:11 +00:00
;(c) 2018-2021 by 4am & qkumba
2019-07-10 17:37:59 +00:00
;
; credits page
;
; Public functions
2019-10-08 03:50:23 +00:00
; - Help
2021-10-18 20:13:05 +00:00
; - Credits
2019-10-08 03:50:23 +00:00
;
2019-07-10 17:37:59 +00:00
2019-10-14 02:22:47 +00:00
;------------------------------------------------------------------------------
; Help
2020-04-02 21:58:13 +00:00
; display per-game or global help page and wait
2019-10-14 02:22:47 +00:00
;
; in: none
2020-03-24 20:30:14 +00:00
; out: see above
2019-10-14 02:22:47 +00:00
;------------------------------------------------------------------------------
Help
2020-04-02 21:58:13 +00:00
jsr GetGameToLaunch
bcs @global
2021-10-13 22:04:56 +00:00
+ST16 @game
2021-11-13 01:46:05 +00:00
jsr LoadIndexedFile
!word kTotalIndexFile
@okvsPtr !word gSearchCache
!word kGameHelpIndexRecord
2021-10-13 22:04:56 +00:00
2021-10-12 23:37:45 +00:00
jsr okvs_find
2021-10-13 22:04:56 +00:00
!word @okvsPtr
@game !word $FDFD ; SMC
+ST16 @indexRecordPtr
jsr LoadIndexedFile
2021-11-09 18:05:33 +00:00
!word kTotalDataFile
2021-10-28 00:08:03 +00:00
!word $800
2021-10-13 22:04:56 +00:00
@indexRecordPtr
!word $FDFD ; SMC
2020-04-02 21:58:13 +00:00
clc
2021-10-13 22:04:56 +00:00
bcc .clearAndDisplayHelp ; always branches
2021-10-28 00:08:03 +00:00
@global jsr LoadFile ; load help text into $800
!word kRootDirectory
!word kHelpTextFile
2021-10-28 00:08:03 +00:00
!word $800
2021-10-13 22:04:56 +00:00
2020-04-02 21:58:13 +00:00
jsr LoadHelpOffscreen ; load fancy backdrop
ldx #7
2021-10-13 22:04:56 +00:00
bne .displayHelp ; always branches
2021-10-18 20:13:05 +00:00
;------------------------------------------------------------------------------
; Credits
; display credits page and wait
;
; in: none
; out: C clear
; all other flags and registers clobbered
;------------------------------------------------------------------------------
Credits
2021-10-28 00:08:03 +00:00
jsr LoadFile ; load credits text into $800
2021-10-18 20:13:05 +00:00
!word kRootDirectory
!word kCreditsFile
2021-10-28 00:08:03 +00:00
!word $800
2021-10-18 20:13:05 +00:00
.clearAndDisplayHelp
jsr ForceHGRMode
jsr ClearOffscreen
ldx #0 ; left margin (0 for credits, different for global help)
.displayHelp
lda OffscreenPage
ror ; draw on offscreen page
2021-10-28 00:08:03 +00:00
+LDADDR $800
2021-10-18 20:13:05 +00:00
+ST16 PTR
2021-10-28 04:40:20 +00:00
;DrawPage inlined here
2021-10-18 20:13:05 +00:00
;
; 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
2021-10-28 04:40:20 +00:00
jsr DrawString_PTR_is_already_set
2021-10-18 20:13:05 +00:00
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