Search code examples
windowsassemblycmdtasmdosbox

I have some problems with masm


I have some problems with masm when I want to run:

CSEG segment
org 100h

Begin:
    mov ah, 9 
    mov dx, offset Message
    int 21h
    ;mov ah, 9 
    ;mov dx, offset mess2
    ;int 21h

    int 20h
mess2 db 'It is me$'
Message db 'Hello, World2243!$'
CSEG ends
end Begin

It prints:

Smth like: ||=It's me!

But I commented this string out!! I compile this code on DosBox, maybe that's the cause


Solution

  • As already mentioned, you use tasm, not masm. These are two different things, see tasm and masm
    In order to print two lines, I used the code:

    MODEL   TINY
    STACK 100h  
    DATASEG
        Hellostr DB 'Hello First Step Site $'
        str2     DB 'Step 16 $'
    CODESEG     
    start:  
        mov ax,@data
        mov ds,ax
        mov dx,offset Hellostr               
        mov ah,09h
        int 21h
        mov dx,offset  str2
        mov ah,09h
        int 21h
        mov ah,04Ch
        mov al,1h
        int 21h
    end start
    

    compile + build + run:

    mount c C:\path\to\asm\file\PROGRA~1.asm
    c:
    tasm PROGRA~1.asm
    tlink /3 PROGRA~1.obj 
    PROGRA~1.exe
    

    result:link
    I will also note, as indicated in the screenshot above, I have a dosbox version 0.74-3
    And lastly: I advise you to look VERY carefully at the screenshot you provided.