Image Map Image Map
Page 1 of 6 12345 ... LastLast
Results 1 to 10 of 54

Thread: Olivetti M24 / AT&T 6300 Keyboard Emulator

  1. #1
    Join Date
    Aug 2017
    Location
    New York, Rome, London
    Posts
    80

    Default Olivetti M24 / AT&T 6300 Keyboard Emulator

    Hello All,
    as I may have mentioned in previous posts, I am the proud owner of an Olivetti M24. An Olivetti M24 was my very first computer - everything computer-related I have ever learnt rests on the foundations that I laid exploring the workings of that intriguing machine when I was a child.
    Fast forward many years later I re-acquired an M24 of near-identical configuration (640Kb RAM, dual 360k floppy, no HD, green monochrome display, 102-key ie Type 2 keyboard), which I am very happy with (especially after adding an XT-IDE board from glitchworks). The only problem is that said M24 resides back in Italy, while I spend the vast majority of my working life here in the US. Shipping it over is unthinkable.

    So after a bit of thinking I reached the logical conclusion - buy its American cousin, the AT&T PC 6300, here in the US, where it should be in (relatively) good supply. So I did! The 6300 I bought is in very good shape but bare-bones, ie no hd, no keyboard, and no monitor.

    To the HD part I will come back later.

    The monitor part I solved relatively quickly after a few false starts with VGA cards - I built the simple adapter and connected it to a NEC MultiSync 1990FXp bought off ebay for $40 delivered. The adapter can be improved as is being discussed in another thread - more on this later.

    The more immediate problem was the keyboard, which is the topic of the current thread... which I realize is getting a bit long so I'll split it into different posts (I hope this does not break forum rules).

  2. #2
    Join Date
    Aug 2017
    Location
    New York, Rome, London
    Posts
    80

    Default

    So I thought - the M24 Theory of Operation manual has schematics for both the motherboard (incl. the keyboard interface) and the keyboard itself, as well as a description of the communication protocol between the two: why not build an emulator? How hard could it be?

    Well, not very, but still a bit harder than I originally thought, as it turns out. The main complication is that unlike AT-to-XT converters, in this case we have to deal with TWO asyncronous clock sources, one generated by the AT keyboard, and the other by the M24, which owns the clock generation for the dialogue with its keyboard. After a bit of trial and error I think I got the most robust sequence for the state machine to work.

    In a nutshell, it is based on an Arduino Uno or Nano, and it needs external circuitry to pull down the open-collector lines (it may be possible to just switch the MCU pin mode at the right time and avoid the external circuit, but I think it's safer this way). I used a 74LS07 but in early tests I also used discrete 2N2222's and it worked fine that way as well. It does not require any external library - in early versions I used the PS2KeyAdvanced library but it turned out not to be suitable for what I needed, so I reimplemented the AT protocol from scratch (taking inspiration from said library, which I gratefully acknowledge).

    Note: the M24 came with one of two keyboards:
    - a "Type 1" keyboard with 83 keys
    - a "Type 2" keyboard with 102 keys (similar layout to AT keyboards), also called "deluxe" by the BIOS

    This emulator attempts to reproduce the behaviour of the "Type 2" keyboard.

    A few interesting points I discovered along the way:
    - the M24 keyboard connector also has a 5V pin, which is not used by the M24 keyboard
    - the M24 keyboard powers itself through the 12V pin, but it never really needs 12V: it immediately regulates it down to 5V with an LM340A
    - the 5V rail that supplies said 5V pin appears to be a bit weak: drawing just 100mA results in the voltage dropping from 5.05V to 4.85V. I will try and investigate this further.
    - the M24 keyboard connector also has a /RESET pin (not used by the original keyboard), which is handy for resetting the Arduino upon cold resets of the M24

    It is now rather robust (I have yet to see any TX/RX errors with the latest version) and I see no unexplained behaviour. I even added a very basic TTY functionality so you can open a PuTTY session on your modern PC, connect to the Arduino via USB, and the emulator will convert characters sent down the serial line to keystrokes. It's actually more useful than I thought it would be!

    So it's all good? Well...
    Last edited by Valerio; October 16th, 2018 at 04:15 AM.

  3. #3
    Join Date
    Aug 2017
    Location
    New York, Rome, London
    Posts
    80

    Default

    There is only one problem left (I think), and this is where I'd welcome any help or suggestion.

    I have not been able to understand what the expected behaviour of the original M24 keyboard is upon reset (remember, I do not currently have access to my own original M24 keyboard). As a consequence, in the BIOS POST routine the emulator is not recognized as a "deluxe" (Type 2) keyboard and the system defaults to the 82-key, "Type 1" keyboard. This means that some scancodes are misinterpreted by the BIOS. This is not a huge deal, as they two types are pretty similar. Also, the keyboard type flag can be corrected in software later on rather easily (bit 0 of the byte at 0040:0018 controls the keyboard type).

    Similarly, the CUSTOMER.EXE program fails to recognize that there's a keyboard attached. Using SYSTEM.EXE you can force to run keyboard tests anyway but the output is a bit weird, which bring me to my first actual question (btw thanks for reading so far!):

    - what should the "keyboard test" section of CUSTOMER.EXE / SYSTEM.EXE look like when connected to a real Type 2 keyboard? Can someone post a screenshot? Mine looks like this:

    SYSTEM_KB_TEST.jpg

    I dug into the BIOS listing and this is the relevant code (see page 416 of the System Programmer's Guide) - this is executed just after the "beep" (ie after the RAM test and the "RT Clock Pass" message):

    Code:
    	mov dx,p_kctrl 		; dx = p_kctrl
    	mov al,40h 		; remove keyboard reset
    	out dx, al
    
    	mov ah,1 			; enable self test
    	call kb_cmd_send
    	mov word ptr ds:[reset_flag],cx		;; cx is zero here
    	xor cx, cx 					
    	loop $						; delay
    
    ; Flush any keyboard scan code and store AAh if we get it.
    kb_flush:
    	in al,kb_status		; get 8041 status
    	test al,1 			; test output buffer bit
    	ja kb_flush_back 	; jump if no character pending
    	in al,p_kscan 		; get scan code from data port
    	cmp al,0AAh 		; verify keyboard present
    	jne kb_flush
    	mov word ptr ds : [reset_flag],ax ; keyboard present
    kb_flush_back:
    	loop kb_flush 		; loop If zero
    	xor cx, cx 		; delay
    	loop $
    
    ;; other memory variables init stuff
    
    ; Assume first not Deluxe Keyboard
    	and byte ptr ds:[kb_flag_1],(not dlx_kb)
    
    ; Send command to request ID code from keyboard.
    	mov ah,05H 		; Read keyboard type
    	call kb_cmd_send 	; -- send command.
    	xor cx, cx 		; set up timeout count
    kb_type_wait:
    	in al,kb_status 	; get port status
    	test al,l 			; data byte available?
    	jnz kb_type_read 	; If so, go read it . .
    	loop kb_type_wait 	; else wait awhile longer.
    	jmp kb_not_dlx 		; timeout, default to non-dlx
    kb_type_read:
    	in al,p_kscan 		; read ID byte..
    	test al,01H 		; deluxe kbd. bit set?
    	jz kb_not_dlx
    
    ; 01H bit set, so initialize to Deluxe Keyboard.
    	or byte ptr ds:[kb_flag_1],dlx_kb
    kb_not_dlx:
    (single semicolon comments are the original ones. Double semicolon ones are mine)
    For reference,

    Code:
    p_kscan	equ 060h
    p_kctrl	equ 061h
    kb_status	equ 064h
    So there are three distinct parts:
    a) "remove keyboard reset", ie release the clock line which, until that point, had been kept low (logic 0). Presumably this is what kept the keyboard LEDs blinking on the original keyboard (the Theory of Operation manual says that clock low for longer than 50ms triggers a reset).
    b) "enable self test". This makes the keyboard controller send 0x10 (not 0x01!) to the keyboard. It then waits for 0xAA, which the emulator dutifully sends as soon as it spots the 0x10 from the M24. So far so good (I think).
    c) "read keyboard type". This is where things go wrong. The code sends 0x05 to the data port of the keyboard controller (p_kscan), but nothing happens: nothing is sent to the keyboard itself. So the emulator does not know when to send its reply. The next IN operation always returns 0, and the keyboard is assumed to be non-deluxe.

    This is where I'm stuck. I have tried several things (eg send another byte after 0xAA), but it made no difference. Incidentally CUSTOMER.EXE / SYSTEM.EXE seem to do the same thing - ie reset via the clock line & send 0x10, several times actually - but I can't get them to recognize that a keyboard is present (let alone which type).

    I have now bitten the bullet and bought an AT&T keyboard off eBay so I can try and sniff the exchange, however it's not a "deluxe" type so it may not help me (and it hasn't arrived yet).

    Any ideas?

    Attached for your reference is the schematic I'm using (dip switches and M24 "sniffer" keyboard connector not implemented yet) and the source code. As always, if you want to experiment, use at your own risk...
    Attached Files Attached Files
    Last edited by Valerio; October 16th, 2018 at 05:25 AM.

  4. #4
    Join Date
    Aug 2006
    Location
    Chicagoland, Illinois, USA
    Posts
    5,848
    Blog Entries
    1

    Default

    Great project, great research, great write-up. My only comment is that the type 2 keyboard was either not offered by AT&T (I've never seen one AT&T-branded), or was so uncommon that it isn't worth attempting to emulate as nothing supported it. A scancode conversion of an AT keyboard to the Type 1 keyboard would be 99.9% sufficient.

    For the M24, that may be a different story, but I've never seen or held a Type 2 keyboard, sorry.
    Offering a bounty for:
    - The software "Overhead Express" (doesn't have to be original, can be a copy)
    - A working Sanyo MBC-775, Olivetti M24, or Logabax 1600
    - Music Construction Set, IBM Music Feature edition (has red sticker on front stating IBM Music Feature)

  5. #5
    Join Date
    Oct 2014
    Location
    near frankfurt/m, germany
    Posts
    860

    Default

    I have keyboard 1, keyboard 2, ... and keyboard 3.

    If you provide me a software which raw accesses the keyboard to read all the codes they can do, then I can test with all of them. Don't forget, keyboard 2 can have mouse connector, and I have the mouse as well. We can also see if there are differences in nationality, all my M24 keyboards are germam, except of one extra keyboard which is swiss.

  6. #6
    Join Date
    Aug 2017
    Location
    New York, Rome, London
    Posts
    80

    Default

    Quote Originally Posted by Trixter View Post
    Great project, great research, great write-up. My only comment is that the type 2 keyboard was either not offered by AT&T (I've never seen one AT&T-branded), or was so uncommon that it isn't worth attempting to emulate as nothing supported it. A scancode conversion of an AT keyboard to the Type 1 keyboard would be 99.9% sufficient.

    For the M24, that may be a different story, but I've never seen or held a Type 2 keyboard, sorry.
    Thank you. It's true, I have never seen a 102-key AT&T 6300 keyboard either. Strange - as far as I recall, the 102-key "Type 2" keyboard for the M24 is far more common than the Type 1 in Italy (I have never seen an M24 Type 1 keyboard in real life, but I have seen many Type 2s).

    It should be straightforward to add Type 1 emulation - only a few keys are different (plus the numlock behaviour).

  7. #7
    Join Date
    Aug 2017
    Location
    New York, Rome, London
    Posts
    80

    Default

    Quote Originally Posted by 1ST1 View Post
    I have keyboard 1, keyboard 2, ... and keyboard 3.

    If you provide me a software which raw accesses the keyboard to read all the codes they can do, then I can test with all of them. Don't forget, keyboard 2 can have mouse connector, and I have the mouse as well. We can also see if there are differences in nationality, all my M24 keyboards are germam, except of one extra keyboard which is swiss.
    I'd love to see a photo of a Type 3! What's it like?

    Thanks for the offer! Unfortunately the raw dialogue between the M24 and its keyboard is masked by the 8041 keyboard controller, and is only accessible by eavesdropping on the CLOCK/DATA lines themselves. As for the different national versions, I would expect the scancodes to remain the same, and the localization to be done entirely by the keyboard driver (I think).

    One thing that would be useful is to try the Olivetti Customer Test (CUSTOMER.EXE) and select the keyboard test and take a screenshot - as per my previous post, in my case it looks quite weird and I don't know if it's normal. Here is the link if you don't already have the disk: ftp://ftp.oldskool.org/pub/drivers/A...s/A6_CUSTS.ZIP

    Over the next few days I will try to put the BIOS keyboard ID code in a small .COM file so it can be executed from the DOS command line - it would be great if you could test that on your keyboard(s) and post the results here.

    As for the mouse... yes I did think about it, maybe I will include it in a future version of the emulator!

  8. #8
    Join Date
    Aug 2006
    Location
    Chicagoland, Illinois, USA
    Posts
    5,848
    Blog Entries
    1

    Default

    Quote Originally Posted by Valerio View Post
    I'd love to see a photo of a Type 3! What's it like?
    I'd love to see photos of all three, actually. I have Xerox 6060 and AT&T 6300 keyboards, would be curious how all three M24 keyboards look compared to them.
    Offering a bounty for:
    - The software "Overhead Express" (doesn't have to be original, can be a copy)
    - A working Sanyo MBC-775, Olivetti M24, or Logabax 1600
    - Music Construction Set, IBM Music Feature edition (has red sticker on front stating IBM Music Feature)

  9. #9
    Join Date
    Oct 2014
    Location
    near frankfurt/m, germany
    Posts
    860

    Default

    Sorry, I have checked, I thought that I have a keyboard 1, but I haven't, or haven't found it. Currently I have 3 keyboard 2 in different nationalities (ger, swiss, uk/us) and a keyboard 3 (ger). The two german keyboards have the mouse connector and I have 2 mice. But as you will see, all of them could have the mouse port, they are just covered instead of a connector. I don't know if I just can add the port by soldering the connector, or if I would need a different firmware in the keyboard controller. Currently I have no space to setup the M24, my desk is full with other things. I would need some days to finish that project on the desk and reassemble it, before I can setup the M24.

    As you can see, there are two different designs of Keyboard 2.

    key3ger-m.jpg key2-uk.jpg key2sw.jpg key2ger-m.jpg
    Keyboard 3 ger , Keyboard 2 swiss, Keyboard 2 UK/US, Keyboard 2 ger with different design

  10. #10
    Join Date
    Aug 2017
    Location
    New York, Rome, London
    Posts
    80

    Default

    Thanks - that Keyboard 3 has a very interesting layout, I've never seen it before. Could you flip it over and read the model number? I believe Keyboard 2 model number is ANK 2462, so I would expect this one to be different.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •