+Stephen Posted February 2, 2023 Share Posted February 2, 2023 I finally got my code working. Order of operations is very important! Clear_Buffers Initial_Sprite_Position_Setup Save_Mask1 in both buffers so the initial restore mask works Main Loop logic: Clear ATTRACT flag Restore_Mask1 (Blitter operation) Flip_Screen (swap buffers - i.e., set values in BCBs) Setup Sprite positions in the BCBs Increment Animation counter Setup new sprite positions Save_Mask1 (Blitter operation) Draw_Object1 (Blitter operation) Wait for VSync and jump to beginning 2 Quote Link to comment Share on other sites More sharing options...
+Stephen Posted February 3, 2023 Share Posted February 3, 2023 As quick as the programming gods giveth, they take away. I extended my code to 2 sprites, and it's broken I wonder, how the hell do I keep coming up with code that only works in one specific case? Frustrating as always. 1 Quote Link to comment Share on other sites More sharing options...
+Stephen Posted February 3, 2023 Share Posted February 3, 2023 Fixed. The new .vbxe_traceblits compact command is awesome! That and a single breakpoint and I found the issue. Here's my initial Save_Masks code for the 2 objects (and both buffers): Save_Masks VBXE: Starting new blit at $00013F - BLT_SAVE_MASK1_16_16: Copy 16x16 [$23C98, +1, +256] -> [$40000, +1, +256] VBXE: Starting new blit at $000154 - BLT_SAVE_MASK2_16_16: Copy 16x16 [$24C00, +1, +256] -> [$40010, +1, +256] Flip screen & Save_Masks VBXE: Starting new blit at $00013F - BLT_SAVE_MASK1_16_16: Copy 16x16 [$33C98, +1, +256] -> [$50000, +1, +256] VBXE: Starting new blit at $000154 - BLT_SAVE_MASK2_16_16: Copy 16x16 [$34C00, +1, +256] -> [$50010, +1, +256] Can you spot the issue with my Restore_Masks? ----- New Frame ----- VBXE: Starting new blit at $000115 - BLT_RESTORE_MASK1_16_16: Copy 16x16 [$40000, +1, +256] -> [$23C98, +1, +256] VBXE: Starting new blit at $00012A - BLT_RESTORE_MASK2_16_16: Copy 16x16 [$40010, +1, +256] -> [$34C00, +1, +256] How can that be? The BCBs are chained. It turns out the issue was: ; Restore then flip buffers jsr Restore_Masks jsr Flip_Screen So - the blitter started but the flip screen code swapped buffers while the blitter was still active. So I added code to the Restore_Masks to not return until the blit is finished. While this does prevent parallel execution of the blitter & 6502, I felt it was better than delaying the jump to Flip_Screen. 2 Quote Link to comment Share on other sites More sharing options...
Yaron Nir Posted February 4, 2023 Share Posted February 4, 2023 @Stephenhow do you work with .vbxe_traceblits? i set it 'on' but don't know what else? Quote Link to comment Share on other sites More sharing options...
+Stephen Posted February 5, 2023 Share Posted February 5, 2023 18 hours ago, Yaron Nir said: @Stephenhow do you work with .vbxe_traceblits? i set it 'on' but don't know what else? After it is set to on (or compact), simple let your code run and any blits that are performed get output to the debug window. I find it helpful to initially perform a .logopen 1st so output will be captured to a text file. Also, while debugging my code I have actually been only letting it run a single frame and then requiring a keypress to run the next frame. This keeps the log output small and easier to see exactly what is going wrong. BTW - here's a helpful tip as well. Let's say you know your BCBs start at $0100 in VBXE memory. The following command will show then neatly, one per line (unexpanded of course). Run this without the quotes "db v:$100 L100 -w 21". To see the BCB "translated", use ".vbxe_bl v:$100". 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.