At least running VICE 2.4:
PRINT PEEK(53280)
254
POKE 53280,14
PRINT PEEK(53280)
254
It's clear that only bits #0-#3 are used, and that the "correct" value is obtained with AND 15
, but why does the 6510 set the upper bits to 1
?
The 6510 CPU doesn't set the unused higher bits to 1; rather, there is no memory backing the higher bits in the appropriate VIC registers. So what happens is that the CPU puts whatever 8-bit value on the data bus when writing, but the VIC chip only stores the lower 4 bits; then later, when the CPU tries to read from that address, it puts 53280 on the address bus, and the VIC chip needs to put all 8 bits on the data bus. But it has only stored the lower 4 bits; the higher 4 bits will need to be faked up as 1.
Of course, it could also pick other fake values for these extra bits (e.g. it could use all 0s); the point is, it has to be a fixed value, since the real 4 bits were never stored anywhere.