Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- But there is a quicker mental maths way to do this that I use to calculate VRAM addresses. Let's just say you wanted to write to VRAM address $C62E:
- Boundary 0 <=> $0000-$3FFF
- Boundary 1 <=> $4000-$7FFF
- Boundary 2 <=> $8000-$BFFF
- Boundary 3 <=> $C000-$FFFF
- Firstly, find what $4000 byte range the address slots into (Boundary 3). Then you subtract it by that boundary's starting value (in this case, $C000, giving $62E).
- After that, you add the subtracted value by $4000 (Which signifies the VRAM write mode, giving $462E). Now we can put the VDP command together:
- $462E <- That will be your first word of the command, which essentially tells you what relative offset from the boundary to start writing.
- $462E 00 <- Next two bytes are ALWAYS 00. The VDP doesn't use them!
- $462E 00 03 <- Your final two bytes are the boundary your address falls into, in this case 3.
- Combined, you get the final VDP command $462E0003, which will write to the VRAM address $C62E.
Advertisement
Add Comment
Please, Sign In to add comment