4sports/src/ui.credits.a

114 lines
3.2 KiB
Plaintext
Raw Normal View History

2021-02-16 06:01:22 +00:00
;license:MIT
2022-08-23 02:04:55 +00:00
;(c) 2018-2021 by 4am & qkumba
2021-02-16 06:01:22 +00:00
;
; credits page
;
; Public functions
; - Help
2022-08-23 02:04:55 +00:00
; - Credits
;
;------------------------------------------------------------------------------
; Help
; display per-game or global help page and wait
2021-02-16 06:01:22 +00:00
;
2022-08-23 02:04:55 +00:00
; in: none
; out: see above
;------------------------------------------------------------------------------
Help
jsr GetGameToLaunch
bcs @global
+ST16 @game
jsr LoadIndexedFile
@okvsPtr !word gSearchCache
!word kGameHelpIndexRecord
jsr okvs_find
!word @okvsPtr
@game !word $FDFD ; SMC
+ST16 @indexRecordPtr
jsr LoadIndexedFile
!word $800
@indexRecordPtr
!word $FDFD ; SMC
clc
bcc .clearAndDisplayHelp ; always branches
@global jsr LoadIndexedFile ; load help text into $800
!word $800
!word kHelpTextRecord
jsr LoadHelpOffscreen ; load fancy backdrop
ldx #7
bne .displayHelp ; always branches
2021-02-16 06:01:22 +00:00
;------------------------------------------------------------------------------
; Credits
; display credits page and wait
;
; in: none
; out: C clear
; all other flags and registers clobbered
;------------------------------------------------------------------------------
Credits
2022-08-23 02:04:55 +00:00
jsr LoadIndexedFile ; load credits text into $800
!word $800
!word kCreditsRecord
.clearAndDisplayHelp
jsr ForceHGRMode
2021-02-16 06:01:22 +00:00
jsr ClearOffscreen
2022-08-23 02:04:55 +00:00
ldx #0 ; left margin (0 for credits, different for global help)
.displayHelp
lda OffscreenPage
2021-02-16 06:01:22 +00:00
ror ; draw on offscreen page
2022-08-23 02:04:55 +00:00
+LDADDR $800
+ST16 PTR
;DrawPage 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_PTR_is_already_set
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
2021-02-16 06:01:22 +00:00
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