+Karl G Posted March 1, 2021 Share Posted March 1, 2021 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 5 2 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted March 1, 2021 Share Posted March 1, 2021 It's in my immediate plans to document the existing text kernels on the Woodgrain Wizard tiki. Seems like a good home to me. You're welcome to make a start. 4 Quote Link to comment Share on other sites More sharing options...
+Andrew Davie Posted March 1, 2021 Share Posted March 1, 2021 (edited) 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 March 1, 2021 by Andrew Davie 1 Quote Link to comment Share on other sites More sharing options...
mzxrules Posted April 28, 2021 Share Posted April 28, 2021 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 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted April 28, 2021 Author Share Posted April 28, 2021 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? Quote Link to comment Share on other sites More sharing options...
mzxrules Posted April 28, 2021 Share Posted April 28, 2021 (edited) By splitting the string into two strings, and alternating which string i initialize: ; Print A to X text__example1 .byte __A, __B, __E, __F, __I, __J, __M, __N, __Q, __R, __U, __V text__example2 .byte __C, __D, __G, __H, __K, __L, __O, __P, __S, __T, __W, __X text24_modified.asm Edited April 28, 2021 by mzxrules 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.