Jump to content

The Southsider

  • entries
    81
  • comments
    767
  • views
    136,062

13 Lines

Sign in to follow this  
cd-w

1,270 views

I decided to experiment again with my textkernel to see if copying the text into zero page memory would be useful. The advantage of using zero page RAM to hold the text is that it removes the need for the text to be in the same bank as the display kernel. The text can be loaded into RAM in one bank and then displayed by bank-switching into the display kernel. Another practical advantage is that it becomes possible to create text dynamically in RAM without the need for the text to be fixed in ROM.

 

Fortunately, copying into RAM didn't impose too much of a penalty and it allowed the buffer creation code and display kernel code to be overlapped. As a result, I can now display 13 lines of text on the screen, as shown below:

 

blogentry-6563-1203008168_thumb.png

 

The kernel takes up a whole 4K bank now and is fairly RAM heavy, though some overlapping may be possible (as suggested by supercat in the last entry). The text data is double-buffered, so it would actually be possible to display the last line of text immediately after the second last, though this would look a little odd. I am reasonably happy with this now, as it manages the same number of lines on-screen as the ET Book Cart, while flickering much less! I think this is really as far as it will be possible to go with this approach, without merging the text characters in advance, though I said that last time!

 

I think this would now make a very nice kernel for a text adventure as it enables text to be loaded from anywhere in ROM. I'm not too keen on this kind of game, so I probably won't be doing it myself. However, I've attached the source code and anyone is free to use it in their own projects (though drop me a line first if you do).

 

Chris

 

Edit: textkernel3.zip is the new 13 line kernel, and textkernel_zp.zip is the 12 line kernel from the previous post adapted to use zero page RAM.

 

textkernel3.zip

textkernel_zp.zip

font.zip

Sign in to follow this  


8 Comments


Recommended Comments

I've got an idea for a game that needs some text display, although really only about four lines. I'll take a look at the kernel and see how I can adapt it. I'll be talking more about my game when I get more code done. Thanks!

Share this comment


Link to comment

I haven't looked at your code yet; could you avoid the need for four versions of the kernel by using the two "frames" on alternate lines (so the first line of text starts with sprites to the left; the second line starts with sprites to the right; etc.)? Otherwise, any possibility of pushing things out to 26 characters? Even if your kernel sprawls into two banks that shouldn't be the end of the world.

Share this comment


Link to comment
I've got an idea for a game that needs some text display, although really only about four lines. I'll take a look at the kernel and see how I can adapt it. I'll be talking more about my game when I get more code done. Thanks!

 

You are welcome to use my code, and I'm interested to hear about your new game. The kernel only displays a single line of text (called 13 times from a loop) so it will be easy to display fewer lines. I've attached another kernel above (textkernel_zp.zip) which displays 12 lines from RAM - this is a much smaller and simpler kernel, so it may be more suitable for your needs.

 

Chris

Share this comment


Link to comment
I haven't looked at your code yet; could you avoid the need for four versions of the kernel by using the two "frames" on alternate lines (so the first line of text starts with sprites to the left; the second line starts with sprites to the right; etc.)? Otherwise, any possibility of pushing things out to 26 characters? Even if your kernel sprawls into two banks that shouldn't be the end of the world.

 

This may be possible - I need to look at the code again. I still have no idea how you managed to get 26 sprites on a line - does it require hitting RESPx mid line?

 

Chris

Share this comment


Link to comment
You are welcome to use my code, and I'm interested to hear about your new game. The kernel only displays a single line of text (called 13 times from a loop) so it will be easy to display fewer lines. I've attached another kernel above (textkernel_zp.zip) which displays 12 lines from RAM - this is a much smaller and simpler kernel, so it may be more suitable for your needs.

 

If my game goes as I plan, I'll need to be able to show a couple of lines of text beneath some basic player pictures, plus some more text as horizontal or vertical menu (using a missile or maybe playfield to highlight choices), and finally a couple of lines of rather dynamic text to be used to show the results of actions. I just DLed the code, so I'm reading up to see how much setup I need, plus just how much RAM it will take to store my text.

Share this comment


Link to comment

I noticed you didn't include font.h in your archive. What's the format of this? Can you upload it too, or is it in another post.

Share this comment


Link to comment
This may be possible - I need to look at the code again. I still have no idea how you managed to get 26 sprites on a line - does it require hitting RESPx mid line?

 

There's a four-line pattern; take a break every seven lines if that's your font height. So the first row of text does lines 0-3 and 0-2 of the pattern. The second does lines 3, 0-3, and 0-1. The third does 2-3, 0-3, and 0. The fourth does 3, 0-3, and 0-1. HMP0 and HMP1 should both be zero.

 

On line 0 of the pattern, STA RESP0 on cycle 38 and STA HMOVE on cycle 71.

On line 1, just STA HMOVE at cycle 71.

On line 2, STA RESP1 on cycle 38 and STA HMOVE on cycle 71.

On line 3, just STA HMOVE at cycle 71.

 

Each line pair only requires spending nine cycles moving sprites. I would guess your present code probably spends about 17 cycles (one LDA#imm, two STA HMPx, one STA HMCLR, and two STA HMOVE). Adding an extra column would increase the "prep" time, but would actually save two cycles in the kernel (assuming six cycles to load the shape)

Share this comment


Link to comment
I noticed you didn't include font.h in your archive. What's the format of this? Can you upload it too, or is it in another post.

 

The font file is now attached (in font.zip).

 

Chris

Share this comment


Link to comment
Guest
Add a comment...

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