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

@@ -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();
}
};