View previous topic :: View next topic |
Author |
Message |
kris_madras Beginner
Joined: 07 Apr 2004 Posts: 41 Topics: 30
|
Posted: Mon Jun 06, 2005 9:18 am Post subject: Right Justification in Assember |
|
|
Hi,
Kindly post the solution to right justify the input data and zero fill the padding characters in Assembler instruction
Example:
Input : 112345 15 bytes
Output : 000000000112345
Thx
Kris |
|
Back to top |
|
 |
dtf Beginner
Joined: 10 Dec 2004 Posts: 110 Topics: 8 Location: Colorado USA
|
Posted: Mon Jun 06, 2005 11:32 am Post subject: |
|
|
Many possible solutions. I think this one will work for any input that you might choose to put in the 15 byte input field. If you study this code, I think there is much here to be learned.
Code: | TRT INPUT,TESTTABL FIND END OF INPUT
S R1,=A(INPUT) CALC LENGTH
BCTR R1,0 DECREMENT FOR PACK
EX R1,PACK EXECUTE PACK
UNPK OUTPUT,PACKED UNPACK TO OUTPUT
o
o
o
PACK PACK PACKED,INPUT(0) EXECUTED INSTRUCTION
PACKED DS CL8 PACK WORKAREA
OUTPUT DC CL15'000000000000000' OUTPUT AREA(INITILIZED TO ZEROS)
INPUT DC CL15'112345 ' INPUT AREA
TESTTABL DC 256X'FF' TRANSLATE
ORG TESTTABL+X'F0' TABLE
DC X'00000000000000000000' AREA (OFF FOR NUMBERS)
ORG RESET LOCATION COUNTER
|
________
Ford Falcon XR6 Turbo specifications
Last edited by dtf on Tue Feb 01, 2011 1:56 pm; edited 1 time in total |
|
Back to top |
|
 |
dtf Beginner
Joined: 10 Dec 2004 Posts: 110 Topics: 8 Location: Colorado USA
|
Posted: Mon Jun 06, 2005 12:09 pm Post subject: |
|
|
Sorry, I added the comments after I assembled the program. You cannot have any comments on the last statement. The ORG must be by itself.
________
Honda SH150i history |
|
Back to top |
|
 |
|
|