Sample code for RST 6.5 Interrupt

We can experiment with 8085 interrupt using onboard interrupt test button easily. When we press TEST button, it will produce logic high to the interrupt pins.

The DIP switch SW1 is used to select the interrupt pins RST5.5, RST6.5 and INTR. For this sample code, we will select RST6.5 by closing contact between pin 2 and pin 7 of the SW1.

The interrupt vector for RST 6.5 is located at 0034H where the monitor code put the instruction JMP 8034H. In our program we can use it easily by putting the service routine for RST 6.5 at the address 8034H.

The program displays cold boot message and shows binary counting on the 4-dot LED while the test button has been pressed. Student can see the sample code running from video file shown below.


             ;Sample code for RST6.5 hardware interrupt

0000 = gpio equ 0

8034 org 8034h
8034 C30881 jmp service_rst6.5 ; relocated interrupt vector for RST 6.5

8100 org 8100h

8100 F3 di ; disable interrupt
8101 3E0D mvi a,1101b ; load MASK bit for RST6.5
8103 30 sim ; write to SIM
8104 FB ei ; enable interrupt
8105 C30581 jmp $ ; jump here wait for interrupt

8108 service_rst6.5:

8108 F5 push psw ; save PSW
8109 3A1881 lda counter ; load accumulator with counter
810C 3C inr a ; increment accumulator
810D 321881 sta counter ; store accumulator to counter byte
8110 D300 out gpio ; write accumulator to gpio
8112 1E02 mvi e,2 ; load register E with function number 2
8114 CF rst 1 ; call monitor function 2
8115 F1 pop psw ; restore PSW
8116 FB ei ; enable interrupt
8117 C9 ret ; return to main

8118 counter dfs 1 ; one byte variable
0000 end
You can enter the machine code (bold letters) into memory with HEX key from address 8100 to 8117 byte by byte. And enter three bytes at 8034 to 8036. Press key HOME to set current address to 8100. Then press key RUN. Press TEST button to produce RST6.5 interrupt.
Click to download demo of program running (Quicktime MP4 file, 1.4MB)
The video shows
1. press key RUN,
2. press TEST button, to produce logic high at RST 6.5,
3. release TEST button,
4. press RESET to return to monior mode.

Written by Wichit Sirichote,
Last updated: May 2, 2007.