diff --git a/index.html b/index.html index 7ca3887..3f75a7c 100644 --- a/index.html +++ b/index.html @@ -69,7 +69,7 @@

-Examples - binary data of simple programs:
+Examples - binary data of some tiny programs:
 db ff d3 ff c3 00 00       // Switch echo between A2 and A1.
 3e 8c d3 ff 0f c3 02 00    // Pattern shift.
@@ -264,6 +264,14 @@ db ff d3 ff c3 00 00 // Switch echo between A2 and A1. function examineNext() { sim.examineNext(); } + + function deposit() { + sim.deposit(); + } + + function depositNext() { + sim.depositNext(); + } diff --git a/js/sim8800.js b/js/sim8800.js index d3b7103..ac25b68 100644 --- a/js/sim8800.js +++ b/js/sim8800.js @@ -418,4 +418,29 @@ class Sim8800 { this.lastAddress++; this.showAddressAndData(); } + + /** + * Writes a byte to the given address. + */ + deposit() { + if (!this.isPoweredOn) + return; + if (this.getInputAddressCallback) { + // Only 8 bits of input is considered. + var value = this.getInputAddressCallback() & 0xff; + this.getWriteByteCallback()(this.lastAddress, value); + this.showAddressAndData(); + this.dumpMem(); + } + } + + /** + * Writes a byte to the next address. + */ + depositNext() { + if (!this.isPoweredOn) + return; + this.lastAddress++; + this.deposit(); + } };