I haven't had a lot of time this week to work on the project, but the couple of hours I have spent on it have been focused on the keyboard scan task - although as it happens I've done very little to the OS ROM, and instead have been getting my head around the VICE keymapping functionality. The way VICE maps a standard ANSI keyboard to the emulated machines' keyboard is pretty smart, using one of two selectable modes and a keymap file which essentially converts PC keyboard codes into row/column pairs - these correspond to the same row/column positions that the VIA derives by strobing the Port B register to see which Port A line(s) responds.
I decided that since VIC++ has no requirement to implement the VIC-20 keyboard, I might as well make use of the VICE keyboard remapper to implement the (nearly) full ANSI keyboard - there are a few keys I'm not worried about, like the numeric keypad and things like Scroll Lock - and encode a fresh row/column table for the VIA which can omit things like the Commodore 'chicken-head' action key. I had a little battle with VICE to begin with about where the keymapping file should be, but in the end we agreed that VICE was best-placed to decide exactly where the file should go - it has to live in the '\VIC20' subfolder beneath the XVIC executable otherwise it just won't get used, even though the commandline options imply it can go anywhere...
But once I'd figured that out, the rest of the time I've spent has been on redefining the keymap to enable VIC++ to receive key presses of a variety of different types from the standard PC keyboard, and arranging the ROM lookup table so that the VIA Port A/B values will then map row/column values as appropriate keyscan codes. It's not quite finished yet, but another hour or so of twiddling will see it done - at which point, we should begin to see things appearing on-screen when a key is pressed.
No comments:
Post a Comment