This commit is contained in:
Stephen Crane 2014-11-24 19:37:04 +00:00
parent 5922792a6a
commit dd8e580335
4 changed files with 30 additions and 9 deletions

View File

@ -1,5 +1,15 @@
Apple-1 Emulator Apple-1 Emulator
================ ================
- Emulates an Apple-1 with 32k of RAM
- see [napple1](https://github.com/nobuh/napple1) - see [napple1](https://github.com/nobuh/napple1)
- see also [krusader](http://school.anhb.uwa.edu.au/personalpages/kwessen/apple1/Krusader.htm) - see also [krusader](http://school.anhb.uwa.edu.au/personalpages/kwessen/apple1/Krusader.htm)
Keyboard
--------
- F1: reset
- F2: advance tape
- F3: rewind tape
- F4: load program from tape (by simulating typing it)
- F6: checkpoint machine
- F7: restore from current checkpoint on tape
- F8: enter debug mode (display current processor status on serial port)

View File

@ -34,7 +34,7 @@ void status(const char *fmt, ...) {
} }
jmp_buf ex; jmp_buf ex;
r6502 cpu(&memory, &ex, status); r6502 cpu(memory, &ex, status);
bool halted = false; bool halted = false;
const char *filename; const char *filename;

15
io.cpp
View File

@ -145,13 +145,14 @@ void io::write_portb(byte b) {
byte io::read_porta_cr() { byte io::read_porta_cr() {
byte b = pia::read_porta_cr(); byte b = pia::read_porta_cr();
if (b == 0xa7) { if (b != 0xa7)
if (_loading) { return b;
if (tape.more())
enter(tape.read()); if (_loading) {
else if (tape.more())
_loading = false; enter(tape.read());
} else
_loading = false;
} }
return b; return b;
} }

10
pia.cpp
View File

@ -3,6 +3,11 @@
#include "pia.h" #include "pia.h"
void pia::operator=(byte b) { void pia::operator=(byte b) {
Serial.print(millis());
Serial.print(" > ");
Serial.print(_acc, 16);
Serial.print(' ');
Serial.println(b, 16);
switch(_acc % 4) { switch(_acc % 4) {
case 0: case 0:
write_porta(b); write_porta(b);
@ -20,6 +25,11 @@ void pia::operator=(byte b) {
} }
pia::operator byte() { pia::operator byte() {
/*
Serial.print(millis());
Serial.print(" < ");
Serial.println(_acc, 16);
*/
switch (_acc % 4) { switch (_acc % 4) {
case 0: case 0:
return read_porta(); return read_porta();