VIC-20 basic memory start + basic stub + etc

From: Gábor Lénárt <lgb_at_lgb.hu>
Date: Tue, 7 Feb 2012 14:30:45 +0100
Message-ID: <20120207133045.GD17880@vega.lgb.hu>
Hi All,

All we know the trick to use "basic stub" in our assembly projects (usually
consist of a single basic line with a SYS). On C64 the behaviour is well
known, the .prg itself starts with word $0801, etc etc.

However, now I want to play with VIC-20. Now I have the situation that I
don't really understand what address a basic prg will be loaded to. Also, I
need plenty of RAM, so I am thinking about memory expansion first (well, to
be honest it just mean some clicks in VICE - as I use emulator). But in this
case: is it really true that load address will be different? Also, I've
read that screen etc address may vary depending on the memory expansion.

Now my question: can I write a program in assembly (with the basic stub)
which works on both of unexpanded and expanded VIC-20 without any
modification? Of course only, if the program would fit into the unexpanded
VIC-20's memory :) But this means another question: if I have an expanded
VIC-20 to the max (as far as I remember something like +28K RAM is reported
by the basic startup msg) then will it be continous, that I can load a
single prg file which is sized - let's say - 25K ?

Now I've tried to save a simple BASIC program in VICE with max expansion and
without it. The first word of the basic programs:

unexpanded:  $1001
expanded:    $1201

Hmm, so according to this, it is simply not possible to do assembly projects
work with and without memory expansions? (And I don't even count the case
when video memory is at another location maybe ...)

I'm thinking on writing some simple code (which contains only PC-relative
jumps, etc) as the relocation code, which copies the rest of the code so I
have a "fixed" address then for it, regardless of the memory expansion (but
I will lose some memory then maybe about $200=512 bytes) to compensate the
difference, and also I need to handle screen address not as a constant
anymore ...

Any suggestion is welcome.

thanks,

- Gábor

       Message was sent through the cbm-hackers mailing list
Received on 2012-02-07 14:00:41

Archive generated by hypermail 2.2.0.