News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Alter a memory character

Started by deeR44, September 03, 2022, 02:32:38 PM

Previous topic - Next topic

deeR44

Quotemov     esi, OFFSET input_buffer ; get address of line
  ;  and     [esi], 05fh        ; this instruction is invalid--doesn't work
  ;  jmp     next1
    mov     al, [esi]           ; get a char--these three get the job done
    and     al, 05fh            ; force to uppercase if it isn't
    mov     [esi], al           ; return adjusted character

next1:
I guess one can't homogenize a memory byte the first way above.

NoCforMe

Quote from: deeR44 on September 03, 2022, 02:32:38 PM
I guess one can't homogenize a memory byte the first way above.

This will definitely work:

    mov     esi, OFFSET input_buffer ; get address of line
    and     BYTE PTR [esi], 05fh        ; this instruction is valid--will work


assuming it's a byte you want to bite. You can also do a word or dword if you like.

Your statement was ambiguous, so the poor assembler couldn't figure out what you wanted to do.

You're uppercasing characters here, right?

BTW, before you indiscriminately AND everything with 5Fh, you might want to check to see if the character is in the range "a ... z".
Assembly language programming should be fun. That's why I do it.

deeR44

Thank you NoCforMe!

I don't think that this is the first assembler that I've come across that's smarter than I am.

NoCforMe

Ackshooly, the problem is that it's dumber than you are. Can't read our minds, yet.

(I'm still waiting for the mythical DWIM program: Do What I Mean.)
Assembly language programming should be fun. That's why I do it.

hutch--

David,

You would have to be a MAC user to wish for that.  :tongue:

NoCforMe

Heh; yeah, they're the ones who can't wait for the cerebral-cortex implant interface. Apple fanbois (and -gurls).
Assembly language programming should be fun. That's why I do it.