On 3/25/25 06:48, Richard Henderson wrote:
On 3/24/25 18:07, Pierrick Bouvier wrote:
A simple nit, maybe we could define constant for register names. This way, it 
can be used
in the two switch for read/access.

Which constant?

    - The absolute address (0x58-0x5f)
    - The i/o port address (0x38-0x3f)
    - or the region offset (0-7)

?  That's where I got stuck and didn't add such.


Something like:

#define RAMPD 0
...
#define SREG 7
#define REG_IOPORT_BASE_ADDR 0x38
#define REG_BASE_ADDR 0x58

And in the switch, we can substract base addresses, so only cases 0..7 are left.

I don't have a strong opinion on names, just thought seeing those 2 address constants + register offset is useful and makes intention clearer.

By the way, are there other architectures where cpu registers are mapped in 
memory like AVR?

Not that I know of.


r~


Reply via email to