add toggle detection tape monitor

This commit is contained in:
nino-porcino 2022-01-14 12:28:15 +01:00
parent 5900dc4cb9
commit 4bd06a1f91
4 changed files with 26 additions and 0 deletions

View File

@ -1,4 +1,8 @@
@call ..\..\tools\build tapemon
@call node ..\..\tools\prg2bin -i out\tapemon_apple1.prg -o out\tapemon.0280.bin
@call ..\..\tools\build tapetoggle
@call node ..\..\tools\prg2woz -i out\tapetoggle_apple1.prg -o out\tapetoggle.0280.woz

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,22 @@
#include <utils.h>
#include <apple1.h>
byte *const LASTSTATE = 0x29; // Last input state
byte *const TAPEIN = 0xC081; // Tape input
byte *const DSP = 0xD012; // display data port
void main()
{
asm {
simple_monitor: lda TAPEIN // read tape input
cmp LASTSTATE // compare to previous state
beq no_toggle // if same just skip
sta LASTSTATE // else save new state
ldx #35 // set "toggle detected" flag in X, 35 is also the char to print
no_toggle: bit DSP // check if display is ready to accept a character
bmi simple_monitor // if not, just keep reading tape
stx DSP // else display the "toggle detected" flag character
ldx #45 // resets the "toggle detected" flag to the "-" sign, sets also Z=0 flag
bne simple_monitor // cheap jump because Z is also 0
}
}