Added test for interrupt bits

This commit is contained in:
2020-04-13 18:31:57 +02:00
parent 273163015c
commit 638432bb88
2 changed files with 56 additions and 83 deletions

View File

@@ -5,91 +5,11 @@ START: IM 2 ;Set interrupt mode 2
LD B,16H ;Set the length of the banner text
LD DE,0H ;Place curser in the top left
CALL 84CDH ;Call system str_out
LD A,INTTBL/256;Load the vectors for the interrupt table
LD I,A ;Load the interrupt table to I
EI ;Make sure interrupt are allowed
LOOP: HALT ;Halt the CPU and wait for interrupts
JR LOOP ;Stay in the loop
RET ;Return to original caller
INTTBL: DW INTHD0 ;Define the address of the first interrupt handler
DW INTHD1 ;Define the address of the second interrupt handler
DW INTHD2 ;Define the address of the third interrupt handler
DW INTHD3 ;Define the address of the fourth interrupt handler
DW INTHD4 ;Define the address of the fifths interrupt handler
DW INTHD5 ;Define the address of the sixths interrupt handler
DW INTHD6 ;Define the address of the seventh interrupt handler
DW INTHD7 ;Define the address of the eighth interrupt handler
INTHD0: DI ;Disable interrupts
EX AF,AF' ;Push AF to the shadow register
EXX ;Push all other registers to the shadow register
LD A,30H ;Load handler id to A
CALL INTHDL ;Call the interrupt handler method.
EXX ;Restore the registers
EX AF,AF' ;Retore AF
EI ;Reenable interrupts
RETI ;Return from interrupt
INTHD1: DI ;Disable interrupts
EX AF,AF' ;Push AF to the shadow register
EXX ;Push all other registers to the shadow register
LD A,31H ;Load handler id to A
CALL INTHDL ;Call the interrupt handler method.
EXX ;Restore the registers
EX AF,AF' ;Retore AF
EI ;Reenable interrupts
RETI ;Return from interrupt
INTHD2: DI ;Disable interrupts
EX AF,AF' ;Push AF to the shadow register
EXX ;Push all other registers to the shadow register
LD A,32H ;Load handler id to A
CALL INTHDL ;Call the interrupt handler method.
EXX ;Restore the registers
EX AF,AF' ;Retore AF
EI ;Reenable interrupts
RETI ;Return from interrupt
INTHD3: DI ;Disable interrupts
EX AF,AF' ;Push AF to the shadow register
EXX ;Push all other registers to the shadow register
LD A,33H ;Load handler id to A
CALL INTHDL ;Call the interrupt handler method.
EXX ;Restore the registers
EX AF,AF' ;Retore AF
EI ;Reenable interrupts
RETI ;Return from interrupt
INTHD4: DI ;Disable interrupts
EX AF,AF' ;Push AF to the shadow register
EXX ;Push all other registers to the shadow register
LD A,34H ;Load handler id to A
CALL INTHDL ;Call the interrupt handler method.
EXX ;Restore the registers
EX AF,AF' ;Retore AF
EI ;Reenable interrupts
RETI ;Return from interrupt
INTHD5: DI ;Disable interrupts
EX AF,AF' ;Push AF to the shadow register
EXX ;Push all other registers to the shadow register
LD A,35H ;Load handler id to A
CALL INTHDL ;Call the interrupt handler method.
EXX ;Restore the registers
EX AF,AF' ;Retore AF
EI ;Reenable interrupts
RETI ;Return from interrupt
INTHD6: DI ;Disable interrupts
EX AF,AF' ;Push AF to the shadow register
EXX ;Push all other registers to the shadow register
LD A,36H ;Load handler id to A
CALL INTHDL ;Call the interrupt handler method.
EXX ;Restore the registers
EX AF,AF' ;Retore AF
EI ;Reenable interrupts
RETI ;Return from interrupt
INTHD7: DI ;Disable interrupts
EX AF,AF' ;Push AF to the shadow register
EXX ;Push all other registers to the shadow register
LD A,37H ;Load handler id to A
CALL INTHDL ;Call the interrupt handler method.
EXX ;Restore the registers
EX AF,AF' ;Retore AF
EI ;Reenable interrupts
RETI ;Return from interrupt
INTHDL: LD DE,100H ;Put char in row 2 col. 1
CALL 8468H ;Calls the char_out function
RET ;Return to the interrupt handler
GREET: DB 'Test for keyboard int.'
END