View previous topic :: View next topic
|
Author |
Message |
Pankaj Shrivastava Currently Banned New User
Joined: 24 Jul 2009 Posts: 51 Location: Pune
|
|
|
|
I have a one byte field in the input file . The value could be a hexadecimal from 00 to 99 .
I have to decrement the value by 1 and update the 1 byte field with new value.
What is the most efficient and shortest way of doing it in assembler .Please help with the code. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
post what You have devised, and we' ll comment on it
this is a help forum, not a do it for me one |
|
Back to top |
|
|
Pankaj Shrivastava Currently Banned New User
Joined: 24 Jul 2009 Posts: 51 Location: Pune
|
|
|
|
Ok Enric
This is what i have designed :
SR R5,R5
IC R5,VAR1BYTE
SH R5,=H'1'
STC R5,VAR1BYTE
Your comment please. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Looks OK. You can eliminate the 2-Byte H'1' Literal by using -
Code: |
AHI R5,-1 SUBTRACT 1 FROM R5 (CC SET)
|
or you can use -
Code: |
BCTR R5,0 SUBTRACT 1 FROM R5 (CC NOT SET)
|
There isn't any SHI, so using the AHI adding a negative 1 will work.
FWIW, BCTR R0,0 will not work....
Bill |
|
Back to top |
|
|
Pankaj Shrivastava Currently Banned New User
Joined: 24 Jul 2009 Posts: 51 Location: Pune
|
|
|
|
Thx Bill |
|
Back to top |
|
|
|