News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Space...

Started by kromag, February 01, 2009, 04:42:57 PM

Previous topic - Next topic

kromag

Does anyone know where I can read exactly what all the definitions are for things like 20h 20d etc...?

As far as I know it's an allocation of space in hex but I'm trying to understand how big it is or if I'm wrong what exactly it means!

Thanks in advance.
----
William

RuiLoureiro

Quote from: kromag on February 01, 2009, 04:42:57 PM
Does anyone know where I can read exactly what all the definitions are for things like 20h 20d etc...?

As far as I know it's an allocation of space in hex but I'm trying to understand how big it is or if I'm wrong what exactly it means!
William,
           20h is a number not an allocation space. h means hexadecimal and it means also 32 in decimal.
            If we are talking about ascii codes, 20h means space like 30h is the ascci code for 0 (zero)
Rui

kromag

So what exactly is this telling me here:

.data
ClassName db "SimpleWinClass",0
AppName  db "Our First Window",0
;::::::::::::::::::::::::::::::::::::::::::::::::
; here
;::::::::::::::::::::::::::::::::::::::::::::::::
char WPARAM 20h                         ; the character the program receives from keyboard


Iczelion's tut says: The initial value is 20h or the space since when our window refreshes its client area the first time, there is no character input. So we want to display space instead.

So how do I find out how much space that is and why I need said amount?

kromag

Ok I think I figured out the above...

It just sets 32 bits of space does it not?

But I don't understand why I need 32 bits of space there and why it was done that way "char WPARAM 20h"
---
William

farklesnots

Quote from: kromag on February 01, 2009, 07:11:10 PM
Ok I think I figured out the above...

It just sets 32 bits of space does it not?

But I don't understand why I need 32 bits of space there and why it was done that way "char WPARAM 20h"
---
William

No, no. It means the space ASCII text character, the same one you get when you press the space bar while entering text. It's just a single byte value.


kromag

oh man thanks!

I totally misinterpreted that one; my condolences!
---
William

GregL

Actually kromag, you are right, char WPARAM 20h creates a 32-bit variable set to 20 hex or 32 decimal or space ASCII. Since WPARAM is defined as WPARAM typedef DWORD in windows.inc.  I'm not sure why he did it that way without looking at the code.


kromag

Greg,
    Thanks for the input  :bg!

Here is the link to the full Tutorial along with the code.
http://win32assembly.online.fr/tut6.html

----
William

farklesnots

Yeah, I saw the 20h value and recognized the  8-bit ASCII code and totally missed that since it's a DWORD value it's 32 bits here.  :red

NightWare

he want a space string, so he generates (in a different way) :
char byte " ",0,0,0
the needed string...
because of stack usage...

kromag

I'm not sure I really understand what you mean by: "because of stack usage".
Thanks for the info tho.
---
William

dedndave

I think you are refering to this quote from Iczelion, "The initial value is 20h or the space since when our window refreshes its client area the first time, there is no character input. So we want to display space instead." In this case, the word "space" is used to refer to the ASCII space character. It is a single byte. It has a value or 20h (=32d), and in ASCII, it translates to the "space" character.

somedata  db 'Hi William'

is the same as

somedata db  'Hi',20h,'William'

I hope that helps you make sense of it
- Dave

kromag

It makes sense now and thank you all for the help!
---
William

psault

If WPARAM is 32-bit storage, and you are storing a byte in the form of a space char, then the null terminating 0, that's only accounting for 16 bits.  I interpret what NightWare said about "stack usage" as having 16 more bits in the form of 0, 0 included in that storage for this "space string".

Am I close?

~psault

kromag

Ah that makes sense as well;
So the contents are padded!
Thank you again folks!
---
William