CPU_Runtime.i

Summary
CPU_Runtime.i
libSFX zero-page variables
SFX_inidispINIDISP shadow variable (byte)
SFX_nmitimenNMITIMEN shadow variable (byte)
SFX_tickFrame ticker (word)
SFX_joy#contJoypad continous read-out (word)
SFX_joy#trigJoypad trigger read-out (word)
Interrupt handling
VBL_setSet software vblank interrupt
VBL_clrClear software vblank interrupt
VBL_onEnable vblank interrupt
VBL_offDisable vblank interrupt
IRQ_setSet software vertical line interrupt
IRQ_onEnable vertical line interrupt
IRQ_offDisable vertical line interrupt
IRQ_suspendSuspend vertical line interrupt
IRQ_releaseRelease suspended vertical line interrupt
System initialization
CPU_initInitialize CPU state
REG_initInitialize PPU & CPU MMIO registers

libSFX zero-page variables

SFX_inidisp

INIDISP shadow variable (byte)

SFX_inidisp is a shadow for the PPU INIDISP register at $2100.  Writes to SFX_inidisp will be written to $2100 at the next vertical blanking interval.

Example

;Turn on screen
lda          #inidisp(ON, DISP_BRIGHTNESS_MAX)
sta          SFX_inidisp
VBL_on

SFX_nmitimen

NMITIMEN shadow variable (byte)

Shadow variable for the NMITIMEN register at $4200.  Used by the various interrupt control macros to enable suspension and enabling of interrupts.

SFX_tick

Frame ticker (word)

16 bit variable that is incremented by 1 during every vertical blanking interval.

SFX_joy#cont

Joypad continous read-out (word)

If enabled with SFX_JOY, libSFX performs automatic joypad read-out and sets the 12 most significant bits in these variables to 1 continously as the corresponding joypad button is pushed.

Depending on how many joypads are enabled for automatic read-out in libSFX.cfg, SFX_joy1cont to SFX_joy4cont are available.

Description

Bit       Button
15        B
14        Y
13        Select
12        Start
11        Up
10        Down
09        Left
08        Right
07        A
06        X
05        L
04        R

SFX_joy#trig

Joypad trigger read-out (word)

As opposed to SFX_joy#cont, the bits in SFX_joy#trig are only set for one frame as a joypad button is pushed.

Interrupt handling

VBL_set

Set software vblank interrupt

Parameter

:in:    addr      Address (uint24)        constant

VBL_clr

Clear software vblank interrupt

VBL_on

Enable vblank interrupt

VBL_off

Disable vblank interrupt

IRQ_set

Set software vertical line interrupt

Parameters

:in:    line      Trigger line (uint8)    constant
:in?:   addr      Address (uint24)        constant    If omitted, last registered address remains

IRQ_on

Enable vertical line interrupt

IRQ_off

Disable vertical line interrupt

IRQ_suspend

Suspend vertical line interrupt

IRQ_release

Release suspended vertical line interrupt

System initialization

CPU_init

Initialize CPU state

REG_init

Initialize PPU & CPU MMIO registers

Automatic joypad read-out