Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ALTTP One-Mind hack: causes the current player in control of Link to switch every so often.
- ; In places where this does not occur (e.g. title screen), both controllers are registered.
- ; Save this text file as an ASM file and patch it to your rom with Asar.
- ; A few extra options for adjusting timing are below.
- ;;;; Timing
- !count_silent = $08 ; Number of silent ticks before audible ones
- !count_audible = $04 ; Number of audible ticks before the controller switches
- !tickTiming = $1F ; Number of frames between ticks (valid: 01, 03, 07, 0F, 1F, 3F, 7F, FF)
- ; Hard mode: set silent to 1, audible to 1.
- ;;;; SFX
- !SFX_Tick = $06 ; SFX values for the tick noise.
- !SFXIO_Tick = $012E
- !SFX_Switch = $25 ; SFX values for when the players switch.
- !SFXIO_Switch = $012F
- ;;;; Technical
- !freeram = $7F9000 ; 2 bytes of free ram to use.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Code begins; don't touch it unless you know what you're doing.
- !active = !freeram ; 1 byte - currently active player
- !ticks = !freeram+1 ; 1 byte - counter for the number of ticks so far
- org $0083D1
- autoclean JSL OneMind
- BRA $05
- freecode
- OneMind:
- PHB : PHK : PLB
- JSR Main
- PLB
- RTL
- Main:
- ; Check whether in a mode we allow switching in.
- ; If not, register both controllers.
- LDA $10
- CMP #$07 ; normal play - interior
- BEQ .acceptable
- CMP #$09 ; normal play - exterior
- BEQ .acceptable
- CMP #$0E ; normal play - text box, pause screen, map screen
- BEQ .acceptable
- BRA SetBothControllers
- .acceptable
- ; Good to go.
- LDA $1A
- AND #!tickTiming
- BNE SetControllers
- LDA !ticks
- INC
- CMP #!count_silent
- BCC .silentTick
- CMP #!count_silent+!count_audible
- BCC .tick
- JSR SwitchPlayers
- BRA SetControllers
- .tick
- LDY #!SFX_Tick
- STY !SFXIO_Tick
- .silentTick
- STA !ticks
- SetControllers:
- LDA !active
- AND #$01
- BNE .c2
- .c1
- LDA $4218
- STA $00
- LDA $4219
- RTS
- .c2
- LDA $421A
- STA $00
- LDA $421B
- RTS
- SetBothControllers:
- LDA $4218
- ORA $421A
- STA $00
- LDA $4219
- ORA $421B
- RTS
- SwitchPlayers:
- LDA #$00
- STA !ticks
- LDA !active
- INC
- STA !active
- LDA #!SFX_Switch
- STA !SFXIO_Switch
- REP #$30
- LDA $7EF35B
- AND #$00FF
- TAX
- LDA !active
- AND #$0001
- BNE .p2pal
- LDA $1BEC06,x
- AND #$00FF
- ASL
- ADC #$D308
- STA $00
- LDA #$001B
- STA $02
- BRA .paletteUpload
- .p2pal
- TXA
- ASL
- TAX
- LDA P2Palettes,x
- STA $00
- LDA.w #P2PalA>>16
- STA $02
- .paletteUpload
- LDY #$000E
- LDX #$01E2
- - LDA [$00]
- STA $7EC300,X
- STA $7EC500,X
- INC $00
- INC $00
- INX
- INX
- DEY
- BPL -
- SEP #$30
- INC $15
- RTS
- P2Palettes:
- dw P2PalA,P2PalB,P2PalC
- ; Player 2 palette data. Feel free to mess with it if you know how.
- P2PalA: ; green mail
- dw $7FFF,$237E,$11B7,$369E,$14A5
- dw $01FF,$1078,$599D,$1CF3,$2CFC
- dw $0415,$101C,$2A5C,$1571,$7A18
- P2PalB: ; blue mail
- dw $7FFF,$237E,$11B7,$369E,$14A5
- dw $01FF,$1078,$599D,$0A1D,$2B3D
- dw $6132,$7E17,$2A5C,$1199,$7A18
- P2PalC: ; red mail
- dw $7FFF,$237E,$11B7,$369E,$14A5
- dw $01FF,$1078,$599D,$62C2,$73EB
- dw $2B28,$3FCB,$2A5C,$2227,$7A18
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement