Assembling com files utilizing MASM32 .386 .model tiny .stack .data message db "Hello world",0 .code assume cs:main,ss:main ;;,ds:main,es:main org 100h call main main proc mov ax,offset message mov ds,ax mov ah,09 lea dx,message int 21h mov ax,4c00h int 21h main endp end MakeIt.bat ;;;; ml.exe /c /AT Comfile.asm Link.exe /SUBSYSTEM:CONSOLE ;;;; Please, help. I cannot assemble this com file. Could anyone advise what is wrong with the code or with the bat file or both? Are there any examples on the Net how to make com files utilizing MASM32? Thanks
Posted on 2001-04-23 15:30:00 by Ol
Ol, You won't either, you code is set to build 32 bit code and you are using a 32 bit linker. The linker is easy, get the OMF linker from Iczelion's site and run it from the command line to get the syntax, it is a lot different from the later linker. Below is a skeleton of a DOS com file. The line, assume cs:com_seg, ds:com_seg means that both the code and data are in the same DOS segment, org 100h means the start address of the memory image of the COM file.

;----------------------- Hello.ASM ----------------------------

com_seg segment byte public            ; define the ONLY segment

        assume cs:com_seg, ds:com_seg  ; both code & data in same segment.
        org 100h                       ; go to start adress in memory.

        mov ah, 40h                    ; the DOS function number.
        mov bx, 1                      ; the screen handle.
        mov cx, 11                     ; the length of the text to display.
        mov dx, offset Greeting        ; the address of the text.
        int 21h                        ; get DOS to execute the function.

        mov ax, 4Ch                    ; the TERMINATE process function.
        int 21h                        ; call DOS again to EXIT.

Greeting db "Hello World",13,10        ; specify the text as byte data.

com_seg ends                           ; define the end of the segment.

        end start


Posted on 2001-04-23 18:48:00 by hutch--
Thanks hutch. Your code works, that is what I need. Where on the Net could I get DOS Functions Programmerís Reference ( int xxh )? Regards, Ol
Posted on 2001-04-24 14:29:00 by Ol
Posted on 2001-04-24 15:07:00 by Ahner
Many thanks Ahner for useful reference utility.
Posted on 2001-05-03 12:16:00 by Ol