VICMON's destroying BASIC!

Basic and Machine Language

Moderator: Moderators

Post Reply
randolph.pickle
Vic 20 Amateur
Posts: 55
Joined: Thu Nov 27, 2014 10:50 am

VICMON's destroying BASIC!

Post by randolph.pickle »

Hi guys. I'm having a bit of a problem I hoped y'all could help with.

When I have a BASIC program in memory, then run VICMON and exit from it, my BASIC program is destroyed! I know that VICMON uses several spots in zero page, and I've tried using the .E command (.E1D00 at start, .E0000 before I use .X), but it's still fudging memory between the time I use .E0000 and the time I'm back in BASIC.

Any helpful workaround would be greatly appreciated.
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Re: VICMON's destroying BASIC!

Post by eslapion »

@randolph.pickle
What memory configuration do you have when this happens?

VICMON is designed to be able to scroll up and down when disassembling or interpreting the memory content. However, the backward scroll only works if your screen memory is at the normal location for an unexpanded VIC.

If you have 8k or more of memory expansion, VICMON does not take into account the screen location change and will corrupt the content of memory at the normal screen location if you try to scroll backwards. If you have a basic program then it will get destroyed.
Be normal.
randolph.pickle
Vic 20 Amateur
Posts: 55
Joined: Thu Nov 27, 2014 10:50 am

Re: VICMON's destroying BASIC!

Post by randolph.pickle »

Thanks for the suggestion eslapion, but what I'm experiencing is on the unexpanded VIC. The LISTing of my program is garbage and can't be run. Also, I noticed that memory location $00 is set to an RTS instruction as opposed to the usual JMP (which breaks the USR() function). Of course, using the .E command does not remedy this...
randolph.pickle
Vic 20 Amateur
Posts: 55
Joined: Thu Nov 27, 2014 10:50 am

Re: VICMON's destroying BASIC!

Post by randolph.pickle »

After doing some sleuthing, I've come up with the following facts:

- The reason my BASIC programs are getting clobbered is because VICMON makes use of memory location 43 ($2B). For instance, it is altered when scrolling down through a disassembly.

- The .E command does copy zero page out of the way.

- .E0000 does not copy the old contents of zero page back into zero page. It just disables virtual zero page mode, causing VICMON to disregard the old copy of zero page created with the .E command.

- While editing memory with virtual zero page mode enabled, you are actually editing the copy of zero page created and not the current contents of zero page.

- If virtual zero page mode is not disabled before you exit, a short routine copies the contents of the virtual zero page to zero page just before VICMON returns control back to BASIC.

- Memory location $00, along with other zero page locations, are altered before the user has a chance to use the .E command.

So my problem was that I was disabling virtual zero page mode with .E0000 before exiting thinking it was needed to restore the old contents of zero page, when in fact I just needed to exit VICMON like normal without disabling virtual zero page mode. However location $00, and other locations, are altered at the start of VICMON before I have a chance to use the .E command.

I posted this in hope that if anyone else has this problem in the future, they might come across this post and not be left scratching their head like me.
Post Reply