6502 中的 Sprite 指针(Commodore 64)

Sprite pointers in 6502 (Commodore 64)

所以我正在尝试设置我的 sprite 指针,但我似乎不知道如何去做。

我知道如果我想将指针设置为 $2000 我应该将指针 ($07F8) 设置为#$80 因为 40 * 80 = 2000。但是如果我在上层内存中有我的 sprite 二进制文件怎么办:$C000,我做不到因为那将是 #$300 这太大了。

VIC-II 只能寻址 16KB 的内存。这可能是因为C-64(VIC-40)最初设计时考虑的是16KB RAM,后来Jack Tramiel口述为64K。

所以主存分为4个bank:

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

因此,当您将 VIC-II 设置为第 3 组(即 C000-FFFF)时,$C000 变为 0th 精灵。

Mapping the Commodore 64

中查看 2040-2047 ($07f8-$07ff) 和 53248 ($d000) 的条目

它是 C64 编程的宝贵资源。

正如另一个答案所说,您需要控制VIC-II 芯片的图形库。为 $DD00 映射 C64 中的条目说明了一切:

Bits 0 and 1 of CIA #2 Port A have an extremely important function. As mentioned in the section on the VIC-II chip (53248, $D000), the video chip can address only 16K of memory at a time, and all graphics data must be stored in that 16K block in order to be displayed. Within this area, sprite graphics data may be placed in any of 256 groups of 64 bytes each. Character data can be stored in any of eight 2K blocks. Text screen memory may be in any of 16 IK areas, and bitmap screen memory may be in either of two 8K sections. When you turn the power on, the VIC-II uses the bottom 16K of memory for graphics. Unfortunately, this block of memory is also used extensively for other important purposes. Though some means of eliminating these conflicts are discussed above, in many situations you will want to change from the default 16K bank at the low end of memory. Bits 0 and 1 select the current 16K bank for video memory from the four possible choices using the following bit patterns: 00 (bit value of 0) Bank 3 (49152-65535, $C000-$FFFF) 01 (bit value of 1) Bank 2 (32768-49151, 00-$BFFF) 10 (bit value of 2) Bank 1 (16384-32767, 00-FFF) 11 (bit value of 3) Bank 0 (0-16383, [=10=]-FFF)