After delving into the Atari TIA I’ve found that the NUSIZ contains the following: -
Code: Select all
; ATARI 2600 NUSIZ
000 - 1 copy
001 - 2 copies - close
010 - 2 copies - med
011 - 3 copies - close
100 - 2 copies - wide
101 - double size player
110 - 3 copies medium
111 - quad sized player
We don't care about double and quad sized player sprites for Pitfall so we can ignore these
if the distance between sprites are 8 - close, 16 medium and 32 wide (will need double checking) we can then set up the following contants
Code: Select all
; 8, 16 and 32 distance
ONE_COPY. = #$00 ; 00000001 - 1 copy
TWO_COPIES. = #$0A ; 00001010 - 2 copies
THREE_COPIES. = #$0B ; 00001011 - 3 copies close
TWO_COPIES_MEDIUM = #$12 ; 00010010 - 2 copies medium
THREE_COPIES_MEDIUM = #$13 ; 00010011 - 3 copies medium
TWO_COPIES_WIDE = #$22 ; 00100010 - 2 copies wide
Then we can use the following to extract the info we need
AND #$03 - gets the number of copies to plot
AND #$38 - gets the distance between sprites in pixels
NB On the otherhand if the distance is 16, 32 and 64 then we can shift bits 6,5,4 left by one and then use AND #$70 instead to get the distance
We can then create a table to store the objects copies and distances with the following: -
Code: Select all
; Max 12 objects
.Object_NUSIZ_Table
EQUB ONE_COPY
EQUB TWO_COPIES
EQUB TWO_COPIES_WIDE
EQUB THREE_COPIES_MEDIUM
EQUB ONE_COPY
EQUB THREE_COPIES
EQUB ONE_COPY
EQUB ONE_COPY
EQUB ONE_COPY
EQUB ONE_COPY
EQUB ONE_COPY
EQUB ONE_COPY
and then something like the following: -
Code: Select all
.UpdateObject
LDX objectType
LDA Object_NUSIZ_Table,X
STA result
AND #$03 ; get number of copies
TAX ; store into X
LDA result
AND #$38 : STA distance
.loop
JSR UpdateObjectSprite
LDA object_xpos : CLC : ADC distance : STA object_xpos
DEX
BNE loop
.exit
RTS
PS All of the above has not been tested as I don't have access to my development machine so may be rubbish