aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gb: auto-reconnect a dead --serial-sock link instead of going silentgbc dev4 days1-0/+6
| | | | | | | | | | | | | | | | | Root-cause work for the 'idle link-socket drop' (see gbos docs/link-drop-investigation.md): when the hub restarts or the bridge dies, the link fd went dead forever - and before SIGPIPE was ignored, the next console-echo write() would kill the whole emulator silently. Now, in --serial-sock mode, EOF on read or EPIPE/ECONNRESET/ENOTCONN/ EBADF on either direction marks the link dead, closes the fd, and retries connect() every 500ms from the serial poll path (the guest polls constantly, so no extra plumbing). RX stays pending while down (serial_no_eof semantics), so the guest just sees a quiet link that comes back. Logs 'link socket lost / reconnected' either way. Verified: SIGKILL the hub, restart it - every GB reconnects within ~1s and keeps its lease.
* gb: boot ROM (BIOS) supportgbc dev5 days1-0/+10
| | | | | | | | | Add optional boot ROM emulation. When a boot ROM image is loaded, gb_reset starts execution at PC=0 with power-on register state instead of the documented post-boot state; the ROM overlays low memory (with the CGB 0x0100-0x01FF header hole showing the cartridge through) until the game writes 0xFF50 to hand off. gb_load_bootrom() accepts 256-byte (DMG) or 2304-byte (CGB) images.
* main/gb: --keys button-script harness + serial_no_eof for OSK testinggbc dev5 days1-0/+1
| | | | | | | | --keys "udlrabse." plays scripted joypad taps (each char = one button held 10 frames then released 10, so the guest sees a clean edge); pairs with --headless --shot to drive on-screen input and capture the result. When --keys is active, serial-RX EOF stays pending instead of sending $04, so a shell blocked on read waits for OSK input instead of exiting.
* headless: $ED opcode = clean power-off (exit + battery save)gbc dev6 days1-0/+1
| | | | | | | | The unused SM83 opcode $ED now sets gb->poweroff, which breaks the headless loop so the normal cart_free()->cart_save() path runs. Lets a guest OS shut the emulator down cleanly (and flush its .sav) instead of relying on an external timeout/SIGTERM, which could SIGKILL before the save. run_frame() also stops on poweroff so exit is immediate.
* serial: headless mode tying serial port to stdio for OS debugginggbc dev6 days1-0/+2
| | | | | | | | - --headless: no rendering/TUI; serial TX -> stdout, RX <- stdin (nonblocking) - generalize serial: serial_out_fd/serial_in_fd on the GB; internal-clock transfer now shifts in a real RX byte (from stdin) instead of always 0xFF - paced to native speed by default, --uncapped for turbo; pipes/scripts cleanly - README: document headless serial console
* apu: register-level emulation of 0xFF10-0xFF3F (fixes music fades)gbc dev7 days1-0/+5
| | | | | | | | | The APU was a black hole: reads returned 0xFF, writes were dropped. That hangs any game that fades music out by decrementing the NR50/rAUDVOL volume register until it reads 0 (Pokemon's StopMusic spin-wait) - the write never stuck, the read never hit 0, infinite loop. Store the 48 sound registers and return them with the standard hardware read-back OR-masks (NR50 mask 0x00 = exact readback). No synthesis, just correct register behavior.
* scaffolding: build system, cartridge loader with MBC1/2/3/5, core typesgbc dev2026-07-041-0/+127