Non-PC OS Development and Different Character Sets
Posted: Thu Aug 03, 2017 12:49 pm
I'm taking a break from x86 development to work on an "as compatible as possible" OS for the C64.
I wanted to clear up as much available RAM as possible, so the first thing I'm currently doing is disabling ALL of the ROM bank overlays, so that the CPU has access to the full 64k of RAM. This means that I have to (or "get to") write my own kernel routines for the video display, keyboard handler, disk drive I/O, etc.
So, of course, my first task is to read events from the keyboard and write characters to the screen. My first approach was to create a table mapping the keyboard logical positions to the default screen character set. This works fairly well for a simple proof-of-concept, but now I'm starting to think about handling string data in memory, and rendering embedded text to the screen.
Now, the problem is that the default character set does not line up with the ASCII character set. The lower and upper case characters are "swapped", and the other symbols are scattered about, meaning that a simple formula to convert from one to the other isn't really an option.
So, the question is, how do (or would) you guys handle the situation where you are working on different platforms that have different keyboards, and the default screen character map is different?
I noticed that the C64 emulator that I'm using (WinVICE, I think), has a built in Debug Monitor, but it displays characters in memory as if they are ASCII encoded. So viewing the C64 video memory RAM does not match the characters on the screen. Also, when using the cc65 compiler, I noticed that when I put string literals into the source file, they ended up being case inverted on the screen, so it appears to have the same "problem" that I have in my own compiler.
So, should I just pick an encoding, and convert everything from/to that at run time? Or should I add the functionality to my compiler to allow me to specify what "encoding" I want strings to be output in the binary file?
And what about (and yes I'm being serious...) communicating on the internet from a C64? If I use ASCII as my "native" memory string format, that would make communication over the internet easier, and it would allow me to use the same compiler logic as other platforms as well.
I've also just started looking into the disk drive format to see how it is encoded, but I'm sure that it is going to be the same PETSCII encoding that the C64 uses (which is different from the default character set, btw.)
Also, and I'm pretty sure I know what the answer is going to be, but if I end up storing text as ASCII in memory, should I reprogram the character set to be an ASCII character set as well?
What do you guys think?
Thanks.
I wanted to clear up as much available RAM as possible, so the first thing I'm currently doing is disabling ALL of the ROM bank overlays, so that the CPU has access to the full 64k of RAM. This means that I have to (or "get to") write my own kernel routines for the video display, keyboard handler, disk drive I/O, etc.
So, of course, my first task is to read events from the keyboard and write characters to the screen. My first approach was to create a table mapping the keyboard logical positions to the default screen character set. This works fairly well for a simple proof-of-concept, but now I'm starting to think about handling string data in memory, and rendering embedded text to the screen.
Now, the problem is that the default character set does not line up with the ASCII character set. The lower and upper case characters are "swapped", and the other symbols are scattered about, meaning that a simple formula to convert from one to the other isn't really an option.
So, the question is, how do (or would) you guys handle the situation where you are working on different platforms that have different keyboards, and the default screen character map is different?
I noticed that the C64 emulator that I'm using (WinVICE, I think), has a built in Debug Monitor, but it displays characters in memory as if they are ASCII encoded. So viewing the C64 video memory RAM does not match the characters on the screen. Also, when using the cc65 compiler, I noticed that when I put string literals into the source file, they ended up being case inverted on the screen, so it appears to have the same "problem" that I have in my own compiler.
So, should I just pick an encoding, and convert everything from/to that at run time? Or should I add the functionality to my compiler to allow me to specify what "encoding" I want strings to be output in the binary file?
And what about (and yes I'm being serious...) communicating on the internet from a C64? If I use ASCII as my "native" memory string format, that would make communication over the internet easier, and it would allow me to use the same compiler logic as other platforms as well.
I've also just started looking into the disk drive format to see how it is encoded, but I'm sure that it is going to be the same PETSCII encoding that the C64 uses (which is different from the default character set, btw.)
Also, and I'm pretty sure I know what the answer is going to be, but if I end up storing text as ASCII in memory, should I reprogram the character set to be an ASCII character set as well?
What do you guys think?
Thanks.