Archived
1
0

add mem_write and mem_read functions

This commit is contained in:
Erick
2022-02-05 01:14:29 +01:00
parent 385a32aee2
commit 4af438a297
+16
View File
@@ -144,6 +144,22 @@ int read_image(const char* image_path) {
return 1;
}
void mem_write(uint16_t address, uint16_t val) {
memory[address] = val;
}
void mem_read(uint16_t address) {
if(address == MMR_KSR) {
if(check_key()) {
memory[MMR_KSR] = 1 << 15;
memory[MMR_KDR] = getchar();
} else memory[MMR_KSR] = 0;
}
return memory[address];
}
int main(int argc, const char* argv[]) {
if(argc < 2) {