Hey all,
A program I am working on alters memory, screen location and size, and character set location(36864,36865,36866,36867,36869,52,56,644, and 648. Is there a magic SYS call that I can use to restore all of these locations and continue to run my program without a reset, or should I just save the values I change to variables and recall them back when I need too?
Later,
Preserve or Restore Values
Moderator: Moderators
It might be worth noting that an application that is trying to be well-behaved by resetting the VIC registers after completion to their prior values, should not make the assumption that those values were the ROM-initialised ones...
I guess it depends on the objective - to reset the VIC to it's warm-start state (which is what that ROM routine does) or to reset it to the way it was before the app made any changes during it's execution. So, for example, an app that is a 'helper' in some way (maybe running on an IRQ or from CHARGOT) should definitely put any VIC registers back to how they were before it ran, not how they were after warm-start.
On the other hand, an app that is the 'main' task (a game, utility, etc) that does not reasonably expect to co-exist with other apps, could legitimately reset the VIC to it's warm-start values when exiting.
I guess it depends on the objective - to reset the VIC to it's warm-start state (which is what that ROM routine does) or to reset it to the way it was before the app made any changes during it's execution. So, for example, an app that is a 'helper' in some way (maybe running on an IRQ or from CHARGOT) should definitely put any VIC registers back to how they were before it ran, not how they were after warm-start.
On the other hand, an app that is the 'main' task (a game, utility, etc) that does not reasonably expect to co-exist with other apps, could legitimately reset the VIC to it's warm-start values when exiting.
I guess I'll get into the meat of it. Maybe there is a better way to do what I want. The program I am working on is a loader that displays a 128x128 pixel picture, waits a few seconds and then loads the main program. The main program doesn't take into account for the screen size change, so I was trying to restore the video before the main program was loaded. The SYS calls above work as expected, but leave the display looking at some area of RAM not the intended 7680 location I was expecting. I even POKEd 30 back into location 648 to try to fix this to no avail. Can I maybe do a warm start and use the dynamic keyboard technique or something like that? Or use the input buffer?
Any ideas?
Any ideas?
Rob
The values stored in the KERNAL's table for $9005 (and bit 7 of $9002 I believe) do indeed position the video matrix elsewhere. Presumably to the positions for the expanded Vic-20, but I haven't verified this myself.
For some reason this didn't occur to me before. My apologies.
I haven't tested it, but, try 58648. It initializes IO, clears the screen, positions the cursor HOME, and sets the screen pointers. It only touches $9005 and $9002, so you'll still want to call the previously mentioned SYS to reinitialize the others. The two routines are actually located right next to each other.
For some reason this didn't occur to me before. My apologies.
I haven't tested it, but, try 58648. It initializes IO, clears the screen, positions the cursor HOME, and sets the screen pointers. It only touches $9005 and $9002, so you'll still want to call the previously mentioned SYS to reinitialize the others. The two routines are actually located right next to each other.
Thanks. I'll give it a shot and let you know how it works.
It is a stand alone game I have been working on and assumes a freshly turned on unexpanded Vic.
It is a stand alone game I have been working on and assumes a freshly turned on unexpanded Vic.
Last edited by GreyGhost on Sun Aug 21, 2011 9:06 am, edited 1 time in total.
Rob