6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed Jun 26, 2024 4:10 am

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Thu Jul 02, 2020 3:06 pm 
Offline

Joined: Fri Nov 16, 2018 8:55 pm
Posts: 71
So, I've long known that on the C64 most programmers needing tile graphics redefine the character set to suit their needs. This makes sense, bit limits the programmer to no more than 256 tiles. Practically speaking, is it possible to have more than 256 tiles at the same time on the C64 via an additional table? How would that work? Are there strategies to relieve the inevitable memory issues?


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2020 3:30 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1938
Location: Sacramento, CA, USA
I can't say that I've ever delved deeply into the subject, but I'm certain that it's not difficult to divide the display into two or more zones, using raster-based interrupts. Each zone can have its own display configuration and tile map. Some assembly required!

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2020 3:45 pm 
Offline

Joined: Fri Nov 16, 2018 8:55 pm
Posts: 71
barrym95838 wrote:
Some assembly required!


I see what you did there.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2020 4:44 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1378
Way back when... I wrote some code for the C64 that used the raster interrupt capability. I sectioned the screen into 8 separate (vertical) areas and dynamically redefined the 8 sprites per area. The end result was 64 sprites, albeit each section of 8 sprites were limited to their own vertical space. The odd thing was all 64 sprites has a slight video shimmer to them. This might have been specific to the 6567 Vic chip, of which there were several versions, mine being a very early one was ceramic cased and ran very hot.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2020 7:43 pm 
Offline

Joined: Thu Jan 21, 2016 7:33 pm
Posts: 270
Location: Placerville, CA
Yeah, it's fairly trivial to split the screen into vertical regions and use different tilesets in each; you can easily do, say, a split playfield/status-bar arrangement this way if you want. That said, if you need much more than that, it may be simpler to just use one of the bitmap modes.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 02, 2020 8:48 pm 
Offline

Joined: Tue Dec 03, 2019 11:39 am
Posts: 8
Take a look at addresses $D018 and $DD00 which from my memory sets the address of where the tile set/character memory/font is located in a 16KB bank and which 16KB bank is seleected. If you time the change of values at those addresses with a raster interrupt you'll be able to display more than one tile set at a time at different vertical positions of the screen.

It's been well over 25 years since I played with those effects on a C64. I did try multiplexing some sprites on the C256 Foenix a few weeks ago which seemed to work when tested on the physical hardware.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 05, 2020 7:55 pm 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 390
Location: Minnesota
At boot up the C64 sets a memory map that has a ROM chip containing the character graphics as its "source" for character images. As other have said, it's possible to manipulate the memory map and instead point the source for character images at any of several RAM locations, into which you can write any data you like. I've never played with raster interrupts with the idea of changing the RAM location from which character images were fetched, though - since these are RAM locations, it's easy enough to overwrite any characters you like with new data at any time. You can display only 256 of them at once, but there's no particular limit on how many times you can replace any character with new image data. Replacing character image data with new data instantly makes every location on the screen displaying that character change to the new image (okay, technically it won't happen before the raster beam reaches each of them, but that's still pretty fast). This can be used for simple animation tricks - flags moving in a breeze, waves rising and falling on water, flames flickering, etc.

A practical example: the C64 versions of the Wizardry series of RPGs all use strictly character graphics. Character images are fetched from RAM. It happens that the monster images for the first three are all 5x6 (or 6x5, I forget - 30 characters either way) and that there are no more than four different types visible at any time. Thus 120 of the 256 available characters are reserved for redefinition as needed (the rest are fixed as letters, dungeon images, and a few other objects). When a fight happens, the game tells the run time engine which images it wants. The RTE checks to see if any are already loaded into the character set. Any that aren't are fetched from disk and written to one of the available slots (ie., a slot not holding a monster image wanted at the moment). This would cause visible flicker, but the games were careful to not actually be displaying any of those characters until the RTE says they're ready (a point the fourth game, which used much larger images but only one at a time, did not at first appreciate).


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 18, 2020 12:54 am 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 672
Also, get clever and reuse the same chars in different ways, and with different colors. Probably the most famous of these usages is Super Mario Bros on the NES reusing the same tiles for bushes & clouds.

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 18, 2020 3:08 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1212
Location: Soddy-Daisy, TN USA
Oh course, the only real limit is the amount of RAM your C64 has access to. There's nothing stopping you from banking in tiles from other memory locations into the current VIC bank. The tileset size on the C64 is actually 2048 bytes. Since each char is 8 lines of one byte each (8 bytes), that gives you your 256 chars. No matter what, you cannot tell the VIC to render more than 256 chars (on the same screen) without raster tricks. Which, is pretty simple to do. Most games would just utilize the 256 char limit per screen or section and then load in new tiles/chars when needed.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 18, 2020 3:16 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10834
Location: England
(Idle question: can you point the VIC at unaligned addresses so it makes a character out of the end of one and the start of the next?)


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 18, 2020 5:31 pm 
Offline
User avatar

Joined: Sun Dec 29, 2002 8:56 pm
Posts: 449
Location: Canada
Quote:
(Idle question: can you point the VIC at unaligned addresses so it makes a character out of the end of one and the start of the next?)

No. The video matrix must be 1kB aligned and the character bitmaps 2kB aligned.

_________________
http://www.finitron.ca


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 20, 2020 10:21 pm 
Offline

Joined: Mon May 01, 2017 7:13 am
Posts: 83
barrym95838 wrote:
I can't say that I've ever delved deeply into the subject, but I'm certain that it's not difficult to divide the display into two or more zones, using raster-based interrupts. Each zone can have its own display configuration and tile map. Some assembly required!


Barry and commodorejohn are correct. So long as you turn off the generic interrupt handler, and call the standard interrupt handler yourself from the end of your raster interrupt when it is needed, you can play lots of wacky tricks like changing the tileset, displaying more than 8 sprites, etc.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 22, 2020 2:34 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1212
Location: Soddy-Daisy, TN USA
Rob Finch wrote:
Quote:
(Idle question: can you point the VIC at unaligned addresses so it makes a character out of the end of one and the start of the next?)

No. The video matrix must be 1kB aligned and the character bitmaps 2kB aligned.



To be technical, the VIC-II can only "see" 16KiB of RAM at once and it must align at 16KiB which it calls banks. Which means there are four banks in a Commodore 64 (RAM expanders don't count).

So while the screen can be 1KiB aligned and the characters can be 2KiB aligned, they both must fall within whatever 16KiB bank the VIC is currently pointing at.

Of course, with raster interrupts, you can change the bank, etc. throughout the screen. Even within the same LINE if you have a stable timer.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 63 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: