|
-
April 28th, 2009, 04:45 PM
#1
Pep/8: trouble working with and outputting hex
Hello,
I've had trouble with an assignment. The purpose of the program is to take two hardcoded hex values, output them as a string, and perform an exor operation and output the result in hex also.
Example run of program
Given:
MLB: .equate 8 ; multi-length bytes
A: .word 0x0123
.word 0xABCD
.word 0x5678
.word 0xCDEF
B: .word 0x0010
.word 0xaaaa
.word 0x8765
.word 0x2323
Program output is
0123abcd5678cdef
exor 0010aaaa87652323
= 01330167d11deecc
The code I have written to output the hex is:
hex: ldx 0,i
ldbytea A,d
top: cpx MLB,i
brge endit
asla
asla
asla
asla
stbytea -2,s
anda 0xF,i
charo A,x
ldbytea -2,s
addx 1,i
br top
endit: stop
It works fine when outputting a basic string, such as ascii: "0123456789abcdef", but only outputs garbage when applied to a hex number. I am severely stumped as to how to proceed, as I can only assume it's outputting ascii codes as opposed to the actual hex value and I don't know how to get it to output correctly. Any help would be much appreciated!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|