UDG on a Vic20 + 3K?

You need an actual VIC.

Moderator: Moderators

Linzino
Vic 20 Amateur
Posts: 53
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

UDG on a Vic20 + 3K?

Postby Linzino » Fri Dec 22, 2017 1:46 am

Hi

Where to place user-defined graphics/characters on a Vic20+3k while possibly having all or most of the ram for the code in a
contiguous block?

Fabrizio

User avatar
Mike
Herr VC
Posts: 3117
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: UDG on a Vic20 + 3K?

Postby Mike » Fri Dec 22, 2017 2:49 am

Regardless the +3K RAM expansion, the UDGs can still only be placed in the internal RAM ($1000..$1FFF, if we disregard $0000..$03FF), three main options (I suppose you stick with the standard screen size of 22x23 chars and single-height 8x8 pixel character definitions):

1. screen at $1E00, charset at $1C00: gives 64 UDGs, another 64 UDGs overlap with the screen, the upper 128 chars access the non-inverted ROM character set - RAM available for code and data: $0400..$1BFF ^= 6 KB,

2. screen at $1A00, charset at $1C00: gives 128 UDGs, the upper 128 chars again access the non-inverted ROM character set - RAM available for code and data: $0400..$19FF ^= 5.5 KB, and

3. screen at $1600, charset at $1800: gives a full set of 256 UDGs. RAM available for code and data: $0400..$15FF ^= 4.5 KB.

Take your pick. :wink:

Linzino
Vic 20 Amateur
Posts: 53
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Re: UDG on a Vic20 + 3K?

Postby Linzino » Fri Dec 22, 2017 3:15 am

Thanks!

I will need slightly more than 6k. My game currently takes 6430 bytes.
Maybe I could optimize it a little bit more and make it fit in about 6000.

The game is CROSS CHASE in its Vic20 + 3k version, which I write in C for any 8 bit computer/console/handheld.

How do I fix the char memory and screen memory at the right places for the 6k solution?
Which VIC registers do I need to set? Which bits?

User avatar
Mike
Herr VC
Posts: 3117
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: UDG on a Vic20 + 3K?

Postby Mike » Fri Dec 22, 2017 3:58 am

Linzino wrote:How do I fix the char memory and screen memory at the right places for the 6k solution?

You'll have to assign the UDGs a dedicated static area in the *.cfg file, and link a prepared 512 byte file with the character definitions. Alternatively, just assign the program/data the restricted range $0400[1]..$1BFF and append the UDGs at $1C00 manually. In each case, the resulting binary (including the BASIC stub) then spans $0401..$1DFF.

Which VIC registers do I need to set? Which bits?

Just set VIC register $9005 to $FF.

If you *really* want to be sure, that the screen memory is accessed by VIC at $1E00 and not $1C00, additionally set bit 7 (value: 128) of VIC register $9002; but it is already correct when the VIC-20 is started up with a +3K RAM expansion.

The colour RAM is located at $9600.


[1]: Actually, "$0400" with the necessary corrections to honor the BASIC start of $0401.

Linzino
Vic 20 Amateur
Posts: 53
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Re: UDG on a Vic20 + 3K?

Postby Linzino » Fri Dec 22, 2017 7:11 am

Thanks Mike!

CROSS CHASE already supports UDG in +8k and +16k Vic20 versions (CROSS CHASE is a game for *all* 8 bit computer/consoles/handhelds).
The VERY SAME C CODE is used for all computers/consoles except for the hardware-specific code in some cases.
The game has 3 versions (generated also by the same meta-code): TINY (6k-8k), LIGHT (about 10-14k), FULL (about 16k-18k).

For the +8k and +16k Vic20 configs I use an external .s file .byte pseudo-opcodes and the memory areas in the cfg look like this:
...
MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A;
SCREEN: start = $1000, size = $0200;
LOADADDR: file = %O, start = $11FF, size = $0002;
HEADER: file = %O, start = $1201, size = $000C;
MAIN: file = %O, define = yes, start = $120D, fill = yes, size = $1C00 - $120D - __STACKSIZE__;
DUMMY: file = %O, start = $1C00 - __STACKSIZE__ - 1, fill = yes, size = __STACKSIZE__;
CHARMEM: file = %O, start = $1C00, size = $0400, type = rw, define = yes, fill = yes;
RAM1: file = %O, start = $2000, size = $2000, type = rw;
}
...

I now need to figure out if I can squeeze fit my game with UDGs in the +3k (which works now with no UDG).

The current +3k config with no UDG looks like:
...
MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $03FF, size = $0002;
HEADER: file = %O, start = $0401, size = $000C;
MAIN: file = %O, define = yes, start = $040D, size = $1E00 - __MAIN_START__ - __STACKSIZE__;
}
...

I need to understand how to modify the 3k in a way that almost all previously available code ram is kept. Otherwise no UDGs for the +3k version.

Fabrizio

Linzino
Vic 20 Amateur
Posts: 53
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Re: UDG on a Vic20 + 3K?

Postby Linzino » Tue Jan 23, 2018 4:12 pm

I think I am close to get UDG into my game for the Vic20+3k but I do not see the UDG on the srceen.

I am trying to get 64 UDG and 6k of available ram for code and data.

The screen starts at $1E00 (7680). If I write into $1E00, I do see the characters but not the user-defined characters.

I am not sure I am correctly setting the VIC chip:
POKE(0x9005,0xFF);
POKE(0x9002,PEEK(0x9002) | 0x80);

But if I do:
for(tmp=0;tmp<254;++tmp)
{
POKE(7680+tmp,tmp);
}
I don't see the UDG.

The cfg may be correct:
...
MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $03FF, size = $0002;
HEADER: file = %O, start = $0401, size = $000C;
MAIN: file = %O, define = yes, start = $040D, size = $1800 - __MAIN_START__ - __STACKSIZE__;
DUMMY: file = %O, start = $1C00 - __STACKSIZE__ - 1, size = __STACKSIZE__, fill = yes;
CHARMEM: file = %O, start = $1C00, size = $0400, type = rw, define = yes, fill = yes;
}
SEGMENTS {
...
UDCCHAR: load = CHARMEM, type = ro, define = yes, optional = no;
...

Linzino
Vic 20 Amateur
Posts: 53
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Re: UDG on a Vic20 + 3K?

Postby Linzino » Wed Jan 24, 2018 2:57 am

If I use Vice monitor and look at $1C00, I only find $00, which means that the linker did not do what I was expecting.

A similar cfg file works fine with the 8k and 16k configuration... No idea what is wrong.

Linzino
Vic 20 Amateur
Posts: 53
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Re: UDG on a Vic20 + 3K?

Postby Linzino » Wed Jan 24, 2018 2:47 pm

Hi!

I have managed to get UDG with +3k. I can only redefine the first 20 characters, though.

I wonder whether this is the expected behavior.

Fabrizio

Linzino
Vic 20 Amateur
Posts: 53
Joined: Fri Nov 06, 2015 4:13 pm
Website: http://retrocomputingarchive.blogspot.fr/
Location: France

Re: UDG on a Vic20 + 3K?

Postby Linzino » Thu Jan 25, 2018 10:46 am

I may have figure it out! :-)

CROSS CHASE with user-defined characers, some sound and joystick support now works on a Vic 20 + 3k!


The following config seems to be OK.
...
MEMORY {
...
MAIN: file = %O, define = yes, start = $040D, size = $1C00 - $40D - __STACKSIZE__, fill=yes;
DUMMY: file = %O, start = $1C00 - __STACKSIZE__ - 1, size = __STACKSIZE__, fill = yes;
CHARMEM: file = %O, define = yes, start = $1C00, size = $0200, type = rw, fill = yes;
}
SEGMENTS {
...
UDCCHAR: load = CHARMEM, type = ro, define = yes, optional = no;
}
...


Return to “Emulation and Cross Development”

Who is online

Users browsing this forum: No registered users and 1 guest