Page 1 of 1

How to enable/disable the Horizontal Sync Interrupt

Posted: Fri Feb 21, 2014 5:20 pm
by zephyr
Listed below is a quick example of how to enable and disable the 15700 Hz Horizontal Sync Interrupt on a Dragon 32/64.

Code: Select all

10          ORG      $5000
20          ORCC     #$50	  * Disable IRQ/FIRQ interrupts
30          LDX      #ISR
40          CMPX     $010D
50          BEQ      DISBLE
60 ENABLE   LDA      $FF03	 * Disable Frame Sync Interrupt
70          ANDA     #$FE
80          STA      $FF03
90          LDA      $FF01	 * Enable Horizontal Sync Interrupt
100          ORA      #$01
110          STA      $FF01
120          BRA      SETVEC
130 DISBLE   LDX      #$9D3D
140          LDA      $FF01	* Disable Horizontal Sync Interrupt
150          ANDA     #$FE
160          STA      $FF01
170          LDA      $FF03	* Enable Frame Sync Interrupt
180          ORA      #$01
190          STA      $FF03
200 SETVEC   STX      $010D	* Set secondary IRQ vector
210          ANDCC    #$AF	 * Enable IRQ/FIRQ interrupts
220          RTS		        * Return to BASIC
230 ISR      LDA      $FF00	* Interrupt Service Routine
240          INC      $0400
250          LDA      $FF03	* Check for 50 Hz Frame Sync Flag
260          BMI      BASIRQ
270          RTI
280 BASIRQ   INC      $0401  
290          JMP      $9D3D	* Jump to BASIC's Interrupt Service Routine (Update TIMER etc)
I have also attached a copy of the original source code (Encoder 09) and the assembled code in .CAS and .WAV format for anyone that would like to test this on their real Dragon 32/64. I recommend using Audacity 1.2.6 to convert the included wave (.WAV) files to a real audio cassette recording.