From: "Steve Hobson" <[email protected]>
Sent: Tuesday, June 03, 2014 10:57 PM
From: "Rob van der Heij" <[email protected]>
Sent: Tuesday, June 03, 2014 1:00 AM
Must have muissed something here.
A 3-instruction loop to sum bytes.
LA 6,X+offset (last byte of area to be summed)
SR 2,2
SR 4,4
Loop IC 4,0(0,6)
AR 2,4
BCT 6,Loop
And you can use BCTR to save a few µS.
Sorry to be picky but unless the string starts at location zero I think
you need:
LA 6,X (address of area to be summed)
LA 7,offset (offset to last byte of area to be summed)
SR 2,2
SR 4,4
Loop IC 4,0(7,6)
AR 2,4
BCT 7,Loop
No need to be sorry. I did a mistake.
However, your proposal also is incorrect (off by 1).
I think that the following will do the trick:-
LA 6,X-1
LA 7,Y (address of last byte of area to be summed).
SR 7,6 (giving number of bytes to be summed)
SR 2,2
SR 4,4
LOOP IC 4,0(7,6)
etc
---
This email is free from viruses and malware because avast! Antivirus protection
is active.
http://www.avast.com