diff options
| author | Uri Shaked | 2019-11-25 22:03:40 +0200 |
|---|---|---|
| committer | Uri Shaked | 2019-11-25 22:03:40 +0200 |
| commit | 9b399811c07cc2ab881abacf6ca35107fc6bc658 (patch) | |
| tree | 4200735eeec384baae148c37cca8d0438e274a67 /src/cpu.ts | |
| parent | doc: README for demo, explain about running tests (diff) | |
| download | avr8js-9b399811c07cc2ab881abacf6ca35107fc6bc658.tar.gz avr8js-9b399811c07cc2ab881abacf6ca35107fc6bc658.tar.bz2 avr8js-9b399811c07cc2ab881abacf6ca35107fc6bc658.zip | |
feat: GPIO peripheral implementation
Add new AVRIOPort class, implements GPIO output logic
Diffstat (limited to '')
| -rw-r--r-- | src/cpu.ts | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -19,7 +19,7 @@ export interface ICPU { writeData(addr: u16, value: u8): void; } -export type ICPUMemoryHook = (value: u8, oldValue: u8, addr: u16) => void; +export type ICPUMemoryHook = (value: u8, oldValue: u8, addr: u16) => boolean | void; export interface ICPUMemoryHooks { [key: number]: ICPUMemoryHook; } @@ -43,7 +43,9 @@ export class CPU implements ICPU { writeData(addr: number, value: number) { const hook = this.writeHooks[addr]; if (hook) { - hook(value, this.data[addr], addr); + if (hook(value, this.data[addr], addr)) { + return; + } } this.data[addr] = value; } |
