deposit logic complete

This commit is contained in:
wixette 2020-03-07 01:51:01 +08:00
parent c907eaac39
commit d3ed30d359
2 changed files with 34 additions and 1 deletions

View File

@ -69,7 +69,7 @@
<input type="button" value="LOAD DATA" onclick="loadData();"> <input type="button" value="LOAD DATA" onclick="loadData();">
</p> </p>
<pre class="comments"> <pre class="comments">
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. db ff d3 ff c3 00 00 // Switch echo between A2 and A1.
3e 8c d3 ff 0f c3 02 00 // Pattern shift.</pre> 3e 8c d3 ff 0f c3 02 00 // Pattern shift.</pre>
@ -264,6 +264,14 @@ db ff d3 ff c3 00 00 // Switch echo between A2 and A1.
function examineNext() { function examineNext() {
sim.examineNext(); sim.examineNext();
} }
function deposit() {
sim.deposit();
}
function depositNext() {
sim.depositNext();
}
</script> </script>
</body> </body>
</html> </html>

View File

@ -418,4 +418,29 @@ class Sim8800 {
this.lastAddress++; this.lastAddress++;
this.showAddressAndData(); 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();
}
}; };