init repo

This commit is contained in:
Roman Krupnin 2025-01-28 19:17:01 +03:00
commit 90e6151613
3260 changed files with 3745062 additions and 0 deletions

25
LICENSE Normal file
View File

@ -0,0 +1,25 @@
BSD 2-Clause License
Copyright (c) 2017,2018,2019,2020, Marcel van Kervinck and Walter Belgers
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

51
README.md Normal file
View File

@ -0,0 +1,51 @@
<br><img src="cropped-logo2.png"/>
Gigatron имеет графическое разрешение 160 на 120 пикселей в графическом режиме VGA 640 на 480. Как вы уже можете догадаться по цифрам, это достигается за счет отображения пикселя Gigatron как 4x4 VGA пикселей. Каждая отдельная точка может отображаться в 64 различных цветах. Аудиовыход поддерживает 4-канальный звук, генерируемый программным обеспечением. В базовой конфигурации Gigatron имеет 32 КБ оперативной памяти, из которых для графических данных требуется чуть менее 19 КБ. Однако уже есть расширения памяти до 64 и 128 Кбайт.
Изобретатели гигатрона
Если я правильно вижу (понимаю), Гигатрон был воплощен в жизнь двумя голландцами. Историю и все источники можно найти на https://gigatron.io/, а также ссылку на форум. Снимаю шляпу перед основателями. Сейчас существует большое сообщество Gigatron и несколько участников. На мой взгляд, это один из самых больших успехов изобретателей. Подобных проектов много, но, насколько я понимаю, ни один не достиг такого размаха. И тогда не следует упускать из виду цель. Насколько я понимаю, согласно девизу Стива Возняка, это достижение цели с помощью как можно меньшего количества кругов.
Источники
gigatron.io — сайт Gigatron TTL со всей информацией
forum.gigatron.io — форум Gigatron
Гигатрон — это компьютер, созданный на основе ТТЛ-схем семейства 7400. Он работает на тактовой частоте 6,25 МГц и спроектирован по гарвардской архитектуре.
Это означает, что программный код и данные не имеют одного и того же адресного пространства. Это упрощает аппаратное обеспечение и требует меньше схем. Но это также означает, что ни одна программа не может быть выполнена из памяти данных (ОЗУ). На первый взгляд это звучит немного парадоксально, поскольку на практике при работе с компьютером программы можно загружать только в память данных (ОЗУ). ПЗУ программы является только считываемой памятью и в него нелегко записать.
Теперь мы подходим к возможностям программирования Гигатрона. Во-первых, конечно, есть машинный язык Гигатрона, единственный, который действительно работает на компьютере. На этом языке написана операционная система Gigatron TTL. С одной стороны, он делает доступными все функции компьютера; он генерирует видеовыход, звук и запрос клавиатуры; Это можно причислить к функциям низкого уровня. Он также предоставляет такие инструменты, как загрузчик, который можно использовать для загрузки внешних данных в Gigatron и его запуска. Помимо нескольких примеров программ, которые также доступны в ПЗУ и могут быть выбраны через меню, существуют также программы, которые позволяют выполнять программный код в памяти данных (ОЗУ).
Во-первых, у нас есть виртуальный ЦП, виртуальный 16-битный ЦП, который интерпретирует программу в оперативной памяти. Это значит, что теперь можно загружать программы в оперативную память и запускать их там. Вторым таким интерпретатором является процессор Virtual 6502. Это означает, что теперь можно выполнить код 6502. Gigatron работает под управлением адаптированной оригинальной операционной системы Apple I и некоторых старых программ 6502, таких как оригинальный MS Basic с арифметикой с плавающей запятой. Если я правильно понял, мы также работаем над виртуальным процессором 8080, чтобы иметь CP/M на Gigatron.
Для программистов, которые не хотят опускаться на уровень ассемблера, все еще доступны некоторые языки высокого уровня. Целочисленный Бейсик уже включен в ПЗУ. Существуют и другие BASIC.
Также на ПК имеются инструменты для создания ПО для Гигатрона и эмулятор для тестирования. Существуют различные ассемблеры для виртуальных ЦП и собственного кода. Существует также компилятор BASIC, который переводит программы в машинный код. Также доступен компилятор ANSI C от LCC.
Я хотел бы записать текущий статус Гигатрона в середине декабря 2021 года. (Как я это вижу)
Gigatron — это недавно разработанный компьютер, который по производительности сравним с домашними компьютерами 1980-х годов, но состоит только из схем TTL (без ЦП), которые уже были доступны в то время. Исключением являются ОЗУ и ПЗУ, но их со временем можно заменить множеством меньших по размеру.
На первом уровне Gigatron имеет 32 Кбайт оперативной памяти, 4-битный аудиовыход, 4 управляемых светодиода, входной интерфейс для геймпада и выход VGA с разрешением 160х120 пикселей в 64 цветах.
1. Чтобы можно было вводить символы, Gigatron получил интерфейс клавиатуры PS2. Небольшая печатная плата «Pluggy McPlugface», на которой небольшой ATTiny85 преобразует сигналы клавиатуры для игрового порта. Вы также можете добиться того же, используя Arduino Uno (или аналогичный) с соответствующими подключениями. Программное обеспечение также предлагает возможность последовательной передачи данных и программ с ПК на Gigatron через Arduino.
2. Далее Norgate разработал «Pluggy Reloaded» ( https://forum.gigatron.io/viewtopic.php?f=4&t=169 ). Печатная плата, сочетающая в себе Arduino Pro Micro с разъемом для SD-карты, входом/выходом игрового порта и соединением PS/2. Плата и соответствующее программное обеспечение одновременно поддерживают геймпад и клавиатуру PS/2. Данные можно передавать с ПК через последовательный USB-интерфейс Pro Micro. И последнее, но не менее важное: программы можно загружать с SD-карты.
3. Параллельно с «Pluggy Reloaded» Марсельк работал над «Шиной расширения». Это небольшая плата, заменяющая оперативную память Gigatron. Он предлагает расширение памяти до 128 КБ (с банком в верхних 32 КБ) и четыре интерфейса SPI. К сожалению, Марсельк больше не смог завершить свою работу. Я успешно протестировал MCP23S17 с этим расширением, которое обеспечивает два 8-битных порта ввода-вывода. К SPI также можно подключить разъем SD-карты, который можно прочитать из lb3361 с помощью нового DEVROM и ОС Gigatron ( https://github.com/lb3361/gigatron-os ). К расширению невозможно подключить более одной SD-карты, возможно, есть проблемы с обработкой MISO некоторых SD-разрывов и подтягивающими резисторами на расширении.
4. На следующем этапе axelb представил свой «Видеоповторитель» ( https://forum.gigatron.io/viewtopic.php?f=4&t=303 ). Предыстория этого такова: Gigatron имеет графику размером 160×120 пикселей, которая отображается с разрешением VGA 640×480. Пиксель состоит из 4 строк/столбцов VGA. Поскольку графика создается Gigatron только с помощью программного обеспечения, Gigatron использует большую часть своей вычислительной мощности для структуры экрана. Для одного пикселя всегда рисуются четыре одинаковые линии. Чтобы увеличить время вычислений приложений, отдельные строки в программном обеспечении можно отключить. Значит после загрузки отображаются только 3 строки из 4. Идея «Видеоповторителя» заключается в том, чтобы сохранить первую строку в оперативной памяти FIFO и затем независимо повторить ее три раза. Плата повторителя заменяет выходной регистр (U37) Gigatron.
5. Совсем недавно «Шина расширения» получила дальнейшее развитие от lb3361 ( https://github.com/lb3361/gigatron-lb ). Текущее расширение поддерживает два разъема для SD-карт для прямого подключения, а плата имеет интерфейс расширения, через который можно напрямую подключить, например, ЦАП 74HCT377 или TLC7524. Это позволяет загружаться с SD-карты, а также загружать и запускать программы с SD-карты. 8-битные данные могут выводиться через интерфейс; плата предоставляет два сигнала выбора для 8-битных выходных портов.

BIN
cropped-logo2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/Gigatron-bottom.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

BIN
docs/Gigatron-manual.pdf Normal file

Binary file not shown.

BIN
docs/Gigatron-top.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

BIN
docs/Layout.pdf Normal file

Binary file not shown.

Binary file not shown.

BIN
docs/Schematics.pdf Normal file

Binary file not shown.

BIN
docs/The Effect of R17.pdf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,13 @@
8 Bit Audo with the TLC7524 Rev. 2
==================================
It is the second draft that tries to avoid the mistakes of the first version. The connection to VREF (15) has been changed. The pin header was adapted to the PCB of lb3361. This means that a 1 to 1 cable can be used. Component footprints have been improved.
! This is just a draft.
![pcb-bottom](8Bit-audio-7524-axelb-v2-brd-bottom.png)
![schematic](8Bit-audio-7524-axelb-v2.sch.png)
![pcb-no-gnd](8Bit-audio-7524-axelb-v2-brd-no-gnd.png)
![pcb](8Bit-audio-7524-axelb-v2-brd-all.png)

View File

@ -0,0 +1,30 @@
# Gigatron Extension 128k+
The 128k+ extension provides 128 kbyte RAM and an SPI interface for the Gigatron.
The first draft was discussed here: https://forum.gigatron.io/viewtopic.php?f=4&t=64
Another extension is lb3361's expansion-retro https://github.com/lb3361/gigatron-lb/tree/main/extension-retro.
It uses two GAL and extends the original with additional I/O functions. The GAL also allows changes to the function through GAL programming.
For all those who don't want GALs and for the new "dev128k7.rom" from lb3361 I made a new PCB from Marcel's original. The extension includes all the latest changes and pin header for two SD card breakout.
In the end there were two PCBs because an old problem reappeared while testing the first one. DANGER! the original circuit does not work with two SD cards and the current ROMs.
This is partly due to the SD cards, which only behave like SPI devices after they have been switched to this mode. The second problem is the SD breakout boards used, which permanently put the MISO signal on the output, independent of /CS. In the original circuit, the MISO signals are separated by the hardware, but they are combined again in the ROM
("anda(0b00001111) #28+i*12 This is why R1 as pull-DOWN is simpler").
One way to solve the problem is to modify the breakout, which requires some skill.
![expansion dualdrive](./picture/sd-card-mod.jpg)
The second possibility is to solve it with hardware. I did that with the second PCB. I borrowed two gates from the 74125 for the solution. This reduces the available SPI on this PCB from 4 to 2.
I built and tested both PCBs. They work as expected.
## original
![expansion original](./expansion-original/picture/expansion-original-pcb-2.jpg)
![expansion original](./picture/gigatron-with-expansion-original.jpg)
## dualdrive modify
![expansion dualdrive](./expansion-dualdrive/picture/expansion-dualdrive-pcb2.jpg)
![expansion dualdrive](./picture/gigatron-with-expansion-dualdrive.jpg)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

View File

@ -0,0 +1 @@
My useful things for the 3d printer

View File

@ -0,0 +1,3 @@
# Breakout holder
A holder for the SD card breakout of the dual drive from LB3361. It brings more mechanical stability.
![sd card breakout holder](gigatron-holder-dual-sd.jpg)

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -0,0 +1,4 @@
# Breakout holder
A holder for the SD card breakout of the single drive on a gigatron. It brings more mechanical stability.
![sd card breakout holder](single-sd-card-holder.jpg)
![holder on gigatron](sd-card-holder-gigatron.jpg)

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -0,0 +1,2 @@
# Jumper cables frame
To give the jumper cables a better hold, I made a small frame in FreeCAD. The STL is for a frame with 13x1 pins (for the current Gigatron I/O expansion). The FreeCAD file can easily be adjusted using the parameters.

View File

@ -0,0 +1,51 @@
# My pictures of soldering
My PCB from JLCPCB
![My PCB from JLCPCB top](picture/gigatron-in-system-rom-emulator-und-debugger-top.jpg)
Soldering FDI FT232R
![soldering fdi FT232R](picture/soldering/0-gigatron-in-system-rom-emulator-and-debugger-solder-fdi.jpg)
Soldering R2, C1, C6 and R4
![soldering R2, C1, C6 and R4](picture/soldering/1-gigatron-in-system-rom-emulator-and-debugger-solder-c1-c6-r4-r2.jpg)
Soldering J2 USB-F-TYPE MINIB and R1
![soldering J2 USB-F-TYPE MINIB and R1](picture/soldering/2-gigatron-in-system-rom-emulator-and-debugger-solder-j2-r1.jpg)
Soldering U2 RAM fix component
![soldering U2 RAM fix component](picture/soldering/3-gigatron-in-system-rom-emulator-and-debugger-solder-u2-ram-fix.jpg)
Soldering U2 RAM finish
![soldering U2 RAM finish](picture/soldering/4-gigatron-in-system-rom-emulator-and-debugger-solder-u2-ram.jpg)
Soldering J3 SDCARD SOCKET
![soldering J3 SDCARD SOCKET](picture/soldering/5-gigatron-in-system-rom-emulator-and-debugger-solder-j3.jpg)
Soldering J3 SDCARD SOCKET
![soldering J3 SDCARD SOCKET](picture/soldering/6-gigatron-in-system-rom-emulator-and-debugger-solder-j3.jpg)
Soldering C8
![soldering C8](picture/soldering/7-gigatron-in-system-rom-emulator-and-debugger-solder-c8.jpg)
Soldering LPC1114
![soldering C8](picture/soldering/8-cpu-soldered.jpg)
Soldering finished
![soldering C8](picture/soldering/9-finished-soldered.jpg)
Two ISD completely assembled
![soldering C8](picture/soldering/A-isd-finished.jpg)
[Back to the overview](https://github.com/hans61/Gigatron-TTL/tree/main/InCircuitEPROMemulator)

View File

@ -0,0 +1,19 @@
# Notes on the electrical connection with the Gigatron
At the ISD I use turned pins for the connection. These give a very good fit in an IC socket with turned contacts. In case of a ZIF socket on the Gigatron, I recommend to insert an IC socket into it. You should be careful with the turned contacts on the ISD, they break off easily when bent.
You also need a connection from the CLK output on the ISD to the Gigatron. The easiest way is to solder a jumper cable to R1 (connection R1 Y1, see pictures). The cable does not interfere with the use of a normal ROM.
**CLK wire on the Gigatron**
![CLK wire on the Gigatron](picture/1-gigatron-with-clk-wire.jpg)
**ZIF socket with ic socket**
![ZIF socket with ic socket](picture/2-gigatron-with-ic-socket.jpg)
**Gigatron with ISD**
![Gigatron with ISD](picture/3-gigatron-with-isd.jpg)
[Back to the overview](https://github.com/hans61/Gigatron-TTL/tree/main/InCircuitEPROMemulator)

View File

@ -0,0 +1,29 @@
# My first steps with the ISD
## Installing the firmware on the LPC1114
The author recommends the lpc21isp tool for programming the microcontroller flash. It is available on Linux and Windows.
Ich habe unter Windows das Tool Flash Magic genutzt (https://www.flashmagictool.com/download.html):
![programming with Flash Magic](picture/installing-the-firmware-on-the-lpc1114.jpg)
I have programmed the firmware without the Gigatron. All three jumpers must be connected.
Addition: I have successfully tested it with lpc21isp under Linux Debian.
## Connection with a terminal program
If jumper JP1 (Vbus) is connected, the Gigatron is supplied with voltage via the USB port of the ISD. This should not be done simultaneously with the USB of the Gigatron. If the Gigatron is supplied with voltage directly, JP1 must not be connected.
Communication should be possible with any terminal program (115200 baud 8 data bits 1 stop bit and parity none, no flow control)
The transfer of data with XMODEM (ROM or gt1 file) I could only test successfully with HyperTerminal and ExtraPuTTYtel.
Addition: I have successfully tested it with minicom under Linux Debian.
## SD card
Only 8.3 file names are supported for the SD card. Folders can exist and be searched. If there is a file with the name **ROM.BIN** in the root directory of the SD card, it is loaded automatically and the Gigatron is started.
[Back to the overview](https://github.com/hans61/Gigatron-TTL/tree/main/InCircuitEPROMemulator)

View File

@ -0,0 +1,45 @@
# In Circuit EPROM emulator and debugger (ISD = In System Debugger)
I am not the author of this project. The repositories is only for documenting my rebuild.
I came upon gesari (Jesus Arias) project here (https://forum.gigatron.io/viewtopic.php?f=4&t=112).
## My first replica
First I soldered the large components. In order FT232R, LPC1114 and CY7C1021D. After a visual inspection then all resistors and capacitors. Then the LD1117S33 and the USB port.
After attaching the crystal and the three jumpers, I did the first test.
After setting all three jumpers and connecting the USB to the computer, a new serial interface should now be recognized.
This only worked for me after connecting PIN 26 (TEST) to GND. That was easy since the neighbor PIN 25 is already on GND. I made a solder bridge between both PINs.
I transferred the firmware for the LPC1114 with the software FlashMagic 13.50 build 6367. (https://www.flashmagictool.com/download.html&d=flashmagic)
Then I removed all jumpers except for JP1 (Power from ISD USB). After that, a serial connection with interactive communication was possible.
After soldering the rest of the parts and removing JP1, it can be inserted into the Gigatron.
Before I soldered the cable for CLK to the Gigatron. It must be in the connection from the crystal to R1. It can be soldered very well to R1 from above. It also didn't affect operation without the board.
CLK wire on Gigatron
![CLK wire](picture/gigatron-romemulator-wire.jpg)
Gigatron with "In Circuit EPROM Emulator and Debugger"
![Gigatron with EPROM emulator and debugger](picture/isd-on-gigatron.jpg)
[**Picture gallery of assembly the ISD**](https://github.com/hans61/Gigatron-TTL/blob/main/InCircuitEPROMemulator/Assembly.md)
[**Programming the firmware and using the SD card**](https://github.com/hans61/Gigatron-TTL/blob/main/InCircuitEPROMemulator/FirstSteps.md)
[**ISD Connection with the Gigatron**](https://github.com/hans61/Gigatron-TTL/blob/main/InCircuitEPROMemulator/ConnectionGigatronIsd.md)
## Use ISD
"In Circuit EPROM Emulator and Debugger" serial communication
![serial communication](picture/rom-emulator-serial.jpg)
"In Circuit EPROM Emulator and Debugger" serial communication load ROM from SD
![serial communication sd card](picture/rom-emulator-serial-load-rom-from-sd.jpg)
"In Circuit EPROM Emulator and Debugger" serial communication load ROM from xmodem
![serial communication xmodem](picture/rom-emulator-serial-load-rom-from-xmodem.jpg)

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

View File

@ -0,0 +1,276 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# 5749180-1_5749180-1
#
DEF 5749180-1_5749180-1 J 0 40 Y Y 1 L N
F0 "J" -200 421 50 H V L BNN
F1 "5749180-1_5749180-1" -200 -600 50 H V L BNN
F2 "TE_5749180-1" 0 0 50 H I L BNN
F3 "5749180-1" 0 0 50 H I L BNN
F4 "Compliant" 0 0 50 H I L BNN
F5 "https://www.te.com/usa-en/product-5749180-1.html?te_bu=Cor&te_type=disp&te_campaign=seda_glo_cor-seda-global-disp-prtnr-fy19-seda-model-bom-cta_sma-317_1&elqCampaignId=32493" 0 0 50 H I L BNN
F6 "5749180-1" 0 0 50 H I L BNN
F7 "None" 0 0 50 H I L BNN
F8 "Connector" 0 0 50 H I L BNN
F9 "6" 0 0 50 H I L BNN
F10 "None" 0 0 50 H I L BNN
F11 "TE Connectivity" 0 0 50 H I L BNN
F12 "Unavailable" 0 0 50 H I L BNN
F13 "6.5 mm[.26 in]" 0 0 50 H I L BNN
F14 "Connector; Mini Circular DIN; Recept. Assy w/Hold Down; 6 Pos; PCB Mnt, Rt Angle" 0 0 50 H I L BNN
DRAW
P 2 0 0 5 -200 -500 200 -500 N
P 2 0 0 5 -200 400 -200 -500 N
P 2 0 0 5 200 -500 200 400 N
P 2 0 0 5 200 400 -200 400 N
X 1 1 400 300 200 L 40 40 0 0 P
X 2 2 400 200 200 L 40 40 0 0 P
X 3 3 400 100 200 L 40 40 0 0 P
X 4 4 400 0 200 L 40 40 0 0 P
X 5 5 400 -100 200 L 40 40 0 0 P
X 6 6 400 -200 200 L 40 40 0 0 P
X SHIELD S1 400 -400 200 L 40 40 0 0 P
X SHIELD S2 400 -400 200 L 40 40 0 0 P
X SHIELD S3 400 -400 200 L 40 40 0 0 P
ENDDRAW
ENDDEF
#
# Connector_Conn_01x06_Male
#
DEF Connector_Conn_01x06_Male J 0 40 Y N 1 F N
F0 "J" 0 300 50 H V C CNN
F1 "Connector_Conn_01x06_Male" 0 -400 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
Connector*:*_1x??_*
$ENDFPLIST
DRAW
S 34 -295 0 -305 1 1 6 F
S 34 -195 0 -205 1 1 6 F
S 34 -95 0 -105 1 1 6 F
S 34 5 0 -5 1 1 6 F
S 34 105 0 95 1 1 6 F
S 34 205 0 195 1 1 6 F
P 2 1 1 6 50 -300 34 -300 N
P 2 1 1 6 50 -200 34 -200 N
P 2 1 1 6 50 -100 34 -100 N
P 2 1 1 6 50 0 34 0 N
P 2 1 1 6 50 100 34 100 N
P 2 1 1 6 50 200 34 200 N
X Pin_1 1 200 200 150 L 50 50 1 1 P
X Pin_2 2 200 100 150 L 50 50 1 1 P
X Pin_3 3 200 0 150 L 50 50 1 1 P
X Pin_4 4 200 -100 150 L 50 50 1 1 P
X Pin_5 5 200 -200 150 L 50 50 1 1 P
X Pin_6 6 200 -300 150 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Connector_DB9_Female_MountingHoles
#
DEF Connector_DB9_Female_MountingHoles J 0 40 Y N 1 F N
F0 "J" 0 650 50 H V C CNN
F1 "Connector_DB9_Female_MountingHoles" 0 575 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
DSUB*Female*
$ENDFPLIST
DRAW
C -70 -400 30 0 1 0 N
C -70 -200 30 0 1 0 N
C -70 0 30 0 1 0 N
C -70 200 30 0 1 0 N
C -70 400 30 0 1 0 N
C 50 -300 30 0 1 0 N
C 50 -100 30 0 1 0 N
C 50 100 30 0 1 0 N
C 50 300 30 0 1 0 N
P 2 0 1 0 -150 -400 -100 -400 N
P 2 0 1 0 -150 -300 20 -300 N
P 2 0 1 0 -150 -200 -100 -200 N
P 2 0 1 0 -150 -100 20 -100 N
P 2 0 1 0 -150 0 -100 0 N
P 2 0 1 0 -150 100 20 100 N
P 2 0 1 0 -150 200 -100 200 N
P 2 0 1 0 -150 300 20 300 N
P 2 0 1 0 -150 400 -100 400 N
P 5 0 1 10 -150 525 -150 -525 150 -375 150 375 -150 525 f
X PAD 0 0 -600 150 U 50 50 1 1 P
X 1 1 -300 400 150 R 50 50 1 1 P
X 2 2 -300 200 150 R 50 50 1 1 P
X 3 3 -300 0 150 R 50 50 1 1 P
X 4 4 -300 -200 150 R 50 50 1 1 P
X 5 5 -300 -400 150 R 50 50 1 1 P
X 6 6 -300 300 150 R 50 50 1 1 P
X 7 7 -300 100 150 R 50 50 1 1 P
X 8 8 -300 -100 150 R 50 50 1 1 P
X 9 9 -300 -300 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Connector_DB9_Male_MountingHoles
#
DEF Connector_DB9_Male_MountingHoles J 0 40 Y N 1 F N
F0 "J" 0 650 50 H V C CNN
F1 "Connector_DB9_Male_MountingHoles" 0 575 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
DSUB*Male*
$ENDFPLIST
DRAW
C -70 -400 30 0 1 0 F
C -70 -200 30 0 1 0 F
C -70 0 30 0 1 0 F
C -70 200 30 0 1 0 F
C -70 400 30 0 1 0 F
C 50 -300 30 0 1 0 F
C 50 -100 30 0 1 0 F
C 50 100 30 0 1 0 F
C 50 300 30 0 1 0 F
P 2 0 1 0 -150 -400 -100 -400 N
P 2 0 1 0 -150 -300 20 -300 N
P 2 0 1 0 -150 -200 -100 -200 N
P 2 0 1 0 -150 -100 20 -100 N
P 2 0 1 0 -150 0 -100 0 N
P 2 0 1 0 -150 100 20 100 N
P 2 0 1 0 -150 200 -100 200 N
P 2 0 1 0 -150 300 20 300 N
P 2 0 1 0 -150 400 -100 400 N
P 5 0 1 10 -150 -525 -150 525 150 375 150 -375 -150 -525 f
X PAD 0 0 -600 150 U 50 50 1 1 P
X 1 1 -300 -400 150 R 50 50 1 1 P
X 2 2 -300 -200 150 R 50 50 1 1 P
X 3 3 -300 0 150 R 50 50 1 1 P
X 4 4 -300 200 150 R 50 50 1 1 P
X 5 5 -300 400 150 R 50 50 1 1 P
X 6 6 -300 -300 150 R 50 50 1 1 P
X 7 7 -300 -100 150 R 50 50 1 1 P
X 8 8 -300 100 150 R 50 50 1 1 P
X 9 9 -300 300 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_D
#
DEF Device_D D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C CNN
F1 "Device_D" 0 -100 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
TO-???*
*_Diode_*
*SingleDiode*
D_*
$ENDFPLIST
DRAW
P 2 0 1 8 -50 50 -50 -50 N
P 2 0 1 0 50 0 -50 0 N
P 4 0 1 8 50 50 50 -50 -50 0 50 50 N
X K 1 -150 0 100 R 50 50 1 1 P
X A 2 150 0 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# SparkFun-Boards_SPARKFUN_PRO_MICRO
#
DEF SparkFun-Boards_SPARKFUN_PRO_MICRO B 0 40 Y Y 1 L N
F0 "B" -350 700 45 H V L BNN
F1 "SparkFun-Boards_SPARKFUN_PRO_MICRO" -350 -750 45 H V L BNN
F2 "SPARKFUN_PRO_MICRO" 0 800 20 H I C CNN
F3 "" 0 0 50 H I C CNN
F4 "XXX-00000" 0 850 60 H V C CNN
$FPLIST
*SPARKFUN_PRO_MICRO*
$ENDFPLIST
DRAW
P 5 1 1 0 -350 650 -350 -650 350 -650 350 650 -350 650 f
X TXO 1 -450 550 100 R 40 40 1 1 B
X 7 10 -450 -350 100 R 40 40 1 1 B
X 8 11 -450 -450 100 R 40 40 1 1 B
X *9 12 -450 -550 100 R 40 40 1 1 B
X *10 13 450 -550 100 L 40 40 1 1 B
X 11(MOSI) 14 450 -450 100 L 40 40 1 1 B
X 12(MISO) 15 450 -350 100 L 40 40 1 1 B
X 13(SCK) 16 450 -250 100 L 40 40 1 1 B
X A0 17 450 -150 100 L 40 40 1 1 B
X A1 18 450 -50 100 L 40 40 1 1 B
X A2 19 450 50 100 L 40 40 1 1 B
X RXI 2 -450 450 100 R 40 40 1 1 B
X A3 20 450 150 100 L 40 40 1 1 B
X VCC 21 450 250 100 L 40 40 1 1 W
X RESET 22 450 350 100 L 40 40 1 1 B
X GND 23 450 450 100 L 40 40 1 1 W
X RAW 24 450 550 100 L 40 40 1 1 W
X GND 3 -450 350 100 R 40 40 1 1 W
X GND 4 -450 250 100 R 40 40 1 1 W
X 2 5 -450 150 100 R 40 40 1 1 B
X *3 6 -450 50 100 R 40 40 1 1 B
X 4 7 -450 -50 100 R 40 40 1 1 B
X *5 8 -450 -150 100 R 40 40 1 1 B
X *6 9 -450 -250 100 R 40 40 1 1 B
ENDDRAW
ENDDEF
#
# Switch_SW_Push
#
DEF Switch_SW_Push SW 0 40 N N 1 F N
F0 "SW" 50 100 50 H V L CNN
F1 "Switch_SW_Push" 0 -60 50 H V C CNN
F2 "" 0 200 50 H I C CNN
F3 "" 0 200 50 H I C CNN
DRAW
C -80 0 20 0 1 0 N
C 80 0 20 0 1 0 N
P 2 0 1 0 0 50 0 120 N
P 2 0 1 0 100 50 -100 50 N
X 1 1 -200 0 100 R 50 50 0 1 P
X 2 2 200 0 100 L 50 50 0 1 P
ENDDRAW
ENDDEF
#
# power_GND
#
DEF power_GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -250 50 H I C CNN
F1 "power_GND" 0 -150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# power_PWR_FLAG
#
DEF power_PWR_FLAG #FLG 0 0 N N 1 F P
F0 "#FLG" 0 75 50 H I C CNN
F1 "power_PWR_FLAG" 0 150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 6 0 1 0 0 0 0 50 -40 75 0 100 40 75 0 50 N
X pwr 1 0 0 0 U 50 50 0 0 w
ENDDRAW
ENDDEF
#
# power_VCC
#
DEF power_VCC #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "power_VCC" 0 150 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
C 0 75 25 0 1 0 N
P 2 0 1 0 0 0 0 50 N
X VCC 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
#End Library

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
update=22/05/2015 07:44:53
version=1
last_client=kicad
[general]
version=1
RootSch=
BoardNm=
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[eeschema]
version=1
LibDir=
[eeschema/libraries]

View File

@ -0,0 +1,537 @@
EESchema Schematic File Version 4
EELAYER 30 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title "Pluggy Reloaded"
Date "2019-10-20"
Rev "1"
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
Text GLabel 7700 1950 0 50 Input ~ 0
GIGATRON_DATA
Text GLabel 7700 2150 0 50 Input ~ 0
GIGATRON_LATCH
Text GLabel 7700 2350 0 50 Input ~ 0
GIGATRON_PULSE
Text GLabel 7700 4000 0 50 Input ~ 0
CONTROLLER_DATA
Text GLabel 7700 3800 0 50 Input ~ 0
CONTROLLER_LATCH
Text GLabel 7700 3600 0 50 Input ~ 0
CONTROLLER_PULSE
Wire Wire Line
7700 1950 8100 1950
Wire Wire Line
7700 2150 8100 2150
Wire Wire Line
7700 2350 8100 2350
Wire Wire Line
7700 3600 8100 3600
Wire Wire Line
7700 3800 8100 3800
Wire Wire Line
7700 4000 8100 4000
$Comp
L power:VCC #PWR010
U 1 1 5DB4203D
P 7300 1450
F 0 "#PWR010" H 7300 1300 50 0001 C CNN
F 1 "VCC" H 7317 1623 50 0000 C CNN
F 2 "" H 7300 1450 50 0001 C CNN
F 3 "" H 7300 1450 50 0001 C CNN
1 7300 1450
1 0 0 -1
$EndComp
$Comp
L power:VCC #PWR011
U 1 1 5DB46AB8
P 7950 3500
F 0 "#PWR011" H 7950 3350 50 0001 C CNN
F 1 "VCC" H 7967 3673 50 0000 C CNN
F 2 "" H 7950 3500 50 0001 C CNN
F 3 "" H 7950 3500 50 0001 C CNN
1 7950 3500
1 0 0 -1
$EndComp
Wire Wire Line
7950 3500 7950 4100
Wire Wire Line
7950 4100 8100 4100
$Comp
L power:GND #PWR09
U 1 1 5DB47A33
P 7850 4500
F 0 "#PWR09" H 7850 4250 50 0001 C CNN
F 1 "GND" H 7855 4327 50 0000 C CNN
F 2 "" H 7850 4500 50 0001 C CNN
F 3 "" H 7850 4500 50 0001 C CNN
1 7850 4500
1 0 0 -1
$EndComp
Wire Wire Line
7800 2250 8100 2250
Wire Wire Line
7850 3700 8100 3700
$Comp
L power:GND #PWR07
U 1 1 5DBF2B5C
P 6400 4050
F 0 "#PWR07" H 6400 3800 50 0001 C CNN
F 1 "GND" H 6405 3877 50 0000 C CNN
F 2 "" H 6400 4050 50 0001 C CNN
F 3 "" H 6400 4050 50 0001 C CNN
1 6400 4050
1 0 0 -1
$EndComp
Text GLabel 5750 4050 2 50 Input ~ 0
KB_DATA
Text GLabel 5750 3650 2 50 Input ~ 0
KB_CLOCK
$Comp
L SparkFun-Boards:SPARKFUN_PRO_MICRO B1
U 1 1 5DB47886
P 5000 2200
F 0 "B1" H 5000 3000 45 0000 C CNN
F 1 "SPARKFUN_PRO_MICRO" H 5000 2900 45 0000 C CNN
F 2 "Boards:SPARKFUN_PRO_MICRO" H 5000 3000 20 0001 C CNN
F 3 "" H 5000 2200 50 0001 C CNN
F 4 "XXX-00000" H 5000 2931 60 0001 C CNN "Field4"
1 5000 2200
1 0 0 -1
$EndComp
Text GLabel 4350 2550 0 50 Input ~ 0
CONTROLLER_PULSE
Text GLabel 4350 2450 0 50 Input ~ 0
CONTROLLER_LATCH
Text GLabel 4350 2350 0 50 Input ~ 0
CONTROLLER_DATA
$Comp
L Connector:DB9_Male_MountingHoles J4
U 1 1 5DB595C8
P 8400 3800
F 0 "J4" H 8580 3802 50 0000 L CNN
F 1 "GAME_CONTROLLER" H 8580 3711 50 0000 L CNN
F 2 "Connector_Dsub:DSUB-9_Male_Horizontal_P2.77x2.84mm_EdgePinOffset9.90mm_Housed_MountingHolesOffset11.32mm" H 8400 3800 50 0001 C CNN
F 3 " ~" H 8400 3800 50 0001 C CNN
1 8400 3800
1 0 0 -1
$EndComp
Wire Wire Line
7850 3700 7850 4400
Wire Wire Line
8400 4400 7850 4400
Connection ~ 7850 4400
Wire Wire Line
7850 4400 7850 4500
$Comp
L Connector:DB9_Female_MountingHoles J3
U 1 1 5DB6F3F1
P 8400 2150
F 0 "J3" H 8580 2152 50 0000 L CNN
F 1 "GIGATRON" H 8580 2061 50 0000 L CNN
F 2 "Connector_Dsub:DSUB-9_Female_Horizontal_P2.77x2.84mm_EdgePinOffset9.90mm_Housed_MountingHolesOffset11.32mm" H 8400 2150 50 0001 C CNN
F 3 " ~" H 8400 2150 50 0001 C CNN
1 8400 2150
1 0 0 -1
$EndComp
Wire Wire Line
7800 2250 7800 2750
Wire Wire Line
7800 2750 7800 2850
Connection ~ 7800 2750
Text GLabel 4350 2650 0 50 Input ~ 0
GIGATRON_DATA
Text GLabel 4350 2750 0 50 Input ~ 0
GIGATRON_LATCH
Text GLabel 5650 2750 2 50 Input ~ 0
GIGATRON_PULSE
Wire Wire Line
4350 2650 4550 2650
Wire Wire Line
4350 2750 4550 2750
Wire Wire Line
5450 2750 5650 2750
Wire Wire Line
4350 2350 4550 2350
Wire Wire Line
4350 2450 4550 2450
Wire Wire Line
4350 2550 4550 2550
$Comp
L power:GND #PWR03
U 1 1 5DBA1EFF
P 4150 1850
F 0 "#PWR03" H 4150 1600 50 0001 C CNN
F 1 "GND" H 4000 1800 50 0000 C CNN
F 2 "" H 4150 1850 50 0001 C CNN
F 3 "" H 4150 1850 50 0001 C CNN
1 4150 1850
1 0 0 -1
$EndComp
Wire Wire Line
4350 1850 4550 1850
Wire Wire Line
4550 1950 4350 1950
Wire Wire Line
4350 1950 4350 1850
Text GLabel 4350 2250 0 50 Input ~ 0
KB_DATA
Text GLabel 4350 2150 0 50 Input ~ 0
KB_CLOCK
Wire Wire Line
4350 2150 4550 2150
Wire Wire Line
4350 2250 4550 2250
$Comp
L Device:D D1
U 1 1 5DBAD20F
P 7300 1650
F 0 "D1" V 7254 1729 50 0000 L CNN
F 1 "D" V 7345 1729 50 0000 L CNN
F 2 "Diode_THT:D_DO-35_SOD27_P7.62mm_Horizontal" H 7300 1650 50 0001 C CNN
F 3 "~" H 7300 1650 50 0001 C CNN
1 7300 1650
0 1 1 0
$EndComp
Wire Wire Line
7300 1450 7300 1500
Wire Wire Line
7300 1800 7300 1850
$Comp
L power:VCC #PWR04
U 1 1 5DBB9D65
P 6150 2000
F 0 "#PWR04" H 6150 1850 50 0001 C CNN
F 1 "VCC" H 6167 2173 50 0000 C CNN
F 2 "" H 6150 2000 50 0001 C CNN
F 3 "" H 6150 2000 50 0001 C CNN
1 6150 2000
-1 0 0 1
$EndComp
Wire Wire Line
6150 2000 6150 1950
Wire Wire Line
7800 2750 8400 2750
$Comp
L power:GND #PWR01
U 1 1 5DC64671
P 3950 4050
F 0 "#PWR01" H 3950 3800 50 0001 C CNN
F 1 "GND" H 3955 3877 50 0000 C CNN
F 2 "" H 3950 4050 50 0001 C CNN
F 3 "" H 3950 4050 50 0001 C CNN
1 3950 4050
1 0 0 -1
$EndComp
Wire Wire Line
3850 4000 3950 4000
Wire Wire Line
3950 4000 3950 4050
$Comp
L power:VCC #PWR02
U 1 1 5DC65A65
P 4200 4050
F 0 "#PWR02" H 4200 3900 50 0001 C CNN
F 1 "VCC" H 4217 4223 50 0000 C CNN
F 2 "" H 4200 4050 50 0001 C CNN
F 3 "" H 4200 4050 50 0001 C CNN
1 4200 4050
-1 0 0 1
$EndComp
Wire Wire Line
3850 3900 4200 3900
Wire Wire Line
4200 3900 4200 4050
Text GLabel 4000 3800 2 50 Input ~ 0
SPI_MISO
Text GLabel 4000 3700 2 50 Input ~ 0
SPI_MOSI
Text GLabel 4000 3600 2 50 Input ~ 0
SPI_SCK
Text GLabel 4000 3500 2 50 Input ~ 0
SPI_CS
Wire Wire Line
4000 3500 3850 3500
Wire Wire Line
3850 3600 4000 3600
Wire Wire Line
3850 3800 4000 3800
Wire Wire Line
3850 3700 4000 3700
Text GLabel 5650 2550 2 50 Input ~ 0
SPI_MISO
Text GLabel 5650 2650 2 50 Input ~ 0
SPI_MOSI
Text GLabel 5650 2450 2 50 Input ~ 0
SPI_SCK
Wire Wire Line
5650 2450 5450 2450
Wire Wire Line
5450 2550 5650 2550
Wire Wire Line
5650 2650 5450 2650
Wire Wire Line
4350 1850 4150 1850
Connection ~ 4350 1850
Text GLabel 4350 2050 0 50 Input ~ 0
SPI_CS
Wire Wire Line
4350 2050 4550 2050
$Comp
L Switch:SW_Push SW1
U 1 1 5DC8EA0F
P 2550 2150
F 0 "SW1" H 2550 2435 50 0000 C CNN
F 1 "RESET" H 2550 2344 50 0000 C CNN
F 2 "Button_Switch_THT:SW_PUSH_6mm_H5mm" H 2550 2350 50 0001 C CNN
F 3 "~" H 2550 2350 50 0001 C CNN
1 2550 2150
1 0 0 -1
$EndComp
$Comp
L 5749180-1:5749180-1 J2
U 1 1 5DCC700F
P 5150 3850
F 0 "J2" H 5258 4415 50 0000 C CNN
F 1 "5749180-1" H 5258 4324 50 0000 C CNN
F 2 "5749180-1:TE_5749180-1" H 5150 3850 50 0001 L BNN
F 3 "5749180-1" H 5150 3850 50 0001 L BNN
F 4 "Compliant" H 5150 3850 50 0001 L BNN "Field4"
F 5 "https://www.te.com/usa-en/product-5749180-1.html?te_bu=Cor&te_type=disp&te_campaign=seda_glo_cor-seda-global-disp-prtnr-fy19-seda-model-bom-cta_sma-317_1&elqCampaignId=32493" H 5150 3850 50 0001 L BNN "Field5"
F 6 "5749180-1" H 5150 3850 50 0001 L BNN "Field6"
F 7 "None" H 5150 3850 50 0001 L BNN "Field7"
F 8 "Connector" H 5150 3850 50 0001 L BNN "Field8"
F 9 "6" H 5150 3850 50 0001 L BNN "Field9"
F 10 "None" H 5150 3850 50 0001 L BNN "Field10"
F 11 "TE Connectivity" H 5150 3850 50 0001 L BNN "Field11"
F 12 "Unavailable" H 5150 3850 50 0001 L BNN "Field12"
F 13 "6.5 mm[.26 in]" H 5150 3850 50 0001 L BNN "Field13"
F 14 "Connector; Mini Circular DIN; Recept. Assy w/Hold Down; 6 Pos; PCB Mnt, Rt Angle" H 5150 3850 50 0001 L BNN "Field14"
1 5150 3850
1 0 0 1
$EndComp
$Comp
L power:VCC #PWR05
U 1 1 5DCD025A
P 6200 4050
F 0 "#PWR05" H 6200 3900 50 0001 C CNN
F 1 "VCC" H 6217 4223 50 0000 C CNN
F 2 "" H 6200 4050 50 0001 C CNN
F 3 "" H 6200 4050 50 0001 C CNN
1 6200 4050
-1 0 0 1
$EndComp
Wire Wire Line
6200 4050 6200 3950
Wire Wire Line
5750 4050 5550 4050
Wire Wire Line
5750 3650 5550 3650
Wire Wire Line
5550 3850 6400 3850
Wire Wire Line
5550 3950 6200 3950
NoConn ~ 5550 3750
NoConn ~ 5550 4150
NoConn ~ 8100 3500
NoConn ~ 8100 3400
NoConn ~ 8100 3900
NoConn ~ 8100 4200
NoConn ~ 8100 2550
NoConn ~ 8100 2450
NoConn ~ 8100 1750
NoConn ~ 8100 2050
NoConn ~ 4550 1650
NoConn ~ 4550 1750
NoConn ~ 5450 1650
$Comp
L Connector:Conn_01x06_Male J1
U 1 1 5DC60CDE
P 3650 3800
F 0 "J1" H 3750 3300 50 0000 C CNN
F 1 "MICRO_SD_BREAKOUT" H 3750 3400 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical" H 3650 3800 50 0001 C CNN
F 3 "~" H 3650 3800 50 0001 C CNN
1 3650 3800
1 0 0 1
$EndComp
Wire Wire Line
5450 1950 6150 1950
Text GLabel 5650 2350 2 50 Input ~ 0
MISC_0
Text GLabel 5650 2250 2 50 Input ~ 0
MISC_1
Text GLabel 5650 2150 2 50 Input ~ 0
MISC_2
Text GLabel 5650 2050 2 50 Input ~ 0
MISC_3
Wire Wire Line
5650 2050 5450 2050
Wire Wire Line
5650 2150 5450 2150
Wire Wire Line
5650 2250 5450 2250
Wire Wire Line
5650 2350 5450 2350
$Comp
L Connector:Conn_01x06_Male J5
U 1 1 5DCBAAAC
P 2250 3800
F 0 "J5" H 2350 3300 50 0000 C CNN
F 1 "MISC_HEADER" H 2350 3400 50 0000 C CNN
F 2 "Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical" H 2250 3800 50 0001 C CNN
F 3 "~" H 2250 3800 50 0001 C CNN
1 2250 3800
1 0 0 1
$EndComp
$Comp
L power:GND #PWR0101
U 1 1 5DCC92DE
P 2550 4050
F 0 "#PWR0101" H 2550 3800 50 0001 C CNN
F 1 "GND" H 2555 3877 50 0000 C CNN
F 2 "" H 2550 4050 50 0001 C CNN
F 3 "" H 2550 4050 50 0001 C CNN
1 2550 4050
1 0 0 -1
$EndComp
Wire Wire Line
2450 4000 2550 4000
Wire Wire Line
2550 4000 2550 4050
$Comp
L power:VCC #PWR0102
U 1 1 5DCC92E6
P 2800 4050
F 0 "#PWR0102" H 2800 3900 50 0001 C CNN
F 1 "VCC" H 2817 4223 50 0000 C CNN
F 2 "" H 2800 4050 50 0001 C CNN
F 3 "" H 2800 4050 50 0001 C CNN
1 2800 4050
-1 0 0 1
$EndComp
Wire Wire Line
2450 3900 2800 3900
Wire Wire Line
2800 3900 2800 4050
Text GLabel 2650 3800 2 50 Input ~ 0
MISC_0
Text GLabel 2650 3700 2 50 Input ~ 0
MISC_1
Text GLabel 2650 3600 2 50 Input ~ 0
MISC_2
Text GLabel 2650 3500 2 50 Input ~ 0
MISC_3
Wire Wire Line
2650 3500 2450 3500
Wire Wire Line
2650 3600 2450 3600
Wire Wire Line
2650 3700 2450 3700
Wire Wire Line
2650 3800 2450 3800
$Comp
L power:PWR_FLAG #FLG0101
U 1 1 5DD7157F
P 7800 1700
F 0 "#FLG0101" H 7800 1775 50 0001 C CNN
F 1 "PWR_FLAG" H 7800 1850 50 0000 C CNN
F 2 "" H 7800 1700 50 0001 C CNN
F 3 "~" H 7800 1700 50 0001 C CNN
1 7800 1700
1 0 0 -1
$EndComp
Wire Wire Line
7800 1700 7800 1850
Wire Wire Line
7800 1850 8100 1850
Wire Wire Line
7300 1850 7800 1850
Connection ~ 7800 1850
Wire Wire Line
6550 2000 6550 1750
$Comp
L power:GND #PWR06
U 1 1 5DBB6CDF
P 2200 2150
F 0 "#PWR06" H 2200 1900 50 0001 C CNN
F 1 "GND" H 2205 1977 50 0000 C CNN
F 2 "" H 2200 2150 50 0001 C CNN
F 3 "" H 2200 2150 50 0001 C CNN
1 2200 2150
1 0 0 -1
$EndComp
$Comp
L power:GND #PWR08
U 1 1 5DB25C47
P 7800 2850
F 0 "#PWR08" H 7800 2600 50 0001 C CNN
F 1 "GND" H 7805 2677 50 0000 C CNN
F 2 "" H 7800 2850 50 0001 C CNN
F 3 "" H 7800 2850 50 0001 C CNN
1 7800 2850
1 0 0 -1
$EndComp
$Comp
L power:PWR_FLAG #FLG0102
U 1 1 5DD9EA59
P 6150 1950
F 0 "#FLG0102" H 6150 2025 50 0001 C CNN
F 1 "PWR_FLAG" H 6150 2100 50 0000 C CNN
F 2 "" H 6150 1950 50 0001 C CNN
F 3 "~" H 6150 1950 50 0001 C CNN
1 6150 1950
1 0 0 -1
$EndComp
Text GLabel 5650 1850 2 50 Input ~ 0
RESET
Wire Wire Line
5650 1850 5450 1850
Text GLabel 2850 2150 2 50 Input ~ 0
RESET
Wire Wire Line
2850 2150 2750 2150
Wire Wire Line
2200 2150 2350 2150
$Comp
L power:GND #PWR0103
U 1 1 5DDB7123
P 6550 2000
F 0 "#PWR0103" H 6550 1750 50 0001 C CNN
F 1 "GND" H 6555 1827 50 0000 C CNN
F 2 "" H 6550 2000 50 0001 C CNN
F 3 "" H 6550 2000 50 0001 C CNN
1 6550 2000
1 0 0 -1
$EndComp
Wire Wire Line
5450 1750 6150 1750
Connection ~ 6150 1950
$Comp
L power:PWR_FLAG #FLG0103
U 1 1 5DDC3D15
P 6150 1750
F 0 "#FLG0103" H 6150 1825 50 0001 C CNN
F 1 "PWR_FLAG" H 6150 1900 50 0000 C CNN
F 2 "" H 6150 1750 50 0001 C CNN
F 3 "~" H 6150 1750 50 0001 C CNN
1 6150 1750
1 0 0 -1
$EndComp
Connection ~ 6150 1750
Wire Wire Line
6150 1750 6550 1750
Wire Wire Line
6400 3850 6400 4050
Wire Wire Line
5550 3450 6400 3450
Wire Wire Line
6400 3450 6400 3850
Connection ~ 6400 3850
$EndSCHEMATC

Binary file not shown.

View File

@ -0,0 +1 @@
https://forum.gigatron.io/viewtopic.php?f=4&t=169&start=20

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
:020000040000FA
:100000001124669A26E030E408C000000197E9F761
:100010008DB183278DB9215019F081E091E7F6CF9A
:1000200080911F138B3E69F48FEF80931F138DE92E
:1000300093E084BF909300108091021081FDFCCF6B
:1000400006C082E080930110E0E0F1E0099580ECC9
:1000500080930608A09123110A2E000CBB0BBC5FF5
:100060002CE530E00E9476007E5F8F4F9F4F2AE0A4
:1000700095958795779567952A95D1F760930808A8
:10008000709309088091E20581608093E205049AEB
:10009000E0E0F2E42DE933E040E41EC08091040882
:1000A00087FFFCCF80910008E11552E4F50711F4B9
:1000B000882391F0809302088193CF018F7799274D
:1000C000892B51F424BF309300108091021080FDE1
:1000D000FCCF8DB184278DB9CF0190548115904C00
:1000E000E8F288ED91E084BF909341000E947D008A
:1000F000B7FF0895821B930B0895A29FB001B39F91
:10010000C001A39F700D811D1124911DB29F700D20
:08011000811D1124911D0895C9
:00000001FF

View File

@ -0,0 +1,422 @@
_runtimePath_ "../../runtime"
_runtimeStart_ &h7FFF
_codeRomType_ ROMv2
const sysArg0 = &h24
const sysArg7 = &h2B
'payload protocol: <isLast>, <length>, <payload 0...62>
'filename packet: <type>, <length>, <name>, <0> : <type> = 1:file or 2:dir
const MAX_FILES = 100
const PAYLOAD_SIZE = 63
const PROTOCOL_SIZE = 1 + 1 + PAYLOAD_SIZE
const PACKET_SIZE = 1 + 1 + 12 + 1
const CmdSDList = 1
const CmdSDExec = 2
const CmdSDOpen = 3
const CmdSDClose = 4
const CmdSDBegin = 5
const CmdSDInit = 6
const EntryFile = 1
const EntryDir = 2
const EntryError = 3
def execAddr, commsAddr, commsSize, commsRetn, browserIdx, browserY, cursorY, cursOldY, isLast, length, runStrAddr, execRtn, waitRtn
runName$ = ""
execName$ = ""
pathName$ = ""
dim commsCmd%(PACKET_SIZE-1) = 0
dim buffer%(PROTOCOL_SIZE-1) = 0
dim browser%(MAX_FILES-1, PACKET_SIZE-1)
gosub findLoader
restart:
gosub initialise
gosub initSDComms
gosub beginSDCard
gosub openSDCard
repeat
gosub listSDCard
gosub loadDir
gosub fillBrowser
until &(isLast)
gosub closeSDCard
gosub printBrowser
f = 0
kk = 255
repeat
wait
gosub handleInput
if &(execRtn) then goto &restart
inc f
forever
end
findLoader:
romType = get("ROM_TYPE")
if romType &= &h20 'ROMv2
execAddr = &hE23E
elseif romType &= &h28 'ROMv3
execAddr = &hB4A8
elseif romType &= &h38 'ROMv4
execAddr = &hAD5A
elseif romType &>= &h40 'ROMv5 or higher
repeat
'create name string
execAddr = get("ROM_READ_DIR", execAddr)
if (execAddr)
poke @execName$, 6
for j=sysArg0 &to sysArg7
poke @execName$ + j - (sysArg0 - 1), peek(j)
next j
if execName$ = "Loader" then return
endif
until execAddr &= 0
print "Loader not found!"
end
endif
return
sendCommsCmd:
asm
LDWI SYS_SendSerial1_v3_80
STW giga_sysFn
LDW _commsAddr
STW giga_sysArg0
LDI 1
STW giga_sysArg2
LD _commsSize
LSLW
LSLW
LSLW
STW giga_sysArg3
SYS 80
STW _commsRetn
endasm
return
'simplified version of Loader, removes checksum, destination address, copying of buffer
'to destination address and visuals
loadDir:
asm
LDW _NextByteIn_32
STW giga_sysFn
loadD0: LDWI _buffer_array
STW giga_sysArg0 'buffer
LDI 207
ST giga_sysArg3 'scanline 207
SYS 32 'isLast, (0 or 1)
LDWI _buffer_array
PEEK
XORI 255
BEQ _loadD0 'loop while idle
LDI 219
ST giga_sysArg3 'scanline 219
SYS 32 'length, (6 bits : 0..62)
LDI 235
ST giga_sysArg3 'scanline 235
SYS 32 'payload 0
LDI 251
ST giga_sysArg3 'scanline 251
SYS 32 'payload 1
LDI 2
ST giga_sysArg3 'scanline 2
loadD1: SYS 32 'payload 2-61
LD giga_sysArg3
ADDI 4
ST giga_sysArg3
XORI 242 'scanline end is 238
BNE _loadD1
LDI 185
ST giga_sysArg3 'scanline 185
SYS 32 'payload 62
endasm
isLast = peek(@buffer)
length = peek(@buffer + 1) AND 63
return
fillBrowser:
bIdx = 2
if length &= 0 then return
if browserIdx &&= MAX_FILES then return
repeat
cIdx = 0
repeat
char = peek(@buffer + bIdx)
poke addr(browser(browserIdx, cIdx)), char
inc bIdx
inc cIdx
until char &&= 0
inc browserIdx
if browserIdx &&= MAX_FILES then return
until (bIdx - 2) &= length
return
printBrowser:
startY = max(min(browserY, browserIdx-15), 0)
endY = min(browserY+14, browserIdx-1)
for i=startY to endY
strAddr = addr(browser(i, 0)) + 1
strLen = peek(strAddr)
isFile = peek(strAddr - 1)
if (i-browserY) &= cursorY
if isFile &&= 1
set FGBG_COLOUR, &h203F
else
set FGBG_COLOUR, &h202A
endif
runStrAddr = strAddr
else
if isFile &= 1
set FGBG_COLOUR, &h3F20
else
set FGBG_COLOUR, &h2A20
endif
endif
at 2, (i-browserY) LSL 3
print string$(strAddr);spc$(12 - strLen);
next i
return
updateBrowser:
startY = max(min(browserY, browserIdx-15), 0)
prevY = startY + cursOldY
prevAddr = addr(browser(prevY, 0)) + 1
prevLen = peek(prevAddr)
isFile = peek(prevAddr - 1)
if isFile &&= 1
set FGBG_COLOUR, &h3F20
else
set FGBG_COLOUR, &h2A20
endif
at 2, (prevY - startY) LSL 3
print string$(prevAddr);spc$(12 - prevLen);
cursOldY = cursorY
currY = startY + cursorY
currAddr = addr(browser(currY, 0)) + 1
currLen = peek(currAddr)
isFile = peek(currAddr - 1)
if isFile &= 1
set FGBG_COLOUR, &h203F
else
set FGBG_COLOUR, &h202A
endif
at 2, (currY - startY) LSL 3
print string$(currAddr);spc$(12 - currLen);
runStrAddr = currAddr
return
getRomType:
romType = get("ROM_TYPE")
NextByteIn_32 = &h0b18 'Default to SYS_ReceiveSerial1
if romType &&= &h20 then NextByteIn_32 = &h0BB1 'ROMv2
if romType &&= &h28 then NextByteIn_32 = &h0BDF 'ROMv3
if romType &&= &h38 then NextByteIn_32 = &h8A31 'ROMv4
if romType &&= &h40 then NextByteIn_32 = &h5907 'ROMv5a
if romType &&= &hf0 then NextByteIn_32 = &h1300 'SDCARD
if romType &&= &hf8 'DEVROM
if execAddr.hi &&= &h5A then NextByteIn_32 = &h5907 '(DEVROM v5a+, initial)
if execAddr.hi &&= &h5C then NextByteIn_32 = &h5B07 '(DEVROM v5a+, last before SYS_ReceiveSerial1)
endif
return
openSDCard:
poke @commsCmd, CmdSDOpen
len = peek(@pathName$)
commsSize = 1 + len + 1
if len &> 0
for i=1 &to len + 1
poke @commsCmd + i, peek(@pathName$ + i)
next i
else
poke @commsCmd + 1, 0
endif
gosub sendCommsCmd
'SDCard open can take a variable amount of time
gosub waitSDCard
pathName$ = ""
return
execApp:
gosub initSDComms
poke @commsCmd, CmdSDExec
runName$ = string$(runStrAddr)
len = peek(@runName$)
for i=1 &to len + 1
poke @commsCmd + i, peek(@runName$ + i)
next i
set FGBG_COLOUR, &h0F20 : cls INIT : cls
commsSize = 1 + len + 1
gosub sendCommsCmd
exec execAddr
return
'repeat delay and auto repeat
handleInput:
k = get("SERIAL_RAW")
if k &&<> kk
f = 0
kk = k
gosub k
endif
if f &> 20
if ((f LSR 1) AND 1)
gosub k
endif
endif
return
'button A
127: gosub execOrList
return
'enter
10: gosub execOrList
return
'right
254: browserY = browserY + 15
browserY = max(min(browserY, browserIdx-15), 0)
gosub printBrowser
return
'left
253: browserY = browserY - 15
browserY = max(browserY, 0)
gosub printBrowser
return
'down
251: inc cursorY
if cursorY &&> min(browserIdx - 1, 14) then cursorY = 0
gosub updateBrowser
return
'up
247: dec cursorY
if cursorY &< 0 then cursorY = min(browserIdx - 1, 14)
gosub updateBrowser
return
'execute files, list directories
execOrList:
entry = peek(runStrAddr - 1)
if entry &&= EntryDir
execRtn = 1
pathName$ = string$(runStrAddr)
endif
if entry &&= EntryFile
execRtn = 0
gosub execApp
endif
if entry &= EntryError
execRtn = 2
pathName$ = ""
endif
return
waitSDCard:
asm
LDW _NextByteIn_32
STW giga_sysFn
waitSD: LDI _waitRtn
STW giga_sysArg0 'waitRtn address
LDI 207
ST giga_sysArg3 'scanline 207
SYS 32 'waitRtn result, (0:ready)
LD _waitRtn
BNE _waitSD 'loop while busy
endasm
wait 2
return
'this command is used to break BabelFish out of it's game controller loop and start checking comms
initSDComms:
commsSize = 1
poke @commsCmd, CmdSDInit
gosub sendCommsCmd
wait
return
listSDCard:
commsSize = 1
poke @commsCmd, CmdSDList
gosub sendCommsCmd
return
closeSDCard:
commsSize = 1
poke @commsCmd, CmdSDClose
gosub sendCommsCmd
return
beginSDCard:
commsSize = 1
poke @commsCmd, CmdSDBegin
gosub sendCommsCmd
'SDCard begin can take a variable amount of time
gosub waitSDCard
return
initialise:
init vars @commsSize
gosub getRomType
commsAddr = @commsCmd
mode 2 : set FGBG_COLOUR, &h3F20 : cls INIT : cls
return

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,710 @@
/*
* PS/2 keyboard handling for Babelfish talking to Gigatron
* Complete rewrite of PS2Keyboard for game controller mapping
* and keymap compression to reduce footprint
*
* References:
*
* https://www.avrfreaks.net/sites/default/files/PS2%20Keyboard.pdf
* The PS/2 Mouse/Keyboard Protocol
*
* http://www.quadibloc.com/comp/scan.htm
* Scan Codes Demytified
*
* https://retired.beyondlogic.org/keyboard/keybrd.htm
* Interfacing the AT keyboard
*
* https://web.archive.org/web/20180101224739/http://www.computer-engineering.org/ps2keyboard/scancodes2.html
* Keyboard Scan Codes: Set 2
*
* https://github.com/PaulStoffregen/PS2Keyboard
* PS/2 Keyboard Library for Arduino
*
* https://github.com/techpaul/PS2KeyAdvanced
* Arduino PS2 Keyboard FULL keyboard protocol support and full keys to integer coding
*
* https://github.com/techpaul/PS2KeyMap/
* Arduino PS2 keyboard International Keyboard mapping from PS2KeyAdvanced and return as UTF-8
*
* https://www.terena.org/activities/multiling/ml-mua/test/kbd-all.html
* This page provides information about layouts of different national
* keyboard their mapping to used Character Sets and UCS
*
* https://github.com/ilpianista/itlinux-win-keyboard
* An Italian keyboard layout for Windows, customized with shortcuts from Linux systems
*/
// TODO
// [Basic features]
// XXX Test keymap for DE
// XXX Test keymap for FR
// XXX Test keymap for GB
// XXX Test keymap for ES
// XXX Issue: Sometimes keyboard starts injecting break codes
// when pressing [buttonA] + arrow keys, making it impossible
// to set the time in Mandelbrot??
// XXX (Left)Alt for buttonB?
//
// [Advanced features, for consideration]
// XXX Caps-Lock and setting LEDs
// XXX Do something with NumLock?
// XXX Key combination to reset keyboard?
// XXX Allow Gigatron to control the keyboard lights
// XXX Let keyboard lights run in a pattern (bad idea :-)
#define PS2_ENTER '\n'
#define PS2_TAB 9
#define PS2_BACKSPACE 127
#define PS2_ESC 27
#define PS2_F1 (0xc0 + 1)
#define PS2_F2 (0xc0 + 2)
#define PS2_F3 (0xc0 + 3)
#define PS2_F4 (0xc0 + 4)
#define PS2_F5 (0xc0 + 5)
#define PS2_F6 (0xc0 + 6)
#define PS2_F7 (0xc0 + 7)
#define PS2_F8 (0xc0 + 8)
#define PS2_F9 (0xc0 + 9)
#define PS2_F10 (0xc0 + 10)
#define PS2_F11 (0xc0 + 11)
#define PS2_F12 (0xc0 + 12)
#define CTRLALTDEL (255 ^ buttonStart)
/*
* Keyboard layout mapping
*/
const char keymapNames[][3] = {
"US", "GB", "DE", "FR", "IT", "ES",
};
const byte nrKeymaps = arrayLen(keymapNames);
int getKeymapIndex(void)
{
byte index = EEPROM.read(offsetof(struct EEPROMlayout, keymapIndex));
return (index >= nrKeymaps) ? 0 : index; // Also handle invalid values
}
const char *getKeymapName()
{
return getKeymapName(getKeymapIndex());
}
const char *getKeymapName(byte index)
{
return (index > arrayLen(keymapNames)) ? 0 : keymapNames[index];
}
enum {
US = 1 << 0,
GB = 1 << 1,
DE = 1 << 2,
FR = 1 << 3,
IT = 1 << 4,
ES = 1 << 5,
NOMOD = 0 << nrKeymaps,
SHIFT = 1 << nrKeymaps,
ALTGR = 2 << nrKeymaps,
EVERY = 3 << nrKeymaps,
};
typedef struct {
byte flags; // Change from byte to word if we add more keymaps
byte code;
byte ascii; // XXX Remove this if we add flags. Value can be inferred by lookup()
} keyTuple_t;
// Keymaps courtesy of
// Arduino PS2Keyboard library (US,DE,FR)
// https://playground.arduino.cc/Main/PS2Keyboard
// and
// Teensy PS2Keyboard library (GB,IT,ES)
// http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html
//
// 229 * 3 bytes = 687 bytes for holding 6 keyboard layouts
// To save space this table excludes codes that aren't in US-ASCII
// because these aren't in the Gigatron font either (yet).
// So accented letters and such are all absent. This is needed
// to make it all fit in the ATtiny85 configuration.
const PROGMEM keyTuple_t keymaps[] = {
{ +US+GB+DE+FR+IT+ES +EVERY, 0x0d, 9 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x5a, 10 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x76, 27 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x29, 32 },
{ +US+GB+DE +IT+ES +SHIFT, 0x16, 33 }, // '!'
{ +FR +NOMOD, 0x4a, 33 },
{ +GB+DE +IT+ES +SHIFT, 0x1e, 34 }, // '"'
{ +FR +NOMOD, 0x26, 34 },
{ +US +SHIFT, 0x52, 34 },
{ +US +SHIFT, 0x26, 35 }, // '#'
{ +FR +ES +ALTGR, 0x26, 35 },
{ +IT +ALTGR, 0x52, 35 },
{ +GB+DE +NOMOD, 0x5d, 35 },
{ +DE+FR +ALTGR, 0x5d, 35 },
{ +US+GB+DE +IT+ES +SHIFT, 0x25, 36 }, // '$'
{ +FR +NOMOD, 0x5b, 36 },
{ +US+GB+DE +IT+ES +SHIFT, 0x2e, 37 }, // '%'
{ +FR +SHIFT, 0x52, 37 },
{ +FR +NOMOD, 0x16, 38 }, // '&'
{ +DE +IT+ES +SHIFT, 0x36, 38 },
{ +US+GB +SHIFT, 0x3d, 38 },
{ +FR +NOMOD, 0x25, 39 }, // '''
{ +IT+ES +NOMOD, 0x4e, 39 },
{ +US+GB +NOMOD, 0x52, 39 },
{ +DE +NOMOD, 0x55, 39 },
{ +DE +SHIFT, 0x5d, 39 },
{ +FR +NOMOD, 0x2e, 40 }, // '('
{ +DE +IT+ES +SHIFT, 0x3e, 40 },
{ +US+GB +SHIFT, 0x46, 40 },
{ +US+GB +SHIFT, 0x45, 41 }, // ')'
{ +DE +IT+ES +SHIFT, 0x46, 41 },
{ +FR +NOMOD, 0x4e, 41 },
{ +US+GB +SHIFT, 0x3e, 42 }, // '*'
{ +DE +IT+ES +SHIFT, 0x5b, 42 },
{ +FR +NOMOD, 0x5d, 42 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x7c, 42 },
{ +US+GB +FR +SHIFT, 0x55, 43 }, // '+'
{ +DE +IT+ES +NOMOD, 0x5b, 43 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x79, 43 },
{ +FR +NOMOD, 0x3a, 44 }, // ','
{ +US+GB+DE +IT+ES +NOMOD, 0x41, 44 },
{ +FR +NOMOD, 0x36, 45 }, // '-'
{ +DE +IT+ES +NOMOD, 0x4a, 45 },
{ +US+GB +NOMOD, 0x4e, 45 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x7b, 45 },
{ +FR +SHIFT, 0x41, 46 }, // '.'
{ +US+GB+DE +IT+ES +NOMOD, 0x49, 46 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x71, 46 },
{ +DE +IT+ES +SHIFT, 0x3d, 47 }, // '/'
{ +FR +SHIFT, 0x49, 47 },
{ +US+GB +NOMOD, 0x4a, 47 },
{ +US+GB+DE +IT+ES +NOMOD, 0x45, 48 }, // '0'
{ +FR +SHIFT, 0x45, 48 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x70, 48 },
{ +US+GB+DE +IT+ES +NOMOD, 0x16, 49 }, // '1'
{ +FR +SHIFT, 0x16, 49 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x69, 49 },
{ +US+GB+DE +IT+ES +NOMOD, 0x1e, 50 }, // '2'
{ +FR +SHIFT, 0x1e, 50 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x72, 50 },
{ +US+GB+DE +IT+ES +NOMOD, 0x26, 51 }, // '3'
{ +FR +SHIFT, 0x26, 51 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x7a, 51 },
{ +US+GB+DE +IT+ES +NOMOD, 0x25, 52 }, // '4'
{ +FR +SHIFT, 0x25, 52 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x6b, 52 },
{ +US+GB+DE +IT+ES +NOMOD, 0x2e, 53 }, // '5'
{ +FR +SHIFT, 0x2e, 53 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x73, 53 },
{ +US+GB+DE +IT+ES +NOMOD, 0x36, 54 }, // '6'
{ +FR +SHIFT, 0x36, 54 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x74, 54 },
{ +US+GB+DE +IT+ES +NOMOD, 0x3d, 55 }, // '7'
{ +FR +SHIFT, 0x3d, 55 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x6c, 55 },
{ +US+GB+DE +IT+ES +NOMOD, 0x3e, 56 }, // '8'
{ +FR +SHIFT, 0x3e, 56 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x75, 56 },
{ +US+GB+DE +IT+ES +NOMOD, 0x46, 57 }, // '9'
{ +FR +SHIFT, 0x46, 57 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x7d, 57 },
{ +FR +NOMOD, 0x49, 58 }, // ':'
{ +DE +IT+ES +SHIFT, 0x49, 58 },
{ +US+GB +SHIFT, 0x4c, 58 },
{ +FR +NOMOD, 0x41, 59 }, // ';'
{ +DE +IT+ES +SHIFT, 0x41, 59 },
{ +US+GB +NOMOD, 0x4c, 59 },
{ +US+GB +SHIFT, 0x41, 60 }, // '<'
{ +DE+FR+IT+ES +NOMOD, 0x61, 60 },
{ +DE +IT+ES +SHIFT, 0x45, 61 }, // '='
{ +US+GB +FR +NOMOD, 0x55, 61 },
{ +US+GB +SHIFT, 0x49, 62 }, // '>'
{ +DE+FR+IT+ES +SHIFT, 0x61, 62 },
{ +FR +SHIFT, 0x3a, 63 }, // '?'
{ +US+GB +SHIFT, 0x4a, 63 },
{ +DE +IT+ES +SHIFT, 0x4e, 63 },
{ +DE+FR +ALTGR, 0x15, 64 }, // '@'
{ +US +SHIFT, 0x1e, 64 },
{ +ES +ALTGR, 0x1e, 64 },
{ +FR +ALTGR, 0x45, 64 },
{ +IT +ALTGR, 0x4c, 64 },
{ +GB +SHIFT, 0x52, 64 },
{ +FR +SHIFT, 0x15, 65 }, // 'A'
{ +US+GB+DE +IT+ES +SHIFT, 0x1c, 65 },
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x32, 66 }, // 'B'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x21, 67 }, // 'C'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x23, 68 }, // 'D'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x24, 69 }, // 'E'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x2b, 70 }, // 'F'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x34, 71 }, // 'G'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x33, 72 }, // 'H'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x43, 73 }, // 'I'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x3b, 74 }, // 'J'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x42, 75 }, // 'K'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x4b, 76 }, // 'L'
{ +US+GB+DE +IT+ES +SHIFT, 0x3a, 77 }, // 'M'
{ +FR +SHIFT, 0x4c, 77 },
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x31, 78 }, // 'N'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x44, 79 }, // 'O'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x4d, 80 }, // 'P'
{ +US+GB+DE +IT+ES +SHIFT, 0x15, 81 }, // 'Q'
{ +FR +SHIFT, 0x1c, 81 },
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x2d, 82 }, // 'R'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x1b, 83 }, // 'S'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x2c, 84 }, // 'T'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x3c, 85 }, // 'U'
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x2a, 86 }, // 'V'
{ +FR +SHIFT, 0x1a, 87 }, // 'W'
{ +US+GB+DE +IT+ES +SHIFT, 0x1d, 87 },
{ +US+GB+DE+FR+IT+ES +SHIFT, 0x22, 88 }, // 'X'
{ +DE +SHIFT, 0x1a, 89 }, // 'Y'
{ +US+GB +FR+IT+ES +SHIFT, 0x35, 89 },
{ +US+GB +IT+ES +SHIFT, 0x1a, 90 }, // 'Z'
{ +FR +SHIFT, 0x1d, 90 },
{ +DE +SHIFT, 0x35, 90 },
{ +FR +ALTGR, 0x2e, 91 }, // '['
{ +DE +IT +ALTGR, 0x3e, 91 },
{ +US+GB +NOMOD, 0x54, 91 },
{ +IT+ES +ALTGR, 0x54, 91 },
{ +IT +NOMOD, 0x0e, 92 }, // '\'
{ +ES +ALTGR, 0x0e, 92 },
{ +FR +ALTGR, 0x3e, 92 },
{ +DE +ALTGR, 0x4e, 92 },
{ +US +NOMOD, 0x5d, 92 },
{ +GB +NOMOD, 0x61, 92 },
{ +DE +IT +ALTGR, 0x46, 93 }, // ']'
{ +FR +ALTGR, 0x4e, 93 },
{ +US+GB +NOMOD, 0x5b, 93 },
{ +IT+ES +ALTGR, 0x5b, 93 },
{ +DE +NOMOD, 0x0e, 94 }, // '^'
{ +US+GB +SHIFT, 0x36, 94 },
{ +FR +ALTGR, 0x46, 94 },
{ +FR +NOMOD, 0x54, 94 },
{ +ES +SHIFT, 0x54, 94 },
{ +IT +SHIFT, 0x55, 94 },
{ +FR +NOMOD, 0x3e, 95 }, // '_'
{ +DE +IT+ES +SHIFT, 0x4a, 95 },
{ +US+GB +SHIFT, 0x4e, 95 },
{ +US+GB +NOMOD, 0x0e, 96 }, // '`'
{ +FR +ALTGR, 0x3d, 96 },
{ +IT +ALTGR, 0x4e, 96 },
{ +ES +NOMOD, 0x54, 96 },
{ +DE +SHIFT, 0x55, 96 },
{ +FR +NOMOD, 0x15, 97 }, // 'a'
{ +US+GB+DE +IT+ES +NOMOD, 0x1c, 97 },
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x32, 98 }, // 'b'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x21, 99 }, // 'c'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x23, 100 }, // 'd'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x24, 101 }, // 'e'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x2b, 102 }, // 'f'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x34, 103 }, // 'g'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x33, 104 }, // 'h'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x43, 105 }, // 'i'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x3b, 106 }, // 'j'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x42, 107 }, // 'k'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x4b, 108 }, // 'l'
{ +US+GB+DE +IT+ES +NOMOD, 0x3a, 109 }, // 'm'
{ +FR +NOMOD, 0x4c, 109 },
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x31, 110 }, // 'n'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x44, 111 }, // 'o'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x4d, 112 }, // 'p'
{ +US+GB+DE +IT+ES +NOMOD, 0x15, 113 }, // 'q'
{ +FR +NOMOD, 0x1c, 113 },
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x2d, 114 }, // 'r'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x1b, 115 }, // 's'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x2c, 116 }, // 't'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x3c, 117 }, // 'u'
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x2a, 118 }, // 'v'
{ +FR +NOMOD, 0x1a, 119 }, // 'w'
{ +US+GB+DE +IT+ES +NOMOD, 0x1d, 119 },
{ +US+GB+DE+FR+IT+ES +NOMOD, 0x22, 120 }, // 'x'
{ +DE +NOMOD, 0x1a, 121 }, // 'y'
{ +US+GB +FR+IT+ES +NOMOD, 0x35, 121 },
{ +US+GB +IT+ES +NOMOD, 0x1a, 122 }, // 'z'
{ +FR +NOMOD, 0x1d, 122 },
{ +DE +NOMOD, 0x35, 122 },
{ +FR +ALTGR, 0x25, 123 }, // '{'
{ +DE +IT +ALTGR, 0x3d, 123 },
{ +ES +ALTGR, 0x52, 123 },
{ +US+GB +SHIFT, 0x54, 123 },
{ +IT +SHIFT, 0x0e, 124 }, // '|'
{ +ES +ALTGR, 0x16, 124 },
{ +FR +ALTGR, 0x36, 124 },
{ +US +SHIFT, 0x5d, 124 },
{ +GB +SHIFT, 0x61, 124 },
{ +DE+FR +ES +ALTGR, 0x61, 124 },
{ +DE +IT +ALTGR, 0x45, 125 }, // '}'
{ +FR +ALTGR, 0x56, 125 },
{ +US+GB +SHIFT, 0x5b, 125 },
{ +ES +ALTGR, 0x5d, 125 },
{ +US +SHIFT, 0x0e, 126 }, // '~'
{ +FR +ALTGR, 0x1e, 126 },
{ +ES +ALTGR, 0x25, 126 },
{ +IT +ALTGR, 0x55, 126 },
{ +DE +ALTGR, 0x5b, 126 },
{ +GB +SHIFT, 0x5d, 126 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x66, 127 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x05, 193 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x06, 194 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x04, 195 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x0c, 196 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x03, 197 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x0b, 198 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x83, 199 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x0a, 200 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x01, 201 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x09, 202 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x78, 203 },
{ +US+GB+DE+FR+IT+ES +EVERY, 0x07, 204 },
};
/*
* Find ASCII code corresponding to key code and active modifiers
* for the current keymap
*/
static inline byte lookup(byte mods, word code)
{
byte keymapFlag = 1 << getKeymapIndex();
for (int i=0; i<arrayLen(keymaps); i++) {
const keyTuple_t *t = &keymaps[i];
byte f = pgm_read_byte(&t->flags);
if (~f & keymapFlag)
continue; // Different keymap
if ((f & EVERY) != EVERY && (f & EVERY) != mods)
continue; // Different modifiers
byte c = pgm_read_byte(&t->code);
if (c != code)
continue; // Different scan code
return pgm_read_byte(&t->ascii);
}
return 0;
}
/*
* Output state
*/
enum {
// bit 0:7 Equivalent game controller buttons (positive)
// buttonRight .. buttonA
// bit 8:13 State of modifier keys
leftShiftFlag = 1<<8,
rightShiftFlag = 1<<9,
leftCtrlFlag = 1<<10,
rightCtrlFlag = 1<<11,
altFlag = 1<<12,
altGrFlag = 1<<13,
shiftFlags = leftShiftFlag | rightShiftFlag,
ctrlFlags = leftCtrlFlag | rightCtrlFlag,
altFlags = altFlag | altGrFlag,
// bit 14:15 Protocol state
breakFlag = 1<<14, // Release of physical key
extendedFlag = 1<<15, // Extended PS/2 keyboard codes
};
#define nextPs2()\
flags &= ~(breakFlag | extendedFlag)
static word flags = 0; // Modifier keys and button state
static byte ascii = 0; // Current ASCII key press
static word lastChange, hold; // Babelfish controls the hold time for keys
// XXX Put variables in a class for better scoping
/*
* PS/2 sequences
*/
static int bitBuffer;
static byte _n;
static word lastClock;
/*
* Input buffering
*/
static volatile byte ps2Buffer[15+1];
static volatile byte head = 0, tail = 0;
#if defined(ARDUINO_attiny)
// attachInterrupt() doesn't work on the ATtiny85
static byte keyboardClockBit;
ISR(PCINT0_vect)
{
if (~PINB & keyboardClockBit) // FALLING edge of PS/2 clock
ps2interrupt();
}
#endif
void keyboard_setup()
{
// Initialize the pins
pinMode(keyboardDataPin, INPUT_PULLUP);
allowPs2();
#if defined(ARDUINO_attiny)
keyboardClockBit = digitalPinToBitMask(keyboardClockPin);
GIMSK |= 1<<PCIE; // Pin change interrupt enable
PCMSK |= keyboardClockBit; // ... for keyboard clock
#else
attachInterrupt(
digitalPinToInterrupt(keyboardClockPin),
ps2interrupt, FALLING);
#endif
}
// Handle one bit from PS/2 keyboard for the next byte
// bit 0 : start bit (0)
// bit 1..8 : data bits 0..7 (lowest bit first)
// bit 9 : parity (odd)
// bit 10 : stop bit (1)
void ps2interrupt()
{
byte nextBit = digitalRead(keyboardDataPin);
word now = (word) millis(); // millis() stops when interrupts are disabled,
// but that is ok, because we will reset n
// after every vPulse (through allowPs2())
// At least 10 kHz required for PS/2, self-reset after time out
if (now - lastClock > 5 || _n >= 11) {
bitBuffer = 1; // Clear bits and setup for odd parity
_n = 0;
}
lastClock = now;
bitBuffer |= nextBit << _n;
bitBuffer ^= nextBit; // Track parity in bit 0
if (_n == 10) {
ps2Buffer[head] = (bitBuffer >> 1) & 255;
byte nextHead = (head + 1) % sizeof ps2Buffer;
if (nextHead != tail // Buffer not (almost) full
&& (bitBuffer & 1)) // Parity check, with bonus check of start/stop bits
head = nextHead;
}
_n++;
}
// Ready to receive
void allowPs2()
{
pinMode(keyboardClockPin, INPUT_PULLUP);
_n = 11; // Consider previous bits lost
}
// Pull clock line LOW to signal that we're not ready to receive
void forbidPs2()
{
digitalWrite(keyboardClockPin, LOW);
pinMode(keyboardClockPin, OUTPUT);
}
// Read next byte from incoming PS/2 buffer, or 0 when empty
static byte readPs2Buffer()
{
byte value = 0;
if (head != tail) {
value = ps2Buffer[tail];
tail = (tail + 1) % sizeof ps2Buffer;
}
return value;
}
byte keyboard_getState()
{
word now = (word) millis(); // Note: without interrupts millis() stops counting
for (;;) {
word value = readPs2Buffer();
if (value == 0) { // Buffer is empty
if (now - lastChange > hold) // Auto-release keys after `hold' milliseconds
ascii = 0;
if (now - lastChange > 1000) // Hold `buttons' a bit longer than the repeat delay. This
flags &= ~255; // is merely a safeguard against missing the break event
// and then ending up with a stuck virtual button press.
break;
}
switch (value) {
// The BREAK or EXTENDED bytes are part of a longer sequence
// Here we don't mind the order they appear in
case 0xe0: flags |= extendedFlag; continue;
case 0xf0: flags |= breakFlag; continue;
case 0xaa: // BAT ok
#define oddParity(x) ((1 ^ x ^ (x>>1) ^ (x>>2) ^ (x>>3) ^ (x>>4) ^ (x>>5) ^ (x>>6) ^ (x>>7)) & 1)
#define code(x) ((1 << 10) | (oddParity(x) << 9) | ((x) << 1))
keyboard_send(code(0xf4)); // Enable (fixes Walter's PERIBOARD-409)
continue;
}
if (flags & extendedFlag)
value |= 0xe0 << 8; // Simplify our switch statements
// Recognize modifier keys
word modifier = 0;
switch (value) {
case 0x11: modifier = altFlag; break;
case 0x12: modifier = leftShiftFlag; break;
case 0x14: modifier = leftCtrlFlag; break;
case 0x59: modifier = rightShiftFlag; break;
case 0xe011: modifier = altGrFlag; break;
case 0xe014: modifier = rightCtrlFlag; break;
}
// Case 1: Handle modifier keys
if (modifier) {
if (flags & breakFlag)
flags &= ~modifier; // Modifier key released
else
flags |= modifier; // Modifier key pressed
nextPs2(); // Reset PS/2 sequence
continue; // Back to reading from buffer
}
// Recognize character and control keys and map them to ASCII
// or game controller buttons
// Always return an updated state to the caller from this point on,
// even if there are still bytes waiting in the buffer.
byte button = 0;
byte newAscii = 0;
switch (value) {
// Extended codes in "Set 2"
case 0xe075: button = buttonUp; break; // [UpArrow]
case 0xe06b: button = buttonLeft; break; // [LeftArrow]
case 0xe072: button = buttonDown; break; // [DownArrow]
case 0xe074: button = buttonRight; break; // [RightArrow]
case 0x66: // [BackSpace]
case 0xe071: if ((flags & ctrlFlags) // [Delete]
&& (flags & altFlags))
newAscii = CTRLALTDEL; // [Ctrl-Alt-Del] becomes [Start]
else
button = buttonA; break; // ASCII DEL is 127 is ~buttonA
case 0xe069: button = buttonA; break; // [End]
case 0xe070: // [Insert]
case 0xe06c: button = buttonB; break; // [Home]
case 0xe07a: button = buttonSelect; break; // [PageDown]
case 0xe07d: button = buttonStart; break; // [PageUp]
case 0xe04a: newAscii = '/'; break; // [/] on numeric island
case 0xe05a: newAscii = '\n'; break; // [Enter] on numeric island
default:
// Apply keyboard mapping to ASCII
if ((flags & altGrFlag) ||
((flags & ctrlFlags) && (flags & altFlag))) // Ctrl+Alt is AltGr
newAscii = lookup(ALTGR, value);
else if (flags & shiftFlags)
newAscii = lookup(SHIFT, value);
else
newAscii = lookup(NOMOD, value);
// Handle control key combinations
if (flags & ctrlFlags)
switch (newAscii) {
case '?': newAscii = 127; break; // Traditional mapping of Ctrl-? to DEL
case ' ': button = 255; break; // Make it send a 0 byte
default:
byte f = fnKey(newAscii);
if (f) {
if (flags & altFlags)
// Ctrl-Alt-Fxx changes the keymap
EEPROM.write(offsetof(struct EEPROMlayout, keymapIndex), f-1);
else
// Ctrl+Fxx are BabelFish commands
newAscii ^= 64;
} else
// Make control codes (what the key is for...)
newAscii &= 31;
}
}
// Consolidate the `flags' and `ascii' states
if (button) { // Case 2: Simulated game controller buttons
lastChange = now;
if (flags & breakFlag)
flags &= ~button; // Button released
else
flags |= button; // Button pressed
ascii = 0;
} else { // Case 3: ASCII keys
if (newAscii != ascii)
lastChange = now;
if (~flags & breakFlag) // Ignore ASCII release events (use 'hold' instead)
ascii = newAscii; // ASCII pressed
hold = 35; // Hold for 3 frames (less than the repeat rate)
if (ascii == CTRLALTDEL) // At least 2 seconds for the [Start] signal
hold = max(500 + now - lastChange, 2500); // No accidental Easter Egg trigger (8b guy)
flags &= ~255;
}
nextPs2(); // Reset PS/2 sequence
break; // Always return, leave anything in buffer behind
}
// Return the newly determined state to caller
return ascii ? ascii : (255 & ~flags);
}
// Return 0 if not a function key, or its ordinal otherwise
byte fnKey(byte key)
{
return (PS2_F1 <= key && key <= PS2_F12) ? (key & 15) : 0;
}
// 'code' must include start, data, parity and stop bits
void keyboard_send(word code)
{
// 1. Bring the Clock line low for at least 100 microseconds
forbidPs2();
delayMicroseconds(100);
// 2. Bring the data line low
digitalWrite(keyboardDataPin, 0);
pinMode(keyboardDataPin, OUTPUT);
// 3. Release the Clock line
allowPs2();
// Pull-up resistor will bring clock line up first
do {
// 6. Wait for the device to bring Clock high
while (digitalRead(keyboardClockPin) == 0)
;
// 4. 7. Wait for the device to bring the Clock line low
// MvK: Falling edge transfers the data
while (digitalRead(keyboardClockPin) != 0)
;
// 5. Set/reset the Data line to send the next data bit
code >>= 1;
if (code & 1)
pinMode(keyboardDataPin, INPUT_PULLUP); // To send 1
else {
digitalWrite(keyboardDataPin, 0);
pinMode(keyboardDataPin, OUTPUT); // To send 0
}
// 8. Repeat steps 5-7 for the other seven data bits and the parity bit
// 9. Release the Data line
} while (code > 1);
pinMode(keyboardDataPin, INPUT_PULLUP);
// 10. Wait for the device to bring Data low
while (digitalRead(keyboardDataPin) != 0)
;
// 11. Wait for the device to bring Clock low
while (digitalRead(keyboardClockPin) != 0)
;
// 12. Wait for the device to release Data and Clock
while (digitalRead(keyboardClockPin) == 0 || digitalRead(keyboardDataPin) == 0)
;
}

View File

@ -0,0 +1,97 @@
// Generated by tinyfont.py
0x0000, // ' '
0x03a0, // '!'
0x6018, // '"'
0x7d5f, // '#'
0x2bf4, // '$'
0x4889, // '%'
0x2aab, // '&'
0x0300, // "'"
0x01d1, // '('
0x45c0, // ')'
0x288a, // '*'
0x11c4, // '+'
0x0440, // ','
0x1084, // '-'
0x0020, // '.'
0x0888, // '/'
0x3e3e, // '0'
0x27e1, // '1'
0x4ea9, // '2'
0x56aa, // '3'
0x709f, // '4'
0x76b2, // '5'
0x3eb7, // '6'
0x4e98, // '7'
0x7ebf, // '8'
0x76be, // '9'
0x0140, // ':'
0x0540, // ';'
0x1151, // '<'
0x294a, // '='
0x4544, // '>'
0x42b8, // '?'
0x3a3d, // '@'
0x3e8f, // 'A'
0x7eaa, // 'B'
0x3a31, // 'C'
0x7e2e, // 'D'
0x7eb1, // 'E'
0x7e90, // 'F'
0x3e37, // 'G'
0x7c9f, // 'H'
0x47f1, // 'I'
0x0a3e, // 'J'
0x7c9b, // 'K'
0x7c21, // 'L'
0x7d9f, // 'M'
0x7ddf, // 'N'
0x7e3f, // 'O'
0x7e4c, // 'P'
0x3a6f, // 'Q'
0x7ecd, // 'R'
0x26b2, // 'S'
0x43f0, // 'T'
0x7c3f, // 'U'
0x783e, // 'V'
0x7cdf, // 'W'
0x6c9b, // 'X'
0x70fc, // 'Y'
0x4eb9, // 'Z'
0x03f1, // '['
0x2082, // '\\'
0x47e0, // ']'
0x2208, // '^'
0x0421, // '_'
0x4100, // '`'
0x1d2f, // 'a'
0x7d26, // 'b'
0x1929, // 'c'
0x193f, // 'd'
0x196d, // 'e'
0x11f4, // 'f'
-0x4d42, // 'g'
0x7d07, // 'h'
0x16e1, // 'i'
-0x76d2, // 'j'
0x7c8b, // 'k'
0x47e1, // 'l'
0x3dcf, // 'm'
0x3d07, // 'n'
0x1926, // 'o'
-0x01b4, // 'p'
-0x4da1, // 'q'
0x3c88, // 'r'
0x15ea, // 's'
0x23e9, // 't'
0x382f, // 'u'
0x386e, // 'v'
0x3cef, // 'w'
0x24c9, // 'x'
-0x1f42, // 'y'
0x256d, // 'z'
0x13f1, // '{'
0x03e0, // '|'
0x47e4, // '}'
0x2310, // '~'
0x7fff, // '\x7f'

View File

@ -0,0 +1,97 @@
#-----------------------------------------------------------------------
#
# tinyfont.py -- a very small font
#
#-----------------------------------------------------------------------
#
# Description:
#
# The tiny font is an 3x5 pixel monospaced font where each character
# is placed in a box of 4x6 pixels. At the native 160x120 Gigatron
# resolution we can display 40x20 characters.
#
# The encoding has 3x5 bits for the pixels and 1 shift bit to indicate
# an overall shift down for characters g, j, p, q and y. The lowercase
# j needs special handling. This scheme gives 2 bytes per character,
# for a total of 192 bytes.
#
# References:
#
# http://vt100.tarunz.org
# VT100 Terminal for Pilot (Brian J. Swetland)
#
# https://robey.lag.net/2010/01/23/tiny-monospace-font.html
# A very tiny, monospace, bitmap font (Robey Pointer)
#
# https://fonts2u.com/small-5x3-regular.font
# Small 5X3 regular (soxhead2000)
#
# https://github.com/olikraus/u8g2
# U8glib library for monochrome displays, version 2
#
# History:
#
# 2018-08-01 (marcelk) Initial version inspired by open source examples
# 2018-08-xx (marcelk) Update of @corz
#
#-----------------------------------------------------------------------
def convert(font):
for c in range(96):
i, j = c % 16, c / 16
word, shift = 0, 0
for y in range(6):
for x in range(3):
p = ((j * 6 + y) * 16 + i) * 4 + x + 1
if font[p] == '@':
if y == 5 and shift == 0:
shift, word = 1, word << 1
word |= 1 << (5*(3-x) - y - 1 + shift)
if shift == 0:
print ' 0x%04x,' % word,
else:
print '-0x%04x,' % (0x8000 - word),
print '// %s' % repr(chr(32+c))
tinyfont =\
'......@..@.@.@.@..@@.@....@...@....@.@..........................'\
'......@..@.@.@@@.@@....@.@.@..@...@...@..@.@..@................@'\
'......@......@.@..@@..@...@.......@...@...@..@@@.....@@@......@.'\
'.............@@@.@@..@...@.@......@...@..@.@..@...@..........@..'\
'......@......@.@..@....@..@@.......@.@...........@........@.....'\
'................................................................'\
'..@@..@..@@..@@..@.@.@@@..@@.@@@.@@@.@@@...........@.....@...@@@'\
'.@.@.@@....@...@.@.@.@...@.....@.@.@.@.@..@...@...@..@@@..@....@'\
'.@.@..@...@..@@..@@@.@@..@@@..@..@@@.@@@.........@.........@..@.'\
'.@.@..@..@.....@...@...@.@.@.@...@.@...@..@...@...@..@@@..@.....'\
'.@@..@@@.@@@.@@....@.@@..@@@.@...@@@.@@......@.....@.....@....@.'\
'................................................................'\
'..@@..@..@@...@@.@@..@@@.@@@..@@.@.@.@@@..@@.@.@.@...@.@.@.@.@@@'\
'.@.@.@.@.@.@.@...@.@.@...@...@...@.@..@....@.@.@.@...@@@.@@@.@.@'\
'.@.@.@@@.@@..@...@.@.@@..@@..@.@.@@@..@....@.@@..@...@@@.@@@.@.@'\
'.@...@.@.@.@.@...@.@.@...@...@.@.@.@..@..@.@.@.@.@...@.@.@@@.@.@'\
'..@@.@.@.@@...@@.@@..@@@.@...@@@.@.@.@@@..@..@.@.@@@.@.@.@.@.@@@'\
'................................................................'\
'.@@...@..@@...@@.@@@.@.@.@.@.@.@.@.@.@.@.@@@..@@.....@@...@.....'\
'.@.@.@.@.@.@.@....@..@.@.@.@.@.@.@.@.@.@...@..@..@....@..@.@....'\
'.@.@.@.@.@@@..@...@..@.@.@.@.@@@..@..@@@..@...@...@...@.........'\
'.@@..@@@.@@....@..@..@.@.@.@.@@@.@.@..@..@....@....@..@.........'\
'.@....@@.@.@.@@...@..@@@..@..@.@.@.@..@..@@@..@@.....@@......@@@'\
'................................................................'\
'.@.......@.........@.......@.....@....@....O.@...@@.............'\
'..@...@@.@@...@@..@@..@@..@...@@.@@..........@.@..@..@@@.@@...@.'\
'.....@.@.@.@.@...@.@.@.@.@@@.@.@.@.@.@@...@@.@@...@..@@@.@.@.@.@'\
'.....@.@.@.@.@...@.@.@@...@..@@@.@.@..@....@.@.@..@..@@@.@.@.@.@'\
'.....@@@.@@...@@..@@..@@..@....@.@.@.@@@.@.@.@.@.@@@.@.@.@.@..@.'\
'..............................@.......... @.....................'\
'..................@...........................@@..@..@@...@@.@@@'\
'.@@...@@.@.@..@@.@@@.@.@.@.@.@.@.@.@.@.@.@@@..@...@...@..@@..@@@'\
'.@.@.@.@.@@..@@...@..@.@.@.@.@@@..@..@.@...@.@@...@...@@.....@@@'\
'.@.@.@.@.@....@@..@..@.@.@@@.@@@..@...@@..@...@...@...@......@@@'\
'.@@...@@.@...@@...@@..@@..@..@@@.@.@...@.@@@..@@..@..@@......@@@'\
'.@.....@..............................@.........................'
print '// Generated by tinyfont.py'
convert(tinyfont)

View File

@ -0,0 +1,9 @@
# Source from 2022-08-16:
## ROM
https://www.dropbox.com/sh/sw0etxvv6z54c0n/AABPUZrywJBoGGucP0vf1NEsa?dl=0
## NO_ROM
https://www.dropbox.com/sh/d8v284j9j41bby3/AAB0HwuKrlWOsKBrOrrxWuCUa?dl=0
Added Arduino Nano Every to BabelFish.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
:020000040000FA
:100000001124669A26E030E408C000000197E9F761
:100010008DB183278DB9215019F081E091E7F6CF9A
:1000200080911F138B3E69F48FEF80931F138DE92E
:1000300093E084BF909300108091021081FDFCCF6B
:1000400006C082E080930110E0E0F1E0099580ECC9
:1000500080930608A09123110A2E000CBB0BBC5FF5
:100060002CE530E00E9476007E5F8F4F9F4F2AE0A4
:1000700095958795779567952A95D1F760930808A8
:10008000709309088091E20581608093E205049AEB
:10009000E0E0F2E42DE933E040E41EC08091040882
:1000A00087FFFCCF80910008E11552E4F50711F4B9
:1000B000882391F0809302088193CF018F7799274D
:1000C000892B51F424BF309300108091021080FDE1
:1000D000FCCF8DB184278DB9CF0190548115904C00
:1000E000E8F288ED91E084BF909341000E947D008A
:1000F000B7FF0895821B930B0895A29FB001B39F91
:10010000C001A39F700D811D1124911DB29F700D20
:08011000811D1124911D0895C9
:00000001FF

View File

@ -0,0 +1,10 @@
// Annotated hexdump for Blinky.gt1
0x7f, 0x00, 0x0b, // Segment 7f00: 11 bytes
0x11, 0x50, 0x44, // 7f00 LDWI $4450 ; Load address of center of screen
0x2b, 0x30, // 7f03 STW 'p' ; Store in variable 'p' (at $0030)
0xf0, 0x30, // 7f05 POKE 'p' ; Write low byte of accumulator there
0xe3, 0x01, // 7f07 ADDI 1 ; Increment accumulator
0x90, 0x03, // 7f09 BRA $7f05 ; Loop forever
0x00, // No more segments
0x7f, 0x00 // Start address

Some files were not shown because too many files have changed in this diff Show More