Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;----------------------------------------------------------
- ; SNES LoRom -> PcAddress conversion
- ;
- ; You must set 2 labels:
- ; - BEGIN ROM (LABEL 1021)
- ; - END ROM (LABEL 1022)
- ;
- ; [Usage]
- ; - SNES Addr -> PC Addr -
- ; m #addr w0
- ; bra 820
- ; ; you can get pc addr from w0
- ;
- ; - PC Addr -> SNES Addr -
- ; m #addr w0
- ; bra 830
- ; ; you can get snes addr from w0
- ;
- ;----------------------------------------------------------
- ;---------------------------------------
- ; SNES Addr -> PC Addr
- ;---------------------------------------
- :820
- bra 822 ; header check
- r0
- m w0 w1
- n #0x7fff & w1
- n #0x7f0000 & w0
- n #1 > w0
- n w1 | w0
- c #0 w4
- beq 821
- a #0x200 w0
- :821
- r
- ;--- header include check sub routine
- :822
- ; header include check
- m l1022 w4
- s l1021 w4
- n #0x8000 $ w4
- r
- ;---------------------------------------
- ; PC Addr -> SNES Addr
- ;---------------------------------------
- :830
- bra 822 ; header check
- r0
- c #0 w4
- beq 831
- s #0x200 w0
- :831
- m w0 w1
- n #0x7fff & w1
- n #0x8000 | w1
- n #1 < w0
- n #0x7f0000 & w0
- n w1 | w0
- r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement