External Ports Shadow Registers - BL2100

Hi I am working with a BL2120 Rabbit Computer Board using the RCM2300 rabbit 2000 module. I am new to Rabbit. I see that I can address external ports on the board with functions like WrPortE(). However, I do no understand how can I assign or create a shadow register for an external port (say 0x0001 (DOPA)). I know that there are preset shadow registers for the internal ports (e.g. PDDR is got PDDRShadow) which I have used on functions like WrPortI(), but when it comes to external ports, how exactly do I create a shadow register that I can send as a parameter on the WrPortE() function. How is it that the rabbit processor knows that the data written to that port must always be stored at the corresponding Shadow register for that external port?

I usually define the external ports of the BL2100 board as it is presented on the User Manual:

#define DOPA 0x0001 // (OUT00-OUT07)
#define DOPB 0x0003 // (OUT08-OUT15)

How do I create valid DOPAShadow & DOPBShadow register in memory, so that I can read them at any time and get the status of these ports?

I’d appreciate if anybody can help me with this matter. Any example code would be deeply appreciated.

I have been looking at the way the Shadow registers are implemented in the Rabbit BIOS code.

Overall I see the following:

  1. Declare Shadow Register as a char variable.
  2. Initialize Port & Shadow Register with default values.

Based on this, would the code bellow be correct to implemente my external port shadow register?

#define EXT_PORT 0x0001
#define EXT_PORTShadow &MyRegShadow

//Declare Shadow Register:

char MyRegShadow;

//Initialize Port & Shadow Register

ld a, 0x45
ioe ld (EXT_PORT), a
ld (EXT_PORTShadow), a

I would appreciate if you can help me with this matter.