Slide 17
Slide 17 text
.model small
.stack 100h
.data
age db 43 ; Byte-sized variable named "age" initialized with 43
msg db "I am %d years old", 0 ; Null-terminated string for printf
.code
mov ax, @data ; Load the data segment address into AX
mov ds, ax ; Set DS to the data segment
mov al, age ; Move the value of "age" into AL register
mov ah, 0 ; Clear AH to prepare AX for printing
lea dx, msg ; Load effective address of the message into DX
mov ah, 09h ; Function 09h - Display string
int 21h ; Call DOS interrupt
mov ax, 4C00h ; DOS function to exit the program
int 21h ; Call DOS interrupt
end
DISCLAIMER: CHATGPT