;Test for the correct checksum and boot program.
movea.l ProgramStart,A0 ; Copy Start Address into A0
move.l ProgramSize,D1 ; Store Program Size into D1
clr.l D2 ; Clear our operational register 1
clr.l D3 ; Clear our operational register 2
Checksumloop:
move.b RTC,D0 ; Reset Watchdog
move.b (A0)+,D2 ; Copy byte from Memory into D2
add.l D2,D3 ; Add contents from memory against register D3
dbf D1,Checksumloop ; If we havent finished, branch until we do
;D3 now contains our calculated checksum. Memory address at "Checksum" is the desired result.
move.l Checksum,D2 ; Copy desired checksum into D2 so we can run a comparison.
cmp.l D3,D2 ; Do the checksums match?
bne.s EndHandleExecute ; If not, the checksum has failed.