Write an emu 8086 assembly language program to push the following values on stack 450, 0, 487, 101, 500, 0, 359, 0, 458. Now write a code to delete the items having quantity zero and update the stack.
.stack 16h
DATA SEGMENT
DATA ENDS
CODE SEGMENT
start:
mov ax,DATA
mov DS,ax
mov ES,ax
push bp
push 450
push 0
push 487
push 101
push 500
push 0
push 359
push 0
push 458
mov cx,9
mov bp, sp
add sp,2
add bp,2
popStack:
pop ax
dec cx
cmp cx,0
je exit
cmp ax,0
je L1
mov [bp],ax
add bp,2
jmp popStack
L1:
jmp popStack
exit:
pop bp
mov ah,0 ; Waiting for a key press
int 16h
; Program is terminated
mov ah,4Ch
int 21h
CODE ENDS
END START
Comments
Leave a comment