Some basic questions

Basic and Machine Language

Moderator: Moderators

Post Reply
gorgh
Vic 20 Newbie
Posts: 7
Joined: Sat Jan 11, 2025 12:37 pm
Location: Wyszków
Occupation: Engineer

Some basic questions

Post by gorgh »

Hi there
My plan is to create a demo for unexpanded VIC20 and I have couple questions since I'm a beginner.
1. VIC Tracker is a nice tool for creating music, but sometimes I have only 0.5 kb of free RAM for music, so I guess vtcomp (player) is not a way to go in that case? Do you adive any other player or one has to create player/tracker from scratch?
2. I'm planning to use Kernal procedures for loading data from disk, what locations on zero page and the area $200-$3ff are forbidden to change in that case?
3. I couldn't find an information about displaying graphics on the border- I saw that some demos display more than 22x23 characters, how is that done? by modifying $9002 and $9003 registers? what about the screen memory then? is it also $1e00-$1fff?
Thanks
gorgh
User avatar
Mike
Herr VC
Posts: 5134
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Some basic questions

Post by Mike »

Welcome!
gorgh wrote:1. VIC Tracker is a nice tool for creating music, but sometimes I have only 0.5 kb of free RAM for music, so I guess vtcomp (player) is not a way to go in that case? Do you adive any other player or one has to create player/tracker from scratch?
tlr wrote:[...]
I am not an expert in VIC Tracker (rather did my own sound player routines where needed), but Daniel Kahlin (tlr) posts regularly here in Denial, so should be able to explain the use of VT in tight memory setups.
2. I'm planning to use Kernal procedures for loading data from disk, what locations on zero page and the area $200-$3ff are forbidden to change in that case?
The KERNAL occupies $90..$FA in zero page, and also a fair share of the $0200..$03FF OS workspace. The vectors at $03xx should be left untouched unless you really know what you're doing, there are also some vital tables in the $02xx range. The so-called 'program indirects' at $02A1..$02FF and the tape buffer in $033C..$3FB are free for user programs - the latter obviously only if no tape operations are active.

You find more background, especially about free ZP addresses, in the thread "Free ZP" which ones?.
3. I couldn't find an information about displaying graphics on the border- I saw that some demos display more than 22x23 characters, how is that done? by modifying $9002 and $9003 registers?
There's no way to put things in the border, but the display window can be re-sized and re-positioned with the VIC registers $9000..$9003. Please note some of the values there depend on whether a PAL or NTSC VIC-20 is in use.
what about the screen memory then? is it also $1e00-$1fff?
The base address of the text screen and character generator can be changed with VIC registers $9005 and $9002. Only the internal RAM ($0000..$03FF and $1000..$1FFF) and the character ROM can be accessed by the VIC chip for graphics data!

Greetings,

Michael
gorgh
Vic 20 Newbie
Posts: 7
Joined: Sat Jan 11, 2025 12:37 pm
Location: Wyszków
Occupation: Engineer

Re: Some basic questions

Post by gorgh »

Lovely, thanks Mike!
gorgh
Vic 20 Newbie
Posts: 7
Joined: Sat Jan 11, 2025 12:37 pm
Location: Wyszków
Occupation: Engineer

Re: Some basic questions

Post by gorgh »

Hi again,
I have another question regarding screen size, what happens if the total sum of number row x columns exceeds $200 bytes size? What happens with color RAM at locations $9600-$97ff? Where are those extra loactions taking color information from?
User avatar
javierglez
Vic 20 Hobbyist
Posts: 120
Joined: Sat Jun 03, 2017 3:33 pm
Location: Spain

Re: Some basic questions

Post by javierglez »

Color RAM starts at $9400. Maybe you can find examples on how to use the video registers in the books hosted here:

https://commodore.bombjack.org/vic-20/books-vic.htm
gorgh
Vic 20 Newbie
Posts: 7
Joined: Sat Jan 11, 2025 12:37 pm
Location: Wyszków
Occupation: Engineer

Re: Some basic questions

Post by gorgh »

AFAIK color RAM at $9400 is available only if 3k memory expansion is present, am I right?
I've got additional question: what part of the stack is safe to be utilized by the program?
User avatar
srowe
Vic 20 Scientist
Posts: 1471
Joined: Mon Jun 16, 2014 3:19 pm

Re: Some basic questions

Post by srowe »

gorgh wrote: Thu Mar 20, 2025 12:04 pm AFAIK color RAM at $9400 is available only if 3k memory expansion is present, am I right?
The address depends on b7 of the $9002 register. Under normal circumstances this bit is set for unexpanded and 3K expansion systems and clear for 8K+.
I've got additional question: what part of the stack is safe to be utilized by the program?
There's no absolutely safe region, the bottom of the stack is used for scratch space by the BASIC number to string conversion routines. The top of the stack is used for the cassette error log. It very much depends on what context your code is running in.
gorgh
Vic 20 Newbie
Posts: 7
Joined: Sat Jan 11, 2025 12:37 pm
Location: Wyszków
Occupation: Engineer

Re: Some basic questions

Post by gorgh »

right
I'm going to use system disk loading routine during my demo, so can I assume that locations somewhere between $110-$1a0 are safe?
User avatar
srowe
Vic 20 Scientist
Posts: 1471
Joined: Mon Jun 16, 2014 3:19 pm

Re: Some basic questions

Post by srowe »

gorgh wrote: Thu Mar 20, 2025 12:28 pm I'm going to use system disk loading routine during my demo, so can I assume that locations somewhere between $110-$1a0 are safe?
Depending on how deep the stack is when you call any KERNAL routine that should be OK.
User avatar
Mike
Herr VC
Posts: 5134
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Some basic questions

Post by Mike »

See also the recent thread here:

How do you decide how much memory can be forked off the stack for your own code?

... which practically asks the same question ... ;) ... and where also an empirical method is given how to find out. :)

Greetings,

Michael
Post Reply