Search code examples
assemblyx86-16tasm

assembly code in 8086


I need help with this code of assembly language

.model small
.stack 100h
.DATA
STRING1 db 5 DUP (?),"$"
.code
main proc

    MOV AX, @DATA
    MOV ES, AX ; initialize ES
    LEA DI,[STRING1]         ; assume BYTE string
    CLD
    MOV AL, 'A'
    STOSB                   ; store 1st byte of A
    STOSB                   ; store 1st byte of A

    lea dx,STRING1
    mov ah,09h
    int 21h

mov ah,4ch
int 21h

main endp
end main

This instruction is to display two "aa" as an output but it is also showing me this:

output

output


Solution

  • Int 21/AH=09h needs the address of the string in DS:DX. You forgot to initialize DS.