4cade/src/ui.cheats.a

38 lines
870 B
Plaintext
Raw Normal View History

2019-09-16 16:57:53 +00:00
;license:MIT
;(c) 2018-9 by 4am
;
; cheat-related UI functions
;
; Public functions:
; - ToggleCheat
2019-09-16 16:57:53 +00:00
;
2019-10-14 02:22:47 +00:00
;------------------------------------------------------------------------------
; ToggleCheat
; toggle whether cheats are enabled (global flag) and update the preferences
; file with the new status
;
; does not update UI
;
; in: none
2019-10-14 02:22:47 +00:00
; out: X = 0
; Z = 1
2019-09-24 19:32:24 +00:00
; all other registers and flags clobbered
2019-10-14 02:22:47 +00:00
;------------------------------------------------------------------------------
ToggleCheat
2019-09-24 19:31:44 +00:00
ldx #$B0
lda MachineStatus
eor #CHEATS_ENABLED
sta MachineStatus
and #CHEATS_ENABLED
beq +
2019-09-24 19:31:44 +00:00
inx
+ stx @val
jsr pref_set
!word kCheat
!word @pref
2019-10-14 02:22:47 +00:00
; X = 0, Z = 1
rts
@pref !byte 1
@val !byte $FD