**Program 1: Hello World**
```assembly
.model small
.stack 100h
.data
message db 'Hello, World!', '$'
.code
main proc
mov ah, 09h ; DOS function to print string
lea dx, message ; Load effective address of message
int 21h ; Call DOS interrupt
mov ah, 4Ch ; Exit program
int 21h
main endp
end main
```
Explanation:
1. `.model small` and `.stack 100h`: Memory model and stack size definitions.
2. `.data` section: Declares the data segment.
- `message db 'Hello, World!', '$'`: Defines a null-terminated string.
3. `.code` section: Contains the main code.
- `mov ah, 09h`: Load DOS function code for printing a string.
- `lea dx, message`: Load effective address of the message string.
- `int 21h`: Call DOS interrupt to print the string.
- `mov ah, 4Ch`: Set the exit code for DOS.
- `int 21h`: Call DOS interrupt to exit the program.
Comments
Post a Comment