mirror of
https://github.com/a2-4am/4cade.git
synced 2025-01-02 06:30:47 +00:00
reduce stack pressure
This commit is contained in:
parent
d2e66645cf
commit
756599740d
@ -248,46 +248,55 @@ iicplus !pseudopc DisableAccelerator {
|
|||||||
; This code cannot run from LC, and *must* bank in ROM.
|
; This code cannot run from LC, and *must* bank in ROM.
|
||||||
; CGGA assumes that ROM is already banked in.
|
; CGGA assumes that ROM is already banked in.
|
||||||
|
|
||||||
lda #2 ; disable accelerator entry point
|
lda #$3A ; DEC, disable accelerator entry point
|
||||||
!byte $2C ; BIT <ABSOLUTE>, hide next lda #
|
!byte $2C ; BIT <ABSOLUTE>, hide next lda #
|
||||||
lda #1 ; enable accelerator entry point
|
lda #$4A ; LSR, enable accelerator entry point
|
||||||
sta @pokery+1 ; action after CGGA_UNLOCK
|
sta @pokery ; action after CGGA_UNLOCK
|
||||||
|
|
||||||
; cgga calls save X and Y regs but sets $0 to 0
|
; cgga calls save X and Y regs but sets $0 to 0
|
||||||
; (this will get a laugh from C programmers)
|
; (this will get a laugh from C programmers)
|
||||||
lda $0
|
lda $0
|
||||||
pha
|
pha
|
||||||
|
|
||||||
ldy #(@endpokery - @jiggery) - 1
|
|
||||||
@copyiicp
|
|
||||||
lda @jiggery,y
|
|
||||||
sta $106, y
|
|
||||||
dey
|
|
||||||
bpl @copyiicp
|
|
||||||
|
|
||||||
php
|
php
|
||||||
sei ; timing sensitive
|
sei ; timing sensitive
|
||||||
jsr $106
|
jsr @jiggerypokery
|
||||||
|
sta $C05B ; fix colouring
|
||||||
plp ; restore interrupt state
|
plp ; restore interrupt state
|
||||||
pla
|
pla
|
||||||
sta $0
|
sta $0
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@jiggerypokery
|
||||||
|
tsx
|
||||||
|
ldy #(@endpokery - @jiggery)
|
||||||
|
@copyiicp
|
||||||
|
lda @jiggery-1,y
|
||||||
|
pha
|
||||||
|
dey
|
||||||
|
bne @copyiicp
|
||||||
|
txa
|
||||||
|
tsx
|
||||||
|
iny
|
||||||
|
!cpu 65c02
|
||||||
|
phy
|
||||||
|
phx
|
||||||
|
!cpu 6502
|
||||||
|
tax
|
||||||
|
rts
|
||||||
|
|
||||||
@jiggery
|
@jiggery
|
||||||
+READ_ROM_NO_WRITE
|
+READ_ROM_NO_WRITE
|
||||||
lda #CGGA_UNLOCK ; unlock to change
|
|
||||||
pha
|
|
||||||
jsr cgga
|
|
||||||
|
|
||||||
@pokery
|
|
||||||
lda #$D1 ; SMC
|
|
||||||
pha
|
|
||||||
jsr cgga ; disable/enable
|
|
||||||
|
|
||||||
lda #CGGA_LOCK ; should lock after a change
|
lda #CGGA_LOCK ; should lock after a change
|
||||||
pha
|
pha
|
||||||
|
@pokery
|
||||||
|
nop ; SMC
|
||||||
|
pha
|
||||||
|
lda #CGGA_UNLOCK ; unlock to change
|
||||||
|
pha
|
||||||
|
jsr cgga ; disable/enable
|
||||||
|
jsr cgga
|
||||||
jsr cgga ; reads parm from stack, must JSR
|
jsr cgga ; reads parm from stack, must JSR
|
||||||
sta $C05B ; fix colouring
|
txs
|
||||||
+READ_RAM2_WRITE_RAM2
|
+READ_RAM2_WRITE_RAM2
|
||||||
rts
|
rts
|
||||||
@endpokery
|
@endpokery
|
||||||
|
@ -5,13 +5,12 @@
|
|||||||
!to "build/PRELAUNCH/STANDARD",plain
|
!to "build/PRELAUNCH/STANDARD",plain
|
||||||
*=$106
|
*=$106
|
||||||
|
|
||||||
lda $59 ; set up game entry point in stack page
|
ldy $5A ; set up game entry point in stack page
|
||||||
ldy $5A ; (last ProRWTS load address - 1)
|
ldx $59 ; (last ProRWTS load address - 1)
|
||||||
sec
|
bne +
|
||||||
sbc #$01
|
|
||||||
bcs +
|
|
||||||
dey
|
dey
|
||||||
+ sta $1FE
|
+ dex
|
||||||
|
stx $1FE
|
||||||
sty $1FF
|
sty $1FF
|
||||||
|
|
||||||
!source "src/prelaunch/common.a"
|
!source "src/prelaunch/common.a"
|
||||||
|
Loading…
Reference in New Issue
Block a user