Implementation of various ALU operations (ADD, SUB, MUL, DIV, AND, OR, XOR, NOT) through assembly language programming for 8086 using MASM and Debug.
MUL and DIV instructions in 8086.DS) before performing operations?int 21h instruction at the end of the program?Create a file named exp2.asm in Notepad and save it in D:\TASM:
.model small
.stack 100h
.data
.code
main proc
mov ax, @data
mov ds, ax
; ADD operation
mov al, 05h
add al, 03h ; AL = 08h
; SUB operation
sub al, 02h ; AL = 06h
; MUL operation
mov al, 04h
mov bl, 03h
mul bl ; AX = AL * BL = 0Ch
; DIV operation
mov ax, 0012h ; 18 in decimal
mov bl, 06h
div bl ; AL = 03h, AH = remainder
; AND operation
mov al, 0Fh
and al, 0Ah ; AL = 0Ah
; OR operation
mov al, 04h
or al, 01h ; AL = 05h
; XOR operation
mov al, 07h
xor al, 03h ; AL = 04h
; NOT operation
mov al, 0F0h
not al ; AL = 0Fh
mov ah, 4ch
int 21h
main endp
end main
Inside DOSBox, compile and run:
tasm filename.asm
tlink filename.obj
Run Debug:
td filename.exe