Limitations of Tile Graphics on the C64?

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
load81
Posts: 71
Joined: 16 Nov 2018

Limitations of Tile Graphics on the C64?

Post by load81 »

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?
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: Limitations of Tile Graphics on the C64?

Post by barrym95838 »

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)
load81
Posts: 71
Joined: 16 Nov 2018

Re: Limitations of Tile Graphics on the C64?

Post by load81 »

barrym95838 wrote:
Some assembly required!
I see what you did there.
User avatar
floobydust
Posts: 1394
Joined: 05 Mar 2013

Re: Limitations of Tile Graphics on the C64?

Post by floobydust »

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.
User avatar
commodorejohn
Posts: 299
Joined: 21 Jan 2016
Location: Placerville, CA
Contact:

Re: Limitations of Tile Graphics on the C64?

Post by commodorejohn »

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.
beethead
Posts: 9
Joined: 03 Dec 2019

Re: Limitations of Tile Graphics on the C64?

Post by beethead »

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.
teamtempest
Posts: 443
Joined: 08 Nov 2009
Location: Minnesota
Contact:

Re: Limitations of Tile Graphics on the C64?

Post by teamtempest »

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).
White Flame
Posts: 704
Joined: 24 Jul 2012

Re: Limitations of Tile Graphics on the C64?

Post by White Flame »

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.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: Limitations of Tile Graphics on the C64?

Post by cbmeeks »

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.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: Limitations of Tile Graphics on the C64?

Post by BigEd »

(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?)
User avatar
Rob Finch
Posts: 465
Joined: 29 Dec 2002
Location: Canada
Contact:

Re: Limitations of Tile Graphics on the C64?

Post by Rob Finch »

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.
johnwbyrd
Posts: 89
Joined: 01 May 2017

Re: Limitations of Tile Graphics on the C64?

Post by johnwbyrd »

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.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: Limitations of Tile Graphics on the C64?

Post by cbmeeks »

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.
Post Reply