Jump to content
IGNORED

Bitmapped Display Template


SmittyB

Recommended Posts

He's being too nice to say that he put it together because I requested help with creating a bitmapped display using 7800basic.

 

It has already been a great help, and your comments have helped what I hadn't yet understood yet from the 7800 software guide, so thank you very much for putting this together @SmittyB

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

7 hours ago, Stephen said:

the 7800 doesn't have a conventional frame buffer does it?

No it doesn't. Essentially the 7800's strength is in drawing large sprites, so I'm filling the screen with rows of sprites and telling the system that their graphics data can be found in RAM rather than ROM, then as long as I write to that area of RAM in the correct order I can put a dot anywhere within the bounds of those sprites.

 

With the ability to put a dot on the screen that then opens up the ability to plot the points of a line (though there are more efficient ways than drawing it point by point), and once it's possible to draw lines then it's possible to draw shapes including maybe wireframe 3d which I would love to see.

 

This 256x192 bitmap takes 6k to store, so in a typical 128k + 16k RAM cartridge it would be possible to double buffer the screen and have 4k plus the system RAM left over. If one were quick enough, it would also be possible to bankswitch RAM while in vblank to process the game state before switching back to do the drawing.

  • Like 4
  • Thanks 2
Link to comment
Share on other sites

One possible variation that anyone looking into implementing this should be aware of. The 7800 Rescue On Fractalus proto uses "mirror ram" (where each even page is mirrored to the next odd page) to draw graphics at half the vertical resolution. While a coarser resolution doesn't seem like a bonus feature, it does mean you have less screen to update, which speeds up your screen updates.

 

a7800, concerto, and the 7800 MiSTer core all support the mirror ram header flag. Implementing mirror ram in any real-hardware cart with ram is trivial - just lift one memory chip leg and ground it.

 

1 hour ago, Karl G said:

It's not listed in the manual..

Oops! I guess I have an update to make.

  • Like 3
Link to comment
Share on other sites

Another nice advantage of that mirror mode is that you can then bitmap with the 160 modes and get square pixels which might look better in some circumstances.

 

Speaking of 160A, it should be fairly simple to modify the code as it relates to getting the bitmask to allow for 4 colours. You could adjust the offset into the table so that the first set of entries are the offsets for colour zero, the next for colour one, etc. You could even have it so that adjacent x coordinates write to the same pixel as a sort of free sub-pixel accuracy, and you wouldn't need to account for the ratio difference between x and y elsewhere in the program.

A lovely side-effect of the 7800's wide pixels is that a 160A bitmap would have the same footprint in memory as a 320A one so you don't need to have separate lookup tables for each version relating to how the lines are arranged.

 

I might have a play around with those ideas and see how things go.

 

  • Like 2
Link to comment
Share on other sites

I've made the adjustments to the 160A drawing and have adjusted the 320A drawing with similar logic. Rather than using EOR to erase the lines by drawing over them again, you  specifically choose the colour and it will draw in that colour. That gives much better results when lots of drawing is happening in a small space such as the middle of the circle.

 

0188.png.c26afab8de967aecd7ed6313ed4f677b.png

 

On this updated ROM you can press select to switch between the 320A and 160A loops.

JS7800

 

0186.png.1085ea212dc94184ae289d9f16bf77e0.png

 

 

BitmapTemplateV2_220123.a78 BitmapTemplate.bas

  • Like 5
Link to comment
Share on other sites

320B would definitely be doable with kangaroo mode enabled for 4 hi-res colours. In terms of drawing it would essentially be equivalent to 160A but with modified masks as the bits are in a different order.

 

The tricky bit is that while 160A and 320B are both 2bpp modes, with 160A's wide pixels it takes up the same screen space as 320A whereas 320B is drawn half as wide. That means unless you're happy with a 160 pixel wide bitmap you need an extra DL entry per zone, double the memory to hold the bitmap, and double the processing power to draw something the same visible size.

  • Like 1
Link to comment
Share on other sites

Yep, there's enough DMA time for that (you'd actually need multiple objects, due to the 32 byte limit) and you'll probably have gas in the tank for other objects on top. You can fill the screen with the more expensive modes, provided you're not doing it with an excessive number of objects.

 

One thing that may help you to transfer experience between modes... The cheap modes (160A, 320A, 320D) are all equivalent in terms of DMA-used-for-%-screen-coverage, and the expensive modes (160B, 320B, 320C) are also equivalent for the same metric.

  • Like 3
Link to comment
Share on other sites

To be more specific, 256 pixels in 320[BC] can be done with 2 objects, 64 bytes each, using 5-byte headers. That works out to 212 MARIA cycles per line which does leave time for several small objects.

 

That's similar to what I'm doing in 7ix, which is 192 pixels across and in 320C. By my calculations I will be right at the limit, maybe slightly over, in the unlikely event that all objects are in the same zone. (BTW my progress has been rather sporadic, I keep taking breaks for RL stuff and/or doing music, but I'm hoping to do an alpha release sometime soon.)

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