Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TASM Direct Addressing

1 view
Skip to first unread message

Jeroen van Disseldorp

unread,
Mar 22, 1994, 4:48:48 AM3/22/94
to
I am writing a program that needs every byte it can get. It is a TSR. I found
that after the TSR is installed, and the DOS prompt is active again, the
Program Segment Prefix (PSP) can be used for variable storage room. It
works great, no lock-ups. Just one thing: I can't get TASM to understand this:

example: MY_VAR EQU 80h

...

MOV type PTR [MY_VAR],value

where type is eg. BYTE and value is a certain value...

It gives an error: Illegal immediate.


but it works for: MOV type PTR DS:[MY_VAR],value
^^^
Now I have created a nice variable space in my PSP, but because I have
to use all those "DS:"s I don't save any space at all !!!

How can TASM be told to use a directive as a pointer to a variable??!?!?


If you know it is (im)possible, please mail me or post a message in this
group...

Greetz.....................
--
### ##### jafc...@cs.ruu.nl | Well, a dogg that don't
# # # ### # # #### | pee on trees, is a bitch!
# # # # # # # # # # Software |
### # ### # # # # Development | - Snoop Doggy Dogg -

John Wilson

unread,
Mar 22, 1994, 10:49:40 AM3/22/94
to
In article <Cn28L...@cs.ruu.nl>,
Jeroen van Disseldorp <jafc...@cs.ruu.nl> wrote:
> example: MY_VAR EQU 80h

> MOV type PTR [MY_VAR],value
> It gives an error: Illegal immediate.
> but it works for: MOV type PTR DS:[MY_VAR],value

Groetjes!

Correct, unless the assembler sees a segment override or a base or
index register, it won't know it's a memory reference even if there
are brackets. This fact is documented somewhere and is an artifact
of the fact that the mental incompetants who designed MASM were C
geeks and designed the whole assembler ass-backwards with typed data
and untyped operations, whereas in fact things are the other way around
in assembly language. The fact that it screws up forward references
is inexcusable, this is exactly what an assembler is FOR!

Anyway, the solution in this case is to put the segment (and "type" --
grrr) override in the symbol definition:

MY_VAR= BYTE PTR DS:80H

Now you can just say "MOV MY_VAR,value" and it will work. Note that
if you use EQU instead of = you may get strange behavior if the address
is a variable which you later change (MY_VAR will magically change to
match it). I got bitten bad by a macro which did this until I changed
it to =. Funny, it seems to me that on the older MS assemblers that
all this is supposed to be based on, EQU was the one that meant "set
this symbol and don't let me change it", you had to use SET if you wanted
to frob it later.

Personally I just use segment overrides on everything, I've found that
you just can't trust the assembler. Define a record offset using "DW"
in an absolute segment (i.e., a DSECT) and the assembler will STILL use
16-bit offsets in indexed addressing even if it'll fit in 8 bits. GEEKS!

Btw, does anyone know if Borland has gotten a life and started upgrading
TASM, the Separate Product? I have TASM 2.01, my roommate bought some
C++ compiler and it came with TASM 3.1, so I called Borland and they said
they'd be happy to sell me 2.02 at full price but they had no idea whether
it fixed the problems I'd had with 2.01 (my biggest problem was goddamned
TLINK not recognizing STACK segments unless they also had class name
'STACK', I don't use class names), and basically I could go fuck myself
because they'd decided not to upgrade TASM any more unless you buy a
C compiler too. I was totally amazed... My next call was to MS to upgrade
to the new version of MASM, it sucks enormously and so do they but at
least they MAINTAIN their lousy products. So anyway have they changed
their minds yet? Why should I pay for a C compiler when all I want is
an assembler?

John "I hate everything" Wilson

Mathew Gyokers Eliot

unread,
Mar 22, 1994, 9:50:39 PM3/22/94
to

Current version of tasm is 4.0

--
Beavis kicks ASS! He KICKS 'em! Kicks, KICKS! He rules, he RULES, RULES!!

Marshall Ramsey

unread,
Mar 24, 1994, 1:40:54 PM3/24/94
to
I can't figure out how to simulate a real mode BIOS interrupt in protected
mode using djgpp. Can someone point me to a good source of documentation.
The docs included with djgpp seem to be rather sparse. Also, sample code would
be great.

Thanks,
Marshall
--
/////////////////////////////////////////////////////////////////////////////
// Marshall Ramsey // "...so I lit a fire. Isn't it good, //
// mra...@nicmos.as.arizona.edu // Norwegian wood." //
// // --GH ...or was it Beavis? //

0 new messages