Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write subroutine named CHKSUM in 328PB assembly language to find the 12. a checksum of a block of memory, and return that checksum in RO.
Write subroutine named CHKSUM in 328PB assembly language to find the 12. a checksum of a block of memory, and return that checksum in RO. The starting address of the block is contained in R17:R16 (R17 contains the upper 8 bits, and R16 contans the lower 8 bits of the address). The length of the block is contained in R19:R18 (similarly, R19 contains the upper 8 bits of the length and R18 contains the lower 8 bits). The checksum is found by adding each of the bytes in the block and ignoring any carry. For example, if memory locations 0x200 through 0x205 contained 0x50, Ox51, 0x80, 0x81, 0x00, 0x03, then the following code should result in OxA5 in RO (because 0x50+0x51+0x80+0x81+0x00+0x03 0x1A5). LDI R17,HIGH(0x200) LDI R16,LO(0x200) LDI R19,HIGH(6) LDI R18,LOW (6) CALL CHKSUM ; RO should contain A5 ; ONLY WRITE THE CHKSUM ROUTINE THIS IS ONLY AN EXAMPLE YOUR CODE SHOULD HANDLE ANY ; SIZED BLOCK (
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started