I am a reasonably experienced developer but totally new to ASM and making games for Atari 2600.
I have decided to tackle this as a bit of a challenge. I specifically want to focus on ASM rather than bB.
I seem to be getting on "ok" with the complex stuff but I am really struggling to visualise how to handle Vertical Positioning. It should be simple enough. I have a hundred examples of working code I can make work but I am not sure I completely understand how the code works.
Can someone help clarify I am on the right track here.
Here is what I think is going on:
*Lets assume my sprite is 20 lines high.
*Lets assume my YPos0 is 80 (from the bottom of the screen)
-- I am looping down through my 192 visible scan lines.
-- On each scan line I am checking of see if we have reached the line where I would like to start to display my sprite.
-- i.e 80+20 being the top of my sprite and 80+1 being the last line.
-- On each of the lines where my sprite intersects the scan line I set the relevant value to GP0 and then when we reach line 79 I set it back to empty.
For some reason in the examples I am working from I can not ever see the calculation / test I am expecting.
in pseudo code I am expecting to see:
if the Current Scanline is equal to or less than YPos0 + Spright Height and Current Scanline is equal to or greater then YPos0 then DRAW THE SPRITE.
Here is one example I have found of code I have running and working but do not understand.
; Get next bitmap byte of sprite 0 MAC DRAW_SPRITE0 sec ; ensure carry set for subtraction lda #SpriteHeight INC YP0 SBC YP0 ;isb YP0 ; INC yp0, then SBC yp0 tay bcs .DoDraw ; outside bounds? lda #0 ; clear bitmap .byte $2c ; (BIT aaaa, skips next 2 bytes) .DoDraw lda (SpritePtr0),y ; lookup sprite bitmap sta GRP0 ; A -> GRP0 ENDM
Any pointers hugely appreciated, sorry if I have made something simple really convoluted, but it is just not going in to my brain.
X position on the other hand, seems simple despite the need to position and then fine position.