AndyGarton wrote: ↑Fri Apr 21, 2023 4:49 pm
Apologies if this has already been answered in the thread, but my search skills have let me down - I have an Electron with an ElkSD128 (so plenty of sideways RAM). I've built some games with Ozmoo and they run fine, but are apparently stuck in (I think) mode 6, with an ugly (to me eyes) blue and black stripey background. Is it possible to change to a different mode, ideally an 80 column mode, please?
Excellent timing for this question Andy.
I've been working on Ozmoo to add support for running in other modes on machines with no shadow RAM. With PAGE=&E00 (which you probably have on the ElkSD128), you can usually run in mode 3 (80 columns), mode 4, mode 6 or (on a BBC, of course) mode 7.
Here's 11.39 alpha 45:
https://github.com/ZornsLemma/ozmoo/rel ... 9-alpha-45. I'd like to point out that this really *is* alpha code, because the logic to check whether a game will fit on a particular machine in a particular screen mode is something I find a bit brain-bending (which maybe just means I don't understand it as well as I should, and/or that I'm not looking at it in the cleanest way possible) and I had to twiddle it quite a lot. But since Andy's question came along at just the right time, I figure I'll announce this now and maybe get some other people to do the testing for me.
The most likely bugs as a result of this change are:
- The game offering to run in a certain mode, then crashing when it actually tries to run.
- The game not offering to run in a certain mode when it should actually be able to do so.
- The game complaining about not having enough RAM to run at all when it does.
- The game complaining correctly about not having enough RAM to run at all, but not correctly reporting what the RAM shortfall is.
- The game crashing because there's a syntax error on a line of code to check some aspect of the memory configuration that doesn't get executed very often so I haven't noticed it yet.
The only downside (once I fix any bugs I've introduced
) to this change is that the game you build will (almost) never work on a 32K machine. This was probably more of a party trick than anything useful (if anyone has enjoyed playing an Ozmoo game seriously on a 32K machine I'd be interested to hear about it...), but if it's important to you you can specify --try-support-32k to get the old behaviour. Note the word "try" - there's no guarantee a particular game *can* be run on a 32K machine.
At the risk of stating the obvious, there's no free lunch here - if you run in mode 3 compared to mode 6, there's an extra 8K of RAM used for the screen, so there will be 8K less RAM available for caching the game data and it may run noticeably slower. But if you choose the mode you'd have had forced on you by the older versions of Ozmoo, you're no worse off - you don't pay for something you aren't using.
When using larger screen modes with no shadow RAM you'll probably see temporary screen corruption during a RESTART because the game re-loads itself from disc and will overrun into screen memory; this is transient and the game will clear the screen after it has finished loading.
Mode 3 and mode 6 always have black bars between the lines of text, but obviously you
can't see them won't notice them if the background is black on the lines of text themselves. You can avoid seeing them (even in older versions of Ozmoo) by using CTRL-B to change the background to black, or by specifying --default-bg-colour=0 when running make-acorn.py so the background defaults to black instead of blue. Edit: I forgot that on a BBC, you can tweak the CRTC settings to close up the black bars between the lines even when using non-black backgrounds. I can think about adding support for that in Ozmoo if anyone's interested. I don't believe it's possible to do this on an Electron though.
I've changed the default mode highlight colour on the mode 7 loader screen from red to blue. I don't know if this will be massively controversial or not.
I did like the red, but it felt a bit in your face for something that's important but isn't the central focus of the screen. Feedback on this welcome, and note that (although it might not work in this alpha, for purely hacky reasons) you can always override the default using a custom title page, and I could and probably will add a simple command line switch to control this more easily.
I've also had to create new mode menu layouts for all the different combinations of available modes that might now be experienced at runtime. Suggested tweaks to these layouts are welcome.
Alpha 45 may also be *slightly* faster than the previous release as I've tried to optimise the use of zero page.
Please don't hesitate to report any problems or suggestions. I am particularly interested in reports of brokenness as a result of unusual machine configurations, PAGE values and uses of the --min-mode and --max-mode build options to restrict the modes the game is allowed to run in.
Technical details
For those interested in this kind of thing...
There's also a new --cache-test option to make-acorn.py which adds a CACHTST BASIC program to the generated SSD. This can be run on a second processor (only) to test the host cache.
The reason the "allow mode choice on machine with no shadow RAM" change means games won't run on an unexpanded 32K machine is that in order to keep as much main RAM free as possible (since that's where the screen memory has to live), we don't consider building using the small dynamic memory model for non-shadow machines, and we prefer to use the medium model over the big model. The medium model puts dynamic memory in the first sideways RAM bank, so we must have at least one such bank. (The big model would potentially allow a 32K machine to run a small game with no sideways RAM, but the big model is slower and more complex and it doesn't feel like a good trade off to force its use just to maybe allow a game to run on a 32K machine while also allowing mode choice on a non-shadow machine. The Ozmoo code itself also gets bigger as a result of the complexity, which will reduce the free RAM for the game even further and make it less likely to work on a 32K machine.) --try-support-32k tells the build system to consider using the small model, as it used to, before trying the medium model.
Although it didn't necessarily give the big wins I'd hoped for, I used two tricks to optimise the zero page use:
- I wrote a hacky Python script which would analyse the "acme" report output and calculate how many bytes would be saved by changing each absolute address to a zero page address (taking into account only instructions which actually have a zero page form), so I could see which would shrink the game code most by moving them into zero page.
- I hacked b-em to count how many times an instruction was executed which a) accessed an absolute address and b) had an equivalent zero page form, and ran the benchmark. This allowed me to see which variables might give the biggest performance increase from being moved into zero page.