2K expansion at $9800-$9fff

Modding and Technical Issues

Moderator: Moderators

Post Reply
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

2K expansion at $9800-$9fff

Post by tokra »

Some time ago I read about hacking a 3K expander at $0400-$0fff to a 2K expander at $9800-$9fff. Since I finally got my Xpander-3 lately, I had to try this:

Image
Image
Image

You can see the cuts on the top where RAM1,RAM2 and RAM3 were connected and the new connections with the little cables on the other side to IO2 and IO3.

Now together with the 32K expander and another 3K I actually have VIC with 37K expansion RAM for a whopping total of 42K RAM without bankswitching-tricks (not counting color nibble-RAM). Beat that :-)

To give this area something to do I compiled SLOAD07 for $9800. Download here and start with SYS 38912. This is a neat hiding place for SJLOAD and also works with DOOM for example. The MegaCarts built-in SJLOAD08 uses the same area.

It would be nice to create a label for this 2K expansion and call it "VIC-1214 MACHINE LANGUAGE 2K RAM CARTRIDGE"
User avatar
Kweepa
Vic 20 Scientist
Posts: 1314
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Re: 2K expansion at $9800-$9fff

Post by Kweepa »

Oh no. I feel an enhanced version of Doom coming on!
User avatar
Mike
Herr VC
Posts: 4831
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: 2K expansion at $9800-$9fff

Post by Mike »

@tokra: Nice hack! Something like this had also crossed my mind for some time, the use of the remaining 1K for $0C00 .. $0FFF in this version is a good idea!
Kweepa wrote:Oh no. I feel an enhanced version of Doom coming on!
Anything, which wants to use that area as RAM is going to have a very small audience. First of all, one would have to reproduce that hack. Furthermore, for development, RAM in this area is not supported by VICE at the moment. Inconsiderate writes to that address range are guaranteed to annoy at least some Mega-Cart and FE3 users, as both cartridges hold control registers there.

IMO, the only legit use has already being pointed out by tokra: the extra 2K are sufficient to hold a small tool of the *user's choice*, which then has a good chance to operate unharmed together with most other games/programs. *When* he has installed that 2K RAM expansion, and thus there can't be a cartridge in that area with control registers anyway.

I suppose though, that you were aware of these issues.
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: 2K expansion at $9800-$9fff

Post by tokra »

I agree uses are limited. I'm wondering if the NVRAM of the MegaCart can be used completely or if there are always registers "in the way". Possibly the MegaCart would need to be restored through the Service Menu to its factory settings or stored preferences afterwards. But are the full 2K theoretically available to use fully with the MegaCart as "pseudo-ROM" using tlr's injection tool? I don't think the FinalExpansion has NVRAM in this area, but just a few visible registers.

In any case: adding the 2K at $9800 feature to VICE should be easy enough, certainly easier than the NTSC-interlace feature of the VIC.
User avatar
pixel
Vic 20 Scientist
Posts: 1342
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: 2K expansion at $9800-$9fff

Post by pixel »

tokra wrote:I agree uses are limited.
Double-buffered screens (and charset) come to mind. Only doable with +3K or your +2K, isn't it? I reckon it's a matter of minutes to get it into VICE. I like the idea very much. It opens up new possibilities formerly unthought of. I'll keep it in mind. 8)
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
Mike
Herr VC
Posts: 4831
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: 2K expansion at $9800-$9fff

Post by Mike »

pixel wrote:Double-buffered screens (and charset) come to mind. Only doable with +3K or your +2K, isn't it?
Neither - nor.

The VIC chip is not able to access *anything* at the expansion port. There's a timing barrier in-between, formed by three 74245 buffer chips. They're necessary, because the 6502 cannot tri-state its address bus.

If you want to make $0400 to $0FFF accessible to VIC, you must add it on the 'right' side of the buffers, internally, on the VIC-20 mainboard. That's why I went all-out with my VFLI mod.
User avatar
pixel
Vic 20 Scientist
Posts: 1342
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: 2K expansion at $9800-$9fff

Post by pixel »

Mike wrote:Neither - nor.
:cry: Damn...

Edit: Added this to the wiki...
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
Mike
Herr VC
Posts: 4831
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: 2K expansion at $9800-$9fff

Post by Mike »

Don't worry. You're definitely not the first one to fall into this trap.

One hint that it's really not that easy could have been the lengths tokra and I went through to expand the graphics capabilities beyond the 'standard' 160x192 pixels bitmap of MINIGRAFIK. As the VIC chip can only use $0000 .. $03FF and $1000 .. $1FFF (5K in total) of an unmodded VIC-20, all graphics data need be sent through this needle eye. That's why the 6502 has to shuffle the graphics data from expansion memory into the internal RAM, so VIC can display it - synchronous to the raster beam. This emulated DMA uses up nearly 100% of the CPU time.

Contrary to this, the VFLI mod provides the 208x256 bitmap mode (PAL) essentially for free - the MAXIGRAFIK equivalent is done with just 2 NMIs per frame. To switch the three global colour registers and the colour RAM bank on each displayed raster then again eats up 256 of the 312 rasters, but that means there's still 20% of CPU available to the main program.

BTT: a monitor with a direct assembler would also be a nice tool in the $9800 to $9FFF range. (Edit: see here :mrgreen:)
tokra wrote:But are the full 2K theoretically available to use fully with the MegaCart as "pseudo-ROM" using tlr's injection tool?
The whole range can be written to (in some parts writes are very slow though), however the registers are strewn across all I/O 3 at $9x00 and $9x80 - one of them triggers a reset, the others change BLK5 between RAM and two different ROM chips - so surprises are guaranteed.
Possibly the MegaCart would need to be restored through the Service Menu to its factory settings or stored preferences afterwards.
Any program or game which requires me to do this, because it wrote all over the Mega-Cart NVRAM won't get a second chance to run on my VIC-20.
Last edited by Mike on Wed May 28, 2014 1:16 pm, edited 1 time in total.
User avatar
pixel
Vic 20 Scientist
Posts: 1342
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: 2K expansion at $9800-$9fff

Post by pixel »

Mike wrote:Don't worry. You're definitely not the first one to fall into this trap.

One hint that it's really not that easy could have been the lengths tokra and I went through to expand the graphics capabilities beyond the 'standard' 160x192 pixels bitmap of MINIGRAFIK. As the VIC chip can only use $0000 .. $03FF and $1000 .. $1FFF (5K in total) of an unmodded VIC-20, all graphics data need be sent through this needle eye. That's why the 6502 has to shuffle the graphics data from expansion memory into the internal RAM, so VIC can display it - synchronous to the raster beam. This emulated DMA uses up nearly 100% of the CPU time.

Contrary to this, the VFLI mod provides the 208x256 bitmap mode (PAL) essentially for free - the MAXIGRAFIK equivalent is done with just 2 NMIs per frame. To switch the three global colour registers and the colour RAM bank on each displayed raster then again eats up 256 of the 312 rasters, but that means there's still 20% of CPU available to the main program.
Yeah, I kinda figured there'd be a couple of traps, which is why I spent a couple of hours on the chip's wiki page. Thanks a lot, though. I hate idea of having to copy whole screens. Am banging my head on scrolling in all directions...

Maybe the VFLI mode would be nice for something like the game "2048" or something similar. I wonder why it didn't happen already.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
Mike
Herr VC
Posts: 4831
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: 2K expansion at $9800-$9fff

Post by Mike »

pixel wrote:I wonder why it didn't happen already.
Supposedly because soldering around on the mainboard isn't exactly everyone's cup of tea. Even given the possible enhancements. :(

It doesn't help either that people mistake the permanent nature of the expansion for increased incompatibility. I went all-length to explain what exactly matters in that case, that it is possible to soft-limit the RAM, that I run my VIC-20 for over 3 years now with no found instance of a program which would trip over the extra RAM, etc. ... but no avail.

Judging from the knowledgable fellows here in the forum, I thought there would be at least one other modded VIC-20 after 1 or 2 months, and then maybe 5 or 6 over the following year. Nothing like that happened. Rest of the story is told here.
User avatar
pixel
Vic 20 Scientist
Posts: 1342
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: 2K expansion at $9800-$9fff

Post by pixel »

Mike wrote:
pixel wrote:I wonder why it didn't happen already.
Supposedly because soldering around on the mainboard isn't exactly everyone's cup of tea. Even given the possible enhancements. :(
Ah! THAT thing. Sorry, I didn't suck up all those articles in their entirety, yet. But it's on my TODO list. :oops:
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
User avatar
Mike
Herr VC
Posts: 4831
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: 2K expansion at $9800-$9fff

Post by Mike »

pixel wrote:I hate idea of having to copy whole screens. Am banging my head on scrolling in all directions...
In any case Leveledit might be worth a look. Here, of the 8-way scrolling the horizontal part is also done with selected character pairs, and the vertical part with the hardware scroll register. :)
User avatar
pixel
Vic 20 Scientist
Posts: 1342
Joined: Fri Feb 28, 2014 3:56 am
Website: http://hugbox.org/
Location: Berlin, Germany
Occupation: Pan–galactic shaman

Re: 2K expansion at $9800-$9fff

Post by pixel »

Mike wrote:
pixel wrote:I hate idea of having to copy whole screens. Am banging my head on scrolling in all directions...
In any case Leveledit might be worth a look. Here, of the 8-way scrolling the horizontal part is also done with selected character pairs, and the vertical part with the hardware scroll register. :)
Holy Moly! Now THAT's smooth. Well, I just arrived at the necessity to mix chars and screen... but I can't use the hardware scrolling. Otherwise the sprites eat up too much of everything.

I'd love to discuss this more, but aren't we going too off-topic here and risking tokra to hate us? ;)
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
Post Reply