Sunday, 29 October 2017

Implementation of BIOS interrupt in 8086 using ALP (MP)

data segment
CR equ 0dh          ;start of the cursor
LF equ 0ah           ;cursor will go to next line
lgn_msg db CR,LF,'Enter a Number between 0-9',CR,LF,'$'
data ends
code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
mov dx,offset lgn_msg
mov ah,09h          ;for displaying message on screen
int 21h
mov ah,01h          ;for accepting user input from keyboard
int 21h
cmp al,39h           ;to check whether number in range of 0 to 9
ja exit
sub al,30h            ;to convert hexadecimal to decimal
mov ah,00h
mov cx,ax
mov ax,0001h
mov bx,0001h
up: mul bx
inc bx
dec cx
jnz up
exit:
int 03h
code ends
end start

No comments:

Post a Comment