A common problem for people wiring BASIC is the large amount of memory taken up by the screen display in the higher resolution or colour modes. A common way to mitigate this when writing assembler is to redefine the screen size to be smaller. This is also particularly relevant when looking to convert programs from other platforms that often had 200 (or fewer) lines displayed. It occurred to me that by defining suitable text and graphics windows we could restrict the screen used by the OS and therefore allocate more for BASIC. For MODE 1 you gain 640 bytes for every line so moving from 32 to 30 lines (which is often hardly noticable) gives you 1.25KB back. Moving to a 200 line display as seen on the C64 or CPC gives you over 4K more space to play with.
All the usual text and graphics operations should work except there is now no hardware scrolling and because we're playing with HIMEM this code will need to go outside of a procedure. Reasonably obviously this won't work over the tube or with a shadow screen - but the memory issue is solved in this case anyway.
https://bbcmic.ro/#%7B%22v%22%3A1%2C%22 ... %5Cn%22%7D
Making extra space for Basic by resizing the screen
Making extra space for Basic by resizing the screen
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Making extra space for Basic by resizing the screen
This is cool! I tried (naively) to use this for a mode 5 program I have. I changed 3000 to 5800, but when the program was running, it looked like a scramble of moving pixels was taking up one of the screen lines.. like the code was visibly running in the screen region itself. I probably need to change more numbers in your code?
Re: Making extra space for Basic by resizing the screen
Here' a version for Mode 5 with the comment removed. Change L% to be the number of lines to remove.
Note that there are "only" 320 bytes saved per line so you might want to put the code to do this in a loader or similar unless there are a significant number of lines.
Code: Select all
L%=2
MODE 5
VDU 28,0,31,19,L%
VDU 24,0;0;1279;1023-L%*32;
H%=&5800+320*L%:HIMEM=H%
VDU 23;6,32-L%;0;0;0
H%=H% DIV 8
VDU 23;12,H% DIV 256;0;0;0
VDU 23;13,H% MOD 256;0;0;0
VDU 23;7,34-L%/2;0;0;0
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
Re: Making extra space for Basic by resizing the screen
Thanks Chris! This works a treat, and if I decide on an L% beforehand the whole thing when hardcoded with values compresses down quite well. I can see this opening up a lot of extra functionality for people's projects.
Re: Making extra space for Basic by resizing the screen
It is an add-on, but the boobip os ram module allows the os to be moved to ram but also the space to be used for basic without changing the os, but I forget the details.
Re: Making extra space for Basic by resizing the screen
Yeah, there's plenty of fun things like this, messing around with CRTC and OS. The Advanced User Guide demonstrates a theoretical mode 8 (16 colour mode in 10K)
Rgds
Stephen
Stephen