Jump to content
Karl G

Text Minikernel

Recommended Posts

This is an early version of what I'm calling my "Mark 1" text minikernel, created with extensive help from RevEng. This minikernel can display up to 12 characters of letters, numbers or special characters with no flicker. This version only requires the the user give up one variable. I have modified my "cannons" sample game to make use of it.

 

post-48311-0-58582100-1549054397.png

 

Please see the attached user's guide on how to make use of this minikernel in you game:

 

 

Text Minikernel.pdf

 

Here are the current limitations:

  • There is not enough room on the screen to display both the score and this minikernel at the same time without shrinking the screen. You either have to set "const noscore=1", or shrink the screen with some combination of pfres and/or pfrowheight, or a pfheights definition that equals 82 lines or less. If you are using the Multisprite kernel, then "const screenheight = 82" should work.
  • Multisprite kernel does not currently work due to an issue with "noscore" with that kernel.
  • No support for the DPC+ kernel yet
  • The minikernel, along with all of the associated character data, weighs in at a whopping 1200 bytes, all in the kernel/graphics bank.
  • The minikernel uses a black background. If your game uses COLUBK for a background color other than black, then it will need to be set inside the game loop.

Planned future features:

  • (DONE) Add support for placing most of the code in another bank to save space in the kernel/graphics bank
  • (DONE) Include a score option within the minikernel that would fit without shrinking the screen
  • (DONE) Support for more than 256 bytes of text data (21 messages)
  • (DONE) DPC+ kernel support
  • (DONE) Fix Multisprite kernel support
  • Create a "Mark 2" text kernel to support 24 characters instead of 12. I plan to work on this once development and bug fixes are done on the current version.

 

Version 1.0:

 

text12.zip

  • Like 14

Share this post


Link to post
Share on other sites

This is awesome! This definitely opens up a lot of possibilities!

Share this post


Link to post
Share on other sites

Awesome well done! No flicker ;-)

 

batari Basic is in desperate need of text abilities.

  • Like 1

Share this post


Link to post
Share on other sites

Would it be acceptable aesthetically to have the text be below the score instead of the other way around as shown in the screenshot? I believe that I can eliminate the need to shrink the rest of the screen if I turn off the built-in score routine and provide my own implementation of it within the minikernel instead. Do you think that it will look fine that way, or at least be an acceptable trade-off to make this more compact?

  • Like 2

Share this post


Link to post
Share on other sites

Would it be acceptable aesthetically to have the text be below the score instead of the other way around as shown in the screenshot? I believe that I can eliminate the need to shrink the rest of the screen if I turn off the built-in score routine and provide my own implementation of it within the minikernel instead. Do you think that it will look fine that way, or at least be an acceptable trade-off to make this more compact?

 

I think displaying text below the score is just fine. Being able to use the full screen and text would be awesome.

 

Thanks for making this minikernel, looking forward to see how this develops. :)

Share this post


Link to post
Share on other sites

Merging score and text may mess with the multi kernel framework. I think the bankswitching code is in the score routine.

 

Just looking for gotchas :)

Share this post


Link to post
Share on other sites

I will look into it. The way it would work would be setting noscore=1 internally to disable the built-in score routine, then do the score within the minikernel first (because part of the score pointer setup is done by then even if noscore is set). the text routine could use the same sprite positioning, etc, since both it and the score are 48-pixel routines.

 

I haven't done anything with the multikernel framework, but I definitely want to ensure compatibility, as I can envision the text kernel being particularly useful for a game built with this framework.

  • Like 1

Share this post


Link to post
Share on other sites

Also - could I get a volunteer to test this version with the Multisprite kernel, perchance?

  • Like 1

Share this post


Link to post
Share on other sites

Also - could I get a volunteer to test this version with the Multisprite kernel, perchance?

 

I will do this sometime between this week and next week. Hopefully we can get more people to test this.

  • Like 1

Share this post


Link to post
Share on other sites
  • Add support for placing most of the code in another bank to save space in the kernel/graphics bank

Once you do that, I'll probably use this in every game I make from now on (if I'm using a compatible kernel).

  • Like 1

Share this post


Link to post
Share on other sites

I maybe jumping ahead, any chance for DPC?

 

I intend to do that after I get the other items done (I've added it to the list). It requires a fair amount of hackery, unfortunately, since there are some issues with the DPC+ kernel's support for minikernels.

Share this post


Link to post
Share on other sites

Version 0.2 is up. Changes include:

 

  • Score is displayed before text
  • Both the score and text fit on the screen without shrinking the playfield area
  • Text height reduced from 6 to 5 pixels (this only affected a few characters)
  • 8 new special characters added with the extra space freed:
    • _pl (plus sign)
    • _pc (percent sign)
    • _lp (left parenthesis)
    • _rp (right parenthesis)
    • _co (colon)
    • _sl (slash)
    • _eq (equal sign)
    • _qt (quote)
  • Optional separate background color for the score (as seen in the screenshot)
  • Added a new score font "SQUISH" to the attached score_graphics.asm file. If selected, it reduces the score to 5 lines instead of 8 in the interests of shrinking the screen a bit more (which means more processing time for your game)
  • Like 5

Share this post


Link to post
Share on other sites

One other note: a variable needs to be set aside for "TextIndex" as shown in the cannons example. I was using aux2 for this previously, but that gets used by the pfheights and pfcolors kernel options if those are in use. I'm going to have to update my other minikernel examples that use aux2, since I thought it was always available.

  • Like 2

Share this post


Link to post
Share on other sites

I forgot to include a way to turn off the score, so I've uploaded another update. Those responsible have been sacked.

 

I use "noscore" internally to disable the built-in score routine since I do my own in the minikernel to save lines. To disable the score when using this minikernel, add the following line:

    const noscoretxt = 1
  • Like 3

Share this post


Link to post
Share on other sites

This is really nice KarlG, looking forward / hoping for a DPC+ version!

 

I was working on a project that I shelved (a recut of the BBC Micro game "Yellow River Kingdom") as text in bB without something like this was just too problematic.

 

going to watch this with interest!

  • Like 1

Share this post


Link to post
Share on other sites

I ended up doing some testing with the Multisprite kernel, and the current version of the text minikernel doesn't work with it. I had reported this before, but I had forgotten: the Multisprite kernel's timing gets thrown off when the "noscore" constant is set. The text minikernel sets this internally and draws its own score, so I think this is the cause of the issue.

 

So - Multisprite kernel support for the text minikernel will probably remain broken until someone can identify the cause and fix the issue with the timing of the Multisprite kernel when "noscore" is set. Any assistance with this would be appreciated!

  • Like 1

Share this post


Link to post
Share on other sites

Version 0.4 is up. No updates to the demo, since I've added a feature that it won't make use of. I will create a new demo that makes use of it later. Changes include:

 

  • Added support for more than 21 messages if the "extendedtxt" constant is set. If not set, the minikernel acts as it has previously. If it is set, the following is different:
    • TextIndex refers to the message number (in theory up to 255 if there were space) instead of the character position
    • Processing takes one more scanline in this mode, so you will need to use the SQUISH score font or shrink the screen to make everything fit
    • Due to data alignment issues, 2 out of 3 of every 21st line will have to be skipped in the data (so lines 21 and 42, but not 63, then 84 and 105, but not 126, etc). This is an ugly kludge, but I haven't found a better solution that doesn't take more scanlines or RAM.
  • Percent _pc glyph removed in favor of apostrophe _ap (these are easily enough to customize in the minikernel as needed)
  • A few bugfixes

 

Note that I do plan on doing better documentation once this is closer to complete - I am just sharing it in its early form in the hopes of getting useful feedback, and to keep myself honest about finishing it. :)

 

My next task will probably be support for switching most of the code to another bank to free up space in the graphics/kernel bank. This is also a prerequisite for my being able to add DPC+ kernel support.

  • Like 6

Share this post


Link to post
Share on other sites

Technical question: is there a clever way to programmatically determine the current bank, or determine the bank number where the kernel resides?

Share this post


Link to post
Share on other sites

Yeah, just like any minikernel the scan lines it uses aren't available for processing in overscan, and this one uses a lot of lines. Shrinking the screen a bit can make up for it in projects where that is feasible.

Share this post


Link to post
Share on other sites

The banks are arranged sequentially in memory, so with a bit of DASM symbol math you can get the current and kernel banks. It's a bit kludgy when it comes to DPC+ and 64k...

 

   set romsize 32k

   bank 3

   asm
   ifconst FASTFETCH ; usin DPC+
KERNELBANK = 1
   else
KERNELBANK = (bs_mask + 1)
   endif
   if bankswitch == 64
THISBANK = (((*) & $1F000))/8192 - 14 + bs_mask
   else
THISBANK = (((*) & $1F000))/8192 - 6 + bs_mask
   endif

   echo "THISBANK =",(THISBANK)d
   echo "KERNELBANK = ",(KERNELBANK)d
end
  • Like 1

Share this post


Link to post
Share on other sites

Thanks! That is just what I needed. It looks like the DPC+ kernel turns off FASTFETCH right before going to the minikernel code, so perhaps checking for the DPC_BASE_ADDRESS constant would work for the check for DPC+ instead.

Share this post


Link to post
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.

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