News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

ORG directive in MASM?

Started by Paulo, August 21, 2013, 02:47:45 AM

Previous topic - Next topic

Paulo

Hi

Can anyone confirm if MASM32 can compile flat binary files with a user defined .ORG directive like in NASM?
I know that MASM versions later then 6.0 can produce .com files with the .MODEL tiny directive but that means the
ORG is fixed at 100h.

Thanks in advance
Paulo.

FORTRANS

Hi,

   Yes.  Do a search on the old forum for "boot sector".  You
should find some threads where building a boot sector was
done from scratch.

Regards,

Steve N.

Paulo

#2
Thanks FORTRANS.

============================
EDIT:
============================

Found the solution (thanks once again to Steve for pointing me in the right direction)
and I'm posting it here in case some one else might be interested.

Below is the test code I used, compiled it twice, once with ORG 0 and again with ORG 100h
BTW, if one specifies an ORG which is not 0 or 100h, Link16.exe throws a warning (with .MODEL Tiny), ignore it as it still produces correct code.



.MODEL  Tiny
OPTION  CaseMap:None

.CODE

          ORG     100h

  ;ORG 0h

; ========================================================
;
; use the 16-bit linker. \masm32\bin\Link16.exe
;
; \masm32\bin\ml /c TestMasmOrg.asm
; \masm32\bin\Link16 /TINY TestMasmOrg.obj
;
; ========================================================

_main   PROC

        mov     dx,offset SomeText
        mov     ah,9
        int     21h

nop
nop

        mov     ax,4C00h
        int     21h

nop
nop

_main   ENDP

; -----------------------------------------------------------

SomeText db 'Yup Hello World What Else',0Dh,0Ah,24h

; -----------------------------------------------------------

        END     _main


Result as follows: