Something went wrong. Try again.
A cycle-accurate Apple II and Apple IIgs emulator written in Zig, usable as both a program and a library.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061// SPDX-FileCopyrightText: 2026 Jeffrey C. Ollie <jeff@ocjtech.us>//// SPDX-License-Identifier: MIT
// An Apple IIe with two drives and a game in the first of them.//// zig65 --config examples/apple2e.ziggy//// Everything the machine itself is, is a field at the top level, named after// the switch it replaces with the dashes turned into underscores. A switch on// the command line beats the file, which is what makes this a starting point// rather than a straitjacket://// zig65 --config examples/apple2e.ziggy --slot 5=disk
// Which Apple this is. Optional -- an Apple IIe is what you get by saying// nothing -- but worth writing down in a file that is meant to be read..machine = "iie",
.rom = "roms/APPLE2E.ROM",
// Which monitor it is being looked at on, and who draws the text. Both change// while it runs, at alt+m and alt+x; these are only where it starts..monitor = "colour",.text = "pixels",
// And the cards. A card is described where it sits and nowhere else: what it// needs is written beside the slot it is in, rather than at the top of the// file in a field named after the card.//// That is what makes a machine with two of a kind sayable at all. Put a second// entry with .card = "disk" in another slot and it has its own firmware, its// own drives and its own disks in them; there is nowhere for one .disk_rom at// the top of a file to have meant both.//// Nothing has to be told where to look for any of this. A IIe's reset counts// down from slot 7 for a card whose page says it can boot, so moving the// controller to slot 5 is a line here and nothing else..slots = [ .{ .slot = 6, .card = "disk", .rom = "roms/341-0027-a.p5", .drives = 2, .disk1 = "disks/game.dsk", }, // A mouse card, driven by the terminal's own pointer. A slot holds one // card, so putting a Mockingboard in 4 as well is an error rather than one // of them quietly winning. .{ .slot = 4, .card = "mouse" }, // A Passport MIDI interface, the card most Apple II MIDI software was // written for. It has no firmware, so it needs no .rom; .out writes what // the machine sends as a Standard MIDI File and .in plays one back in, // timed by the machine's own clock. .{ .slot = 2, .card = "passport", .out = "midi/played.mid", },]