Hello, Guest the thread was called286 times and contains 7 replays

last post from LGB-Z at the

Keyboardhandling

  • I was wondering how to properly query the keyboard on the MEGA65. I know that I can use $D610 which makes it very simple to implement keyboardhandling. However, in games you probalby have to be able to press multiple keys at once. With the matrix on C64/C128 it's quite easy and convienent to achieve this, and also to notice when keys are released. With the use $D610 interface I don't see how you can detect when a key is released, especially when more than one key is pressed. So is there also an alternate way to query the state of keys?

  • You can still use the old "matrix way". This $D610 thing ("hardware accelerated keyboard scanner") is more like making programmer's life easy if it's about typing a text (also the result is ASCII - not PETSCII - already). Surely, it's not ideal for games etc, but it was not designed for that purpose. So you can still use the keyboard matrix as it was on C64 and C65 of course, it hasn't disappeared, this $D610 thing is just an extra.

  • You can still use the old "matrix way". This $D610 thing ("hardware accelerated keyboard scanner") is more like making programmer's life easy if it's about typing a text (also the result is ASCII - not PETSCII - already). Surely, it's not ideal for games etc, but it was not designed for that purpose. So you can still use the keyboard matrix as it was on C64 and C65 of course, it hasn't disappeared, this $D610 thing is just an extra.

    Ah! Cool! I was going to try that anyway, but I haven't setup an emulator yet. :) Good to know!


    I already have a keyboard scanning function written for C64 and C128 so I was going to use that as well.

  • I may be missing something here but doesn't returning ASCII results from a PETSCII keyboard force the programmer to put an ASCII-2-PETSCII LUT in order to use the routine?

    that's an extra add-on by MEGA65 (designed for modern usage needs) and it's not compulsory to be used, for sure. Surely, the old way still works, as form of the keyboard matrix, and 100% compatible.

  • Surely, the old way still works, as form of the keyboard matrix, and 100% compatible.

    Cool! So this means that I already have my first MEGA65 function. :D I just have to find a suitable toolchain so I can test it on the emulator. My preferred way is CA65. Even the name is somehow fitting. :thumbsup:


    Is the emulator able to mount D64 images? Does the OpenROM support it?

  • I may be missing something here but doesn't returning ASCII results from a PETSCII keyboard force the programmer to put an ASCII-2-PETSCII LUT in order to use the routine?

    that's an extra add-on by MEGA65 (designed for modern usage needs) and it's not compulsory to be used, for sure. Surely, the old way still works, as form of the keyboard matrix, and 100% compatible.

    I'm not sure this fully answers my question which basically boils down to: why ASCII on a PETSCII machine? There's a lot of code points that will go unused (anything over 127 as they don't represent the same thing as PETSCII graphics)

  • I may be missing something here but doesn't returning ASCII results from a PETSCII keyboard force the programmer to put an ASCII-2-PETSCII LUT in order to use the routine?

    that's an extra add-on by MEGA65 (designed for modern usage needs) and it's not compulsory to be used, for sure. Surely, the old way still works, as form of the keyboard matrix, and 100% compatible.

    I'm not sure this fully answers my question which basically boils down to: why ASCII on a PETSCII machine? There's a lot of code points that will go unused (anything over 127 as they don't represent the same thing as PETSCII graphics)

    Dunno, it was not my choice, I just wanted to help with some background, I cannot give you the ultimate answer you're waiting for. Now at least you have freedom to choice. But one reason I can think of, if you look at the MEGA65 keyboard, you'll see some non-PETSCII chars as well, intended for modern usage with modern software which was not part of the PETSCII standard back to then. But if you ever dream about something like a native C compiler for MEGA65, you mad want to use it in an editor, and things like that. Anyway saying "PETSCII machine" does not mean a lot, it's not a hardware but software thing, some can use ASCII even on a C64 as well. It's just a habit more, as you can change software. And habits can change. When I had my first C64, surely I had no problem with PETSCII or too much idea that I want ASCII instead. Now I have from time to time.