Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ---------------------------------------------------------------------------
- ; CheckSum Check by Markey Jester (Fast)
- ; ---------------------------------------------------------------------------
- ; =============== S U B R O U T I N E =======================================
- CheckSumCheck:
- movea.w #$200,a0 ; prepare start address
- move.l ($1A4).w,d7 ; load size
- sub.l a0,d7 ; minus start address
- move.b d7,d5 ; copy end nybble
- andi.w #$F,d5 ; get only the remaining nybble
- lsr.l #4,d7 ; divide the size by 20
- move.w d7,d6 ; load lower word size
- swap d7 ; get upper word size
- moveq #0,d0 ; clear d0
- - rept 8
- add.w (a0)+,d0 ; modular checksum (8 words)
- endm
- dbf d6,- ; repeat until all main block sections are done
- dbf d7,-
- subq.w #1,d5 ; decrease remaining nybble for dbf
- bpl.s + ; if there is no remaining nybble, branch
- - add.w (a0)+,d0 ; add remaining words
- dbf d5,- ; repeat until the remaining words are done
- + cmp.w ($18E).w,d0 ; does the checksum match?
- bne.s CheckSumError
- ; ---------------------------------------------------------------------------
- ; CheckSum Check from Side Pocket (Fast)
- ; ---------------------------------------------------------------------------
- ; =============== S U B R O U T I N E =======================================
- CheckSumCheck:
- movea.w #$200,a0
- move.l ($1A4).w,d7
- sub.l a0,d7
- lsr.l #6,d7
- moveq #0,d0
- - rept 32
- add.w (a0)+,d0
- endm
- dbf d7,-
- cmp.w ($18E).w,d0
- bne.s CheckSumError
- ; ---------------------------------------------------------------------------
- ; CheckSum Check from Sonic 2 (Slow)
- ; ---------------------------------------------------------------------------
- ; =============== S U B R O U T I N E =======================================
- CheckSumCheck:
- movea.l #$200,a6
- move.l ($1A4).w,d6
- moveq #0,d7
- - add.w (a6)+,d7
- cmp.l a6,d6
- bhs.s -
- cmp.w ($18E).w,d7
- bne.s CheckSumError
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement