assembly6502commodore

Sprite pointers in 6502 (Commodore 64)


So I'm trying to set my sprite pointers, but I can't seem to find out how to do it.

I know that if I want to set the pointer to be let's say $2000 I should set the pointer ($07F8) to #$80 since 40 * 80 = 2000. But what if I have my sprite binaries in the upper ram: $C000, I can't do that since that would be #$300 and that's to big.


Solution

  • VIC-II can address only 16KB of memory. This is probably because C-64 (VIC-40) first designed 16KB RAM in mind, later Jack Tramiel dictated that it will be 64K.

    So the main memory divided into 4 banks:

    0000-3FFF (0)
    4000-7FFF (1)
    8000-BFFF (2)
    C000-FFFF (3)
    

    So when you set VIC-II to 3rd bank (that is C000-FFFF) $C000 becomes 0th sprite.