Skip to content

Implement Peripheral Slot Adapter for External Plugins #349

Description

@maxolasersquad

Objective

Bridge slot peripheral plugins implementing the C99 Peripheral_t vtable into LinApple's internal slot management system (Slots 1–7).

Scope & Requirements

  • Adapt the plugin Peripheral_t C99 vtable into LinApple's slot interface.
  • Route hardware memory operations:
    • I/O space read/write ($C0n0–$C0nF for Slot n)
    • Slot PROM read/write ($Cn00–$CnFF)
    • Expansion ROM mapping ($C800–$CFFF)
    • Frame updates and periodic think ticks
  • Connect IRQ and NMI line assertion from the plugin back to the emulated 6502 bus.
  • Provide procedural slot management functions:
    • plugin_slot_insert(SlotManager* slot_mgr, int slot_index, Peripheral_t* peripheral) -> bool
    • plugin_slot_eject(SlotManager* slot_mgr, int slot_index) -> void
  • Ensure clean destruction of card state upon ejection or machine reset.

Testing & Verification

  • Insert a mock peripheral plugin into Slot 4 and verify CPU reads and writes to $C0C0–$C0CF reach the plugin's I/O handlers.
  • Verify Slot PROM reads at $C400–$C4FF map to the card's firmware PROM buffer.
  • Verify Expansion ROM reads at $C800–$CFFF route to the active card when selected.
  • Assert an IRQ from the mock plugin and verify the 6502 CPU registers the pending interrupt line, and verify deasserting IRQ clears it.
  • Verify periodic frame update ticks are dispatched to the slotted card's update / think function.
  • Verify inserting a card into an invalid slot index (< 1 or > 7) or passing null pointers returns false and fails gracefully.
  • Eject the plugin from Slot 4 and verify memory accesses to Slot 4 revert to floating bus / empty slot behavior.
  • Verify inserting a new card into an occupied slot cleanly unloads the previous card before binding the new one.

Acceptance Criteria

  • CPU reads and writes to assigned slot memory spaces invoke the plugin card handlers.
  • Plugin cards can trigger and release 6502 IRQ interrupts.
  • Ejecting or replacing a plugin slot card cleanly releases resources without bus corruption.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

sdl3Affects the SDL3 frontend.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions