From a2a4bc65c528d69ea3ca527d418bb547f4b3ddd7 Mon Sep 17 00:00:00 2001 From: BigEd Date: Sun, 26 Apr 2015 18:30:53 +0100 Subject: [PATCH] Add I/O to 6800 --- chip-6800/testprogram.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/chip-6800/testprogram.js b/chip-6800/testprogram.js index a741cfe..49b3620 100644 --- a/chip-6800/testprogram.js +++ b/chip-6800/testprogram.js @@ -4,20 +4,26 @@ testprogramAddress=0x0000; // we want to auto-clear the console if any output is sent by the program var consoleboxStream=""; -// for opcodes, see ftp://ftp.comlab.ox.ac.uk/pub/Cards/txt/6800.txt +// demonstrate write hook +writeTriggers[0x8000]="consoleboxStream += String.fromCharCode(d);"+ + "consolebox.innerHTML = consoleboxStream;"; + +// demonstrate read hook (not used by this test program) +readTriggers[0x8004]="((consolegetc==undefined)?0:0xff)"; // return zero until we have a char +readTriggers[0x8000]="var c=consolegetc; consolegetc=undefined; (c)"; + +// for opcodes, see http://www.textfiles.com/programming/CARDS/6800 testprogram = [ 0xce, 0x43, 0x21, // LDX #4321 0x35, // TXS - 0xc6, 0xfb, // LDAB #$FB + 0xce, 0x80, 0x00, // LDX #8000 + 0xc6, 0x40, // LDAB #$40 0xbd, 0x00, 0x10, // JSR $0010 - 0x7e, 0x00, 0x04, // JMP $0004 + 0x7e, 0x00, 0x09, // JMP $0009 0x01, // NOP - 0x01, // NOP - 0x01, // NOP - 0x01, // NOP - 0x08, // INX 0x4a, // DECA + 0xe7, 0x00, // STAB 0, X 0x7c, 0x00, 0x0f, // INC $0F 0x0d, // SEC 0xc9, 0x02, // ADCB #$02