I'm using easy68k, and I have a string, and I want to add a number to every digit so it ends up being a different string. Is there a command that lets me target the specific bytes in a string?
for example:
ORG $1000
START:
MOVE.B str,D0
ADD.B #$20,D0
MOVE.B D0,str
str DC.B 'ASDF'
END START
I'm trying to make "ASDF" into "asdf", but my current code only allows me to target the first byte of "ASDF" which is "A", so my resulting string is now "aDSF", how do I make it so the byte thing move onto D,S, and F? is there a specific command to do this?
Thanks in advance
A bit can only be 0
or 1
. 0 and 1 are the only digits in base2 numbers.
xor is an add without the carry from low bits to high bits. Does that help? The question body doesn't seem to match the title, though.
Your terminology is very mixed up, unfortunately. Probably a lot of technical meaning was lost in translation from your native language.
A "digit" usually means a decimal or hex digit: 0-9 or 0x0-0xF
A "bit" always means a single 0 or 1 value. The title of this question doesn't match what you seem to be asking in the body.
A "string" usually means a sequence of ASCII (or UTF8, or UTF16) bytes that encodes a printable string. e.g. char *str="Hello World!";
(i.e. not arbitrary binary.) You can say "a string of bytes", which seems to be what you're talking about.
An "array" is a sequence of elements, like uint8_t arr={0xA2, 0x02, 0x15, 0xFF};
This seems to be what you're talking about: an array of bytes.
Please edit your question to retitle it if you didn't intend to ask about individual bits.
It sounds more like you have a sequence of bytes, and you want to add the same value to each byte. You'll need a loop to do that, since there is no SIMD instruction set for m68k, accoding to google. A SIMD instruction could do multiple single-byte adds in parallel, on each byte of a vector register. (like x86's PADDB
vector instruction, which you could use after broadcasting 0x20 to all 16 elements of a vector register.)
A SIMD add is an add with breaks in the carry from low bits to high bits, at the element boundaries.