News:

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

Everything +100h?

Started by dncprogrammer, December 18, 2006, 08:46:19 PM

Previous topic - Next topic

dncprogrammer

What does the following mean (besides the DOS call to print a terminated string, I mean the +100h part)

mov             dx, OFFSET whatever_string+100h   <---?
mov             ah, 09h
int               21h

Im confused because there was nothing after the string declaration at the end of the code listing, no more bytes!
The author also used it on another totally different string to be displayed earlier in the program, and once again when
setting to color display in the beginning of the code:
mov            CS:screen+100h, 0b800h    <--    screen          dw 0b000h

?
jon





MichaelW

This is a stretch, but if you assembled a COM program that had no ORG directive, or an ORG 0 instead of an ORG 100h, then for the data addresses to be correct at run time you would need to add 100h to the addresses that the assembler assigned.

eschew obfuscation

PBrennick

I certainly would hesitate to use or learn from any code written by the person! Please be warned.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

japheth


it is sometimes necessary to avoid the "ORG 100h" directive for COM binaries, and this might be just one of these cases. I also used some startup code which looks strange on first glance:



DGROUP  group _TEXT

        mov    ax,cs
        add     ax,10h
        mov    ds,ax
        mov    cx,ax
        call      xxxx   
        ...



xxxx:
        pop     ax
        dec     ah
        push    ds
        push    ax
        retf


IIRC the reason for doing this was that it allowed me to use the very same library routines for both TINY and SMALL memory model.


PBrennick

A standard COM file should never avoid the org 100h directive as it gives room for the PSP. The PSP occupies the first 256 bytes. If you defeat this it can cause problems as it becomes a nonstandard COM file and the OS has to do a fix up. It is best to do it correctly and there is never a reason to not do this unless you are creating an overlay. A program and a library routine are two different things.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

japheth

Be asured that a COM without ORG 100h is absolutely no problem and of course remains a "standard" COM file (else it simply would not run).

Thanks for the hint about programs and libraries not being the very same thing, that was new to me! And a hint from me: read the posts caryfully *before* you are replying!