C64 (or possible other CBMs too): PETSCII -> screen codes conversion table in ROM?

From: Gábor Lénárt <lgb_at_lgb.hu>
Date: Mon, 12 Dec 2011 17:11:52 +0100
Message-ID: <20111212161152.GF15794@vega.lgb.hu>
Hi,

I want to manipulate the text video RAM directly, so I mostly have
information in the form of "screen codes" already (instead of PETSCII) since
using a KERNAL function like CHROUT is much slower for heavy usage.
However, I have some information presented in PETSCII. I have the idea that
KERNAL should know about the PETSCII->screen codes translation somehow,
since it also prints onto the screen. But I want to avoid the "overhead"
of calling CHROUT, so my question is: can I found a conversion table
somewhere in the ROM, I can use, like this?

; X=byte to output
LDA conv_table,X ; conv_table in KERNAL
; now I have the screen code in A

Of course I can include a 128 byte long conversion table by my own too, but
I wouldn't make my software larger, if there is already a table like this in
the ROM somewhere. Or does the conversion based on a routine and not table?
For sure, in this case, I don't need to interpret special "control
characters", like reverse on, return ...

It's possible that KERNAL does this by a subroutine instead of a table, but
then it's surely slower than using just a table.

Currently I do an ugly trick: after clearing the screen, I print out
characters by KERNAL, then I copy bytes from the video RAM (what kernal
written as bytes into the video ram) into my reserved area used as the
translation buffer.  After this, I clear the screen again.  In this way, at
least I don't need to include a pre-generated table in my program, however
this solution feels a bit hacky for me :) If kernal provides any translation
table (rather than using code for "translation") it's still means less
memory footprint if I can use that.

thanks!

       Message was sent through the cbm-hackers mailing list
Received on 2011-12-12 17:00:32

Archive generated by hypermail 2.2.0.