programming-in-emu8086___with-brief-theory

This project is maintained by MahediKamal

💜5 ) let bx = 1234d. print the value of bx using stack.

Solution code:

		.model small
		.stack 100h
		.data

		.code
		main proc
			
			mov bx,1234d
			
			; saving remainder in the stack
			while_bx_not_0:
			mov cx,0d
			cmp bx,cx
			jle exit1
			
				mov ax,bx
				mov dl,10d
				div dl
				
				
				mov cl,ah
				mov ch,0d
				push cx
				mov ah,0d
				mov bx,ax
				
				
			

			jmp while_bx_not_0
			exit1:
			
			
			; printing from stack
			while_stack_not_empty:
			mov bx,0100h
			cmp sp,bx
			jge exit2
				pop bx
				mov ah,2
				mov dl,bl
				add dl,30h
				int 21h
			
			
			jmp while_stack_not_empty
			exit2:
		main endp        
		end main