• Please review our updated Terms and Rules here

AT to XT Keyboard Converter

No specific advice, it's just a matter of table lookup. It's all in the file XTTRANS.INC, in PS/2 scan code order. Each RETLW instruction in the table takes as an operand the scan code of the XT keyboard. The XT technical reference will make things a bit easier to figure out, assuming that you have the PS/2 scan codes already at your fingertips.

I used the gpasm assembler from the GP Utils
 
Thanks, I also used gpasm when re-assembled it for the 12f683, it was a matter of changing the micro related directives, disabling the comparator as for the 12f675 (and changing it's name from CMCON to CMCON0), and removing the OSC calibration call.
Let's start to change codes...
 
Ok, some progress here, first problem, on spanish keyboards (also XT ones), right alt is called "Alt Gr" and behaves differently, it's used to access some special characters, so... I needed to read and send 0xE0 scancode. That's done; I added some code for checking for 0xE0, and if found just send it, and keep polling, so now I can use it properly. Now, I'll try to update the table, it's not an easy task, cause spanish XT and AT keyboards have different layout, so...
But well, let's go.
 
I'm probably stating the obvious, but any changes to the table should be done using assembly conditional (IF/ENDIF statements), so that a single corpus can be maintained and re-assembled for a given layout by simply defining the appropriate symbol. Ideally, a complete table (not just individual entries) should be duplicated within the conditional "brackets" to make things clear that this is, say, the US English table, or the European Spanish table...

(This would be post number 5000 for me. :) )
 
(This would be post number 5000 for me. :) )

Maybe Erik can make a new member class just for you? :p
I've often wondered how you get anything done (and you do so much) while helping everyone here so much.

Maybe you are hiding a secret? Chuck(G) has a clone?? :)

Congrats though, and thanks for all the help :D
__
Trevor
 
As I age, I find that sleep doesn't come easily. A night where I can get four hours of shuteye is a good one. The flip side is that it leaves me with more time. ;)
 
Well, nice, I think the 0xe0 scancode was all that's needed for spanish. keyb.com command handles the translation under msdos (>5) if launched with the /e modifier for a 102 keys keyboard.
So, do you want the changes I made?, it was a quick hack, perhaps you want to make it nicer, as I'm more into AVR asm and not PIC, but it works really nice :)
In xtatkey.asm, main loop:

Code:
Main4:
    call    ReadKey         ; read something from the buffer
    bz  Main2           ; no data
    movfw   rATChar         ; get the key
    bbc rATChar,7,Main6     ; if not a special

    ; HACK for reading 0xE0 (for right alt, ctrl, etc identification)
    movwf   rTemp1
    sublw   0xe0            ; test E0
    btfss   STATUS,Z
    goto    Main5           ; if not E0 continue

    ; E0, send it
    movlw   0xe0
    movwf   rXTByte
    call    SendXTByte
    goto    Main2

Main5:
    movfw   rTemp1
    xorlw   0xf0            ; it's a key-up
    keep
    skpnz
    bsf rATFlags,bnATRelease    ; key is released
    unkeep
    goto    Main4           ; get next keystroke

;   Something resembling a normal keycode has arrived.

Main6:
    movfw   rATChar
    call    TransATXT       ; translate
    iorlw   0           ; test for zero
    bz  Main8           ; skip if undefined

    keep
    btfsc   rATFlags,bnATRelease

Just the stuff between Main4 and the new Main5, the rest is unchanged.
 
I'm willing to make the change to pass E0 permanent in all versions if we know that early US-based 5150s and clones can handle the keystroke. Does anyone know for certain?
 
So, do you want the changes I made?, it was a quick hack, perhaps you want to make it nicer, as I'm more into AVR asm and not PIC, but it works really nice :)
In xtatkey.asm, main loop:
Ideally, I want the whole file and a description of what it is you did and why. Think of future users, a couple years from now, loading it up for the first time-this thread could be gone.
The code cleanliness doesn't bother me; it's documenting the changes and archiving it. Unless of course if chuck updates the code entirely and makes a new revision... :)
 
Ideally, I want the whole file and a description of what it is you did and why. Think of future users, a couple years from now, loading it up for the first time-this thread could be gone.
The code cleanliness doesn't bother me; it's documenting the changes and archiving it. Unless of course if chuck updates the code entirely and makes a new revision... :)

I just posted the changes I made for the main developer, so if he wants to include it, this will go in the main file at the wiki.
If not, then I'll post my version somewhere, don't worry :)
 
Hargle, I'll try to get the code integrated and checked out this weekend for this. I want to make sure that it works with domestic clone XTs as well. By next week, I'll post new source and binaries.
 
perfect. i'm just about to pop the top on my new PIC programmer and see if the converter board I built last weekend works as expected. A new code base would compliment that nicely. I can test it too on a variety of machines.
 
Hi! I just ordered a new batch of AT2XTKBD PCBs so if anyone would like them please contact me. Everything is the same as last time.

Thanks and have a nice day!

Andrew Lynch
 
Well, here's the lowdown on the change. I've tried this with two XT clones with the same results.

If the converter passes the E0 code to the host system, you get a short beep on each "special" key depression and release--this include the cursor keypad of the Model M, not just the right Alt and Ctrl keys. We're sure to get moaning from our US and UK users about this.

So what to do?

I could use the spare jumper to differentiate between an unvarnished keyboard setup and one that passes E0. Or, I could provide a separate object file for those who wanted it that passes E0 along.

What say ye?
 
At the moment, I'd go with the jumper selection. Not everyone has a PIC programmer, but everyone (who uses a keyboard anyway!) has fingers in which to enable or disable the jumper.

When the day comes when better things can be selected with the jumper, such as AT->XT or XT->AT then we can revisit this issue.

I'd also say that it should default to US without the jumper on. I think there may be a few of us who never even put the header on the board.
 
Okay, here's the firmware for 0.93. US keyboard layout users should need to do nothing.

I got caught in a RTFM situation. I'd assumed that all I/O pins in input mode to have configurable pullups. That turns out not to be true for GP3, pin 4! So, if you don't have a jumper on pin 4, it's low anyway. Easily remedied by soldering a resistor between 2K and 100K (not value-critical) between pin 1 and pin 4 of the PIC--but I recommend the change only for those who will be using the alternate "Scan code E0 pass-through" feature. If you do install the resistor, no jumper means the "E0" mode; a jumper means "no E0" mode. If you don't have the resistor, the result is "No E0" regardless of the jumper.

So, for most people, no change.

Andrew, you might want to amend the schematic and layout to include a, say, 47K resistor between pin 4 and Vcc. I doubt that it will amount to much more than a couple of extra holes in the PCB.

Sorry about the screw-up, guys. Fortunately, it won't affect most users.

Thanks,
Chuck
 

Attachments

  • XTAT093.ZIP
    12.9 KB · Views: 7
Hi! I noticed last night the AT2XTKBD PCBs have arrived. They are $5 with $1 shipping in the US and $3 elsewhere each. Please contact me at LYNCHAJ@YAHOO.COM if interested. These are the build it yourself PCB only variety.

Thanks and have a nice day!

Andrew Lynch
 
Hi all,
I'm a noob to this thread. I've built the XTATKBD converter on strip board, and checked the wiring 4 or 5 times, but it doesn't want to work. I can see (with a logic probe) the signals incoming to pins 5 and 6, but nothing is coming out at pins 2 and 3. I used the 12F675 which I programmed with a P16PRO40 programmer; it verified correctly.
I'm at a loss what to try next. Clues?

Bob Devries
Dalby, QLD, Australia
 
Did you re-assemble the source with the line saying:

clrf 0x1f

un-commented? The 675 differs from the 629 in that the ADC is enabled by default and must be disabled. (0x1f is the ANSEL register).

Hope this helps...
 
Back
Top