Push Pop program for 8086 microprocessor

CODE	SEGMENT
	ASSUME CS:CODE,DS:CODE,SS:CODE
	ORG 1000H
	
	MOV AX,0000H
	MOV DS,AX
	MOV SS,AX
	
	MOV AL,100
	MOV BL,00H
	CALL RANDOM
	
	INT 3

RANDOM PROC NEAR
	
	PUSHF
	PUSH CX
	PUSH DX

	MOV CL,AL
	MOV AX,0000H
	MOV AL,17
	MOV DL,SEED
	MUL DL
	ADD AX,0043
	DIV CL
	MOV BL,AH
	MOV SEED,AH

	POP DX
	POP CX
	POPF
	RET

RANDOM ENDP

;              SEED VALUE

	ORG 1500H
	SEED DB 27
	
CODE	ENDS
	END

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s