Re: [cc65] C64: printf() into another VIC bank, memory layout

From: Ullrich von Bassewitz <>
Date: 2013-08-18 18:45:48

On Sun, Aug 18, 2013 at 12:41:53PM +0200, Maik Merten wrote:
> I outfitted my application, which uses functions like printf() and
> cputsxy(), with a custom font. I didn't yet find a way to make those
> functions write into Screen RAM position other than 0x0400, which
> means that the font currently has to be situated in VIC bank 3.

Combining stuff from conio and standard file I/O (which printf is) is usually
not a good idea. When using cputsxy, I would recommend using cprintf instead
of printf.

> The easiest solution would be to switch VIC memory into a higher
> location. I'm already doing this for displaying bitmap graphics.
> However then I somehow need to configure printf() and friends to
> expect the Screen RAM at some other position. Is this possible?

conio uses the same variables as the kernal. So it should be enough to update
the screen pointer at $D1/$D2 and maybe the color RAM pointer at $F3/$F4. The
thread starting here:

contains some more information on the topic.

> Another solution may be to divide RAM so that the font area is left
> untouched. I'm trying something like
>     RAM:      file = %O, define = yes, start = $080D, size = $2ff2;
>     RAM2:     file = %O, define = yes, start = $4000, size = $4000;
> where the font would thus fit into the gap between RAM and RAM2.

It would, but the memory image created in the file has no gap. So in the file,
the contents of RAM2 start where RAM ends - which explains the crash. If you
want to do that, you have to add some empty space in between, so the file
contains an exact memory image. The disadvantage of this solution is that the
empty space is in the file, which makes it bigger and therefore slower to



Ullrich von Bassewitz                        
Encrypted email preferred                          PGP Key-Id: 29D93B10
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Aug 18 18:45:58 2013

This archive was generated by hypermail 2.1.8 : 2013-08-18 18:46:00 CEST