4cade/src/ui.cheats.a

28 lines
532 B
Plaintext

;license:MIT
;(c) 2018-9 by 4am
;
; cheat-related UI functions
;
; Public functions:
; - ToggleCheat
;
ToggleCheat
; in: none
; out: X = 0, Z = 1 (guaranteed by pref_set)
; all other registers and flags clobbered
ldx #$B0
lda MachineStatus
eor #CHEATS_ENABLED
sta MachineStatus
and #CHEATS_ENABLED
beq +
inx
+ stx @val
jsr pref_set
!word kCheat
!word @pref
rts
@pref !byte 1
@val !byte $FD