flat assembler
Message board for the users of flat assembler.

Index > Main > loading unprintable character into a register

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 05 Feb 2004, 20:15
How would you load unprintable characters into a register.
I want to do this:

Code:
mov word [esi],'d\0'    

Instead of:
Code:
mov byte [esi],'d':mov byte [esi+1],0    
Post 05 Feb 2004, 20:15
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 05 Feb 2004, 20:18
In this case just:
Code:
mov word [esi],'d'    

will do what you want.
More universal solution:
Code:
mov word [esi],'d' + 0 shl 8    

But how is this related to the title of your post?
Post 05 Feb 2004, 20:18
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 05 Feb 2004, 20:35
ok, thanks. Hmm, didn't know it would add the zero byte if you did: mov word [esi],'d' . I couldn't find any information on this in the fasm docs. I'm writing some number conversion routines for a 32bit asm/dos library that I am writing and wanted to save some typing.
Post 05 Feb 2004, 20:35
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.