Jump to content
IGNORED

Text Kernel Approaches


Karl G

Recommended Posts

I was thinking it would be useful to document different approaches to implementing text kernels on the 2600. The one I use in Penult is descended from a version designed to be an add-on minikernel for batari Basic based on a design by @RevEng and implemented by me. It has the advantage of low RAM requirements (just the number of bytes equal to the number of text characters on the line, plus one temp byte). It has a big, unrolled loop for each vertical line of text display, and every other display line is blank to give time to build the characters on the fly and write them to the graphics registers.

 

I've not studied other approaches, but I can only assume that any without missing lines must load the lines of graphics in RAM first before displaying the line of text?

 

Anyway, here is an example of the low-RAM text kernel I use in Penult (24-character). It's a little messy, since it's ripped from my game, and adjusted to use zeropage RAM instead of SuperChip (so the cycle counts in comments are slightly off). I'm curious about other approaches that can be taken for dynamic text in games.

 

text24.asm

text24.bin

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

The 32-line kernel on the PlusCart is made by building a binary (F4) on the ARM while the 6507 is sitting in an idle-display loop running in RAM. The binary consists of hardwired graphics with dedicated load/store values. If you need to change anything on the screen, then you put the 6507 into idle again, and build a whole new 28K binary. When the binary is ready, then you signal the 6507 to exit the idle loop and effectively reset -- which will run the ROM that was just created.

 

When you're running those demos that show the 32-char or 36-char displays, they are just hardwired binaries exactly analogous to what the ARM code would have built anyway. You can't change the text on-the-fly... you need to build a whole new ROM. That's my understanding anyway.  Having an ARM that effectively "feeds" a binary to the '2600, you then have the capability to modify the (or more particularly create a new) binary that can reflect changes in the text displayed.

 

It sounds insane, but actually it works perfectly well for the use-case.

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

  • 1 month later...

I think I figured out a way to eliminate StartFrame1Text and reduce the ram requirements of text24.asm

 

The only difference that I see between ____frame0_text and StartFrame1Text aside from the alternating Text indices is that ____frame0_text has a sleep 4, while StartFrame1Text has a sleep 6

 

To fix this, I use the overflow flag along with this macro to alternate between a 4 and 6 cycle delay: 

    MACRO VSLEEP
    bvs .j0
.j0
    bvs .j1
.j1
    ENDM

 

Link to comment
Share on other sites

21 minutes ago, mzxrules said:

I think I figured out a way to eliminate StartFrame1Text and reduce the ram requirements of text24.asm

 

The only difference that I see between ____frame0_text and StartFrame1Text aside from the alternating Text indices is that ____frame0_text has a sleep 4, while StartFrame1Text has a sleep 6

 

To fix this, I use the overflow flag along with this macro to alternate between a 4 and 6 cycle delay: 


    MACRO VSLEEP
    bvs .j0
.j0
    bvs .j1
.j1
    ENDM

 

Okay, cool, but if you are merging the code from the alternating frames, then how do you handle the alternating text indices? Do you have any sample code showing your approach?

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