Advertisement
Guest User

Untitled

a guest
Nov 12th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cheat   macro lable, addr, code
  2.     if strlen(\code)&1
  3.         dc.b 0
  4.     endif
  5.  
  6. \lable:
  7. .lc = 0
  8.     rept strlen(\code)
  9. .cc     substr .lc+1,.lc+1,\code
  10.  
  11.     if ('\.cc'='u')|('\.cc'='U')
  12.         dc.b ~$01+1
  13.  
  14.     elseif ('\.cc'='d')|('\.cc'='D')
  15.         dc.b ~$02+1
  16.  
  17.     elseif ('\.cc'='l')|('\.cc'='L')
  18.         dc.b ~$04+1
  19.  
  20.     elseif ('\.cc'='r')|('\.cc'='R')
  21.         dc.b ~$08+1
  22.  
  23.     elseif ('\.cc'='a')|('\.cc'='A')
  24.         dc.b ~$40+1
  25.  
  26.     elseif ('\.cc'='b')|('\.cc'='B')
  27.         dc.b ~$10+1
  28.  
  29.     elseif ('\.cc'='c')|('\.cc'='C')
  30.         dc.b ~$20+1
  31.  
  32.     else
  33.         inform 3,"Illegal character '\.cc'"
  34.     endif
  35.  
  36. .lc =       .lc+1
  37.     endr
  38.  
  39.     dc.l    \addr&$FFFFFF
  40.     endm
  41.  
  42.  
  43.  
  44. CheckButtonPresses:
  45.         move.b  $FFFFF605.w,d2      ; get pressed buttons
  46.         beq.s   .rts            ; if none were pressed, branch
  47.  
  48.         lea CheatsOffset.w,a1   ; get cheats offset
  49.         tst.l   (a1)            ; check if no cheats are active
  50.         beq.s   .chkallcheats       ; if no cheat active, branch
  51.         bsr.s   .chk            ; check cheats here
  52.         addq.w  #2,a1           ; next cheats
  53.         move.b  $FFFFF605.w,d2      ; get pressed buttons
  54.  
  55. .chk        move.w  (a1),d0         ; get the offset to read from
  56.         add.b   .chtarr(pc,d0.w),d2 ; get next cheat entry
  57.         bne.s   .resetcheat     ; if not 0, reset cheat
  58.  
  59.     ; cheat ok
  60.         addq.w  #1,(a1)         ; next cheat offset
  61.         move.b  .chtarr+1(pc,d0.w),d2   ; check if this is the end of the cheat
  62.         bne.s   .rts            ; if not 0, branch
  63.         clr.w   (a1)
  64.         move.l  .chtarr+1(pc,d0.w),a0   ; get the address to run
  65.         jmp (a0)            ; and run it
  66.  
  67. .chtarr     dc.w dncht1+1-.chtarr
  68.         dc.w dncht2+1-.chtarr
  69.         dc.w dncht3+1-.chtarr
  70.         dc.w foxcht+1-.chtarr
  71.         dc.w gencht+1-.chtarr
  72.         dc.w 0
  73.  
  74. .chkallcheats   lea .chtarr(pc),a0      ; get cheats array1
  75. .chknextcht move.w  (a0)+,d0        ; get cheat offset
  76.         beq.s   .rts            ; if null, end
  77.  
  78.         move.b  .chtarr-1(pc,d0.w),d1   ; get next cheat entry
  79.         add.b   d2,d1           ; eor together
  80.         bne.s   .chknextcht     ; if not 0, rcheck another cheat
  81.  
  82.         move.w  d0,(a1)+        ; save cheats offset
  83.         bra.s   .chknextcht     ; check next cheat
  84.  
  85. .resetcheat clr.w   (a1)            ; reset cheat
  86. .rts        rts
  87.  
  88. ; cheat codes
  89.     cheat dncht1, WriteFanficOnScreen, "BABABCB"
  90.     cheat dncht2, WriteFanficOnScreen, "ABCBCAB"
  91.     cheat dncht3, WriteFanficOnScreen, "ACCABAB"
  92.     cheat foxcht, NatsumiAnim, "BACLUA"
  93.     cheat gencht, GenesisDoes, "UUDDLRLRBA"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement