Advertisement
Dotsarecool

Mario & Wario

Feb 4th, 2018
732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;========================
  2. ; Mario & Wario
  3. ; Modification to allow mouse in 2nd port
  4. ; Modification to allow selecting worlds 9, 10, & 11
  5. ;========================
  6.  
  7. ORG $009960
  8.     NOP
  9.     NOP
  10.     JSL check_world
  11. ; remove special check for W9
  12. ORG $009976
  13.     db $80 ; BNE -> BRA
  14.    
  15. ORG $00DFB6
  16.     NOP
  17.     NOP
  18.     JSL swap_mouse
  19.     PLP
  20.     RTS
  21.  
  22. !controller_1 = $72
  23.    
  24. !mouse_con    = $00AF
  25. !mouse_x      = $00B7
  26. !mouse_y      = $00B5
  27. !mouse_sw     = $00B9
  28. !mouse_swt    = $00BB
  29. !mouse_sb     = $00BD
  30.    
  31. ORG $18FF00
  32.  
  33. swap_mouse:
  34.  
  35.     PHP
  36.  
  37.     REP #$20
  38.  
  39.     LDA !mouse_con
  40.     XBA
  41.     STA !mouse_con
  42.  
  43.     LDA !mouse_x
  44.     XBA
  45.     STA !mouse_x
  46.  
  47.     LDA !mouse_y
  48.     XBA
  49.     STA !mouse_y
  50.  
  51.     LDA !mouse_sw
  52.     XBA
  53.     STA !mouse_sw
  54.  
  55.     LDA !mouse_swt
  56.     XBA
  57.     STA !mouse_swt
  58.  
  59.     LDA !mouse_sb
  60.     XBA
  61.     STA !mouse_sb
  62.  
  63.     PLP
  64.     RTL
  65.  
  66. check_world:
  67.     PHP
  68.  
  69.     REP #$30
  70.     LDA !controller_1
  71.     AND #$00FF
  72.     CMP #$0010 ; start for W9
  73.     BNE .not_w9
  74.     LDA #$0009
  75.     BRA .return
  76. .not_w9:
  77.     CMP #$0020 ; select for W10
  78.     BNE .not_w10
  79.     LDA #$000A
  80.     BRA .return
  81. .not_w10:
  82.     CMP #$0030 ; start + select for W11
  83.     BNE .not_w11
  84.     LDA #$000B
  85.     BRA .return
  86. .not_w11:
  87.     LDA $39
  88.  
  89. .return:
  90.    
  91.     PLP
  92.     STA $1C1B
  93.     LDA $037F
  94.     RTL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement