I've been attempting to get some code working using CC65 and I've run into the problem where the VIC-20 kernel doesn't handle the actual screen size, but only the default screen size. I've done a bit of searching and have been unable to find much discussion of this, but I'm guessing that I'm not the first person to tackle this problem. I guess it seems obvious that Commodore did it that way for memory (or maybe performance) reasons, but for a machine with a re-sizable display it's a pain in the a$%#.
Has anybody attempted to unravel what is required to get the kernel functions to work with an arbitrary sized screen?
Is it possible to replace just some of the screen routines, and the rest will function correctly?
Or do you have to replace so much code that it blows out the program size?
Most of the stuff I work with is targeted at expanded systems anyway.
Kernel Routines and Arbitary Screen Size
Moderator: Moderators
My only experience with kernel routines and non-standard screen sizes is with PRNSTR ($cb1e) and PRNINT ($ddcd).
I use this workaround: I place the cursor pointer ($d1) at the right screen location and call PRNSTR or PRNINT normally. Then I call GOHOME ($e581). In machine code:
Works ok for games when you need just some printing (eg. "GAME OVER").
I use this workaround: I place the cursor pointer ($d1) at the right screen location and call PRNSTR or PRNINT normally. Then I call GOHOME ($e581). In machine code:
Code: Select all
my_print:
jsr PRNSTR
jsr GOHOME
rts
- Mike
- Herr VC
- Posts: 4841
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Kernel Routines and Arbitary Screen Size
The number of columns (and, for that matter, also the number of rows) are hardcoded within the screen editor all over the place.hawk wrote:[...] what is required to get the kernel functions to work with an arbitrary sized screen?
You can't replace only parts of the screen editor - there are no vectored calls inside. You'll need to replace the entire code, 1.5 K worth. And hook the replacement into the vectors of BASIN, and BSOUT, like all the 40 column emulators also do.Is it possible to replace just some of the screen routines, and the rest will function correctly? Or do you have to replace so much code that it blows out the program size?
That's the good thing of C. You're always free to write your own versions of printf(), and scanf().I've been attempting to get some code working using CC65 and [...]
TNT has coded a screen print routine which doesn't use the kernal, and allows for custom screen sizes. It's here.
Michael
Yeh, the cc65 conio library just links into the kernal routines. Good for keeping the code size smaller, but doesn't solve the variable screen size issue. It does, however, use the vector address, so I may only need to replace the kernal routines.
My first thought was to just duplicate the kernal routines, replacing the hard coded bits (including the screen line table), but it looks like TNT has come up with a better alternative. I just need to get it to assemble using ca65.
My first thought was to just duplicate the kernal routines, replacing the hard coded bits (including the screen line table), but it looks like TNT has come up with a better alternative. I just need to get it to assemble using ca65.