Apple II: emulator, assembler and debugger
An Apple II+ or IIe in your browser — text, lo-res and hi-res with NTSC artifact colour or a monochrome monitor, the speaker, and a Disk II that reads .DSK, .DO, .PO, .2MG and .NIB images as real GCR nibbles. Write 6502 assembly and debug it with breakpoints beside the code, stepping, registers, memory and the soft switches. Load your own ROMs; without them a stub monitor written for this site runs.
Added
How to use it
Press Power on, or just press Assemble & run in the Assembly tab — the Apple starts by itself. Click the screen to give it the keyboard. The page has four tabs: Run (the machine, the disk drives, typing, firmware), Assembly, Debugger and References.
How to use it
-
Assembly: pick an example (hello world with
COUT, the text screen, lo-res colour bars, hi-res artifact colour, a scale on the speaker, reading keys, a loop that ends inBRK) or write your own, then Assemble & run (Ctrl+Enter). The Apple is reset, the page waits for the prompt, puts the code in memory and calls it; anRTSreturns to themonitor. Code usually goes at= $0800; hi-res page 1 is$2000–$3FFF. Load into memory stores the code without running it; Download .BIN saves it as a flat binary. -
Run: choose the Apple II+ or IIe, and the monitor: Colour shows hi-res the way an NTSC TV did — alternate dots become violet or green, and bit 7 of a byte shifts its dots half a dot to give blue or orange; White, Green and Amber show the dots themselves. Drop a disk image on the screen (or the drop box) to put it in drive 1 and boot it; drive 2 takes a second disk. Type into the Apple types a listing or monitor commands key by key.
-
The stub monitor understands
300(show a byte),300.31F(dump),300: A9 C1 20 ED FD 60(store bytes),300G(run) andC600G(boot the disk in drive 1).
Debugging
The Assembly tab is a split view: the editor on one side, the screen with the debugger on the other — registers and flags (click to edit), the stack with JSR return addresses marked, the code around the program counter, and watches.
-
Click a line number beside the code to set a breakpoint; click the dot to clear it; right-click a number for Run to here. F9 toggles the line with the cursor.
-
When the program stops, ▶ marks the line and the status says where — or not in your source when the CPU is in the firmware; the disassembly then shows the monitor’s routine names (COUT, RDKEY …) and the soft switches (
KBD,SPKR,TXTCLR…). -
Keys: F5 continue, F6 pause, F11 step, F10 step over, Shift+F11 step out, Ctrl+F10 run to the cursor line.
The Debugger tab adds a memory viewer and editor, the breakpoint list, and four chip views: the video soft switches (mode, page, mixed, 80 columns), memory (the language card, the IIe’s auxiliary-memory switches, slot 6), the Disk II controller (motor, drive, head position in half-tracks and phases, read/write mode, the data latch, and the next sector coming round under the head), and the keyboard latch.
Disks
Images are turned into the bytes a Disk II really reads: each 256-byte sector becomes an address
field (D5 AA 96, volume, track, sector and checksum in 4-and-4 code) and a data field
(D5 AA AD and 342 six-bit values in 6-and-2 GCR plus a checksum), with sectors interleaved as
DOS 3.3 or ProDOS expects — following Beneath Apple DOS (Worth and Lechner, 1981). DOS reads
and writes them through the emulated controller: the phase magnets at $C0E0–$C0E7 step the
head, $C0EC returns the next nibble. Save .DSK reads the sectors back out of the nibbles
(with any changes); .NIB saves the raw tracks.
A .DSK is assumed to be in DOS 3.3 order unless its first ProDOS directory block says
otherwise (.DO and .PO say which they are). Files you open are kept under Recently used in
this browser.
Firmware
Apple’s ROMs — the monitor, Applesoft and Integer BASIC, the Disk II boot ROM and the
character generator — are copyrighted, and Apple has never allowed them to be shared; no
clearly licensed open replacement exists. So none are included. Instead this page builds its
own firmware with the site’s 6502 assembler (the source is on the References tab, MIT
licence): a monitor that answers at the documented entry points — COUT $FDED, HOME $FC58,
RDKEY $FD0C, GETLN $FD6A, PRBYTE $FDDA, PLOT $F800, HLINE, VLINE, SETCOL,
SCRN, WAIT $FCA8, BELL … — so assembly programs that use them run unchanged, and a stand-in
for the slot 6 boot ROM. The text font is the public-domain X11 misc-fixed 5×8.
If you own the ROMs, Load my ROM files… takes a 12 KB II/II+ image ($D000–$FFFF), a 20 KB
II+ dump, a 16 KB IIe image ($C000–$FFFF, with the internal $C100–$CFFF firmware) and the
256-byte Disk II boot ROM. They are kept in this browser’s IndexedDB and never leave it.
Presenting
⛶ Present (or F) shows just the Apple screen, filling the window — for a talk or a classroom. The keyboard keeps working; Esc closes it. With Link options → Open in presentation mode and Start automatically, a share link opens full screen and runs the program in the editor.
Limits
-
The CPU runs instruction by instruction with the documented cycle counts, not cycle by cycle; the video is drawn once a frame, so programs that switch modes mid-frame (split screens) and "vapour lock" tricks that read the floating bus don’t work.
-
No double hi-res or double lo-res; IIe MouseText shows as letters. The IIe is the original (NMOS 6502) model, not the enhanced 65C02 one.
-
Disk II timing is simplified: every read of
$C0ECgets the next nibble. DOS 3.3 and ProDOS work; copy protection that measures timing, half-tracks or sync-byte lengths doesn’t. 13-sector (DOS 3.2) disks and WOZ images aren’t read. -
With the stub firmware there is no BASIC and no DOS: a disk boots (the boot ROM’s sector reads are done by the emulator), but DOS stops as soon as it calls Apple’s ROM.
-
No paddles or joystick yet (the buttons are the Alt keys), no cassette, printer or other cards.
-
The NTSC colours are the usual approximations (Wikipedia’s "Apple II graphics" palette); a real TV blends them more softly.
Linking to an example
Links can be written by hand. Settings not in the link keep their defaults.
| Parameter | Meaning | Example |
|---|---|---|
|
Tab: |
|
|
Example program: |
|
|
|
|
|
Monitor: |
|
|
Open the screen full-window and run the program |
|
For example: ?mode=asm&example=hires&video=color&autostart=1
(hi-res artifact colour), ?mode=asm&example=lores,
?model=iie&mode=asm&example=brk. Share links
never carry disks or ROMs.
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.