MEGA65 / mega65-user-guide

MEGA65 User Guide
75 stars 50 forks source link

Banking Register VIC-III example #610

Closed Pimau closed 2 weeks ago

Pimau commented 2 weeks ago

Describe where we can find the problematic topic

Describe the solution you'd like It isn't wrong, but misleading in my opinion, because not only ROMC gets activated with this value. I was very confused until I found out that the register has already other default values.

Wouldn't it be correct to say: "For example, if you add $20 = %00100000 to $D030, then ROMC is enabled, and the 16-bit addresses $C000 – $CFFF access 2.C000 – 2.CFFF." But this leads into the edge case that the bit could be set before and "adding" creates garbage.

So, would it better, to stay with the other roles of the registers default values: "For example, if $D030 is set from $44 = %01000100 to $64 = %01100100, then ROMC is enabled, and the 16-bit addresses $C000 – $CFFF access 2.C000 – 2.CFFF."

Or move to an example with TSB instead of naming real values?

dansanderson commented 2 weeks ago

Fair enough. I chose that example specifically because that's the boot state value of $D030, and the point is that the only bit in this default value that refers to banking is bit 5 for ROMC. I can clarify: "For example, if $D030 is set to $64 = %01100100, then banking bit 5 for ROMC is enabled... This is the default value for $D030 when you switch on the computer."

("OR'ing" instead of "adding" would fix your example in a general way.)

dansanderson commented 2 weeks ago

Revision:

For example, if \$D030 is set to \$64 = \%01100100, then banking bit 5 is set, and bits 3, 4, and 7 are clear. This means ROMC is enabled, and the 16-bit addresses \$C000 -- \$CFFF access 2.C000 -- 2.CFFF. This is the default state of \$D030 when you switch on the computer.

Pimau commented 2 weeks ago

I like this one. The hint about an default state, even when it is not fully explained at this point, makes a huge difference for rookies.