Advertisement
Guest User

Untitled

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