Dandaman955

CVA

Sep 7th, 2017
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Hey. I dunno if anyone's interested, but I've had this guide sitting about for like a year, and I thought I'd post an easy method of calculating VRAM  addresses in your head, so you can save time over getting a converter if you learn it.
  2.  
  3. Let's just say you wanted to write to VRAM address $C62E:
  4.  
  5. Boundary 0  <=>   $0000-$3FFF
  6. Boundary 1  <=>   $4000-$7FFF
  7. Boundary 2  <=>   $8000-$BFFF
  8. Boundary 3  <=>   $C000-$FFFF
  9.  
  10. 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).
  11. 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:
  12.  
  13. $462E <- That will be your first word of the command, which essentially tells you what relative offset from the boundary to start writing.
  14.  
  15. $462E 00 <- Next two bytes are ALWAYS 00. The VDP doesn't use them!
  16.  
  17. $462E 00 03 <- Your final two bytes are the boundary your address falls into, in this case 3.
  18.  
  19. Combined, you get the final VDP command $462E0003, which will write to the VRAM address $C62E. If you wanted to turn DMA on, you'd add $80 to your value ($83).
  20.  
  21. This is mainly for calculating VRAM addresses but a similar concept can be applied to other modes. Change the +$4000 value of the first word to +$C000 for CRAM write, and you'd add $10 to the boundary byte to change it to VSRAM write. I don't think it's worth covering the lesser-used modes such as read, as it will end up confusing matters.
Advertisement
Add Comment
Please, Sign In to add comment