News:

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

assume esi:struct

Started by korte, June 26, 2008, 12:26:40 PM

Previous topic - Next topic

korte


MSDOS using 16 bit segment

x_code segment para public 'CODE' use16


HANDLE struct

HANDLE ends

 assume esi: HANDLE  ERROR: A2158 type is wrong size for register


if using 32 bit register (use32 in segment definiation)

assume OK, but program halt.

how to use Assume struct 32 bit register 16 bit segment?




jj2007

Quote from: korte on June 26, 2008, 12:26:40 PM

MSDOS using 16 bit segment

x_code segment para public 'CODE' use16


HANDLE struct

HANDLE ends

 assume esi: HANDLE  ERROR: A2158 type is wrong size for register


if using 32 bit register (use32 in segment definiation)

assume OK, but program halt.

how to use Assume struct 32 bit register 16 bit segment?


Try another syntax:
      mov eax, [esi.HANDLE.whateveritem]

sinsi

Try using ASSUME ESI:PTR HANDLE
Light travels faster than sound, that's why some people seem bright until you hear them.

korte

 assume esi: ptr HANDLE

work, but only 32 bit segment (use32 in segment def)

my problem, if deining segment 32 bit (use32) not run in std MS DOS.
He would be good though.

using flatreal mode (4 GB memory)
all pointer 32 bit.
unnecessary all instructions the 32 bit prefix (66h)

how running 32 bit code(no prefix) which can be solved in MS-DOS

What kind of flag identifies it as the processor the 32/16 mode?






donkey

doesn't assume work with non-extended registers i.e. ASSUME SI:HANDLE, I don't have MASM on my dev PC so I can't check this but I would imagine that since you can use it for segment registers you should be able to use the low order word of an extended data register..
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

sinsi

This seems to work

handle struc
x dd ?
handle ends
...
mov eax,(handle ptr [esi]).x


Light travels faster than sound, that's why some people seem bright until you hear them.

jj2007

Quote from: sinsi on July 11, 2008, 09:46:36 AM
This seems to work

handle struc
x dd ?
handle ends
...
mov eax,(handle ptr [esi]).x


Did you test that in 16-bit code, Sinsi? If yes, would mov eax, [esi.handle.x] work, too?

sinsi

Quote from: jj2007 on July 11, 2008, 09:58:16 AM
Did you test that in 16-bit code, Sinsi? If yes, would mov eax, [esi.handle.x] work, too?
Sure did, they both assemble to "mov eax,[esi]". Well done my man  :clap:
Taught me something new  :bg

mov eax, [esi.handle.x]
AX=0000  BX=0000  CX=000F  DX=0000  SP=FFFE  BP=0000  SI=0000  DI=0000
DS=186D  ES=186D  SS=187D  CS=187D  IP=0003   NV UP EI PL ZR NA PE NC
187D:0003 67668B06      MOV     EAX,[ESI]              DS:0000=9FFF20CD
-
mov eax,(handle ptr [esi]).x
AX=20CD  BX=0000  CX=000F  DX=0000  SP=FFFE  BP=0000  SI=0000  DI=0000
DS=186D  ES=186D  SS=187D  CS=187D  IP=0007   NV UP EI PL ZR NA PE NC
187D:0007 67668B06      MOV     EAX,[ESI]              DS:0000=9FFF20CD


Of course, if ESI>FFFF it faults.
Light travels faster than sound, that's why some people seem bright until you hear them.

jj2007

Quote from: sinsi on July 11, 2008, 10:16:34 AM
Sure did, they both assemble to "mov eax,[esi]". Well done my man  :clap:
Taught me something new  :bg
My pleasure :bg