8085微处理器中的掷模仿真程序
编写8085汇编语言程序,以使用中断来模拟掷骰子。
我们为该程序提供了一个计数器,该计数器对范围从1到6进行计数,并在无限循环中无限循环的情况下再次重复计数序列。通过按下键盘上的“VectIntr”键,可以模拟获得掷骰头的概率。8085的分支分支到RST7.5ISS。在此,计数器gets的当前值显示在数据字段中,该数据字段控制并返回到主程序以继续计数器操作。因此,我们以1到6之间的一个随机值按下“VectIntr”键,该键显示在数据字段中,用于模拟模具的投掷。
; FILE NAME DIETHROW.ASM; Main program to reset RST7.5 Flip-Flop, unmask RST7.5, enable interrupts,; and count from 1 to 6 endlessly in an infinite loopORG C000HCURDT: EQU FFF9HUPDDT: EQU 06D3HDELAY: EQU 04BEHMVI A, 00011011BSIM ; Reset RST7.5 Flip-Flop, Unmask RST7.5EI ; Enable interrupt system; Program segment for an endless counter (1 to 6) loop.; The 2 NOP instructions are needed because interrupt request; lines are sensed by 8085 subsequent to JMP BEGIN instruction; after a short time-interval of about 15 clocks. It may be; better to have few NOP instructions to provide margin of safety.BEGIN: MVI A, 01HLOOP: NOPNOPINR ACPI 06HJNZ LOOPJMP BEGIN; RST7.5 ISS to display the counter valueRST75: STA CURDTCALL UPDDT ; Display count value in data fieldLXI D, FFFFHCALL DELAY ; Generate a delay of 0.5 secondLDA CURDTEIRET; When VECT INTR key is pressed, RST7.5 line is activated. So; control is shifted to location 7.5 * 8 = 60 = 003CH. This location; has JMP FFB1H instruction. (For ESA kit there is JMP 8FBFH). Hence; it is necessary to write JMP RST75 instruction at location FFB1H.; This is done by the following 2 instructions.ORG FFB1H ; For ESA Kit it should be ‘ORG 8FBFH’JMP RST75