Jump to content

Photo

Text Minikernel


90 replies to this topic

#1 Karl G OFFLINE  

Karl G

    Dragonstomper

  • 735 posts

Posted Mon Jan 28, 2019 1:29 PM

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.

 

cannonstxt.bas_2.png

 

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

 

Attached File  Text Minikernel.pdf   96.22KB   0 downloads

 

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.

This is an early version, so feedback and bug reports will be greatly appreciated!

 

Version 0.8:

 

Attached File  text12.zip   137.17KB   3 downloads



#2 KevKelley OFFLINE  

KevKelley

    Chopper Commander

  • 150 posts
  • Lots of hobbies, little time, loads of fun.
  • Location:Orlando

Posted Mon Jan 28, 2019 3:09 PM

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

#3 mksmith OFFLINE  

mksmith

    Star Raider

  • 68 posts
  • Location:Melbourne, Australia

Posted Tue Jan 29, 2019 12:02 AM

Awesome well done! No flicker  ;-)

 

batari Basic is in desperate need of text abilities.



#4 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Tue Jan 29, 2019 8:05 AM

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?



#5 Impaler_26 OFFLINE  

Impaler_26

    Cookie Meister

  • 2,677 posts
  • Braindead
  • Location:Hueco Mundo

Posted Tue Jan 29, 2019 11:54 AM

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



#6 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,308 posts

Posted Tue Jan 29, 2019 3:49 PM

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 :)



#7 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Tue Jan 29, 2019 4:12 PM

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.



#8 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Tue Jan 29, 2019 4:24 PM

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



#9 Trip2018 OFFLINE  

Trip2018

    Star Raider

  • 84 posts
  • Furry (I'm not gay I swear!)
  • Location:nebraska

Posted Tue Jan 29, 2019 8:52 PM

Finally someone picked up on this! I see a lot of great opportunities.

#10 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,308 posts

Posted Wed Jan 30, 2019 12:49 PM

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.



#11 Random Terrain ONLINE  

Random Terrain

    Visual batari Basic User

  • 28,867 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Wed Jan 30, 2019 1:38 PM

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

#12 Lewis2907 ONLINE  

Lewis2907

    Moonsweeper

  • 318 posts
  • Location:Senatobia, MS

Posted Wed Jan 30, 2019 2:50 PM

I maybe jumping ahead, any chance for DPC?

#13 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Wed Jan 30, 2019 4:38 PM

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.



#14 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Fri Feb 1, 2019 3:36 PM

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)


#15 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Fri Feb 1, 2019 3:44 PM

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.



#16 Tony The 2600 ONLINE  

Tony The 2600

    Moonsweeper

  • 424 posts
  • 1.19 MHz
  • Location:Adelaide, Australia

Posted Fri Feb 1, 2019 7:59 PM

Looking good :thumbsup:



#17 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Sat Feb 2, 2019 6:58 AM

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


#18 Muddyfunster OFFLINE  

Muddyfunster

    Moonsweeper

  • 285 posts

Posted Sat Feb 2, 2019 7:59 AM

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!



#19 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Sun Feb 3, 2019 11:25 AM

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!



#20 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Mon Feb 4, 2019 9:11 PM

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.



#21 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Tue Feb 5, 2019 2:17 PM

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



#22 Sprybug OFFLINE  

Sprybug

    Dragonstomper

  • 568 posts

Posted Tue Feb 5, 2019 9:13 PM

Ooooh. I can so use this in Zed.  does it eat cycle time?



#23 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Tue Feb 5, 2019 9:47 PM

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.

#24 RevEng OFFLINE  

RevEng

    Bit Player

  • 5,105 posts
  • Location:bottom of the stack

Posted Tue Feb 5, 2019 10:07 PM

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


#25 Karl G OFFLINE  

Karl G

    Dragonstomper

  • Topic Starter
  • 735 posts

Posted Wed Feb 6, 2019 5:29 AM

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.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users