Closed ghost closed 3 years ago
Hi Peter, Is this the type of thing you are looking for? https://atariage.com/forums/topic/308806-7800basic-tips-tricks-and-examples/?tab=comments#comment-4581175
That is similar. Is there a limit on wide the graphic can be? I was suggesting the ideal that all the loaded graphics go into an index system.
incgraphic 00 sprite000.png incgraphic 01 sprite001.png : : incgraphic 98 sprite098.png incgraphic 99 sprite099.png
ndx = 98 plotsprite ndx pal posx posy
That is similar how I have been programming games for the 8-bit in assembly code. The sprite source data that gets transferred to player/missile area is looked up in a table that looks something like this: Sprite_Addr_Lo .byte <P000, <P001, <P002,..... Sprite_Addr_Hi .byte >P000, >P001, >P002,.....
It saves a lot of CPU cycles. Not sure if this can be applied to the 7800
If sprites are variable size, may need additional tables Sprite_Size .byte sprite001-sprite000, sprite002-sprite001, sprite003-sprite002 .... sprite_last - sprite999.
Not sure of the official width limits - I originally used sprite strips of 128 pixels wide in Arkanoid. Just make sure to follow the 4 pixel increments so they display correctly.
With the existing PlotSprite feature you cannot use pointers as the generated assembly configures that for you using the image reference - I guess you could take that generated code as a basis to create your own assembly calls. I've found the Animation List FrameIndex lookup pretty good as a replacement but obviously it's not as dynamic.
Mike created this for me https://atariage.com/forums/topic/307436-7800basic-under-the-hood/ which allows non-moving sprites allocated to zones (ie. tiled map) but it does show the sort of thing that can be done via assembly. In Millie and Molly I configure a pointer data list in a similar manner you have shown to update animated tiles.
data titleStarsObjectPointer <title_background1,<title_background2,<title_background3 end
I have to check this stuff out.
The ML hack goes something like this.... ` dim tableplot_sprite =$2200 dim tableplot_palette =$2210 dim tableplot_xpos =$2220 dim tableplot_ypos =$2230 dim tableplot_zone =$2240
asm
Process_tableplot
ldy #tableplot_Max
tableplot_yzone_loop
LDA tableplot_ypos,Y
LSR ; 2 - Divide by 8 or 16
LSR ; 2
LSR ; 2
if WZONEHEIGHT = 16
LSR ; 2
endif
STA tableplot_zone,Y
DEY
BPL tableplot_yzone_loop
LDY #tableplot_Max
tableplot_Sprite_Loop
LDX tableplot_sprite,Y
BEQ no_sprite
LDX tableplot_zone,Y
STX temp5
SEC
LDA dlend+0,X
ADC dlend+1,X
ADC dlend+2,X
CMP #108
BCS no_sprite
LDX tableplot_sprite,Y
BEQ no_sprite
LDA Sprite_Addr_Low,X
STA temp1
LDA Sprite_Addr_High,X
BEQ no_sprite
STA temp2
LDA tableplot_palette,Y
ORA Sprite_Width_TwosCompliment,X
STA temp3
LDA tableplot_ypos,Y
STA temp5
LDA tableplot_xpos,Y
STA temp4
lda #(sprite001_mode|%01000000)
sta temp6
JSR plotsprite
LDY tableplot_Index
LDX tableplot_sprite,Y
CLC
LDA temp1
ADC Sprite_Width,X
STA temp1
BCC No_tableplot_sprite_inc_1
INC temp2
No_tableplot_sprite_inc_1
LDA temp5
CLC
ADC #WZONEHEIGHT
STA temp5
JSR plotsprite
LDY tableplot_Index
LDX tableplot_sprite,Y
CPX #38
BNE no_sprite
LDA temp1
CLC
ADC Sprite_Width,X
STA temp1
BCC No_tableplot_sprite_inc_2
INC temp2
No_tableplot_sprite_inc_2
LDA temp5
CLC
ADC #WZONEHEIGHT
STA temp5
JSR plotsprite
no_sprite
LDY tableplot_Index
DEY
BMI tableplot_done
JMP tableplot_Sprite_Loop
tableplot_done
`
You need to make tables for all the sprite low and high addresses, sizes, #of zones they need, etc. But I think it saves memory compared to using
` for tableplot_index 0 to 9
if tableplot_sprite[tableplot_index] =1 then plotsprite sprite001 p x y
if tableplot_sprite[tableplot_index] =2 then plotsprite sprite002 p x y
if tableplot_sprite[tableplot_index] =3 then plotsprite sprite003 p x y
if tableplot_sprite[tableplot_index] =4 then plotsprite sprite004 p x y
if tableplot_sprite[tableplot_index] =5 then plotsprite sprite005 p x y
if tableplot_sprite[tableplot_index] =6 then plotsprite sprite006 p x y
if tableplot_sprite[tableplot_index] =7 then plotsprite sprite007 p x y
if tableplot_sprite[tableplot_index] =8 then plotsprite sprite008 p x y
if tableplot_sprite[tableplot_index] =9 then plotsprite sprite009 p x y
: : :
if tableplot_sprite[tableplot_index] =99 then plotsprite sprite099 p x y
next tableplot_index
`
Is there a way an index system be added to the next version. Like have "SpriteIndex On" at the top.
Within the program instead of
incgraphic sprite001.png plotsprite sprite001 1 16 36
it will become incgraphic ### sprite001.png plotsprite ### 1 16 36. What ### is the number image loaded and referenced. It will make programs much more dynamic.