ldy INDICES+0 ldx INDICES+1 lda SORT_BY,x ; SORT_BY[INDICES[1]] cmp SORT_BY,y ; SORT_BY[INDICES[0]] bge next next ldy INDICES+2 cmp SORT_BY,y ; SORT_BY[INDICES[2]] ble next2 next2 ldx INDICES+3 lda SORT_BY,x ; SORT_BY[INDICES[3]] cmp SORT_BY,y ; SORT_BY[INDICES[2]] bge next3 next3 ldy INDICES+4 cmp SORT_BY,y ; SORT_BY[INDICES[4]] bge next4 next4
nactors* { ldy sorted_indices+i ;3 lax actorY,y ;4 sta sort_table,y ;5 lda bucket,x ;4 sta bucketnext,y ;5 tya ;2 sta bucket,x ;5 total 28*na, assuming last frame's sort indices are in zp }
nactors * { ldy sort_table+i ; 3 ldx bucket,y ; 4 lda bucket_next,x ; 4 sta bucket,y ; 5 sta sort_indices+i ; 3 total 19*na }