Skip to content
hasu@tmk edited this page Aug 26, 2023 · 28 revisions

AMIGA Keyboard

https://www.amigarealm.com/computing/knowledge/hardref/aph.htm

https://archive.org/details/amiga-hardware-reference-manual-3rd-edition/page/357/mode/2up?view=theater

Scan Codes

AMIGA 500/2000/3000

,---. ,------------------------. ,------------------------.
|Esc| |F1  |F2  |F3  |F4  |F5  | |F6  |F7  |F8  |F9  |F10 |
`---' `------------------------' `------------------------'
,-------------------------------------------------------------. ,-----------. ,---------------.
|  `  |  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|  \|Bsp| |Del  |Help | |  (|  )|  /|  *|
|-------------------------------------------------------------| `-----------' |---------------|
|  Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|     |               |  7|  8|  9|  -|
|--------------------------------------------------------\Entr|     ,---.     |---------------|
|Ctrl|Cap|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|  #|    |     |Up |     |  4|  5|  6|  +|  
|-------------------------------------------------------------| ,-----------. |---------------|
|Shift |  <|  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|  Shift   | |Lef|Dow|Rig| |  1|  2|  3|   |
`-------------------------------------------------------------' `-----------' |-----------|Ent|
    |Alt |A   |            Space                  |A   |Alt |                 |      0|  .|   |
    `-------------------------------------------------------'                 `---------------'
,---. ,------------------------. ,------------------------.
| 45| | 50 | 51 | 52 | 53 | 54 | | 55 | 56 | 57 | 58 | 59 |
`---' `------------------------' `------------------------'
,-------------------------------------------------------------. ,-----------. ,---------------.
| 00  | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 41| | 46  | 5F  | | 5A| 5B| 5C| 5D|
|-------------------------------------------------------------| `-----------' |---------------|
| 42    | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B|     |               | 3D| 3E| 3F| 4A|
|--------------------------------------------------------\ 44 |     ,---.     |---------------|
| 63 | 62| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 2A| 2B|    |     | 4C|     | 2D| 2E| 2F| 5E|
|-------------------------------------------------------------| ,-----------. |---------------|
| 60   | 30| 31| 32| 33| 34| 35| 36| 37| 38| 39| 3A|    61    | | 4F| 4D| 4E| | 1D| 1E| 1F|   |
`-------------------------------------------------------------' `-----------' |-----------| 43|
    | 64 | 66 |              40                   | 67 | 64 |                 |     0F| 3C|   |
    `-------------------------------------------------------'                 `---------------'

https://bboah.claunia.com/a4000keyb_german_big.jpg

https://scontent-nrt1-2.xx.fbcdn.net/v/t1.6435-9/141816086_1038725079957336_7190317493765473393_n.jpg?_nc_cat=109&ccb=1-7&_nc_sid=730e14&_nc_ohc=iXuzgoSD9gcAX-JM3Fb&_nc_ht=scontent-nrt1-2.xx&oh=00_AfAQ1Hj-BnsV6tGriRSwUKEOOxYXzYzBLH8YmcnnVQ_oiA&oe=6510CDAB

Pinouts

compatible to IBM PC AT and PS/2

model connector
AMIGA 2000/3000 DIN-5P
AMIG 4000 Mini-DIN-6P

https://allpinouts.org/pinouts/connectors/input_device/keyboard-amiga-6-pin/

SGI Keyboard

Keyboard: http://www.sgistuff.net/hardware/other/input.html

Protocol: https://web.archive.org/web/20151124154027/techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi%3Fcmd=getdoc&coll=0650&db=man&fname=7%20keyboard

Connector: https://hardware.majix.org/computers/sgi/keyboards.shtml

The interface between the keyboard and the system is 600 baud asynchronous. The format used is one start bit followed by eight data bits, an odd parity bit and one stop bit, with one byte sent per key up or down transition. The MSB of the byte is a 0 for a downstroke and a 1 for an upstroke.

5V 3.3V Voltage Translation

http://www.cepstrum.co.jp/hobby/5v33v/5v33v.html

https://www.ti.com/lit/an/scea035a/scea035a.pdf

Basic Operations of CMOS Logic IC

Code Tester

Integer Overflow/Rollover

https://arduino.stackexchange.com/a/12588

Arduino Timer:

  • unsigned long millis()
  • unsigned long micros()

unsigned long is 32-bit size on AVR. millis() rollovers in 49.7 days and micros() in 71.58 secs.

C Integer

Integer Promotion

With the exception of a few special cases like ++ and sizeof operators, the integer promotions apply to almost all operations in C, no matter if unary, binary (or ternary) operators are used.

C11 6.3.1.1:

If an int can represent all values of the original type (as restricted by the width, for a bit-field), the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer promotions. All other types are unchanged by the integer promotions.

The integer promotions are applied only: as part of the usual arithmetic conversions, to certain argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the shift operators, as specified by their respective subclauses.

https://port70.net/~nsz/c/c11/n1570.html#6.3.1.1

Usual arithmetic conversions

Whenever a binary operation (an operation with 2 operands) is done in C, both operands of the operator have to be of the same type. Therefore, in case the operands are of different types, C enforces an implicit conversion of one operand to the type of the other operand. The rules for how this is done are named the usual artihmetic conversions (sometimes informally referred to as "balancing"). These are specified in C11 6.3.18:

Notable here is that the usual arithmetic conversions apply to both floating point and integer variables. In case of integers, we can also note that the integer promotions are invoked from within the usual arithmetic conversions. And after that, when both operands have at least the rank of int, the operators are balanced to the same type, with the same signedness.

C11 6.3.1.8 Usual arithmetic conversions

  • Otherwise, the integer promotions are performed on both operands. Then the following rules are applied to the promoted operands:
    • If both operands have the same type, then no further conversion is needed.
    • Otherwise, if both operands have signed integer types or both have unsigned integer types, the operand with the type of lesser integer conversion rank is converted to the type of the operand with greater rank.
    • Otherwise, if the operand that has unsigned integer type has rank greater or equal to the rank of the type of the other operand, then the operand with signed integer type is converted to the type of the operand with unsigned integer type.
    • Otherwise, if the type of the operand with signed integer type can represent all of the values of the type of the operand with unsigned integer type, then the operand with unsigned integer type is converted to the type of the operand with signed integer type.
    • Otherwise, both operands are converted to the unsigned integer type corresponding to the type of the operand with signed integer type.

https://port70.net/~nsz/c/c11/n1570.html#6.3.1.8

AVR Integer Size

https://gcc.gnu.org/wiki/avr-gcc#Type_Layout

https://www.nongnu.org/avr-libc/user-manual/group__avr__stdint.html

IDEA

Minmal firmware Build

for non-keyboard project

  • NO_KEYBOARD build option for minimal build
  • 6KRO_ENABLE(boot keyboard compatible when report protocol)
  • NKRO_ENABLE

currently keyboard function is built automatically without any options.

Mouse Scroll Wheel Emulation

two implementatons exists on PS/2 and ADB. One common impl to be shared by projects would be nice.

IBMPC buffer handling on send

Data on recv buffer can be removed by calling host_send(). TODO: Fix

MOUSE_ENABLE/MOUSEKEY_ENABLE Build Option

need to be organized

MOUSE_ENABLE is needed for mouse project without mouse key feature. It enables mouse output interface.

Control Endpoint 0

Send command to the endpoint for hidden functions.

UHS3

class

UHS_host/UHS_HID/UHS_HID.h

UHS_HID : UHS_USBInterface

  • UHS_HID(UHS_USB_HOST_BASE *p, UHS_HID_PROCESSOR *hp)
  • Start()
  • OKtoEnumerate(ENUMERATION_INFO *ei)
  • SetInterface(ENUMERATION_INFO *ei)
  • Poll()
  • DriverDefaults()
  • driverPoll()
  • GetAddress()
  • Polling()
  • OnRelease()
  • SetIdle(iface, reportID, duration)
  • SetProtocol(iface, protocol)
  • SetReport(iface, report_type, report_id, nbytes, dataptr)
  • ReportDescr(wIndex, nbytes, *buffer)

UHS_HID_PROCESSOR

  • onStart(UHS_HID_base)
  • onPoll(UHS_HID_base, data, length)
  • onRelease(UHS_HID_base)

UHS_HID_base

HID drivers: RAW, KEYBOARD, MOUSE

  • UHS_HID *parent
  • UHS_HID_driver_t driver
  • driverPoll()
  • driverStart()
  • driverRelease()
  • writeReport(nbytes, *dataptr)

UHS_HID_RAW : UHS_HID_base

UHS_host/UHS_HID/HIDBOOT/UHS_HIDRAWBOOT_KEYBOARD.h

UHS_HIDBOOT_keyboard : UHS_HID_base

UHS_host/UHS_HID/HIDBOOT/UHS_HIDRAWBOOT_MOUSE.h

UHS_HIDBOOT_mouse : UHS_HID_base

Clone this wiki locally