Update patch, better timing info

This commit is contained in:
Gregor Riepl 2022-09-04 10:24:01 +02:00
parent f1d23b090f
commit 4469010fb1

View file

@ -12,10 +12,10 @@ index cd38b6d..cf10121 100644
+ tape-rs232.h
diff --git a/src/tapeport/tape-rs232.c b/src/tapeport/tape-rs232.c
new file mode 100644
index 0000000..680a1c4
index 0000000..416657b
--- /dev/null
+++ b/src/tapeport/tape-rs232.c
@@ -0,0 +1,270 @@
@@ -0,0 +1,274 @@
+/*
+ * tape-rs232.h: RS-232 interface for the PET, connected to the tape port
+ *
@ -80,6 +80,9 @@ index 0000000..680a1c4
+} tape_rs232_state_t;
+static tape_rs232_state_t tape_rs232_state[TAPEPORT_MAX_PORTS] = { { false, }, };
+
+CLOCK last_maincpu_clk = 0;
+CLOCK last_sample_maincpu_clk = 0;
+
+/* ------------------------------------------------------------------------- */
+
+/* device interface prototypes */
@ -186,7 +189,7 @@ index 0000000..680a1c4
+ alarm_unset(dev->read_alarm);
+ }
+}
+CLOCK last_maincpu_clk = 0;
+
+static void tape_rs232_write(int port, int write_bit)
+{
+ if (port < 0 || port >= TAPEPORT_MAX_PORTS) {
@ -235,7 +238,8 @@ index 0000000..680a1c4
+ dev->write_register = (dev->write_register >> 1) | (dev->write_level ? 0x200 : 0x000);
+ /* and decrement the counter */
+ --dev->write_shift;
+ long delta = (long) maincpu_clk - last_maincpu_clk;
+ long delta = (long) maincpu_clk - last_sample_maincpu_clk;
+ last_sample_maincpu_clk = maincpu_clk;
+ last_maincpu_clk = maincpu_clk;
+ log_debug("tape_rs232: sample %d reg 0x%04x offset %lu clock %lu delta %ld shift %u", dev->write_level, dev->write_register, offset, maincpu_clk, delta, dev->write_shift);
+ /* transmission complete? */