News:

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

struct assume problem

Started by korte, March 18, 2007, 04:05:56 PM

Previous topic - Next topic

korte

My code:


WINDOW   STRUCT
_WINDOW_Flag      DD   ?
_WINDOW_CLASS     DD   ?
_WINDOW_X      DD   ?
_WINDOW_Y      DD   ?
_WINDOW_WIDTH      DD   ?
_WINDOW_HEIGHT      DD   ?
_WINDOW_PROC             DD      ?
_WINDOW_VALUE      DD   ?
_WINDOW_PARRENT   DD   ?
WINDOW ENDS


.
.
.

error this line:
    assume esi: PTR WINDOW

error code: type is wrong size for register

writing this "assume si: PTR WINDOW" no error







Vortex

I don't see any problem with the ASSUME statement :

.386
.model flat,stdcall
option casemap:none

WINDOW  STRUCT

    _WINDOW_Flag    DD  ?
    _WINDOW_CLASS   DD  ?
    _WINDOW_X       DD  ?
    _WINDOW_Y       DD  ?
    _WINDOW_WIDTH   DD  ?
    _WINDOW_HEIGHT  DD  ?
    _WINDOW_PROC    DD  ?
    _WINDOW_VALUE   DD  ?
    _WINDOW_PARRENT DD  ?

WINDOW  ENDS

.data?

buffer  db 100 dup(?)

.code

start:

    mov     esi,OFFSET buffer
    ASSUME  esi:PTR WINDOW
    mov     [esi]._WINDOW_X,100
    ASSUME  esi:NOTHING
    ret

END start

u

it's probably because his
".model flat,stdcall" isn't present or intact.
(note that the assembler assumes a pointer to be 16-bit, not 32-bit)
Please use a smaller graphic in your signature.

korte



thanx.

Problem 16 bit segment.


xcode segment para public 'CODE' use16





MichaelW

In a 16-bit segment you need to use a 16-bit register for the pointer, and it must be a base or index register. If you combine two registers in one instruction, one must be a base register and the other an index register. For example:

mov ax,[bx+si]

is OK, but these are not:

mov ax,[bp+bx]
mov ax,[si+di]
eschew obfuscation