Code written in assembly, no C.
LSR is a 8 bit function, is there any code available that shows how to use the LSR function to shift an entire 16 bit word to the right by two?
Code written in assembly, no C.
LSR is a 8 bit function, is there any code available that shows how to use the LSR function to shift an entire 16 bit word to the right by two?
Use the carry bit. Clear carry first. Do the shift on the high byte and the carry has the bit that dropped out then shift the low byte. Job done.
No need to clear the carry bit first:
lsr r17 ; Shift MSB, MSB.7 resets, MSB.0 goes to CY ror r16 ; Rotate LSB, CY goes to LSB.7
Job done :)
Thanks, then I just repeat that twice to divide a 16 bit number by two.
No you don't. The code above does this alone.
is there any code available that shows how to use
no C.