Hi everyone,
I have an 8051 boot loader for in-system programming. I have a command protocol that allows me to read and write to flash, XRAM, and IRAM over the in-system communications interface (e.g. UART). I would like to add the four pages (0x00, 0x10, 0x0f, and 0x0c) of SFRs, but of course they can only be accessed directly, not indirectly.
Does anyone have a clever way of taking e.g. an SFR address in the range of 0x80 to 0xff as an input and returning the value of the SFR?
The best idea I have at the moment is a jump table, indexed by (addr-0x80), where each entry is a pre-programmed get/set of the corresponding SFR, followed by a jump to the end (effectively a 128-entry switch statement). Assuming I do the SFR paging and any loop management externally, the smallest I can see to shrink this is 3 bytes per entry (MOV A, addr ; RET), for 384 B to cover the full 128 B address space.
Speed is not of particular importance for this particular application, but code space is.
Cheers, -Lance
Whoa slow down there.. I wasn't asking anyone to slog through anything. I'm simply saying the suggested remapping approach will not work in this case.
Allow me to rephrase to be more explicit: you cannot remap XRAM onto code space on any SiLabs 8051 device of interest to me.