Memory chapter on C64-style banking says:
To bank out the I/O registers such that the 16-bit addresses $D000 – $DFFF access the underlying Chip RAM at 0.D000 – 0.DFFF, clear bits 0 and 1 of location $0001. To restore the I/O registers, set bits 0 and 1 of location $0001.
This is inaccurate. It should say to write a value with bits 0 and 1 are clear to disable I/O, and bit 0 is set and bit 1 is clear to enable I/O. The intent is to recognize that MEGA65 programmers only care about enabling or disabling I/O, and probably do not want to bank in C64 ROM.
This also needs to be revised to emphasize that 0001 is write-only. You can't use TRB/TSB, nor a load-update-store method, to update just those bits in isolation. This section should recommend full 8-bit values for these two states, specifically $84 to disable I/O and $85 to enable I/O. The BASIC sample should be revised to use POKE 1,$84 to disable I/O and POKE 1,$85 to enable I/O.
Note that the BASIC sample does work in its current form, writing (decimal) 240 to disable and 255 to enable, but it would be more generally useful to recommend $84 (132) and $85 (133) instead, because it keeps C64 ROM out of the way when MAPHI is not the BASIC default. Confusingly, POKE 1,241 crashes BASIC, but POKE 1,$85 doesn't, so whatever difference there is between writing 255 (%11111111) and 241 (%11111101) is subtle and off-topic.
Memory chapter on C64-style banking says:
This is inaccurate. It should say to write a value with bits 0 and 1 are clear to disable I/O, and bit 0 is set and bit 1 is clear to enable I/O. The intent is to recognize that MEGA65 programmers only care about enabling or disabling I/O, and probably do not want to bank in C64 ROM.
This also needs to be revised to emphasize that 0001 is write-only. You can't use TRB/TSB, nor a load-update-store method, to update just those bits in isolation. This section should recommend full 8-bit values for these two states, specifically $84 to disable I/O and $85 to enable I/O. The BASIC sample should be revised to use
POKE 1,$84to disable I/O andPOKE 1,$85to enable I/O.Note that the BASIC sample does work in its current form, writing (decimal) 240 to disable and 255 to enable, but it would be more generally useful to recommend $84 (132) and $85 (133) instead, because it keeps C64 ROM out of the way when MAPHI is not the BASIC default. Confusingly,
POKE 1,241crashes BASIC, butPOKE 1,$85doesn't, so whatever difference there is between writing 255 (%11111111) and 241 (%11111101) is subtle and off-topic.