The mini-assembler now has its entry point moved to $EEE because that's easier to remember than $D13. So from wozmon you enter its `!'-prompt with:
The I/O (keyboard, display) is now handled by PIA chip emulation instead of the v6502 BRK instruction. In the original Apple-1, all I/O goes through the memory mapped PIA chip that's snooping on addresses $D010..$D013. The Gigatron emulation now mimics these addresses! The "software PIA" is implemented as a vertical blank interrupt that monitors these addresses an reacts to changes accordingly
. The behaviour isn't 100.00% identical, because doing that requires putting hooks in the v6502 instructions themselves and that's not worth it. But now it comes pretty pretty close to how the real Apple-1 works. We need just two tweaks:
First, ECHO must avoid a race condition, so we rewrote it from
Code: Select all
FFEF 2C 12 D0 ECHO BIT DSP
FFF2 30 FB BMI ECHO
FFF4 8D 12 D0 STA DSP
FFF7 60 RTS
into:
Code: Select all
FFEF 8D 12 D0 ECHO STA DSP
FFF2 2C 12 D0 WAIT BIT DSP
FFF5 30 FB BMI WAIT
FFF7 60 RTS
I'm sure Woz wouldn't mind, and it should work on original hardware as well (not tested
).
Second, reading KBD doesn't clear its bit 7. But sending out a character does clear this bit instead, and that fools practically all A1 programs.
- EEER.png (43.69 KiB) Viewed 7369 times
P.S.1: Two things provisionally broke and still need to be fixed:
- The `@'-cursor is missing because the vIRQ handler simply doesn't draw it (yet).
- Integer BASIC (E000R) is momentarily broken, because lack of stack space. The PIA emulation and interrupt handler eat 8 bytes and that broke the camel's back. It takes a bit of effort to win back that space.
[Edit: Both issues have been fixed already.]
P.S.2: The above also means that this doesn't run on stock ROM v4 anymore. ROM v4 doesn't have the vertical blank interrupt. You have to build a dev.rom instead. (Or wait for ROM v5 to come out, but there's no schedule for that.)