always load game-specific prelaunch files, move cheats bit to MachineStatus, move MachineStatus to FFF9, check MachineStatus before executing cheat patches in prelaunch files

This commit is contained in:
4am 2019-10-04 21:34:49 -04:00
parent 645109328e
commit 6d87274cc6
61 changed files with 768 additions and 379 deletions

View File

@ -99,6 +99,7 @@ asmfx:
asmprelaunch:
@for f in src/prelaunch/*.a; do grep "^\!to" $${f} >/dev/null && $(ACME) $${f} >> build/log; done
@for f in res/title.hgr/*; do rsync --ignore-existing build/PRELAUNCH/STANDARD build/PRELAUNCH/$$(basename $$f); done
chd: dsk
chdman createhd -c none -isb 64 -i build/"$(DISK)" -o build/"$(DISK)".chd >>build/log

View File

@ -42,6 +42,7 @@ Reenter
cld
cli
jsr SwitchToBank2
jsr DisableAccelerator
jsr CloseHandles ; close any open handles to restore ProRWTS
jsr SaveOrRestoreScreenHoles ; restore original screen hole contents
ldx #5
@ -116,6 +117,18 @@ gGamesListStore
SwitchToBank2
+READ_RAM2_WRITE_RAM2
rts
; MachineStatus (label is in constants.a so prelaunchers can use it)
; 7 6 5 4 3 2 1 0
; | | | | | | | +- bit 0 reserved
; | | | | | | +--- bit 1 reserved
; | | | | | +----- bit 2 reserved
; | | | | +------- bit 3 = 1 if cheats are enabled
; | | | +--------- bit 4 = 1 if IIgs
; | | +----------- bit 5 = 1 if VidHD
; | +------------- bit 6 = 1 if 128K
; +--------------- bit 7 = 1 if joystick
; Use the bit masks defined in constants.a
!byte $FD ; MachineStatus ($FFF9)
!word Reenter ; NMI vector ($FFFA-B)
!word Reenter ; reset vector ($FFFC-D)
!word Reenter ; IRQ vector ($FFFE-F)

View File

@ -27,7 +27,9 @@
@s_no64K !scrxor $80,"REQUIRES 64K"
@no64Klen=(*-@s_no64K)-1
+ jsr DisableAccelerator ; set to 1 MHz (supports IIgs and many common accelerator cards)
+
lda #0
sta zpMachineStatus
lda ROM_MACHINEID
cmp #$06
bne NotGS
@ -50,6 +52,7 @@ NotGS clc
; bit 5 = 1 if VidHD
; bit 6 = 1 if 128K
; bit 7 = 1 if joystick
; and all other bits are 0 (we'll set bit 3 after copying it to LC RAM)
lda ROM_MACHINEID
cmp #$06
@ -142,6 +145,16 @@ NotGS clc
dey
bne @LM
jsr BuildAcceleratorFunction
+STAY @accelSrc
dex
-
@accelSrc=*+1
lda $FDFD,x ; copy (de)acceleration functions to RAM bank 2
sta DisableAccelerator,x
dex
bpl -
jmp OneTimeSetup
; ProRWTS2 has its own function to relocate itself
@ -151,7 +164,6 @@ ProRWTSBuffer
!source "src/hw.vidhd.a"
!source "src/hw.memcheck.a"
!source "src/hw.joystick.a"
!source "src/hw.normfast.a"
TOTAL
!text "T O T A L"
REPLAY
@ -172,11 +184,12 @@ Loader128KAndJoystick
!byte 15
!text "joystick + 128K"
!source "src/hw.normfast.a"
!source "src/parse.games.a"
OneTimeSetup
lda zpMachineStatus
sta MachineStatus ; save machine status
sta MachineStatus ; save machine status in LC RAM
jsr SaveOrRestoreScreenHoles ; save initial copy of screen hole content
lda #$91
sta holepatch ; enable restoring of copy from now on
@ -227,10 +240,11 @@ CopyDevs
ldy #1
lda (PTR),y ; A = #$B1 or #$B0
and #1 ; A = #$01 or #$00
clc
ror
ror ; A = #$80 or #$00
sta gCheatsEnabled
asl
asl
asl ; A = #$08 or #$00
ora MachineStatus
sta MachineStatus ; set bit 3 of MachineStatus
; calculate and update visible game count (3-digit decimal number as ASCII string)
dey ; Y = 0

View File

@ -18,6 +18,7 @@
; D5F8..DB52 - HGR font code & ProRWTS glue code
; DB53..DB62 - backup of stack (during gameplay and self-running demos)
; ...unused...
; DBB6..DBFF - (de)acceleration function
; DC00..DFFF - HGR font data
;------------------------------------------------------------------------------
@ -109,9 +110,14 @@ gValLen = $1F80
gVal = $1F81
; LC RAM 1
gCheatsAvailable = $D000 ; master cheats table, indexed by game index in gGamesListStore
; 1 byte per game, so max size = 256 games
gCheatsEnabled = $D0FF ; bit 7 = 1 if cheats are enabled
gCheatsAvailable = $D000 ; master cheats table, indexed by game index in gGamesListStore
; 1 byte per game, so max size = 256 games
MachineStatus = $FFF9
; actual constants
SUPPORTS_SHR = %00110000 ; AND mask for MachineStatus
; LC RAM 2
DisableAccelerator = $DBB6
EnableAccelerator = DisableAccelerator+3
; AND masks for MachineStatus
SUPPORTS_SHR = %00110000
CHEATS_ENABLED = %00001000

View File

@ -94,19 +94,9 @@ gGameToLaunch=*+1
dex
bne @clear
bit gCheatsEnabled ; are cheats enabled?
bpl @noCheats
ldx gGameToLaunch
ldy gCheatsAvailable,x ; are there any cheats for this game?
bne @Cheats
@noCheats
+LDADDR kStandardPrelaunch ; no game-specific prelaunch file, so
+STAY @pfile ; load standard prelaunch file instead
@Cheats
jsr LoadFile ; if cheats are enabled and this game has a prelaunch
!word kPrelaunchDirectory ; file that will set up the cheats, load that, otherwise
@pfile !word $FDFD ; load the standard prelaunch file
jsr LoadFile ; load this game's prelaunch file at $106
!word kPrelaunchDirectory
@pfile !word $FDFD
!word $0106
ldx #1 ; construct path to game's startup file

View File

@ -1,5 +1,12 @@
;;; NORMFAST Disable/enable Apple II compatible accelerator
;
; Release 7 2019-10-04 No functional changes to the
; acceleration routines, but for Total Replay, we split the
; machine identification code from the (de)acceleration code,
; because we can do the ID part once at program startup (when
; ROM is easily available), then (de)accelerate repeatedly
; from the language card.
;
; Release 6 2017-10-05 Fix Mac IIe card check
;
; Release 5 2017-09-27 Add Macintosh IIe Card. Addon
@ -50,7 +57,7 @@
; addresses are lowercase, constant values are in CAPS
RELEASE = 6 ; our version
RELEASE = 7 ; our version
romid = $FBB3
; $38=][, $EA=][+, $06=//e compatible
@ -124,88 +131,99 @@ zc_enable = $C05B
iobase = $C000 ; easily confused with kbd
DisableAccelerator
; disable accelerator
lda #1
!byte $2C ; BIT <ABSOLUTE>, hide next lda #
EnableAccelerator
; enable accelerator
lda #0
BuildAcceleratorFunction
; in: none
; out: A/Y points to lo/hi address of code block
; X contains length of code block
ldx #RELEASE ; our release number
;; first check built-in accelerators
ldx romid
cpx #ROMID_IIECOMPAT
bne build_addon ; not a //e
;; first check built-in accelerators
ldx romid
cpx #ROMID_IIECOMPAT
bne addon ; not a //e
ldx romid_ec
beq iic ; //c family
ldx romid_ec
beq iic ; //c family
; not worth the bytes for enhanced //e check
ldx irq+1
cpx #l128irqpage
bne gscheck
ldx irq+1
cpx #l128irqpage
bne gscheck
; a Laser 128, hopefully harmless on a non EX
ldy #EX_3MHZMASK ; phew, all needed bits set
ldx #<(ex_cfg)
;; setspeed - set 1Mhz with AND and fast with OR
;
; A = lsb set for normal speed
; X = low byte address of speed location
; Y = OR mask for fast
setspeed
lsr
tya
bcs setnorm
ora iobase,x
bne setsta ; always
setnorm
eor #$FF
and iobase,x
setsta
sta iobase,x
rts
ldy #EX_3MHZMASK ; phew, all needed bits set
ldx #<(ex_cfg)
gscheck
pha
sec
jsr idroutine
pla
bcs maccheck ; not a gs
pha
sec
jsr idroutine
pla
bcs maccheck ; not a gs
; set IIGS speed
ldy #GS_FAST
ldx #<(gsspeed)
bne setspeed ; always
ldy #GS_FAST
ldx #<(gsspeed)
bne build_setspeed ; always branches
maccheck
ldx romid_maciie_2
cpx #2
bne addon ; no built-in accelerator
ldx romid_maciie_2
cpx #2
bne build_addon ; no built-in accelerator
; the IIe Card in a Mac
ldy #MACIIE_FAST
ldx #<(maciie)
bne setspeed ; always
ldy #MACIIE_FAST
ldx #<(maciie)
bne build_setspeed ; always branches
iic
ldx romid_c
cpx #ROMID_CPLUS
bne addon ; not a //c+, eventually hit Zip
ldx romid_c
cpx #ROMID_CPLUS
bne build_addon ; not a //c+, eventually hit Zip
lda #<iicplus
ldy #>iicplus
ldx #(end_iicplus-iicplus)
rts
build_setspeed
stx setspeed_x
sty setspeed_y
lda #<setspeed
ldy #>setspeed
ldx #(end_setspeed-setspeed)
rts
build_addon
lda #<addon
ldy #>addon
ldx #(end_addon-addon)
rts
;-----------------------------------------------------------
; 3 distinct accelerator functions
;
; Only 1 of these will be required on any particular machine.
;
; Each has 2 entry points, +0 to disable acceleration and
; +3 to enable acceleration.
;
; setspeed must be self-modified before use (setspeed_x and
; setspeed_y).
;
;-----------------------------------------------------------
; Function #1: Apple IIc+
iicplus
; Set //c+ speed. Uses the horrible firmware in case other
; code works "by the book", that is can check and set
; whether the accelerator is enabled.
; The //c+ is otherwise Zip compatible.
lda #1 ; disable accelerator entry point
!byte $2C ; BIT <ABSOLUTE>, hide next lda #
lda #0 ; enable accelerator entry point
!cpu 65C02 ; only used for //c+
inc ; 65C02 $1A
@ -213,75 +231,105 @@ iic
; cgga calls save X and Y regs but sets $0 to 0
; (this will get a laugh from C programmers)
ldx $0
php
sei ; timing sensitive
pha ; action after CGGA_UNLOCK
ldx $0
php
sei ; timing sensitive
pha ; action after CGGA_UNLOCK
lda #CGGA_UNLOCK ; unlock to change
pha
jsr cgga
lda #CGGA_UNLOCK ; unlock to change
pha
jsr cgga
jsr cgga ; disable/enable
jsr cgga ; disable/enable
lda #CGGA_LOCK ; should lock after a change
pha
jsr cgga
lda #CGGA_LOCK ; should lock after a change
pha
jsr cgga
plp ; restore interrupt state
stx $0
rts
plp ; restore interrupt state
stx $0
rts
end_iicplus
;; At this point, the computer does not have a built-in
;; accelerator
; Function #2: IIgs, Laser 128EX, or IIe card
;; setspeed - set 1Mhz with AND and fast with OR
;
; Previous versions had tested fc_enable, which was not
; enough. Running low on space so just set blindly.
; A = lsb set for normal speed
; X = low byte address of speed location
; Y = OR mask for fast
setspeed
lda #1 ; disable accelerator entry point
!byte $2C ; BIT <ABSOLUTE>, hide next lda #
lda #0 ; enable accelerator entry point
setspeed_x=*+1
ldx #$FD ; SMC
setspeed_y=*+1
ldy #$FD ; SMC
lsr
tya
bcs setnorm
ora iobase,x
bne setsta ; always branches
setnorm
eor #$FF
and iobase,x
setsta
sta iobase,x
rts
end_setspeed
; Function #3: Card-based accelerator (TransWarp, ZipChip,
; FastChip, &c.)
; We blindly set switches for all known cards.
addon
; TransWarp I
lda #1 ; disable accelerator entry point
!byte $2C ; BIT <ABSOLUTE>, hide next lda #
lda #0 ; enable accelerator entry point
sta tw1_speed
; TransWarp I
sta tw1_speed
; Zip Chip
tay
eor #1
tax
lda #ZC_UNLOCK
php
sei ; timing sensitive
sta zc_lock
sta zc_lock
sta zc_lock
sta zc_lock
lsr ; not ZC_LOCK or ZC_UNLOCK
sta zc_lock,x ; disable/enable
lda #ZC_LOCK
sta zc_lock
tay
eor #1
tax
lda #ZC_UNLOCK
php
sei ; timing sensitive
sta zc_lock
sta zc_lock
sta zc_lock
sta zc_lock
lsr ; not ZC_LOCK or ZC_UNLOCK
sta zc_lock,x ; disable/enable
lda #ZC_LOCK
sta zc_lock
;; current products are subject to change so do
;; these last
; trademarked accelerator from Germany
sta uw_fast,y ; value does not matter
sta uw_fast,y ; value does not matter
; FASTChip
ldx #FC_1MHZ
tya
bne fcset
ldx #FC_ON ; enable set speed?
ldx #FC_1MHZ
tya
bne fcset
ldx #FC_ON ; enable set speed?
fcset
lda #FC_UNLOCK
sta fc_lock
sta fc_lock
sta fc_lock
sta fc_lock
sta fc_enable
stx fc_speed
lda #FC_LOCK
sta fc_lock
plp ; restore interrupt state
rts
lda #FC_UNLOCK
sta fc_lock
sta fc_lock
sta fc_lock
sta fc_lock
sta fc_enable
stx fc_speed
lda #FC_LOCK
sta fc_lock
plp ; restore interrupt state
rts
end_addon

View File

@ -77,6 +77,10 @@
bit $C08B
}
!macro READ_RAM2_NO_WRITE {
bit $C080
}
!macro READ_RAM2_WRITE_RAM2 {
bit $C083
bit $C083
@ -112,3 +116,22 @@
and zpCharMask
+
}
; these are mostly for prelaunchers -- code in the main program should keep track of which bank is active to minimize code size
!macro ENABLE_ACCEL {
+READ_RAM2_NO_WRITE
jsr EnableAccelerator
+READ_ROM_NO_WRITE
}
!macro DISABLE_ACCEL {
+READ_RAM2_NO_WRITE
jsr DisableAccelerator
+READ_ROM_NO_WRITE
}
!macro GET_MACHINE_STATUS {
+READ_RAM2_NO_WRITE
lda MachineStatus
+READ_ROM_NO_WRITE
}

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
lda #$60
sta $4035
jsr $1ffd
lda #$ad
sta $8289
jmp $7c1e
+ENABLE_ACCEL
lda #$60
sta $4035
jsr $1ffd ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$ad
sta $8289 ; patch - don't decrease lives
+
+DISABLE_ACCEL
jmp $7c1e

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
lda #$60
sta $81c
jsr $800
dec $5ff5
dec $608b
jmp $4000
+ENABLE_ACCEL
lda #$60
sta $81c
jsr $800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
dec $5ff5
dec $608b
+
+DISABLE_ACCEL
jmp $4000

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
lda #$60
sta $201f
jsr $2000
lda #$ad
sta $7699
jmp $73a0
+ENABLE_ACCEL
lda #$60
sta $201f
jsr $2000 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$ad
sta $7699 ; patch - don't decrease lives
+
+DISABLE_ACCEL
jmp $73a0

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
lda #$60
sta $1638
jsr $1610
lda #$ad
sta $10c9
sta $be8
jmp $833
+ENABLE_ACCEL
lda #$60
sta $1638
jsr $1610 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$ad
sta $10c9
sta $be8
+
+DISABLE_ACCEL
jmp $833

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $819D
jsr $3FF8 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $766C ; patch - don't decrease lives
sta $764E ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $4000

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
lda #$60
sta $3f06
jsr $3eb1
lda #$ad
sta $6d31
jmp $5c00
+ENABLE_ACCEL
lda #$60
sta $3f06
jsr $3eb1 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$ad
sta $6d31
+
+DISABLE_ACCEL
jmp $5c00

View File

@ -7,12 +7,18 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $2065
jsr $2000 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $1E20 ; patch - don't decrease lives
sta $6D5C ; patch - don't increase lives
sta $7354 ; patch - don't increase lives
sta $7D5C ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $BB00

View File

@ -7,10 +7,14 @@
!source "src/prelaunch/common.a"
lda #$60
sta $8034
jsr $4ab0
lda #$a5
sta $1619
sta $11ae
jmp $1100
lda #$60
sta $8034
jsr $4ab0 ; decompress and show title
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$a5
sta $1619
sta $11ae
+
jmp $1100

View File

@ -13,8 +13,12 @@
lda #$60
sta $BD40
jsr $BD1D ; decompress 2
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $69DC ; patch - don't decrease lives
sta $6C9A ; patch - don't increase lives
sta $6C9D ; patch - don't increase lives
+
jmp $7200

View File

@ -7,13 +7,19 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $0813
jsr $0800 ; decompress
lda #$60
sta $363F
jsr $3600 ; memory move
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$A5
sta $1338 ; patch - don't decrease lives
sta $10A8 ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $0A00

View File

@ -7,13 +7,19 @@
!source "src/prelaunch/common.a"
lda #<cheat
sta $b55
lda #>cheat
sta $b56
jmp $900
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
sta cheat+1
lda #<cheat
sta $b55
lda #>cheat
sta $b56
jmp $900
cheat
lda #$2c
sta $8a7e
jmp $3800
lda #0 ; SMC (will be non-zero if cheats are enabled)
beq +
lda #$2c
sta $8a7e
+
jmp $3800

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
lda #$60
sta $94d
jsr $800
lda #$b5
sta $82b0
sta $8324
jmp $6000
+ENABLE_ACCEL
lda #$60
sta $94d
jsr $800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$b5
sta $82b0
sta $8324
+
+DISABLE_ACCEL
jmp $6000

View File

@ -7,12 +7,16 @@
!source "src/prelaunch/common.a"
lda #$60
sta $3f03
jsr $3e97
lda #$24
sta $a433
sta $96ea
sta $94d1
sta $9768
jmp $a300
lda #$60
sta $3f03
jsr $3e97
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$24
sta $a433
sta $96ea
sta $94d1
sta $9768
+
jmp $a300

View File

@ -7,11 +7,17 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $0827
jsr $0800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$A5
sta $6E42 ; patch - don't decrease lives
sta $1B0D ; patch - don't increase lives
sta $8389 ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $8000

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
lda #$60
sta $8022
jsr $67de
lda #$a5
sta $35c2
jmp $3000
+ENABLE_ACCEL
lda #$60
sta $8022
jsr $67de ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$a5
sta $35c2
+
+DISABLE_ACCEL
jmp $3000

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $083A
jsr $0800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$A5
sta $902B ; patch - don't decrease lives
sta $77ED ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $5FED

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $0C33
jsr $0C00 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$B5
sta $A231 ; patch - don't decrease lives
+
+DISABLE_ACCEL
jmp $A000

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $2076
jsr $1FFD ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$BD
sta $19C5 ; patch - don't decrease lives
sta $196A ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $1000

View File

@ -7,22 +7,26 @@
!source "src/prelaunch/common.a"
lda #$60
sta $81e
jsr $800
lda #$60
sta $bd40
jsr $bc94
jsr $5ff8
lda #$6c
sta $bd40
lda #$60
sta $6ba2
jsr $3ffc
jsr $be00
lda #$ad
sta $19f5
sta $1a00
sta $1b4e
;;sta $a973
jmp $6ba5
lda #$60
sta $81e
jsr $800
lda #$60
sta $bd40
jsr $bc94
jsr $5ff8
lda #$6c
sta $bd40
lda #$60
sta $6ba2
jsr $3ffc
jsr $be00
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$ad
sta $19f5
sta $1a00
sta $1b4e
;;sta $a973
+
jmp $6ba5

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $244B
jsr $2400 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$A5
sta $9D89 ; patch - don't decrease lives
sta $9DF4 ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $0800

View File

@ -7,12 +7,18 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $6240
jsr $6230 ; phase 1
lda #$60
sta $85AE ; phase 2
jsr $85A4
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$00
sta $4786 ; patch - don't decrease lives
+
+DISABLE_ACCEL
jmp $4000

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $0818
jsr $0800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $4292 ; patch - don't decrease lives
sta $7C1F ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $4000

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $202A
jsr $2000 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $8075 ; patch - don't decrease lives
+
+DISABLE_ACCEL
jmp $8EA6

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $0813 ; decompress
jsr $0800
sta $0813
jsr $0800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$A5
sta $7579 ; patch - don't decrease lives
sta $6567 ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $4000

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
lda #$60
sta $826
jsr $800
lda #$24
sta $a1d9
sta $8ca6
jmp $8000
+ENABLE_ACCEL
lda #$60
sta $826
jsr $800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$24
sta $a1d9
sta $8ca6
+
+DISABLE_ACCEL
jmp $8000

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
lda #$60
sta $3eab
jsr $3e36
lda #$2c
sta $729b
sta $6fea
jmp $4000
+ENABLE_ACCEL
lda #$60
sta $3eab
jsr $3e36 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$2c
sta $729b
sta $6fea
+
+DISABLE_ACCEL
jmp $4000

View File

@ -7,52 +7,58 @@
!source "src/prelaunch/common.a"
ldy #(cheat_e-cheat_b)-1
- lda cheat_b,y
sta $bf70,y
dey
bpl -
lda #$4c
sta $4215
lda #$70
sta $4216
lda #$bf
sta $4217
jmp $4000
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
sta store-$BF70+cheat_b+1
ldy #(cheat_e-cheat_b)-1
- lda cheat_b,y
sta $bf70,y
dey
bpl -
lda #$4c
sta $4215
lda #$70
sta $4216
lda #$bf
sta $4217
jmp $4000
cheat_b !pseudopc $bf70 {
pla
sta jmp1+1
pla
sta jmp2+1
lda #>(patch-1)
pha
lda #<(patch-1)
pha
jmp ($8c00)
pla
sta jmp1+1
pla
sta jmp2+1
lda #>(patch-1)
pha
lda #<(patch-1)
pha
jmp ($8c00)
patch
lda #$24
ldy #$70
ldx $bf4a
beq store
ldy #$5e
dex
beq store
ldy #$00
dex
bne jmp2
lda #$24
ldy #$70
ldx $bf4a
beq store
ldy #$5e
dex
beq store
ldy #$00
dex
bne jmp2
store
sta $69b2,y
ldx #0 ; SMC (will be non-zero if cheats are enabled)
beq +
sta $69b2,y
+
jmp2
lda #$d1
pha
lda #$d1
pha
jmp1
lda #$d1
pha
rts
lda #$d1
pha
rts
}
cheat_e

View File

@ -13,6 +13,10 @@
lda #$60
sta $B890
jsr $B82C ; phase 2
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $962A ; patch - don't decrease lives
+
jmp ($0020)

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
lda #$60
sta $3f0e
jsr $3ebd
dec $9d19
dec $9d06
jmp $6000
+ENABLE_ACCEL
lda #$60
sta $3f0e
jsr $3ebd ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
dec $9d19
dec $9d06
+
+DISABLE_ACCEL
jmp $6000

View File

@ -7,13 +7,19 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $204E
jsr $2000 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $0E19 ; patch - don't decrease lives
sta $19F2 ; patch - don't decrease lives
sta $0E69 ; patch - don't increase lives
sta $7E11 ; patch - don't increase lives
sta $BE11 ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $4000

View File

@ -7,12 +7,19 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $2034
jsr $2000 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $4EF3 ; patch - don't decrease lives
lda #$00
sta $7F62 ; patch - don't increase lives
+
+DISABLE_ACCEL
lda #$00
tay
jmp $2035

View File

@ -7,12 +7,18 @@
!source "src/prelaunch/common.a"
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
sta patch+1
lda #<patch
sta $0859
lda #>patch
sta $085A
jmp $0800 ; decompress and show title and decompress again
patch
lda #0 ; SMC (will be non-zero if cheat mode is enabled)
beq +
lda #$A5
sta $5846 ; patch - don't decrease lives
+
jmp $57D7

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $36F3
jsr $0800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $13EE ; patch - don't decrease lives
; (game increases lives but caps at 9, so no further patches)
+
+DISABLE_ACCEL
jmp $0B00

View File

@ -13,6 +13,10 @@
lda #$60
sta $B845
jsr $B837
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$A5
sta $A5B0 ; patch - don't decrease lives
+
jmp $A720

View File

@ -7,13 +7,19 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $0866
jsr $0800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$A5
sta $54B2 ; patch - don't decrease lives
sta $5165 ; patch - don't increase lives
lda #$BD
sta $54B6 ; patch - don't decrease lives
sta $5162 ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $4000

View File

@ -7,15 +7,21 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #<patcher
sta $9431
lda #>patcher
sta $942E
jsr $4856 ; decompress
patcher rts
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$AD
sta $50A5 ; patch - don't decrease lives
sta $7197 ; patch - don't increase lives
+
+DISABLE_ACCEL
lda #$07
pha
lda #$FF

View File

@ -7,9 +7,13 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $4028
jsr $4000 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$A5
sta $6387 ; patch - don't decrease lives after dying
lda #$2C
@ -18,4 +22,6 @@
; to give you a bonus for each bomb left, so instead we patch one caller but
; not the other so you can plant a bomb without using up a bomb then get the
; maximum 'unused bombs' bonus and advance to the next level)
+
+DISABLE_ACCEL
jmp $6000

View File

@ -7,12 +7,20 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
sta patch+2
lda #<patch
sta $0814
lda #>patch
sta $080D
jmp $0800 ; decompress
patch nop
lda #0 ; SMC (will be non-zero if cheats are enabled)
beq +
lda #$A5
sta $70F4 ; patch - don't decrease lives
+
+DISABLE_ACCEL
jmp $94E0

View File

@ -7,10 +7,14 @@
!source "src/prelaunch/common.a"
lda #$60
sta $85e
jsr $800
lda #$ad
sta $2bc9
sta $2b6b
jmp $3e00
lda #$60
sta $85e
jsr $800 ; decompress and show title/options screens
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$ad
sta $2bc9
sta $2b6b
+
jmp $3e00

View File

@ -7,14 +7,20 @@
!source "src/prelaunch/common.a"
lda #<cheat
sta $10da
lda #>cheat
sta $10db
jmp $1000
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
sta cheat+1
lda #<cheat
sta $10da
lda #>cheat
sta $10db
jmp $1000
cheat
lda #$ad
sta $1661
sta $1476
jmp $1000
lda #0 ; SMC (will be non-zero if cheats are enabled)
beq +
lda #$ad
sta $1661
sta $1476
+
jmp $1000

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $404B
jsr $4000 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$A5
sta $7BA0 ; patch - don't decrease lives
sta $806A ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp ($0020)

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
lda #$60
sta $8214
jsr $4900
lda #$a9
sta $4299
jmp $4000
+ENABLE_ACCEL
lda #$60
sta $8214
jsr $4900 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$a9
sta $4299
+
+DISABLE_ACCEL
jmp $4000

View File

@ -7,9 +7,15 @@
!source "src/prelaunch/common.a"
lda #$60
sta $816
jsr $800
lda #$a5
sta $6d0d
jmp $6004
+ENABLE_ACCEL
lda #$60
sta $816
jsr $800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$a5
sta $6d0d
+
+DISABLE_ACCEL
jmp $6004

View File

@ -7,13 +7,19 @@
!source "src/prelaunch/common.a"
lda #$60
sta $49d5
jsr $800
lda #$60
sta $2fe
jsr $2ef
lda #$ad
sta $2d07
sta $1c17
jmp $919
+ENABLE_ACCEL
lda #$60
sta $49d5
jsr $800
lda #$60
sta $2fe
jsr $2ef
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$ad
sta $2d07
sta $1c17
+
+DISABLE_ACCEL
jmp $919

View File

@ -7,18 +7,24 @@
!source "src/prelaunch/common.a"
lda #$60
sta $816
jsr $800
lda #<cheat
sta $2007
lda #>cheat
sta $2008
jmp $2000
+ENABLE_ACCEL
lda #$60
sta $816
jsr $800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #<cheat
sta $2007
lda #>cheat
sta $2008
+
+DISABLE_ACCEL
jmp $2000
cheat
jsr $38cf
lda #$2c
sta $87e0
sta $97d2
rts
jsr $38cf
lda #$2c
sta $87e0
sta $97d2
rts

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
+ENABLE_ACCEL
lda #$60
sta $0837
jsr $0800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$00
sta $5791 ; patch - don't decrease lives
sta $5352 ; patch - don't increase lives
+
+DISABLE_ACCEL
jmp $4003

View File

@ -7,10 +7,16 @@
!source "src/prelaunch/common.a"
lda #$60
sta $84c8
jsr $3ffa
lda #$ad
sta $6ed8
sta $7f1c
jmp $9e00
+ENABLE_ACCEL
lda #$60
sta $84c8
jsr $3ffa ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
lda #$ad
sta $6ed8
sta $7f1c
+
+DISABLE_ACCEL
jmp $9e00

View File

@ -7,17 +7,25 @@
!source "src/prelaunch/common.a"
lda #$60
sta $851
jsr $800
lda #<cheat
sta $248
lda #>cheat
sta $249
jmp $200
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
sta cheat+1
+ENABLE_ACCEL
lda #$60
sta $851
jsr $800
+DISABLE_ACCEL
lda #<cheat
sta $248
lda #>cheat
sta $249
jmp $200
cheat
lda #$b5
sta $17f0
sta $1998
jmp $d00
lda #0 ; SMC
beq +
lda #$b5
sta $17f0
sta $1998
+
jmp $d00

View File

@ -7,6 +7,9 @@
!source "src/prelaunch/common.a"
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
sta patch+1
ldx #7 ; copy patch code to zero page (stack will be destroyed by the time we need to patch)
- lda patch,x
sta $F8,x
@ -18,6 +21,9 @@
sta $4062
jmp $2DC2
patch
lda #0 ; SMC
beq +
lda #$B5
sta $0912 ; patch - don't decrease lives
+
jmp $0200 ; continue with load

View File

@ -7,8 +7,14 @@
!source "src/prelaunch/common.a"
lda #$60
sta $505d
jsr $800
dec $1e65
jmp $800
+ENABLE_ACCEL
lda #$60
sta $505d
jsr $800 ; decompress
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
beq +
dec $1e65 ; patch - don't decrease lives
+
+DISABLE_ACCEL
jmp $800

View File

@ -7,14 +7,20 @@
!source "src/prelaunch/common.a"
lda #<cheat
sta $208c
lda #>cheat
sta $208d
jmp $2000
+GET_MACHINE_STATUS
and #CHEATS_ENABLED
sta cheat+1
lda #<cheat
sta $208c
lda #>cheat
sta $208d
jmp $2000
cheat
ldy #$bd
sty $1a40
sty $1a61
jmp $200
ldy #0 ; SMC
beq +
ldy #$bd
sty $1a40
sty $1a61
+
jmp $200

View File

@ -12,9 +12,10 @@ ToggleCheat
; out: X = 0, Z = 1 (guaranteed by pref_set)
; all other registers and flags clobbered
ldx #$B0
lda gCheatsEnabled
eor #$80
sta gCheatsEnabled
lda MachineStatus
eor #CHEATS_ENABLED
sta MachineStatus
and #CHEATS_ENABLED
beq +
inx
+ stx @val

View File

@ -12,12 +12,6 @@
; - WaitForKeyFor30Seconds
; - CoverFade
;
; Public variables:
; - MachineStatus
; bit 4 = 1 if IIgs
; bit 5 = 1 if VidHD
; bit 6 = 1 if 128K
; bit 7 = 1 if joystick
;------------------------------------------------------------------------------
; SoftBell
@ -60,8 +54,7 @@ SoftBell
; out: $0106..$011F clobbered
;------------------------------------------------------------------------------
Home
MachineStatus = *+1
lda #$D1 ; SMC
lda MachineStatus
and #SUPPORTS_SHR
beq @noSHR
lda NEWVIDEO

View File

@ -125,8 +125,9 @@ DrawUI
bpl -
@doneWithLine2
bit gCheatsEnabled
bpl @maybeDrawDots ; if cheat mode is disabled, we don't need
lda MachineStatus
and #CHEATS_ENABLED
beq @maybeDrawDots ; if cheat mode is disabled, we don't need
; any curves or spaces on UI line 1
ldx gGameToLaunch
ldy gCheatsAvailable,x
@ -196,8 +197,10 @@ DrawUI
+LDADDR UILine2
jsr Draw40Chars ; draw UI line 2 on offscreen page
bit gCheatsEnabled ; if cheats are disabled, then we're done drawing UI
bpl @uidone
lda MachineStatus
and #CHEATS_ENABLED
beq @uidone ; if cheats are disabled, then we're done drawing UI
; (SAVE) still points to length-prefixed cheat description
ldy #0
lda (SAVE),y ; A = length of cheat description