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

From: Maik Merten <maikmerten1googlemail.com>
Date: 2013-08-18 18:53:57
Hello Uz,

thanks for these insightful hints! For now I solved my problem by using 
another VIC bank and updating some kernal variables. However, I think I 
now understand a bit better thanks to your comments, so this should 
prove helpful shall I need to do some memory layout trickery in the 
future :-)


Maik

Am 18.08.2013 18:45, schrieb Ullrich von Bassewitz:
>
> Hi!
>
> 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:
>
>    http://www.cc65.org/mailarchive/2013-03/11299.html
>
> 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
> load.
>
> Regards
>
>
>          Uz
>
>

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Aug 18 18:54:10 2013

This archive was generated by hypermail 2.1.8 : 2013-08-18 18:54:12 CEST