Advertisement
Leo40Bin

Untitled

Jun 24th, 2019
2,547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; loc_328:
  2. ChecksumTest:
  3.     ; optimized checksum routine by MarkeyJester
  4.     if skipChecksumCheck=0  ; checksum code
  5.     movea.l #EndOfHeader,a0 ; prepare start address
  6.     move.l  (ROMEndLoc).w,d7    ; load size
  7.     sub.l   a0,d7       ; minus start address
  8.     move.b  d7,d5       ; copy end nybble
  9.     andi.w  #$F,d5      ; get only the remaining nybble
  10.     lsr.l   #4,d7       ; divide the size by 20
  11.     move.w  d7,d6       ; load lower word size
  12.     swap    d7      ; get upper word size
  13.     moveq   #0,d0       ; clear d0
  14. ; loc_338:
  15. .loop_main:
  16.     add.w   (a0)+,d0    ; modular checksum (8 words)
  17.     add.w   (a0)+,d0    ; ''
  18.     add.w   (a0)+,d0    ; ''
  19.     add.w   (a0)+,d0    ; ''
  20.     add.w   (a0)+,d0    ; ''
  21.     add.w   (a0)+,d0    ; ''
  22.     add.w   (a0)+,d0    ; ''
  23.     add.w   (a0)+,d0    ; ''
  24.     dbf d6,.loop_main   ; repeat until all main block sections are done
  25.     dbf d7,.loop_main   ; ''
  26.     subq.w  #1,d5       ; decrease remaining nybble for dbf
  27.     bpl.s   .done       ; if there is no remaining nybble, branch
  28. .loop_extra:
  29.     add.w   (a0)+,d0    ; add remaining words
  30.     dbf d5,.loop_extra  ; repeat until the remaining words are done
  31. .done:
  32.     cmp.w   (Checksum).w,d0 ; compare correct checksum to the one in ROM
  33.     bne.w   ChecksumError   ; if they don't match, branch
  34.     endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement