Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
hardware:interrupts [2016/06/05 15:09]
ex_writer created
hardware:interrupts [2016/06/11 22:17] (current)
ex_writer [Automatic Interrupts (ACTINT)]
Line 1: Line 1:
 ====== Interrupts ====== ====== Interrupts ======
  
-An [[glossary#​i|interrupt]] is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention. An interrupt alerts the processor to a high-priority condition requiring the interruption of the current code the processor is executing. The processor responds by suspending its current activities, saving its state, and executing a function called an interrupt handler (or an interrupt service routine, ISR) to deal with the event. This interruption is temporary, and, after the interrupt handler finishes, the processor resumes normal activities. ([[wp>​Interrupt]])+An [[:glossary#​i|interrupt]] is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention. An interrupt alerts the processor to a high-priority condition requiring the interruption of the current code the processor is executing. The processor responds by suspending its current activities, saving its state, and executing a function called an interrupt handler (or an interrupt service routine, ISR) to deal with the event. This interruption is temporary, and, after the interrupt handler finishes, the processor resumes normal activities. ([[wp>​Interrupt]])
  
 The Bally Arcade provides several interrelated registers that help the user acknowledge and respond to both hardware and software interrupts. ​ The Bally Arcade provides several interrelated registers that help the user acknowledge and respond to both hardware and software interrupts. ​
Line 26: Line 26:
 The value $B4 (or 180) is two times the desired vertical blanking target of line 90. The remaining 12 lines below vertical blank are reserved for scratchpad use throughout the game. (//Astro Battle// [[http://​www.ballyalley.com/​ml/​ml_source/​battle.asm|source code]]) The value $B4 (or 180) is two times the desired vertical blanking target of line 90. The remaining 12 lines below vertical blank are reserved for scratchpad use throughout the game. (//Astro Battle// [[http://​www.ballyalley.com/​ml/​ml_source/​battle.asm|source code]])
  
-The screen area below the vertical blank line will display the [[color ​mapping#frame color|frame color]] defined in bits 6 and 7 of the Horizontal Color Boundary (HORCB: [[hardware: i o ports|output port]] $9).+The screen area below the vertical blank line will display the [[color#​frame color|frame color]] defined in bits 6 and 7 of the Horizontal Color Boundary (HORCB: [[hardware: i o ports|output port]] $9).
  
 ----  ---- 
  
-==== Example ​1 ====+=== Example: VERBL and HORCB ===
  
-{{rectangles03.png}}+{{:rectangles03.png}}
  
-Example 1 depicts three stacked rectangles set to three different palette entries. The horizontal color boundary is set to byte 30 (120 pixels), and VERBL is set to 102. Setting VERBL to the Bally Arcade'​s lowest line reveals the contents of scratchpad RAM (the multi-colored pixels) in the lower two lines of the screen. The frame color is also set to 2, but the lack of any blanking area leaves the frame '​hidden.'​+The screen above depicts three stacked rectangles set to three different palette entries. The horizontal color boundary is set to byte 30 (120 pixels), and VERBL is set to 102. Setting VERBL to the Bally Arcade'​s lowest line reveals the contents of scratchpad RAM (the multi-colored pixels) in the lower two lines of the screen. The frame color is also set to 2, but the lack of any blanking area leaves the frame '​hidden.'​
  
  
 ===== User-Defined Interrupts ===== ===== User-Defined Interrupts =====
  
-The Bally Arcade also allows the user to enable and respond to two software-controlled interrupts: screen interrupts at designated scanlines and interrupts for tracking [[glossary#​l|light pen]] input.+The Bally Arcade also allows the user to enable and respond to two software-controlled interrupts: screen interrupts at designated scanlines and interrupts for tracking [[:glossary#​l|light pen]] input.
  
 ==== Screen Interrupts ==== ==== Screen Interrupts ====
Line 48: Line 48:
  
   * Enable screen interrupts and set its mode in INMOD ($E)   * Enable screen interrupts and set its mode in INMOD ($E)
-  * Designate the target interrupt scanline in INLIN ($F)+  * Designate the target interrupt scanline in INLIN ($F)+++ 
   * Set the interrupt handler address... ​   * Set the interrupt handler address... ​
     * low byte in INFBK ($D)     * low byte in INFBK ($D)
Line 55: Line 55:
   * Enable interrupts with the EI opcode   * Enable interrupts with the EI opcode
  
 ++++<wrap alert>​necessary only with multiple interrupts? screen interrupts seem to function fine when INLIN isn't set </​wrap>​
 === Interrupt Enable and Mode (INMOD) === === Interrupt Enable and Mode (INMOD) ===
  
Line 113: Line 114:
 ===== Automatic Interrupts (ACTINT) ===== ===== Automatic Interrupts (ACTINT) =====
  
-<​WRAP ​alert>To be written...</​WRAP>​+<​WRAP ​todo>Test and clarify</​WRAP>​ 
 + 
 +The Bally Arcade system ROM provides an "​automatic"​ interrupt service via the [[system routines:​interrupt scheduler#​ACTINT]] system routine. 
 + 
 +In the system ROM source, ACTINT is listed as follows: 
 + 
 +<code z80> 
 +MACTIN: 
 +        DI                      ; MAKE SURE INTERRUPT IS DISABLED 
 +        PUSH    AF 
 +        PUSH    BC 
 +        PUSH    DE 
 +        PUSH    HL 
 +        IM      2 
 +        LD      A,ITAB SHR 8 
 +        LD      I,A 
 +        LD      A,$C8 
 +        OUT     ​(INLIN),​A 
 +        LD      A,ITAB & 0FFH 
 +        OUT     ​(INFBK),​A 
 +        CALL    TIMEZ           ; UPDATE TIMEOUT,​MUSIC AND SECONDS 
 +        LD      C,$0F           ; USE CT0-3 
 +        CALL    TIMEY           ; DEC CT0-3 
 +        POP     HL 
 +        POP     DE 
 +        POP     BC 
 +        POP     AF 
 +        EI 
 +        RET 
 +</​code>​ 
 + 
 +ACTIN does the following:​ 
 + 
 +  * Sets Z80 interrupt mode 2 (IM2) 
 +  * Sets I register and INFBK to vector to ITAB on interrupt (which calls MACTIN) 
 +  * Sets INLIN to $C8 (i.e., line 100) 
 +  * Calls TIMEZ (updates game timer, blackout timer, and music processor) 
 +  * Calls TIMEY (decrements counter-timers CT0–CT3)
 ===== Screen Interrupt Examples ===== ===== Screen Interrupt Examples =====