BASIC support for odd screen sizes

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

BASIC support for odd screen sizes

Post by Victragic »

Hi all,

nothing like a global shutdown to bring some ideas to fruition. I've been tinkering with this over the last week or so, if something else that does this already exists, please feel free to stop me immediately!

I'm working on a wedge that will enable full 'native' support of different screen sizes. As you would know, the VIC-I is a very versatile chip, in that it allows the user to select any screen size they wish. This is an excellent feature, and pretty unique for machines of that time. Unfortunately, the Vic's firmware only supports a screen size of 22 columns by 23 lines.

On NTSC screens, I understand the borders are quite small, so it's not really possible to make the screen too much larger before the characters disappear out of sight (24 or 25 columns by 27 or 28 rows of 8-pixel characters). On PAL screens, the borders are much larger, and depending on the screen, it's normal to be able to fit 28 or 29 columns by 35 or 36 rows. I get 28 columns by 36 rows on my modern LED screen, and that is also what you will see on many emulators including VICE.

There are numerous 40 column software solutions (among others) and they work - but being 'bitmap' solutions they use a lot of memory and slow the processor down considerably, not to mention the colour map gets thrown out and sometimes the readability suffers as well.

Edit : The program now does the following:
- provides 'native' support for any screen size, up to 32 columns by 36 rows height (1024 bytes maximum)
- detects when the screen has been resized, and recalibrates the screen accordingly
- works for PAL and NTSC (at least from testing on VICE this works)
- fits into 3K memory expansion slot, works for any machine with memory expansion.

The idea came to me as I was looking at my 3K memory expander, wondering what I could possibly want to use this for.

As a further idea, I am also considering providing support for 'double height' characters, however this comes with further compromises. (Edit : I've decided against this for now..)

Updated Link:

https://drive.google.com/open?id=1eOrKi ... JYn_fmn501
Last edited by Victragic on Tue Apr 28, 2020 11:55 pm, edited 2 times in total.
3^4 is 81.0000001
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: BASIC support for odd screen sizes

Post by tokra »

Good to see you again :D I did something VERY similar 3 years ago (has it been that long already?):

http://sleepingelephant.com/ipw-web/bul ... =2&p=92294

On the final page is a version that can be compiled to any screen-size desired. This is not "on the fly" while the program is running, but you need to compile a separate version.

However the .d64 provides several useful versions for PAL and NTSC. You can place the extentsion at several addresses in memory and it takes about 6 blocks, I have options to place it a either $0a00, $ba00 or if you have I/O-RAM at $9a00.
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Re: BASIC support for odd screen sizes

Post by Victragic »

Hi Tokra good to see you too!

Yes your link shows exactly what I was looking for.. looks like I'm reinventing the wheel so to speak.

I may or may not keep going with this.. I learned more about the Vic's firmware than I ever really wanted to this last week..!

Cheers
3^4 is 81.0000001
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: BASIC support for odd screen sizes

Post by Mike »

An auto resize feature would be nice extra regardless. :)

Do you think it would be feasible to retrofit the extra capabilities (like the windowing feature) of the screen editors in BASIC 3.5/7.0?
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Re: BASIC support for odd screen sizes

Post by Victragic »

Hi Mike!

I loved those escape key window functions on the Plus/4 - very useful for editing Vic programs written in 22x23 screen. Will be great if they can be adapted to the Vic as well. Just want to keep it all within 3k, so I'll probably have around 1.5k left to work with.

I've noticed someone has implemented the BASIC 7.0 escape functions for C64, that may be another project in future to bring to the VIC..

..if not, will be a bit more awkward with requiring the user to enter some pokes, but I'm sure will be feasible to implement.

Cheers
3^4 is 81.0000001
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Re: BASIC support for odd screen sizes

Post by Victragic »

I really like the way Maxi-edit can relocate itself in RAM, that's a clever feature. Maxi-edit can also be more compact than this, as trying to be 'dynamic' I have to clear more memory.

And Maxi-edit is indeed excellent. I pondered whether I might discontinue my efforts, however decided I might as well take it a bit further, for no other reason than I'd come this far - but it does provide a couple of differences (unless they are eventually incorporated into Maxi-edit, of course!)

This program is now more or less complete from what I originally set out to do. I've decided against offering a 16-byte character mode for the sake of simplicity. If you don't need it, it's a total waste of memory. Also, while the screen 'windowing' feature is intriguing, it's a separate project in itself.

https://drive.google.com/open?id=1eOrKi ... JYn_fmn501

Load the program "autoresizer.prg",8,1 into any VIC with a 3K RAM expansion (can add more memory but must have a 3K expander.)

Running the program will resize the screen to a (hopefully!) TV friendly size for either PAL or NTSC and perform a 'cool' start, bringing up the familiar boot screen with amount of memory available.

Either Before or after running, you can set the X and Y limits of the screen as follows:

POKE 1037,X (where x is the number of columns)
POKE 1038,Y (where Y is the number of rows - up to a maximum of 36. Any higher value will be limited to 36)

Nothing will change until you enter

SYS 1077, upon which the VIC will resize the screen, centre it, perform a screen clear and continue whatever it was doing. You can change screen formats within a BASIC program.

If you want, you can reboot again by entering SYS 1044.

Note you need to start with the reboot, so that it sets the variables properly.

..and that's it really.
The program doesn't do much to zero-page variables, other than the screen-link variables (217-240) are no longer used, and the NMI vector (792,793) is redirected to ensure the screen doesn't mess up when you perform a runstop/Restore.

As a caveat, make sure the screen is under 1024 bytes or you'll get strange results - ditto if you try to put in column widths greater than the size the 6560/6561 chip can handle.

Also, the screen memory now starts at 7168 instead of 7680 for Vic+3K with no additional memory expansion.
Last edited by Victragic on Wed Apr 29, 2020 6:32 am, edited 1 time in total.
3^4 is 81.0000001
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: BASIC support for odd screen sizes

Post by Mike »

Victragic wrote:Also, the screen memory now starts at 7168 instead of 7680 for 8K Vics.
Just a small remark regarding this one: people usually don't refer to the total amount of RAM in the VIC-20 when they speak of memory requirements for programs. It's for 'unexpanded VIC', for '+3K RAM', for '+8K RAM', etc. Especially speaking of a "8K VIC" could easily be mistaken for a VIC-20 with a +8K RAM expansion.
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Re: BASIC support for odd screen sizes

Post by Victragic »

Ah yes, I'm forgetting that there are now true 8k Vics in the world as well.. the way they should always have been ;)
3^4 is 81.0000001
Post Reply