Hi,
I'm currently converting a source into TASM 4.1/5.0 and cannot figure out how to convert MASM:
dw LOWWORD(offset xxx)
into TASM. LOW() is supported in TASM, but returns a BYTE only, what returns a WORD?
Regards
Japheth
Japheth,
Here are some examples from The Paradigm Assembler User's Guide (http://www.ee.washington.edu/class/472/wtr01/reference/pasmug.pdf). The Paradigm Assembler is based on TASM 5.0 and not much, if anything, is different. It is a very good guide for TASM.
; IDEAL Mode
big DD 12345678h
MOV ax,[WORD big] ;ax=5678h
MOV al,[BYTE PTR big] ;al=78h
MOV ax,[WORD HIGH big] ;ax=1234h
MOV ax,[WORD LOW big] ;ax=5670h
MOV al,[BYTE LOW WORD HIGH big] ;al = 3rd byte of big = 34h
; MASM Mode
MOV ax,2 PTR big ;ax=5678h
MOV ax,WORD PTR big ;ax=5678h (WORD has value 2)
thanks a lot for this link! TASM docs are hard to find.
From the documentation I can see that the Paradigm Assembler (and TASM) supports the "SMALL" operator, which seemed to be an replacement for LOWWORD. But my efforts using it to get the low word of an offset *directly* weren't successful.
This is my test case:
.386
_TEXT segment use32 public
db 13210h dup (?)
xxx db 0
mov ax, small offset xxx ;I want 3210h in AX!
_TEXT ends
END
I tried some dozen variants, but none worked.
Quote from: japheth on September 04, 2006, 09:43:59 AM
.386
_TEXT segment use32 public
db 13210h dup (?)
xxx db 0
mov ax, small offset xxx ;I want 3210h in AX!
_TEXT ends
END
Wouldn't it be like this...
.386
_TEXT segment use32 public
www dw 013210h
bbb db 0, 1, 32h, 10h ; same thing as above
ASSUME ds:_TEXT
mov ax, [www]
mov cx, [bbb]
_TEXT ends
END
I haven't coded TASM in MANY MANY years but your xxx was in the wrong spot afiak, and you need to set DS to the section in which the data is actually in (in this instance it's the same as the code. Enclosing in brackets should give you access to the value at that address, and since you are moving into the AX register, you shouldn't need to typecast it since the assembler knows the size of AX and will insert that ammount from that memory location. Let me know if I'm wrong, if so I'll hunt down my TASM 5.0 disks and install it and find out where I went wrong.
Regards,
Bryant Keller
> Wouldn't it be like this...
> ASSUME ds:_TEXT
> mov ax, [www]
> mov cx, [bbb]
No, this loads something from memory to registers, but the LOWWORD() operator just loads part of an address into a register (which does *not* access memory).
Japheth,
Are you using IDEAL mode or not?
Hi Greg,
> Are you using IDEAL mode or not?
No, since one must be able to assemble the source by either MASM or TASM.
Quote from: japheth on September 03, 2006, 12:15:48 AMLOW() is supported in TASM, but returns a BYTE only, what returns a WORD?
Can you use a size over ride on this operator?
I don't use TASM, but the question seemed to make sense.
Regards, P1 :8)
> Can you use a size over ride on this operator?
Yes, both variants are accepted:
dw word ptr LOW(offset xxx)
and
dw LOW(word ptr xxx)
but also in both cases the expression evaluates to 0010h, not 3210h. And replacing LOW by SMALL gives errors.
In the Old days, I would just mask off what I did not want.
Nibbles and Bits, food for that old dog programmer.
Regards, P1 :8)