Hello and problem moving screen memory

Basic and Machine Language

Moderator: Moderators

Post Reply
shadow
Vic 20 Newbie
Posts: 5
Joined: Thu Jan 05, 2017 9:38 pm
Location: Akron, OH

Hello and problem moving screen memory

Post by shadow »

Hello, I've been experimenting with VIC-20 screen POKEs using WinVice. My intent is to move the screen memory into the 3K expansion range, at byte 1024, but I can't make it work. First, having the 3K expansion installed moves the start-of-BASIC address down from 4097 to 1025, so I use this to move it back:

Code: Select all

POKE 4096,0:POKE 44,16:NEW
That should put BASIC in its non-expansion location, and free up the entire 3K expansion area. Then this code should move the screen memory there:

Code: Select all

POKE 648,4:POKE 36866,22:POKE 36869,144:PRINT CHR$(147)
However, if I run that code, I get a garbled screen. I get the same thing using higher addresses within the 3K expansion range. I'm using math from a couple of Compute! articles, and the example in the first article works fine, but moving to these other addresses doesn't. Am I missing something?
wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: Hello and problem moving screen memory

Post by wimoos »

We know that the VIC-20 video chip gets two things from memory: "screen memory" and "the character set." But it sees the computer's memory in an unusual way:
The VIC chip is not able to address memory in the expansion connector.

In my VIC I have soldered 3K memory piggyback on existing internal memory. For me the following works:

Code: Select all

POKE 648,4:POKE 642,6:POKE 644,32:SYS 64824
Screenmemory is now at $0400, Basic-memory is now from $0600 to $2000.

Also, when I put a 24k RAM cartridge in the expansion port then the following works:

Code: Select all

POKE 648,4:POKE 642,6:POKE 644,128:SYS 64824
Resulting in 30.5K of Basic RAM and screenmemory at $0400 :-).


Regards,

Wim.
Last edited by wimoos on Sun Jan 08, 2017 9:57 am, edited 2 times in total.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
shadow
Vic 20 Newbie
Posts: 5
Joined: Thu Jan 05, 2017 9:38 pm
Location: Akron, OH

Re: Hello and problem moving screen memory

Post by shadow »

Ah, didn't know that, thanks. I was about to add to my post that I couldn't move the character memory there, either, so that explains that. A bit of a missed design opportunity if you ask me- a cart with 3K of RAM at $0400 and 8-24K at $2000 wouldn't have all of the free memory contiguous if the screen RAM is stuck in the middle. I guess that's why the RAM expansions were 8K and 16K, not 11K and 19K :D
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Hello and problem moving screen memory

Post by Mike »

Is there any specific reason you wanted to move text screen and/or character definitions into the range $0400..$0FFF other than just for the sake of it?

That extra +3K most probably would not cut it in the presence of other, bigger RAM expansions, and even while the VIC chip can't access it, it's still there and can, for example, be used to put data or machine code in it.
shadow
Vic 20 Newbie
Posts: 5
Joined: Thu Jan 05, 2017 9:38 pm
Location: Akron, OH

Re: Hello and problem moving screen memory

Post by shadow »

Just for the sake of it, really. I was thinking of a theoretical cart with RAM in the 3K and 8K positions, and the free memory in one contiguous block. Since the video memory can't be moved above $1E00, contiguous memory meant moving it down.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Hello and problem moving screen memory

Post by Mike »

Even if +3K and +8K were not sold by Commodore as combined RAM expansion, other companies did and even with the CBM RAM expanders it was possible to combine those with a slot expander, like the VIC-1010 or VIC-1020.

However, as you've noticed, the screen memory is moved down to $1000 as soon as a RAM expansion is added in BLK1, which blocks the range of $0400..$0FFF for BASIC use, and thus wouldn't have any positive impact on available memory for BASIC programs.

You are by far not the first one though to fall into the 'trap' of assuming there must be a way to set the VIC registers into the range $0400..$0FFF: WTB: VIC 1010 Expansion Module. And I easily can come up with another two dozen threads about this issue. ;)

Some time ago, I actually found a good reason to make that address range available for the VIC chip (other than for the sake of it), and made a similar modification to my VIC-20 as wimoos did. However, I expanded a little bit on this, so my VIC-20 is now able to display 208x256 pixels in 16 colours while still being able to run programs written for the VIC-20 without the mod. :mrgreen:
Post Reply