diff --git a/source/Uthernet2.cpp b/source/Uthernet2.cpp index 7399beb8..dba2c61b 100644 --- a/source/Uthernet2.cpp +++ b/source/Uthernet2.cpp @@ -1407,7 +1407,7 @@ BYTE Uthernet2::IO_C0(WORD programcounter, WORD address, BYTE write, BYTE value, const uint16_t oldAddress = myDataAddress; #endif - const uint8_t loc = address & 0x0F; + const uint8_t loc = address & U2_C0X_MASK; if (write) { diff --git a/source/W5100.h b/source/W5100.h index 169fec93..7d8cec8d 100644 --- a/source/W5100.h +++ b/source/W5100.h @@ -2,10 +2,13 @@ // Uthernet II registers -#define U2_C0X_MODE_REGISTER 0x04 -#define U2_C0X_ADDRESS_HIGH 0x05 -#define U2_C0X_ADDRESS_LOW 0x06 -#define U2_C0X_DATA_PORT 0x07 +// only A0 and A1 are decoded +#define U2_C0X_MASK 0x03 + +#define U2_C0X_MODE_REGISTER (0x04 & U2_C0X_MASK) +#define U2_C0X_ADDRESS_HIGH (0x05 & U2_C0X_MASK) +#define U2_C0X_ADDRESS_LOW (0x06 & U2_C0X_MASK) +#define U2_C0X_DATA_PORT (0x07 & U2_C0X_MASK) // W5100 registers and values