Jump to content
IGNORED

3-Pixel Horizontal Scrolling (Homebrew)


NaOH

Recommended Posts

The other day I talked to someone who had an Atari, and I got interested in doing homebrew, which I've never done before. Attached are gifs of my first demo (purple), and a 3-pixel scrolling example which could be interesting to some. Normally, the playfield only allows scrolling in 4-pixel increments, so this is interesting perhaps.
 

In the horizontal scrolling example, the playfield isn't used at all. Instead, the cpu rapidly writes different colours to the background color register (COLUBK). This allows image data to be written with 3-pixel precision, because there are 3 pixels per cpu cycle.
 

This means that while drawing to the screen, every single instruction must write to COLUBK, and there is no time for any logic to read image data from the ROM. So, how can dynamic image data -- such as a scrolling marquee -- be produced? Well, during VBLANK, the image data is read from the ROM and is dynamically compiled on the fly into a sequence of bytecode instructions that can produce the image shown, and then that routine is executed directly from RAM. (As an aside, the squishing effect shown below is produced by running subsections of this dynamically-compiled routine a different number of times -- at its thinnest, each section of the routine is run only once. Each section comprises exactly one scanline, so if the section is run multiple times in succession, then it will be stretched vertically.)
 

Are there any other games which are known to execute instructions from RAM? Or is this unusual?

Demo 1:

1756652137_Peek2022-09-1810-01.gif.0eecd66e540a7cda2232bfea574c99b1.gif

 

Demo 2 (3-pixel horizontal scrolling)
47651040_Peek2022-09-2015-44.gif.c5c871f974a48f19ae01c4336b895809.gif

Edited by NaOH
  • Like 5
Link to comment
Share on other sites

Wouldn't you know it -- the thread right before this one is using the same RAM kernal technique as I am. Clever use of SAX too -- I think I will steal that trick to get a fourth colour.

 

Edit: and so does the thread right after! Also using the SAX trick, even! Is there something in the air, or is this just a very common technique?

Edited by NaOH
  • Like 1
Link to comment
Share on other sites

On 9/27/2022 at 2:20 AM, NaOH said:

In the horizontal scrolling example, the playfield isn't used at all. Instead, the cpu rapidly writes different colours to the background color register (COLUBK). This allows image data to be written with 3-pixel precision, because there are 3 pixels per cpu cycle.

You might want to take a look at ISO by JAC! who does the same thing in a really nice way: https://www.pouet.net/prod.php?which=58044

 

On 9/27/2022 at 2:20 AM, NaOH said:

and then that routine is executed directly from RAM.

This works with a lot of cartridges containing RAM like CommaVid and SuperCharger. It does NOT work with SARA aka SuperChip. I don't know about CBS, though. (They all work within microcontroller simulated bankswitching.)

Link to comment
Share on other sites

  • 2 weeks later...

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