COAL ASSIGNMENT2
COAL ASSIGNMENT2
Roll no:Bsai-168
Subject: COAL
data segment
; add your data here!
pkey db "press any key...$"
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
mov bl,5
mov cx,3
mov al,0
label1:
add al,bl
LOOP label1
mov bh,10
div bh
mov ah,2
mov dl,al
add dl,30h
int 21h
mov ah,2
mov dl,bl
add dl,30h
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start
2.Take two inputs from user and display the largest one.
; multi-segment executable file template.
include emu8086.inc
data segment
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
mov ah,1
int 21h
mov bl,al
mov ah,1
int 21h
cmp bl,al
JG Greatest
JMP exit
Greatest:
exit:
int 21h
ends
3.Take two inputs from user lets say x and y and implement the given
c++ code
.model small
.stack 100h
.data
zeroMsg db '0$'
.code
main proc
mov ds, ax
int 21h
; Read x
int 21h
mov x, al ; Store x
int 21h
; Read y
int 21h
mov y, al ; Store y
mov al, x
cmp al, 4
mov al, y
cmp al, 9
forLoop:
elseBranch:
; Print "0"
endProgram:
int 21h
main endp
end main
org 100h
mov al, 1
mov bl, 2
iterate:
call PRINT_NUM
call PRINT_CHAR
db ' ', 0
mov ah, al
mov dl, 10
div dl
cmp ah, 0
jne no_newline
call PRINT_CHAR
db 0Dh, 0Ah, 0
no_newline:
add al, bl
loop iterate
DEFINE_PRINT_STRING
DEFINE_PRINT_NUM
DEFINE_PRINT_NUM_UNS
DEFINE_PRINT_CHAR
ret