home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!uunet.ca!geac!zooid!ross
- From: Ross Ridge <ross@zooid.guild.org>
- Subject: Re: Results of the smallest TSR contest
- Organization: ZOOiD BBS
- Date: Tue, 1 Sep 1992 21:24:08 GMT
- Message-ID: <1992Sep1.212408.7974@zooid.guild.org>
- References: <BtvM6J.70o@ireq.hydro.qc.ca>
- Lines: 60
-
- beaurega@ireq.hydro.qc.ca (Denis Beauregard) writes:
- >In the category : HLL with Assembly
- > Ross Ridge
- > 64 bytes for a TSR counter
- >
- >Note : I have no Borland compiler on hand. But, statements like
- >#define get_strategy() (_AX=0x5800, INT21(), _AX)
- >looks like inline functions. What is doing _AX=0x5800 ? Compiling
- >this into "mov ax,$5800" ? If true, this is inline!
-
- No it's not. _AX=0x5800 isn't assembler, it doesn't even look
- like assembler. But it was only used for convience, these functions
- could easily have been written (more portability) like this:
-
- int
- get_strategy(void) {
- union REGS regs;
-
- regs.x.ax = 0x5800;
- intdos(®s, ®s);
- return regs.x.ax;
- }
-
- The only use of register pseudovariables that's required is at the
- start of the isr funtion:
-
- _DS = _CS;
-
- Again this isn't assembler, you can't even do that in assembler, as
- "mov ds,cs" is illegal. The compiler is has to take the statement,
- expressed in C, of "assign the code segment register to the data
- segment register" and translate it into assembler. It even has
- a view choices of how to do this:
-
- push cs
- pop ds
- or...
- mov ax,cs
- mov ds,ax
-
- In the latter case it could use bx, cx, or dx instead of ax. Maybe
- si and di too, I dunno, I don't care. I'm no 8086 assembler wiz,
- in fact when I first used a statement like "_ES = _DS;" I didn't
- even realize that it couldn't be translated into assembly as
- one statement.
-
- >My own entry : doing the key swapper in HLL + Inline.
- >Let's presume I use the same loader as Ross' program.
- >The result would give 48 bytes. Compare with 160 bytes without assembly.
-
- My loader can't create an TSR less than 64 bytes including the MCB because
- parts of the new PSP are modified by MS-DOS while setting it up.
-
- Ross Ridge
-
- --
- Ross Ridge - The Great HTMU l/ //
- [OO][oo]
- ross@zooid.guild.org /()\/()/
- uunet.ca!zooid!ross db //
-