68k interrupts: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
m (5 revisions: Import from wikkii)
mNo edit summary
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
There are 3 interrupt levels on the AES and MVS. Only 2 on the CD hardware.
The cartridge systems use 3 '''auto-vectored''' interrupt levels. The CD systems use 6 '''vectored''' interrupts, 3 of which are equivalent to the cartridge system's.


Interrupts need to be acknowledged by writing to register $3C000C (REG_IRQACK).
See [[68k vector table]].
*bit2: Ack VBlank
*bit1: Ack RLI
*bit0: Ack level 3


<pre>
Video-related interrupts must to be acknowledged to re-trigger in the future by writing to the register {{Reg|REG_IRQACK}}.
move #$0007,REG_IRQACK    ; Acknowledges all interrupts
*bit 2: Acknowledge v-blank interrupt
</pre>
*bit 1: Acknowledge [[timer interrupt]]
*bit 0: Acknowledge reset interrupt (only occurs on cold boot ?)


Bits 8~10 of the SR register are used to mask them. $2000 enables them all, $2700 disables them.
Multiple bits can be set:
<syntaxhighlight>
move #$0007,REG_IRQACK    ; Acknowledge all interrupts
</syntaxhighlight>


== Vertical Blank Interrupt ==
Bits 8~10 of the [[68k]]'s SR register is used to set the minimum priority:
<syntaxhighlight>
move #$2000,SR    ; Accept all interrupts (+Supervisor mode)
move #$2700,SR    ; Ignore all interrupts (+Supervisor mode)
</syntaxhighlight>


VBlank interrupt is almost always used. It occurs everytime a new frame is traced (~60Hz).
Note that the 68k's interrupt level setting is different from the interrupt configuration bits in {{Reg|REG_LSPCMODE}}.


== Raster Line Interrupt ==
=Vertical blank interrupt=


The RLI interrupt's behavior can be programmed through memory mapped registers. It's made to occur at (the start/end ? of) specific horizontal lines of the video output. See the Sammy logo at the start of [[Viewpoint]] for an example of its use. [[Sengoku 3]] and [[Neo Turf Masters]] are also known to rely on them to do [[scanline effects]].
The v-blank interrupt is almost always used. It occurs when the rendering of a frame is about to start (~60 times per second). See [[display timing]].


== AES/MVS interrupts ==
=[[Timer interrupt]]=


*VBlank: 0
The timer interrupt's behavior can be programmed through the [[LSPC]]'s [[memory mapped registers]]. It is triggered by a 32-bit down counter clocked by the 6MHz pixel clock, and a corresponding reset register. When the counter reaches 0, an interrupt is generated. Intervals can range from 166.7ns ('''would cause an interrupt flood !''') to a little over 11.9 minutes.
*RLI: 1
*Pending at startup ?: 2


== CD interrupts ==
It can be used for special video effects such as [[scanline effects]], for example:
* The interlaced Sammy logo in [[Viewpoint]]
* [[Sengoku 2]]'s intro
* The road in [[Riding hero]]
* [[Neo Turf Masters]]'s ground perspective
* ...


*VBlank: 1
=AES/MVS interrupt levels=
*RLI: 0
 
*Level 1: V-blank
*Level 2: Timer
*Level 3: Pending after reset
 
=CD interrupt levels=
 
The V-blank and Timer levels '''are swapped''' compared to the cartridge systems.
 
*Level 1: Timer
*Level 2: V-blank
*Level 3: Not used ?
*Vector 21: CD host decoder interrupt (data ready)
*Vector 22: CD drive communication start
*Vector 23: Used but not understood


[[Category:Base system]]
[[Category:Base system]]
[[Category:Code]]
[[Category:Code]]

Latest revision as of 23:50, 16 October 2023

The cartridge systems use 3 auto-vectored interrupt levels. The CD systems use 6 vectored interrupts, 3 of which are equivalent to the cartridge system's.

See 68k vector table.

Video-related interrupts must to be acknowledged to re-trigger in the future by writing to the register REG_IRQACK.

  • bit 2: Acknowledge v-blank interrupt
  • bit 1: Acknowledge timer interrupt
  • bit 0: Acknowledge reset interrupt (only occurs on cold boot ?)

Multiple bits can be set:

move	#$0007,REG_IRQACK     ; Acknowledge all interrupts

Bits 8~10 of the 68k's SR register is used to set the minimum priority:

move	#$2000,SR     ; Accept all interrupts (+Supervisor mode)
move	#$2700,SR     ; Ignore all interrupts (+Supervisor mode)

Note that the 68k's interrupt level setting is different from the interrupt configuration bits in REG_LSPCMODE.

Vertical blank interrupt

The v-blank interrupt is almost always used. It occurs when the rendering of a frame is about to start (~60 times per second). See display timing.

Timer interrupt

The timer interrupt's behavior can be programmed through the LSPC's memory mapped registers. It is triggered by a 32-bit down counter clocked by the 6MHz pixel clock, and a corresponding reset register. When the counter reaches 0, an interrupt is generated. Intervals can range from 166.7ns (would cause an interrupt flood !) to a little over 11.9 minutes.

It can be used for special video effects such as scanline effects, for example:

AES/MVS interrupt levels

  • Level 1: V-blank
  • Level 2: Timer
  • Level 3: Pending after reset

CD interrupt levels

The V-blank and Timer levels are swapped compared to the cartridge systems.

  • Level 1: Timer
  • Level 2: V-blank
  • Level 3: Not used ?
  • Vector 21: CD host decoder interrupt (data ready)
  • Vector 22: CD drive communication start
  • Vector 23: Used but not understood