|
Re: PETSCII/Screen Code map? [message #262543 is a reply to message #262513] |
Sun, 27 July 2014 17:38 |
Paul Förster
Messages: 415 Registered: April 2012
Karma: 0
|
Senior Member |
|
|
Hi Harry,
On 2014-07-27 18:46:24 +0000, Harry Potter said:
> Where on the internet can I find them?
you can poke the values 0-255 to the first 256 screen locations (don't
forget color RAM) and see what characters appear, then make a printout
of your Vice screen and mark each line start (0, 40, 80, 120,...).
That's the easiest way, if you really want it that way, that is... :-)
--
cul8er
Paul
paul.foerster@gmx.net
|
|
|
Re: PETSCII/Screen Code map? [message #262544 is a reply to message #262543] |
Sun, 27 July 2014 17:48 |
Harry Potter
Messages: 1304 Registered: March 2012
Karma: 0
|
Senior Member |
|
|
On Sunday, July 27, 2014 5:38:48 PM UTC-4, Paul Förster wrote:
> you can poke the values 0-255 to the first 256 screen locations (don't
> forget color RAM) and see what characters appear, then make a printout
> of your Vice screen and mark each line start (0, 40, 80, 120,...).
> That's the easiest way, if you really want it that way, that is... :-)
>
Well, for PETSCII, I used x64 and wrote PRINT ASC("<whatever>") and looked at the number that's printed. However, I'd rather have a table. Note that your approach gives only the screen codes, not the PETSCII codes. Thank you for trying.
|
|
|
|
|
|
Re: PETSCII/Screen Code map? [message #267217 is a reply to message #267205] |
Fri, 12 September 2014 16:37 |
Harry Potter
Messages: 1304 Registered: March 2012
Karma: 0
|
Senior Member |
|
|
On Friday, September 12, 2014 1:38:31 PM UTC-4, The Doctor wrote:
> May I assume that you want a petscii to screen code converter for
> programming purposes?
>
I'd like that, but I need to find the petscii and screen values for given symbols.
|
|
|
Re: PETSCII/Screen Code map? [message #267274 is a reply to message #262513] |
Sat, 13 September 2014 13:47 |
Paul Förster
Messages: 415 Registered: April 2012
Karma: 0
|
Senior Member |
|
|
Hi Joe,
On 2014-07-27 18:46:24 +0000, Harry Potter said:
> Where on the internet can I find them?
This prints either a PETSCII or screen code table, depending on the
bool petscii. It runs on a C64. If you want to run it on some other
machine, make sure to adjust the screen address (scn) and screen color
address (scncol). On monochrome Commodores (PET/CBM), remove the
command POKE(scncol+offset, ccol);.
You can use the table printed to either determine the character for a
given code or vice versa.
Hope this helps.
#include <conio.h>
#include <stdio.h>
#include <peekpoke.h>
#include <stdbool.h>
int main(void) {
// Set petscii to either true or false, resulting in either
// PETSCII or screen code characters are being displayed.
const bool petscii = false;
const unsigned int scn = 0x0400; // Start of screen RAM.
const unsigned int scncol = 0xd400; // Start of color RAM.
char ccol = PEEK(0x286); // Get cursor color.
char x, y, c;
// Clear screen and print heading.
clrscr();
if (petscii) {
printf("\npetscii code table\n\n ");
} else
printf("\nscreen code table\n\n ");
// Table low nybble numbering.
for (x = 0; x < 16; ++x)
printf("%2x", x);
printf("\n\n");
// Output table, either PETSCII or screen codes.
for (y = 0; y < 16; ++y) {
printf(" %02x ", y<<4);
for (x = 0; x < 16; ++x) {
c = (y<<4)+x;
if (petscii) {
// cc65 doesn't like character 0, so manual provisions
// must be made. Also prepare for cr, shift-cr and del.
// Everything else prints properly, if quoted.
if (c == 0)
printf("\022@\222 ");
else if (c != 13 && c != 141 && c != 20)
printf("\"\b%c\"\b ", c);
else
printf(" ");
} else {
// Poke character code to screen and also set the
// corresponding color in screen color RAM.
unsigned int offset = 206+(x<<1)+y*40;
POKE(scn+offset, c);
POKE(scncol+offset, ccol);
}
}
printf("\n");
}
return 0;
}
--
cul8er
Paul
paul.foerster@gmx.net
|
|
|
|
Re: PETSCII/Screen Code map? [message #267402 is a reply to message #267217] |
Mon, 15 September 2014 13:22 |
The Doctor
Messages: 71 Registered: July 2003
Karma: 0
|
Member |
|
|
When I did my C64 programming, almost entirely in asm, I would use a
table driven screen print routine. Much faster than the rom routine.
I still have all my old disks. No idea if they work anymore. They
have not been touched in over 20 years. If I get a change I'll take a
look.
On Fri, 12 Sep 2014 13:37:16 -0700 (PDT), Harry Potter
<rose.joseph12@yahoo.com> wrote:
> On Friday, September 12, 2014 1:38:31 PM UTC-4, The Doctor wrote:
>> May I assume that you want a petscii to screen code converter for
>> programming purposes?
>>
> I'd like that, but I need to find the petscii and screen values for given symbols.
|
|
|
Re: PETSCII/Screen Code map? [message #267417 is a reply to message #267402] |
Mon, 15 September 2014 14:50 |
Paul Förster
Messages: 415 Registered: April 2012
Karma: 0
|
Senior Member |
|
|
Hi Doc,
On 2014-09-15 17:22:07 +0000, The Doctor said:
> When I did my C64 programming, almost entirely in asm, I would use a
> table driven screen print routine. Much faster than the rom routine.
>
> I still have all my old disks. No idea if they work anymore. They
> have not been touched in over 20 years. If I get a change I'll take a
> look.
I think Joe is not after performance. He wanted a way to translate
characters into codes or vice versa. Since he's an avid cc65 user, I
did that program quickly which either prints a PETSCII or screen code
table. It was not meant to be fast or comfortable in any way. I'm sure
it can be done *much* faster and way better. :-P But I'm sure it will
help Joe at whatever he's doing.
--
cul8er
Paul
paul.foerster@gmx.net
|
|
|