assembly68000easy68k

68k how to add/subtract individual bytes?


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


Solution

  • 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.

    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.