;---------------------------------------------------------------- ; LD262.ASM This program responds to the the external interrupt, ; ExtInt on the DECE-I microcomputer. Each interrupt branches ; control to an interrupt handler where a variable is incremented ; and displayed at port-3. C.P. Diduch, October 8, 2004. ;---------------------------------------------------------------- ; MAIN PROGRAM ; void main(void) { ; .EQU Tmp R0 ; #define Tmp R0 .EQU N R1 ; #define N R1 ; .ORG 0x8000 ; main { ; ADD N, NULL, NULL ; N = 0 ; ADD R2, NULL, NULL ; R2 = 0 ; ADD R3, NULL, NULL ; R3 = 0 ; ADDL Tmp, NULL, IH ; "initialize interrupt vector" STOREM 0, Tmp ; ADDL Tmp, NULL, 0xF8 ; "write Interrupt Controller STOREP 0x001A, Tmp ; Control Word to clear all ; Irq's and unmask ExtInt" ORL# FL, FL, 0x0040 ; "set DECE IF" ; M0: JMP M0 ; do {} ; } ;---------------------------------------------------------------- ; void interrupt IH(void) ; ; Each time the interrupt handler, IH, is invoked it ; adds "1" to N and and writes the new value to port-3. ; IH: ; void interrupt IH(void) { ; ADDL N,N, 1 ; N = N + 1; STOREP 0x0003, N ; outport(3, N) ; ; ADDL Tmp, NULL, 0x88 ; "write Interrupt Controller STOREP 0x001A, Tmp ; Control Word to clear ; IrqExt at Interrupt Controller ; with IrqExt unmasked" RETI ; } ;----------------------------------------------------------------