UDG's

Basic and Machine Language

Moderator: Moderators

Post Reply
Tepic
Vic 20 Devotee
Posts: 209
Joined: Wed Mar 24, 2004 10:47 pm

UDG's

Post by Tepic »

I'm fiddling about programming my Vic again. I am much better at it now than I was as a kid..

I'm a bit stuck with UDG's though. I've worked through the programmers reference guide and understand most of it, but I can't figure out how it works with expansion memory.

What do I poke where to protect some space for the UDG's without making my Vic think it only has 2.5k free?

Thanks.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I think poking 36869, 255 only makes use of 512 bytes for user defined graphics.

YOu don't really need to protect it. But if you are worried about variables runninig into graphic space, you'll need to alter the memory locations 52 and 56. THe memory must be restricted somehow, but I don't think you need to restrict a full 1k.
High Scores, Links, and Jeff's Basic Games page.
Tepic
Vic 20 Devotee
Posts: 209
Joined: Wed Mar 24, 2004 10:47 pm

Post by Tepic »

Thanks, I was trying the examples in the guide and it was hiding all the memory.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I think adjusting both locations with the value 28 will protect 512bytes. Can someone confirm that?
High Scores, Links, and Jeff's Basic Games page.
Tepic
Vic 20 Devotee
Posts: 209
Joined: Wed Mar 24, 2004 10:47 pm

Post by Tepic »

I think adjusting both locations with the value 28 will protect 512bytes. Can someone confirm that?
Once the child has finished with the TV I'll check it out :)

Thanks again!
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Well, if you are going to use expansion ram and want to use your own graphics, then you need to move the basic memory. (You alter the start address of the basic memory instead of the ending address). If you for example do this:

poke44,32:poke32*256,0:new

Then your basic memory will start at the expansion ram and leave the whole graphics mem free for your own graphics, a bigger screen, etc... You might not need to move it that far though. For example on my Tribbles game, I have it at 28*256 I think (poke 44,28:poke28*256,0:new)

Also read this thread:
http://sleepingelephant.com/ipw-web/bul ... .php?t=116

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

ooops. I totally missed the expansion memory part! Ha ha! I'm not sure. I have only programmed the unexpanded Vic. Sorry.
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Generally, if you have 0 or 3K expansion, it is enough to lower the roof (POKE 52,28:POKE 56,28:CLR for 64 UDGs starting at 7168, activate with POKE 36869,255). If you have 8K expansion or more, you rather have to move Basic forwards as Boray mentions. Normally this means that the program has to load into two parts or you need some advanced programming and tools to save your program (I'm thinking saving a memory dump consisting of both graphics and program in one, using some nifty POKE or SYS combination to put things right).
Anders Carlsson

Image Image Image Image Image
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Look at "Programming/Moving Basic memory while running", there's a nice solution from Boray and others for moving the basic pointers around and loading a programm consisting of Basic/ML(Graphics)/BASIC in one part.
I tried his solution and it worked perfectly well, now I can load a Basic program which has it's own UDG without worrying about Multi-Part loading etc.

Schlowski

PS: Link to topic: http://sleepingelephant.com/ipw-web/bul ... .php?t=116
Post Reply