Skip to content

4.3.0

Latest
Compare
Choose a tag to compare
@alekmaul alekmaul released this 10 Jun 14:12
9f278d4

What's Changed

New Contributors

Full Changelog: 4.2.0...4.3.0

Breaking Changes (tks undisbeliever for the log)

Interrupts:

  • The VBlank ISR now detects lag frames.
    • Code that uses WaitForVBlank() should be unaffected
    • Code that uses wai to pause execution will be treated as a lag-frame.
      See interrupt.h documentation for more details.
    • CAUTION: nmi_handler is called on every VBlank interrupt (ie, no lag-frame detection).
  • The VBlank ISR will automatically transfer oamMemory to the PPU OAM on non lag-frames.
    • nmi_handler's that contain a DMA transfer to OAM should remove it.
  • nmiSet() is now a function.
    • nmiSet() will disable IRQ interrupts, enable VBlank interrupts and enable Joypad Auto-Read.
  • tcc__registers_irq has been renamed to tcc__registers_nmi_isr (it is not used by IRQ interrupts).

Inputs:

  • The VBlank ISR will automatically read inputs on non-lag frames.
    • Code that loops until a button is pressed must call WaitForVBlank() within the loop otherwise it will loop forever (See commit d450096).
    • The lag-frame detection will prevent the input variables from suddenly changing in the middle of the mainloop.
    • The lag-frame detection will reduce dropped keysUp() and keyDown() events during lag-frames.
  • Removed scanPads(), scanMPlay5(), mouseRead(), scanScope()
    • scanPads() and scanMPlay5() has been inlined into the VBlank ISR.
    • mouseRead() and scanScope() is now private and automatically called by the VBlank ISR.
  • Renamed pad_keysrepeat to pad_keysdown to better describe what it holds.
  • padsDown(), padsUp() and padsClear() argument has changed to match padsCurrent().
    • padsDown(0) is unaffected. padsDown(1) now returns the down keys of the 2nd controller.
  • padsDown() is now a macro.

Changes

Interrupts:

  • Rewrote the VBlank Interrupt Service Routine
    • Please see the VBlank-ISR section of interrupt.h documentation for more details.
  • Moved the VBlank ISR, VBlank variables and input reading code to a new vblank.asm file.
  • Added lag-frame detection to the VBlank ISR
    • WaitForVBlank() is used to detect lag frames. A lag-frame is when a VBlank Interrupt occurs and the S-CPU is not in WaitForVBlank().
    • nmi_handler's can test for lag-frames using the vblank_flag variable.
      See myconsoleVblank() in the Mode1ContinuosScroll example.
  • Added a lag-frame counter: lag_frame_counter
  • Fixed a potential crash a VBlank Interrupt occurs in the middle of nmiSet()
  • Forced tcc imaginary registers to address 0
    • .RAMSECTIONs that would have moved tcc__registers out of address 0 now cause a wla-dx linker error.
  • VBlank ISR imaginary registers are now page-aligned to prevent a D.l != 0 direct-page cycle penalty.

Inputs:

  • Inputs are now read at the end of the VBlank ISR (to free VBlank time that can be used by the nmi_handler)
  • Fixed scanPads() and scanMPlay5() erroneously reading REG_RDIO.
  • Fixed high byte of pad_keys not cleared if input is not a standard controller.
  • Fixed scanMPlay5() not reading controllers 2 & 3 (3a3db70).
    • CAUTION: REG_WRIO ($4201) must not be written to while MultiPlayer5 is active.
  • Multiplayer5 reading code clears pad_keys if the input is not a standard controller.
  • Fixed padsClear() not clearing the high-byte of pad_keys* variables.
  • Rewrote padsClear() and padsUp()
  • Fixed pad_key* array size in input.h