Interrupts management.

Summary
Interrupts management.
irqportIRQ ports
irq_disableInterrupts disable port.
irq_statusInterrupts status.
IRQ indentifiers.
INT_IRQ2This interrupt is available on the HuCard and expension connectors.
INT_IRQ1IRQ1 is triggered by the VDC.
INT_TIMERThis TIMER interrupt is generated by the HuC6280’s internal timer.
INT_NMIThe NMI interrupt does not seem to be used.
INT_ALLBitfield grouping all interrupts.
irq_onEnable one or multiples IRQ interrupts.
irq_offDisable one or multiples IRQ interrupts.
IRQ vectors.
IRQ2Index of the user defined IRQ2 vector.
IRQ1
TIMER
NMI
VSYNC
HSYNC
SOFT_RESET
irq_enable_vecEnable IRQ vector.
irq_disable_vecDisable IRQ vector.
irq_set_vecSet user interrupt functions.
irq_cntInterrupt counter.
irq_mInterrupt control mask.

irqport

irqport = $1400

IRQ ports

irq_disable

irq_disable = irqport+2

Interrupts disable port.

irq_status

irq_status = irqport+3

Interrupts status.

IRQ indentifiers.

INT_IRQ2

This interrupt is available on the HuCard and expension connectors.  It is also triggered by the BRK instruction and the CD-ROM ADPCM hardware.

INT_IRQ1

IRQ1 is triggered by the VDC.  This means that the irq1 vector will be called whenever a VDC interrupt occurs.  Namely

  • Vertical blanking (vblank)
  • Scanline interrupt (hblank)
  • VRAM to VRAM DMA transfer end
  • VRAM to SATB DMA transfer end
  • Sprite overflow
  • Sprite collision

A way to differentiate between those interrupts is to check the value of the VDC status register.

INT_TIMER

This TIMER interrupt is generated by the HuC6280’s internal timer.

INT_NMI

The NMI interrupt does not seem to be used.

INT_ALL

INT_ALL = INT_IRQ2 | INT_IRQ1 | INT_TIMER | INT_NMI

Bitfield grouping all interrupts.

irq_on

Enable one or multiples IRQ interrupts.

Assembly call

irq_on    INT_TIMER |INT_IRQ2

Parameter

iIRQ bit field (see IRQ identifiers).

irq_off

Disable one or multiples IRQ interrupts.

Assembly call

irq_off    INT_TIMER |INT_IRQ2

Parameter

iIRQ bit field (see IRQ identifiers).

IRQ vectors.

IRQ2

IRQ2 = 0

Index of the user defined IRQ2 vector.

IRQ1

IRQ1 = 1

TIMER

TIMER = 2

NMI

NMI = 3

VSYNC

VSYNC = 4

HSYNC

HSYNC = 5

SOFT_RESET

SOFT_RESET = 6

irq_enable_vec

Enable IRQ vector.

  • Bit 4 of irq_m is used to tell that the user vsync hook must be run.
  • Bit 5 is for standard vsync hook.
  • Bit 6 and 7 are the same things but for hsync.
  • Standard and user [h|v]sync hooks are not mutually exclusive.  If both bits are set, first the standard handler will be called then the user one.

Assembly call

irq_enable_vec vec

Parameter

vecVector to enable

irq_disable_vec

Disable IRQ vector.

Assembly call

irq_enable_vec vec

Parameter

vecVector to enable

irq_set_vec

Set user interrupt functions.

Warning

A,X and Y will be overwritten.  Interrupts are disabled.

Assembly call

irq_set_vec vec, addr

Parameters

vecinterrupt to hook.
addruser function to be called when interrupt will be triggered.

irq_cnt

irq_cnt = $20f2

Interrupt counter.

irq_m

irq_m = $20f5

Interrupt control mask.

from Hu7cd doc BIT0 - irq2 user interrupt mask BIT1 - irq1 user interrupt mask BIT2 - timer user interrupt mask BIT3 - nmi user interrupt mask BIT4 - (if !BIT1), vsync user interrut mask BIT5 - “irq1 occured but not on vsync” user interrupt mask BIT6 - (if !BIT1), raster/hsync user interrupt mask BIT7 - “irq1 occured but not on hsync” user interrupt mask

irqport = $1400
IRQ ports
irq_disable = irqport+2
Interrupts disable port.
irq_status = irqport+3
Interrupts status.
INT_ALL = INT_IRQ2 | INT_IRQ1 | INT_TIMER | INT_NMI
Bitfield grouping all interrupts.
IRQ2 = 0
Index of the user defined IRQ2 vector.
IRQ1 = 1
TIMER = 2
NMI = 3
VSYNC = 4
HSYNC = 5
SOFT_RESET = 6
irq_cnt = $20f2
Interrupt counter.
irq_m = $20f5
Interrupt control mask.
Close