Jump to content
IGNORED

VBXE example/tutorial - Using the blitter


Thelen

Recommended Posts

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
  • Like 2
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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".

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...