`
Objective
To write an 8086 Assembly program that:
Takes two hardcoded numbers.
Performs addition, subtraction, multiplication, and division.
Prints each result to the screen.
Tools Used
Emulator: EMO8086
Assembler: Turbo Assembler (TASM)
Code:
.model small
.stack 100h
.data
num1 dw 12
num2 dw 4
msg_add db 'Addition: $'
msg_sub db 'Subtraction: $'
msg_mul db 'Multiplication: $'
msg_div db 'Division: $'
newline db 13, 10, '$' ; CR + LF
.code Lab Report Status
main:
mov ax, @data
mov ds, ax
Marks: ………………………………… Signature: .....................
; ---------------------
Comments:
; Addition .............................................. Date: ..............................
; ---------------------
lea dx, msg_add
call print_string
mov ax, num1
add ax, num2
call print_number
call new_line
; ---------------------
; Subtraction
; ---------------------
lea dx, msg_sub
call print_string
mov ax, num1
sub ax, num2
call print_number
call new_line
; ---------------------
; Multiplication
; ---------------------
lea dx, msg_mul
call print_string
mov ax, num1
mov bx, num2
mul bx
call print_number
call new_line
; ---------------------
; Division
; ---------------------
lea dx, msg_div
call print_string
mov ax, num1
mov bx, num2
xor dx, dx
div bx
call print_number
call new_line
; Exit
mov ah, 4ch
int 21h
; ---------------------------------------
; Subroutine to print string
; ---------------------------------------
print_string:
mov ah, 09h
int 21
ret
; ---------------------------------------
; Subroutine to print number in AX
; ---------------------------------------
print_number:
pusha
mov cx, 0
mov bx, 10
.convert:
xor dx, dx
div bx
push dx
inc cx
cmp ax, 0
jne .convert
.print:
pop dx
add dl, '0'
mov ah, 02h
int 21h
loop .print
popa
ret
; ---------------------------------------
; Subroutine to print newline
; ---------------------------------------
new_line:
lea dx, newline
call print_string
ret
end main
Output:
Addition: 16
Subtraction: 8
Multiplication: 48
Division: 3
Conclusion
This lab demonstrates how 8086 Assembly can handle basic arithmetic and convert binary
results into readable ASCII format for display using DOS interrupts. It improves
understanding of register manipulation, arithmetic instructions, and low-level output.