Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Program for simulation of throwing a die in 8085 Microprocessor
Write an 8085 assembly language program to simulate the throw of a die using an interrupt.
We have a counter for this program, which counts the ranges from 1 to 6, and again repeats the sequence of count in a matter which is endless in an infinite loop. The die throwing getting the head and tail probability gets simulated by pressing the key ‘Vect Intr’ on the keyboard. The branching of 8085 branches to RST7.5 ISS. Here, the current value of the counter gets is displayed in the data field, which controls and returns to the main program for the continuation of the counter operation. Hence we press the ‘Vect Intr’ key at a random value between 1 to 6 which is displayed in the data field for the simulation of throwing of a die.
<p>; FILE NAME DIETHROW.ASM</p><p>; Main program to reset RST7.5 Flip-Flop, unmask RST7.5, enable interrupts,</p><p>; and count from 1 to 6 endlessly in an infinite loop</p><p>ORG C000H</p><p>CURDT: EQU FFF9H</p><p>UPDDT: EQU 06D3H</p><p>DELAY: EQU 04BEH</p><p>MVI A, 00011011B</p><p>SIM ; Reset RST7.5 Flip-Flop, Unmask RST7.5</p><p>EI ; Enable interrupt system</p><p>; Program segment for an endless counter (1 to 6) loop.</p><p>; The 2 NOP instructions are needed because interrupt request</p><p>; lines are sensed by 8085 subsequent to JMP BEGIN instruction</p><p>; after a short time-interval of about 15 clocks. It may be</p><p>; better to have few NOP instructions to provide margin of safety.</p><p>BEGIN: MVI A, 01H</p><p>LOOP: NOP</p><p>NOP</p><p>INR A</p><p>CPI 06H</p><p>JNZ LOOP</p><p>JMP BEGIN</p><p>; RST7.5 ISS to display the counter value</p><p>RST75: STA CURDT</p><p>CALL UPDDT ; Display count value in data field</p><p>LXI D, FFFFH</p><p>CALL DELAY ; Generate a delay of 0.5 second</p><p>LDA CURDT</p><p>EI</p><p>RET</p><p>; When VECT INTR key is pressed, RST7.5 line is activated. So</p><p>; control is shifted to location 7.5 * 8 = 60 = 003CH. This location</p><p>; has JMP FFB1H instruction. (For ESA kit there is JMP 8FBFH). Hence</p><p>; it is necessary to write JMP RST75 instruction at location FFB1H.</p><p>; This is done by the following 2 instructions.</p><p>ORG FFB1H ; For ESA Kit it should be ‘ORG 8FBFH’</p><p>JMP RST75</p>
