Jump to content

Question on Zone Height and Doublewide

Recommended Posts

I think I already know the answer to this question through trial and error and experimenting but thought it a good idea to pop it hear incase i'm missing a trick :)


I assume that once set,


set zoneheight 8
set doublewide on

-can not be changed for different screens ? to change something to add some text for in 320 for example I'd use a "topscreen" routine instead?


Background : I want to use a nice small font (like "font" or "alphabet_4_wide") for a short status display but I find with doublewide on, this does not display correctly so I have to revert to a less elegant 8 pixel font with chunkier letters on screen. Assume I cannot change these settings between screens, so have the main game in zoneheight8 and doublewide and pause screen in zoneheight 16 and doublewide off for example?


conclusion so far is that zone heights and doublewide cannot be adjusted after being set ?


Is there any known workaround for this or am I missing something in my understanding of these commands ? Is there a way to use then thinner fonts with a doublewide setup using char tiles.







Edited by Muddyfunster
Link to comment
Share on other sites

The zoneheight can't be changed on the fly in 7800BASIC because it affects a lot of the underlying structures in the code that you don't really see.


As for doublewide I remember similar problems getting text to display properly because I wanted doublewide on for most graphics but not for the text. It's been a long time since, but I think I found that I could import the text graphics before the set doublewide on command and it at least improved the results I was getting. In Spire of the Ancients I'm also directly changing the graphics modes and doublewide setting on the fly by writing directly to CTRL and its copy sCTRL. I don't know how much of 7800BASIC I might be breaking by doing that but it seems to work for me at least.


This page is the best reference if you want to go down that route and if @RevEng doesn't point something I'm missing ?



I'm glossing over a load of detail because I'm not able to type this up on a PC at the moment. Happy to go into more detail / answer follow up questions when I can.

  • Like 2
Link to comment
Share on other sites

As always, SmittyB's answer is on the money. To make this plain, the supported usage is to have zoneheight and doublewide set once at the beginning of your program. Anything else is considered under the hood hacking.


zoneheight affects the way graphics are laid-out in ROM, the dma hole positioning, and how the plot* functions convert a Y coordinate to a zone position (and sub-position). Setting double-wide enables compile-time differences in the functions responsible for storing and plotting character strings, due to character indexes being double what they would otherwise be. I try not to hard-code things into 7800basic, but these are two cases where doing so was a clear win for performance, rom-size, and support headaches.


So far as under the hood advice...


You can change the display mode with the "displaymode" command at any time. As SmittyB said, you can turn off double-wide characters by modifying CTRL and sCTRL. The problem remains that the character plotting routines won't work with your single-wide indexes. You can use "extrawide" data instead of turning on doublewide, but you'd take a hit in performance for any characters that need to be wide. (Maria needs to do twice the look-ups). 


If you really need to change to zoneheight=8 for your text, you'll need to change the heights encoded within the display list itself to accomplish that. You'd need to create the font at 16 pixels tall, with the top 8 being blank; there's no reasonable way to mix the rom layout for graphics intended for different zone heights in 7800basic, even under the hood.

  • Like 2
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.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...