Product specifications

DJNZ KILLloop ;Decrement loop counter and if loop
;counter < > 0 then goto KILLloop else
;drop through to next section of code.
It can be seen in the above code that the reset byte 3 is being written to the ctc chip
twice. This is because the CTC may expect the next byte input to it to be a time
constant therefore a re-write will eliminate these.
Part 2
After executing the code above, the next section of code (listed below), selects
interrupt mode 2, sets up the interrupt vector table by loading the high byte of the
vector table start address into the I register and the low byte of the vector table start
address into channel 0 of the ctc chip, then loading the interrupt servicing routine start
address into vector table bytes 0 and 1.
The most important point to note at this stage is that the two byte vector table start
address selected by the value in I (High byte), and the value output to CTC channel 0
(Low byte), MUST point to a fixed 0 byte boundary address.
The assumption being made is that the start address of the vector table is £8180
(Hex).
SETupCTC: DI ;Disable all existing interrupts
IM 2 ;Select interrupt mode 2 (IM 2)
LD A,£81 ;Load the high byte of the vector
;table start address into the
LD I,A ;page select register
LD A,£80 ;Select low byte vector table
;start address on 8 byte boundary
OUT (CTC),A ;within the page pointed to by the
;contents of I.
LD HL,VDPout ;Select the start address of the actual
;servicing routine. In this case it is
;indicted by the label VDPout
LD (IJtable),HL ;Load the interrupt servicing routine
;start address into vector table bytes
;0 and 1.
Part 3
The final stage is to re-enable the ctc chip interrupt on channel one, and clear the vdp
interrupt flag on board the vdp chip, by performing a read of the vdp read only register
(signified by variable VDPRGO which = 2).
Each time the read only register is read, the interrupt line is reset on board the vdp
chip.
NB:
1. The read only register on board the vdp chip must be read each time you
exit from your interrupt routine
2. The maximum duration of your interrupt routine MUST NOT be longer than
1/50 second (20,000 microseconds).