Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lorom
- ;Map16 Copy
- ORG $0FF9D0 ;14336 bytes = $3800 bytes
- ;Map16 Low Byte Table = $7E:C800
- ;Map16 High Byte Table = $7F:C800
- !RAMHigh = $7FC00B ;$7F9C7B
- !RAMLow = $7FC00C ;$7F9C7C
- LoadMap16LowTable:
- PHP
- PHA
- PHX
- PHY
- REP #$10 ; 16 bit X Y
- SEP #$20 ; 8 bit A
- STZ $2000 ;Set S-MSU1 Address for Data Port
- STZ $2001
- STZ $2002
- STZ $2003
- - LDA $2000 ;Don't start the port to RAM until it's ready
- AND #$80
- CMP #$80
- BNE -
- STZ !RAMLow ;RAM : Low Byte, Bytes Recieved.
- STZ !RAMHigh ;RAM : High Byte, Bytes Recieved.
- LDX #$00
- TXS
- LoadLowLoop:
- - LDA $2001 ;Byte Port from S-MSU1
- STA [$7EC800],X ;To Map16 Low Byte Table
- LDA !RAMLow ;Check if $FF bytes has been received.
- CMP #$FF
- BEQ HighByteUp ;If yes, go to "HighByteUp"
- INC !RAMLow ;If no, add 1 to received bytes (low)
- INX ;Add 1 to X
- BRA - ;Loop
- HighByteUp:
- INC !RAMLow
- INC !RAMHigh
- INX
- LDA !RAMHigh
- CPX #$3800
- BEQ LoadMap16HighTable
- JMP LoadLowLoop
- LoadMap16HighTable:
- STZ $2000
- LDA #$38
- STA $2001
- STZ $2002
- STZ $2003
- - LDA $2000
- AND #$80
- CMP #$80
- BNE -
- STZ !RAMLow ;RAM : Low Byte, Bytes Recieved.
- STZ !RAMHigh ;RAM : High Byte, Bytes Recieved.
- LDX #$00
- LoadHighLoop:
- - LDA $2001
- STA [$7FC800],X
- LDA !RAMLow
- CMP #$FF
- BEQ HighByteUpHigh
- INC !RAMLow
- INX
- BRA -
- HighByteUpHigh:
- INC !RAMLow
- INC !RAMHigh
- INX
- LDA !RAMHigh
- CMP #$38
- BEQ Stop
- JMP LoadHighLoop
- Stop:
- PLP ;Gets everything back to normal
- PLA
- PLX
- PLY
- Stop2:
- LDA.b #$10 ;Insert replaced opcodes here
- STA.w $1DF5
- RTL
- ORG $009AC0 ;Insert JSL somewhere after the Level Loading Routine.
- JSL $0FF9D0
- NOP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement