Unexpanded VIC 20 Memory

Basic and Machine Language

Moderator: Moderators

JoshuaHorn
Vic 20 Drifter
Posts: 37
Joined: Fri Feb 06, 2009 11:03 am

Question

Post by JoshuaHorn »

I have a expansion cartridge, which I think adds an extra 3k? how high expansion cartridges did Commodore release?
Joshua Horn
--
"Just because YOU think it's old, does not me it's useless to ME!" -- Joshua Horn
gklinger
Vic 20 Elite
Posts: 2051
Joined: Tue Oct 03, 2006 1:39 am

Post by gklinger »

I believe they released a 3K, a 3K with additional software, an 8K and a 16K.
In the end it will be as if nothing ever happened.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Yes, it seems correct as Commodore themselves preferred to use BLK3 for application/game cartridges. On the other hand the 8K VIC-1110 and the 16K VIC-1111 both have internal settings to let you relocate them to either of blocks 1,2,3,5 and the docs even mention how. So factory default was 3K, 8K or 16K while a bit of custom modding and a cartridge expander would have let you fit at least 32K of pure Commodore memory expansions.
Anders Carlsson

Image Image Image Image Image
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

Im kickin myself cause this guy in new york had a mint condition 3k super expander on ebay for $4.00 and I lost the auction by .28 cents . I mean the thing looked like it just came off the assembly line and the box was mint. :shock: I thought I won cause no one bidded, then I went back and found out I was outbid by 28 cents? Somethings not right there

http://cgi.ebay.com/ws/eBayISAPI.dll?Vi ... 0336786468

also I found a vic w/16k expander for $30

http://cgi.ebay.com/Vic-20_W0QQitemZ290 ... 1|294%3A50
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Post by ral-clan »

The Denial Wiki is your friend:

http://sleepingelephant.com/denial/wiki ... _Expansion

We're only missing an article on the Super Expander (which I hope to add soon). All other Commodore RAM expansions for the VIC are already described there.
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

I thought I had posted this before but I can't find the thread now. I was asking about allocating memory with poke 52,28 : poke 56,28
which frees up 512k at the end of User Basic Ram, and Basic will not touch this area of user ram now.

52,20 56,20 frees up from 5120-7679
52,24 56,24 frees up from 6144-7679

is there any other combos to free up less than 512 or more than 2559?
The only way to program better is to find a better programmer. - Legacy 2009
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

You need to understand what those values do. Addresses 51-52 and 55-56 are pointers to top of Basic RAM. When Basic allocates variable space, numerical variables start at the end of the program code while strings and arrays (DIM) work from top of memory backwards. When the two meet, you get ?OUT OF MEMORY.

The default setting is PEEK(55)=0, PEEK(56)=30 which equals address 7680, i.e. the first byte of the screen matrix on an unexpanded VIC. When you POKE56,28 you move this pointer 512 bytes backwards:

28 * 256 = 7168
30 * 256 = 7680

As you probably have learned by now, each byte can hold a value 0-255. In order to represent a larger value, multiple bytes are used. Almost everywhere in the VIC-20 when a 16-bit value is stored, it is recorded low byte, high byte where the high byte gets multiplied by 256 to get the actual address.

This means POKE55,255:POKE56,29 would reserve exactly ONE byte that Basic won't touch.

POKE55,128:POKE56,29 gives [30-29]*256 - 128 = 128 bytes, or space for 16 custom characters.

POKE55,64:POKE56,28 gives [30-28]*256 - 64 = 448 bytes, or space for 56 characters.

And so on. The same applies to the pointer at 51-52 and so on. For example the routine to LIST a program is referenced by a pointer at address 713-714. Perhaps you have seen some LIST protection POKEs that change 714 to some different value that makes the computer crash. Actually you could change both the low byte (713) and high byte (714) to point to a different routine.

I hope this makes sense to you.
Anders Carlsson

Image Image Image Image Image
Legacy
Vic 20 Enthusiast
Posts: 154
Joined: Wed Dec 31, 2008 4:01 pm

Post by Legacy »

So if we can accomplish the memory freeup with poke 55 : poke 56
why is poke 52 used? I see 55 is low byte, 56 is high byte which stores the address End of, or pointer to Limit of memory 56(x) is the address and 55(x) is bytes allocated.

Then why do we always see the code poke 52,28 : poke 56,28 when 56,28 will handle the memory limiter for 512 bytes by itself? What is the purpose of zero page $0034 (52). Is it to move the actual character memory as well, I thought 36869,255 took care of that .
The only way to program better is to find a better programmer. - Legacy 2009
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

The pointer at 51-52 determines from where strings are stored. The pointer at 55-56 is top of Basic. The start of arrays is at 47-48 which perhaps work from bottom and up anyway, I can't recall.
Legacy wrote:56(x) is the address and 55(x) is bytes allocated.
Not quite, but pretty close. The two form a 16-bit address which sets the top limit:

POKE55,0:POKE56,28 = 7168
POKE55,64:POKE56,28 = 7232
POKE55,128:POKE56,29 = 7552
POKE55,255:POKE56,29 = 7679
POKE56,0:POEK56,30 = 7680

7680 - 7168 = 512 bytes reserved
7680 - 7232 = 448 -""-
7680 - 7552 = 128
7680 - 7679 = 1
7680 - 7680 = 0 bytes reserved
Anders Carlsson

Image Image Image Image Image
Post Reply