Jump to content
IGNORED

Trouble with asymmetrical reflected playfield


Recommended Posts

Hello there! First, I want say thanks to everyone who's previously posted and answered questions here. As a struggling noob, I've already had about a million problems solved by scouring these boards. Unfortunately, I haven't been able to sort this issue out on my own.

 

I'm trying to create an asymmetrical stage using only playfields one and two. I got close, but I wasn't able to get the redraw of playfield 2 started at the correct spot. To illustrate what's happening, I changed the bitmap for the pf2 redraw to solid blue. If things were working correctly, that chunk of black at the top left of the pf2 redraw wouldn't be there. You'd just see a solid blue rectangle. Instead, it looks like the left pf2 is being reflected until about 1/4 of the way down the map. Here's the code snippet for this area. Any help would be much appreciated!

 

ScanLoop
    sta WSYNC            
        
    lda PFBitmap1,y     
    sta PF1           
        
    lda PFBitmap2,y     
    sta PF2            
        
    sleep 26
        
    lda PFBitmap3,y     
    sta PF2            

    lda PFBitmap4,y     
    sta PF1            
       

    dey            
    bne ScanLoop

Level_1_Problem.png

Link to comment
Share on other sites

I haven't fully gotten my head around page boundaries. Would you be able to explain how I might manage the alignment of the four PFBitmaps? Here's the table for PF1 on the left side.

 

PFBitmap1
    hex 00
    hex 00000000000000000000000000003f3f
    hex 3f3f3f3f3f0033333333333333202020
    hex 20202020202020202020202020202020
    hex 20202020202020202020202020202020
    hex 202020202020202020203f3f3f3f3f3f
    hex 3f202626262626262620202020202020
    hex 20202020202020202727272727272720
    hex 27272727272727202020202020202020
    hex 20202020202027272727272727202626
    hex 26262626262020202020202020202020
    hex 202020203f3f3f3f3f3f3f003f3f3f3f
    hex 3f3f3f00000000000000000000000000

Link to comment
Share on other sites

An 'align 256' statement placed on the line before the array label would make sure that it would start at a page boundary (pages are 256 bytes).  The downside is that the ROM will be padded with zeros to make that happen.  So you'll want to keep that in mind if/when you start running out of space.

  • Like 1
Link to comment
Share on other sites

Thanks! That worked like a charm! I do have one more question, though. If I plan to create multiple levels with different maze structures inside the box, do you have any recommendations for efficiently storing the arrays? Is space going to be an issue if I'm trying to make 30 or so screens? I'm a little confused as to where exactly this information is stored and how to see how much space I have remaining. 

Level_1_Fixed.png

Link to comment
Share on other sites

1 hour ago, SUPERDIVORCE said:

If I plan to create multiple levels with different maze structures inside the box, do you have any recommendations for efficiently storing the arrays?

Well, for starters, you have a lot of repeating data: 22 rows are displayed, but there's data for every single scanline.  You can reduce that data, IF you add another counter to your display loop (using the X register), and only increment/decrement it every 8 scanlines, THEN you could use that as your array index instead.

 

Before your display kernel, load X with 21, and then insert this into your display kernel loop after your second STA PF1:

  TYA              ;-- transfer Y reg (scanline counter) to A reg
  AND  #7          ;-- mask off everything but the lower bits (will give a number 0..7, essentially (Y mod 7))
  BNE  notNextRow  ;-- branch if not zero
  DEX              ;-- move to next row  (could also be INX... all depends which way you want to count)
notNextRow:

If you want to use INX instead, just load X with 0 instead before the loop.   All depends on which direction you want to store your data.

 

-----

 

1 hour ago, SUPERDIVORCE said:

I'm a little confused as to where exactly this information is stored and how to see how much space I have remaining. 

 

The array data is stored in ROM.  The easiest way to see where something is in ROM, like PFBitmap1, would be to do:

  echo "PF1Bitmap is located at ",PF1Bitmap

 

Then, when running DASM, you'll see that listed in the output on the console/terminal window.

 

  • Like 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...