Closed SebastianZug closed 3 years ago
Hi Sebastian, that's a great idea! I also want to add this in wokwi.com some time soon.
Basically, it goes like this:
cpu.data[0]
… cpu.data[31]
cpu.SP
cpu.SREG
cpu.dataView.getUint16(26, true)
cpu.dataView.getUint16(28, true)
cpu.dataView.getUint16(30, true)
You can get their memory space address by looking at the configuration object you passed to the constructor. So for example, if you want the current value for Timer/Counter0, that's the TCNT0
register, and its address will reside in timer0Config.TCNT
. So you can access its value by cpu.data[timer0Config.TCNT]
.
Another example: accessing DDRB (DDR of PORTB) at cpu.data[portBConfig.DDR]
.
Note that you can also use this method to change the value registers if you need. The only exception is cpu.SREG
, which is a read-only property. You can overcome it by writing directly to cpu.data[0x5f]
;
Hello Uri,
I want to access individual registers (timers, counters) etc in a tutorial to then show the "internal" mechanisms in a graph. How can I then access the memory from a js function to read the status?
Greetings !
Sebastian