Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tst.b (Checksum_OK).w
- bne.w CS_Skip
- ; MJ's Modular Checksum
- CheckSumCheck:
- movea.w #ErrorTrap,a0 ; prepare start address
- move.l (ROMEndLoc).l,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
- ; loc_338: ChecksumLoop:
- CS_MainBlock:
- add.w (a0)+,d0 ; modular checksum (8 words)
- add.w (a0)+,d0 ; ''
- add.w (a0)+,d0 ; ''
- add.w (a0)+,d0 ; ''
- add.w (a0)+,d0 ; ''
- add.w (a0)+,d0 ; ''
- add.w (a0)+,d0 ; ''
- add.w (a0)+,d0 ; ''
- dbf d6,CS_MainBlock ; repeat until all main block sections are done
- dbf d7,CS_MainBlock ; ''
- subq.w #1,d5 ; decrease remaining nybble for dbf
- bpl.s CS_Finish ; if there is no remaining nybble, branch
- CS_Remains:
- add.w (a0)+,d0 ; add remaining words
- dbf d5,CS_Remains ; repeat until the remaining words are done
- CS_Finish:
- cmp.w (Checksum).l,d0 ; does the checksum match?
- bne.w ChecksumError ; if not, branch
- move.b #1,(Checksum_OK).w
- CS_Skip:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement