Answer to Question #285950 in Assembler for nnnnn

Question #285950

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.


1
Expert's answer
2022-01-09T02:21:03-0500
.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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS