2019-09-16 16:57:53 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2018-9 by 4am
|
|
|
|
;
|
|
|
|
; cheat-related UI functions
|
|
|
|
;
|
|
|
|
; Public functions:
|
2019-09-16 17:36:48 +00:00
|
|
|
; - 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
|
|
|
|
;
|
2019-09-16 17:36:48 +00:00
|
|
|
; 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
|
2019-10-05 01:34:49 +00:00
|
|
|
lda MachineStatus
|
|
|
|
eor #CHEATS_ENABLED
|
|
|
|
sta MachineStatus
|
|
|
|
and #CHEATS_ENABLED
|
2019-09-16 17:36:48 +00:00
|
|
|
beq +
|
2019-09-24 19:31:44 +00:00
|
|
|
inx
|
|
|
|
+ stx @val
|
2019-09-16 17:36:48 +00:00
|
|
|
jsr pref_set
|
|
|
|
!word kCheat
|
|
|
|
!word @pref
|
2019-10-14 02:22:47 +00:00
|
|
|
; X = 0, Z = 1
|
2019-09-16 17:36:48 +00:00
|
|
|
rts
|
|
|
|
@pref !byte 1
|
|
|
|
@val !byte $FD
|