├── Support ├── Assembler │ ├── readme.md │ ├── C++ │ │ ├── readme.md │ │ └── Windows │ │ │ ├── readme.md │ │ │ └── asm.exe │ └── Python │ │ ├── readme.md │ │ └── asm.py ├── readme.md └── Emulator │ ├── Windows │ ├── flash.bin │ ├── Minimal64.exe │ └── readme.md │ └── Processing │ ├── Minimal_64_Emulator │ └── flash.bin │ └── README.md ├── Revision 1.2 ├── KiCAD │ ├── Minimal Expansion.dcm │ ├── 8-Bit CPU 32k-rescue.dcm │ ├── 74hc4078.kicad_sym │ ├── 8-Bit CPU 32k.bin │ ├── fp-lib-table │ ├── UART_TX.kicad_sch │ ├── 8-Bit CPU 32k-rescue.lib │ ├── sym-lib-table │ ├── 8-Bit CPU 32k.kicad_prl │ ├── ArduinoPC.pretty │ │ ├── FP_MINI_DIN_6_PS2.kicad_mod │ │ └── VGA DSUB15HD_female.kicad_mod │ ├── 8-Bit CPU 32k-rescue.kicad_sym │ ├── 8-Bit CPU 32k.dcm │ ├── ArduinoPC.lib │ ├── gui_defaults.par │ ├── 8-Bit CPU 32k.pro │ ├── 8-Bit CPU 32k.rules │ ├── Minimal Expansion.lib │ ├── RegA.sch │ ├── RegB.sch │ ├── 8-Bit CPU 32k.kicad_pro │ ├── UART_TX.sch │ ├── 8-Bit CPU 32k │ └── PC.sch ├── Layout.pdf ├── Schematics.pdf ├── FLASH Images │ ├── flash.bin │ ├── ctrl_hsb.bin │ ├── ctrl_lsb.bin │ ├── ctrl_msb.bin │ ├── flash_us.bin │ └── debug │ │ ├── debug_rename_to_flash.bin │ │ ├── debug2_rename_to_flash.bin │ │ └── readme.md ├── Minimal_64_Rev1.2_Gerbers.zip ├── Mouser Parts List by Jim Bailey.xls └── readme.md ├── Programs ├── asm │ ├── readme.md │ ├── chars.asm │ ├── ps2.asm │ ├── hello.asm │ ├── defs.asm │ ├── keyboard_us.txt │ ├── keyboard_german.txt │ ├── vga.asm │ ├── mandel.asm │ ├── balls.asm │ └── blocks.asm ├── min │ ├── rects.min │ ├── dots.min │ ├── fill.min │ ├── lines.min │ ├── readme.md │ ├── std.min │ ├── MIN's EBNF language definition.txt │ └── blocks.min ├── readme.md └── manual.txt ├── CHANGE LOG.md ├── DISCLAIMER.txt └── README.md /Support/Assembler/readme.md: -------------------------------------------------------------------------------- 1 | # Cross-Platform Assembler 2 | -------------------------------------------------------------------------------- /Support/Assembler/C++/readme.md: -------------------------------------------------------------------------------- 1 | Cross-platform assembler written in C++. 2 | -------------------------------------------------------------------------------- /Support/Assembler/Python/readme.md: -------------------------------------------------------------------------------- 1 | Minimalistic cross-platform assembler written in Python. 2 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/Minimal Expansion.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/8-Bit CPU 32k-rescue.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /Support/Assembler/C++/Windows/readme.md: -------------------------------------------------------------------------------- 1 | Cross-platform assembler written in C++ running on Windows. 2 | -------------------------------------------------------------------------------- /Support/readme.md: -------------------------------------------------------------------------------- 1 | # Supporting Tool-Chain 2 | 3 | o Cross-platform assemblers 4 | 5 | o Emulators 6 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/74hc4078.kicad_sym: -------------------------------------------------------------------------------- 1 | (kicad_symbol_lib (version 20211014) (generator kicad_symbol_editor) 2 | ) 3 | -------------------------------------------------------------------------------- /Revision 1.2/Layout.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/Layout.pdf -------------------------------------------------------------------------------- /Revision 1.2/Schematics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/Schematics.pdf -------------------------------------------------------------------------------- /Programs/asm/readme.md: -------------------------------------------------------------------------------- 1 | # Assembly Programs 2 | 3 | Assembly code (OS, native tool-chain, games, demos) written for the 'Minimal 64'. 4 | 5 | -------------------------------------------------------------------------------- /Support/Emulator/Windows/flash.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Support/Emulator/Windows/flash.bin -------------------------------------------------------------------------------- /Revision 1.2/FLASH Images/flash.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/FLASH Images/flash.bin -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/8-Bit CPU 32k.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/KiCAD/8-Bit CPU 32k.bin -------------------------------------------------------------------------------- /Support/Assembler/C++/Windows/asm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Support/Assembler/C++/Windows/asm.exe -------------------------------------------------------------------------------- /Revision 1.2/FLASH Images/ctrl_hsb.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/FLASH Images/ctrl_hsb.bin -------------------------------------------------------------------------------- /Revision 1.2/FLASH Images/ctrl_lsb.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/FLASH Images/ctrl_lsb.bin -------------------------------------------------------------------------------- /Revision 1.2/FLASH Images/ctrl_msb.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/FLASH Images/ctrl_msb.bin -------------------------------------------------------------------------------- /Revision 1.2/FLASH Images/flash_us.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/FLASH Images/flash_us.bin -------------------------------------------------------------------------------- /Support/Emulator/Windows/Minimal64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Support/Emulator/Windows/Minimal64.exe -------------------------------------------------------------------------------- /Revision 1.2/Minimal_64_Rev1.2_Gerbers.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/Minimal_64_Rev1.2_Gerbers.zip -------------------------------------------------------------------------------- /Programs/min/rects.min: -------------------------------------------------------------------------------- 1 | use "std.min" 2 | 3 | clear() 4 | 5 | while 1: 6 | int x = rnd() and 0xff 7 | int y = rnd() and 0x7f 8 | rect(x, y, 144, 112) 9 | -------------------------------------------------------------------------------- /Revision 1.2/Mouser Parts List by Jim Bailey.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/Mouser Parts List by Jim Bailey.xls -------------------------------------------------------------------------------- /Programs/min/dots.min: -------------------------------------------------------------------------------- 1 | use "std.min" 2 | 3 | clear() 4 | 5 | while 1: 6 | int x = rnd() and 0xff << 1 7 | int y = rnd() and 0xff 8 | if (x < 400 and y < 240): dot(x, y) 9 | -------------------------------------------------------------------------------- /Revision 1.2/FLASH Images/debug/debug_rename_to_flash.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/FLASH Images/debug/debug_rename_to_flash.bin -------------------------------------------------------------------------------- /Support/Emulator/Processing/Minimal_64_Emulator/flash.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Support/Emulator/Processing/Minimal_64_Emulator/flash.bin -------------------------------------------------------------------------------- /Revision 1.2/FLASH Images/debug/debug2_rename_to_flash.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slu4coder/The-Minimal-64-Home-Computer/HEAD/Revision 1.2/FLASH Images/debug/debug2_rename_to_flash.bin -------------------------------------------------------------------------------- /Programs/min/fill.min: -------------------------------------------------------------------------------- 1 | use "std.min" 2 | 3 | int a=a[0|25] 4 | 5 | int i=0 6 | while i<25: a[i] = 0xffff; i=i+1 7 | 8 | int video @ 0xc30c 9 | 10 | i=0 11 | while i<7680: video[i]=a; i=i+32 12 | -------------------------------------------------------------------------------- /Programs/min/lines.min: -------------------------------------------------------------------------------- 1 | use "std.min" 2 | 3 | clear() 4 | 5 | int i=0 6 | while i<400: 7 | line(i, 0, 399-i, 239) 8 | i=i+5 9 | 10 | i=0 11 | while i<240: 12 | line(0, 239-i, 399, i) 13 | i=i+5 14 | -------------------------------------------------------------------------------- /Programs/readme.md: -------------------------------------------------------------------------------- 1 | # Native Software of the 'Minimal 64 Home Computer' 2 | 3 | o '.asm' denotes assembly source code. 4 | 5 | o '.min' denotes 'Min' source code. 6 | 7 | o 'manual.txt' is displayed by the 'Minimal 64' upon entering 'show manual'. 8 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (lib (name "logo")(type "KiCad")(uri "${KIPRJMOD}/logo.pretty")(options "")(descr "")) 3 | (lib (name "ArduinoPC")(type "KiCad")(uri "${KIPRJMOD}/ArduinoPC.pretty")(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /Programs/asm/chars.asm: -------------------------------------------------------------------------------- 1 | #org 0x8000 2 | 3 | start: LDI 0x1e ; sends all visible chars starting from 30 up until 255 via UART 4 | 5 | next: OUT NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP 6 | INC 7 | BCC next 8 | JPA start 9 | -------------------------------------------------------------------------------- /Programs/asm/ps2.asm: -------------------------------------------------------------------------------- 1 | ; You can take a look at the raw PS/2 data your Minimal 64 is receiving by using the following code snippet: 2 | 3 | #org 0x8000 4 | 5 | test: INK CPI 0xff BEQ test PHS JPS 0xb04e PLS JPA test ; calls API function _PrintHex 6 | 7 | -------------------------------------------------------------------------------- /Programs/min/readme.md: -------------------------------------------------------------------------------- 1 | # 'Min' Programs 2 | 3 | 'Min' is a Python-like high-level programming language running natively on the 'Minimal 64'. 4 | The interpreter 'min.asm' assembly source code is located in the '../asm' section. 5 | 6 | See 'Min's EBNF Language Definition.txt' for more information. 7 | -------------------------------------------------------------------------------- /Revision 1.2/readme.md: -------------------------------------------------------------------------------- 1 | # Hardware Revision 1.2 2 | 3 | For the bill of materials (BOM) please refer to the chapter 'Hardware' of the 'Minimal 64 Reference Manual': https://docs.google.com/document/d/1e4hL9Z7BLIoUlErWgJOngnSMYLXjfnsZB9BtlwhTC6U/edit?usp=sharing 4 | 5 | Jim Bailey has also shared his MOUSER parts list. 6 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/UART_TX.kicad_sch: -------------------------------------------------------------------------------- 1 | (kicad_sch (version 20211123) (generator eeschema) 2 | 3 | (uuid 58175766-a528-4fb2-ae9f-44f2b527a568) 4 | 5 | (paper "A4") 6 | 7 | (title_block 8 | (title "UART Transmitter") 9 | (date "2022-07-21") 10 | (rev "0.5") 11 | (comment 2 "creativecommons.org/licenses/by-nc-sa/4.0/") 12 | (comment 3 "This work is licensed under CC BY-NC-SA 4.0") 13 | (comment 4 "Author: Carsten Herting (slu4)") 14 | ) 15 | 16 | (lib_symbols 17 | ) 18 | 19 | ) 20 | -------------------------------------------------------------------------------- /Support/Emulator/Windows/readme.md: -------------------------------------------------------------------------------- 1 | # Emulator (Win64 .exe) 2 | 3 | On some graphic cards, 60Hz VSYNC is not detected correctly. In that case, set the frame rate manually to 60Hz from within your graphic card's control center. 4 | 5 | Please note that the source code of the Windows/OpenGL version of the emulator (~5400 lines of code) is not available for download. If you are interested in the - amazingly simple - general principle of the emulator, please refer to the more readable but otherwise functionally identical Java/Processing version (~800 lines of code). 6 | -------------------------------------------------------------------------------- /Revision 1.2/FLASH Images/debug/readme.md: -------------------------------------------------------------------------------- 1 | These FLASH images might by helpful to debug your board in case it won't start up properly. 2 | 3 | 'debug' writes a back and a white 8x8 pixel square into VRAM's upper left corner 4 | prior to starting the bootloader. 5 | This might show you a 'first sign of life' in case the OS doesn't boot. 6 | 'debug2' writes 0xff contiguously into VRAM starting from the left upper corner 7 | for each byte copied from FLASH to RAM during bootstrapping. 8 | This lets you monitor the boot process in case the OS doesn't boot. 9 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/8-Bit CPU 32k-rescue.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # CP_Small-Device 5 | # 6 | DEF CP_Small-Device C 0 10 N N 1 F N 7 | F0 "C" 10 70 50 H V L CNN 8 | F1 "CP_Small-Device" 10 -80 50 H V L CNN 9 | F2 "" 0 0 50 H I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | $FPLIST 12 | CP_* 13 | $ENDFPLIST 14 | DRAW 15 | S -60 -12 60 -27 0 1 0 F 16 | S -60 27 60 12 0 1 0 N 17 | P 2 0 1 0 -50 60 -30 60 N 18 | P 2 0 1 0 -40 50 -40 70 N 19 | X ~ 1 0 100 73 D 50 50 1 1 P 20 | X ~ 2 0 -100 73 U 50 50 1 1 P 21 | ENDDRAW 22 | ENDDEF 23 | # 24 | #End Library 25 | -------------------------------------------------------------------------------- /Programs/asm/hello.asm: -------------------------------------------------------------------------------- 1 | #org 0x8000 2 | 3 | LDI 0xfe STA 0xffff ; init stack 4 | JPS _Clear CLW _XPos 5 | start: LDI string PHS ; put MSB of string address on the stack 7 | JPS _Print PLS PLS ; clean up the stack 8 | JPS _WaitInput 9 | JPA start 10 | 11 | string: 'Hello! Press any key.', 0 12 | 13 | #mute 14 | 15 | #org 0xb02a _WaitInput: 16 | #org 0xb030 _Clear: 17 | #org 0xb048 _Print: 18 | #org 0xbccc _XPos: 19 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (lib (name "8-Bit CPU 32k-cache")(type "KiCad")(uri "${KIPRJMOD}/8-Bit CPU 32k-cache.kicad_sym")(options "")(descr "")) 3 | (lib (name "8-Bit CPU 32k")(type "KiCad")(uri "${KIPRJMOD}/8-Bit CPU 32k.kicad_sym")(options "")(descr "")) 4 | (lib (name "8-Bit-CPU-32k-rescue")(type "KiCad")(uri "${KIPRJMOD}/8-Bit CPU 32k-rescue.kicad_sym")(options "")(descr "")) 5 | (lib (name "Minimal Expansion")(type "KiCad")(uri "${KIPRJMOD}/Minimal Expansion.kicad_sym")(options "")(descr "")) 6 | (lib (name "74hc4078")(type "KiCad")(uri "${KIPRJMOD}/74hc4078.kicad_sym")(options "")(descr "")) 7 | ) 8 | -------------------------------------------------------------------------------- /CHANGE LOG.md: -------------------------------------------------------------------------------- 1 | # CHANGE LOG 2 | 3 | Nov 26 2023: Extending the reserved memory range for expansion cards 4 | 5 | The memory range reserved for expansion cards is extended to a full page 0xbf00 - 0xbfff. This involves changes in the documentation (reference manual, manual.txt) and also makes relocating some OS variables (e.g. cursor position _XPos and _YPos) necessary, forcing an update of all software using these variables ;-) as well as the "standard" image 'flash.bin'. 6 | 7 | Oct 28 2023: Microcode 1.22 update: 8 | 9 | o The instruction LTX replaces LAX but remains functionally identical. 10 | 11 | o The instruction LTA replaces LAY and now uses the accumulator A as table index rather than the Y register. 12 | -------------------------------------------------------------------------------- /DISCLAIMER.txt: -------------------------------------------------------------------------------- 1 | IN THE FOLLOWING, ALL INFORMATION MADE AVAILABLE IN THIS REPOSITORY 2 | 'The-Minimal-64-Home-Computer' IS SUMMARIZED UNDER THE TERM "SOFTWARE". 3 | 4 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 7 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 8 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 9 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | THE 'MINIMAL 64 HOME COMPUTER' MIGHT UNINTENTIONALLY INTERFERE WITH RADIO 12 | SIGNALS OR DISTURB OTHER ELECTRONIC DEVICES. USE THIS DEVICE FOR EDUCATIONAL 13 | PURPOSES ONLY AND DON’T EMBED IT IN ANOTHER PRODUCT. 14 | -------------------------------------------------------------------------------- /Support/Emulator/Processing/README.md: -------------------------------------------------------------------------------- 1 | # Emulator (Java/Processing) 2 | 3 | This is the portable 'Java/Processing' version of the 'Minimal 64 Home Computer' emulator. 4 | 5 | The emulator is using German keyboard layout. For customizing do the following: 6 | 7 | o Uncomment the first line of the 'keyPressed()' function in the source code: println(keyCode); 8 | 9 | o Run the emulator and press any keys under question. 10 | 11 | o Note the corresponding keyCodes printed out in Processing's console window. 12 | 13 | o Identify the corresponding PS/2 scan codes (see section 'PS/2 Keyboard' in the 'Minimal 64 Reference Manual': 14 | https://docs.google.com/document/d/1e4hL9Z7BLIoUlErWgJOngnSMYLXjfnsZB9BtlwhTC6U/edit?usp=sharing 15 | 16 | o Update the pre-defined 'keyScancodePairs' entries in the source code. 17 | 18 | Have fun! 19 | -------------------------------------------------------------------------------- /Programs/asm/defs.asm: -------------------------------------------------------------------------------- 1 | #mute ; MinOS API definitions generated by 'asm os.asm -s_' 2 | 3 | #org 0xb000 _Start: 4 | #org 0xb003 _Prompt: 5 | #org 0xb006 _ReadLine: 6 | #org 0xb009 _ReadSpace: 7 | #org 0xb00c _ReadHex: 8 | #org 0xb00f _SerialWait: 9 | #org 0xb012 _SerialPrint: 10 | #org 0xb015 _FindFile: 11 | #org 0xb018 _LoadFile: 12 | #org 0xb01b _SaveFile: 13 | #org 0xb01e _MemMove: 14 | #org 0xb021 _Random: 15 | #org 0xb024 _ScanPS2: 16 | #org 0xb027 _ReadInput: 17 | #org 0xb02a _WaitInput: 18 | #org 0xb02d _ClearVRAM: 19 | #org 0xb030 _Clear: 20 | #org 0xb033 _ClearRow: 21 | #org 0xb036 _SetPixel: 22 | #org 0xb039 _ClrPixel: 23 | #org 0xb03c _GetPixel: 24 | #org 0xb03f _Char: 25 | #org 0xb042 _Line: 26 | #org 0xb045 _Rect: 27 | #org 0xb048 _Print: 28 | #org 0xb04b _PrintChar: 29 | #org 0xb04e _PrintHex: 30 | #org 0xb051 _ScrollUp: 31 | #org 0xb054 _ScrollDn: 32 | #org 0xb057 _ResetPS2: 33 | 34 | #org 0xbcb0 _ReadPtr: 35 | #org 0xbcb2 _ReadNum: 36 | #org 0xbcc4 _RandomState: 37 | #org 0xbccc _XPos: 38 | #org 0xbccd _YPos: 39 | #org 0xbcce _ReadBuffer: 40 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/8-Bit CPU 32k.kicad_prl: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "active_layer": 37, 4 | "active_layer_preset": "", 5 | "auto_track_width": true, 6 | "hidden_nets": [], 7 | "high_contrast_mode": 0, 8 | "net_color_mode": 1, 9 | "opacity": { 10 | "pads": 1.0, 11 | "tracks": 1.0, 12 | "vias": 1.0, 13 | "zones": 0.7699999809265137 14 | }, 15 | "ratsnest_display_mode": 0, 16 | "selection_filter": { 17 | "dimensions": true, 18 | "footprints": true, 19 | "graphics": true, 20 | "keepouts": true, 21 | "lockedItems": true, 22 | "otherItems": true, 23 | "pads": true, 24 | "text": true, 25 | "tracks": true, 26 | "vias": true, 27 | "zones": true 28 | }, 29 | "visible_items": [ 30 | 0, 31 | 1, 32 | 2, 33 | 3, 34 | 4, 35 | 5, 36 | 6, 37 | 7, 38 | 8, 39 | 9, 40 | 10, 41 | 11, 42 | 13, 43 | 14, 44 | 15, 45 | 16, 46 | 17, 47 | 18, 48 | 19, 49 | 20, 50 | 21, 51 | 22, 52 | 23, 53 | 24, 54 | 25, 55 | 26, 56 | 27, 57 | 28, 58 | 29, 59 | 30, 60 | 32, 61 | 33, 62 | 34, 63 | 35, 64 | 36 65 | ], 66 | "visible_layers": "003ffff_80000001", 67 | "zone_display_mode": 0 68 | }, 69 | "meta": { 70 | "filename": "8-Bit CPU 32k.kicad_prl", 71 | "version": 3 72 | }, 73 | "project": { 74 | "files": [] 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/ArduinoPC.pretty/FP_MINI_DIN_6_PS2.kicad_mod: -------------------------------------------------------------------------------- 1 | (module FP_MINI_DIN_6_PS2 (layer F.Cu) (tedit 5F735A85) 2 | (fp_text reference REF** (at -5.08 -0.97) (layer F.SilkS) 3 | (effects (font (size 1 1) (thickness 0.15))) 4 | ) 5 | (fp_text value FP_MINI_DIN_6_PS2 (at 0 14.27) (layer F.Fab) 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | ) 8 | (fp_line (start 0 0) (end 7 0) (layer F.Fab) (width 0.12)) 9 | (fp_line (start 0 0) (end -7 0) (layer F.Fab) (width 0.12)) 10 | (fp_line (start -7 0) (end -7 13.2) (layer F.Fab) (width 0.12)) 11 | (fp_line (start -7 13.2) (end 7 13.2) (layer F.Fab) (width 0.12)) 12 | (fp_line (start 7 0) (end 7 13.2) (layer F.Fab) (width 0.12)) 13 | (fp_line (start -3.81 0) (end -3.81 1.57) (layer F.Fab) (width 0.12)) 14 | (fp_line (start -3.81 1.57) (end 3.81 1.57) (layer F.Fab) (width 0.12)) 15 | (fp_line (start 3.81 1.57) (end 3.81 0) (layer F.Fab) (width 0.12)) 16 | (pad 2 thru_hole circle (at 1.3 8.9) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask)) 17 | (pad "" thru_hole circle (at 0 5) (size 4 4) (drill 2.4) (layers *.Cu *.Mask)) 18 | (pad "" thru_hole circle (at 6.75 5.8) (size 4 4) (drill 2.2) (layers *.Cu *.Mask)) 19 | (pad "" thru_hole circle (at -6.75 5.8) (size 4 4) (drill 2.2) (layers *.Cu *.Mask)) 20 | (pad 1 thru_hole circle (at -1.3 8.9) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask)) 21 | (pad 3 thru_hole circle (at -3.35 8.9) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask)) 22 | (pad 4 thru_hole circle (at 3.35 8.9) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask)) 23 | (pad 6 thru_hole circle (at 3.35 11.3) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask)) 24 | (pad 5 thru_hole circle (at -3.35 11.3) (size 1.6 1.6) (drill 0.9) (layers *.Cu *.Mask)) 25 | ) 26 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/8-Bit CPU 32k-rescue.kicad_sym: -------------------------------------------------------------------------------- 1 | (kicad_symbol_lib (version 20211014) (generator kicad_symbol_editor) 2 | (symbol "CP_Small-Device" (pin_numbers hide) (pin_names (offset 0.254) hide) (in_bom yes) (on_board yes) 3 | (property "Reference" "C" (id 0) (at 0.254 1.778 0) 4 | (effects (font (size 1.27 1.27)) (justify left)) 5 | ) 6 | (property "Value" "CP_Small-Device" (id 1) (at 0.254 -2.032 0) 7 | (effects (font (size 1.27 1.27)) (justify left)) 8 | ) 9 | (property "Footprint" "" (id 2) (at 0 0 0) 10 | (effects (font (size 1.27 1.27)) hide) 11 | ) 12 | (property "Datasheet" "" (id 3) (at 0 0 0) 13 | (effects (font (size 1.27 1.27)) hide) 14 | ) 15 | (property "ki_fp_filters" "CP_*" (id 4) (at 0 0 0) 16 | (effects (font (size 1.27 1.27)) hide) 17 | ) 18 | (symbol "CP_Small-Device_0_1" 19 | (rectangle (start -1.524 -0.3048) (end 1.524 -0.6858) 20 | (stroke (width 0) (type default) (color 0 0 0 0)) 21 | (fill (type outline)) 22 | ) 23 | (rectangle (start -1.524 0.6858) (end 1.524 0.3048) 24 | (stroke (width 0) (type default) (color 0 0 0 0)) 25 | (fill (type none)) 26 | ) 27 | (polyline 28 | (pts 29 | (xy -1.27 1.524) 30 | (xy -0.762 1.524) 31 | ) 32 | (stroke (width 0) (type default) (color 0 0 0 0)) 33 | (fill (type none)) 34 | ) 35 | (polyline 36 | (pts 37 | (xy -1.016 1.27) 38 | (xy -1.016 1.778) 39 | ) 40 | (stroke (width 0) (type default) (color 0 0 0 0)) 41 | (fill (type none)) 42 | ) 43 | ) 44 | (symbol "CP_Small-Device_1_1" 45 | (pin passive line (at 0 2.54 270) (length 1.8542) 46 | (name "~" (effects (font (size 1.27 1.27)))) 47 | (number "1" (effects (font (size 1.27 1.27)))) 48 | ) 49 | (pin passive line (at 0 -2.54 90) (length 1.8542) 50 | (name "~" (effects (font (size 1.27 1.27)))) 51 | (number "2" (effects (font (size 1.27 1.27)))) 52 | ) 53 | ) 54 | ) 55 | ) 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Legacy: Minimal 64 Home Computer 2 | 3 | See https://github.com/slu4coder/Minimal-64x4-Home-Computer for the most recent version. 4 | 5 | Quick note: This is a free and non-commercial project. I am in no way associated with any activies selling this as a product. 6 | Any such activity represents a license violation. Individual licenses apply for hardware and software parts. Please refer to 7 | appropriate documentations for detailed licensing information. 8 | 9 | ![IMG_1506_2](https://github.com/slu4coder/The-Minimal-64-Home-Computer/assets/52576999/b598f07d-306d-4c5c-b5dd-82162dc874fa) 10 | 11 | Here is my take on 80's home computer magic: The most computer from the least logic or the shortest way from TTL to Space Invaders. 12 | 13 | Introductory videos: https://www.youtube.com/watch?v=3zGTsi4AYLw, https://www.youtube.com/watch?v=FJsnKu20ch8 14 | 15 | Reference manual: https://docs.google.com/document/d/1e4hL9Z7BLIoUlErWgJOngnSMYLXjfnsZB9BtlwhTC6U/edit?usp=sharing 16 | 17 | Visit my YouTube channel: https://www.youtube.com/channel/UCXYQcMpUBT3aaQKfmAVJNow 18 | 19 | Like this project and want to give something back? https://www.paypal.me/carstenherting 20 | 21 | FEATURES 22 | 23 | ● Only 56 74HCxx logic ICs, 1x 6C1008 SRAM, 4x 39SF0x0 FLASH, BUT NO MICROCONTROLLER! 24 | 25 | ● Textbook 'Von-Neumann' architecture, 8-bit data bus, 16-bit address bus, 24 control signals 26 | 27 | ● 64KB RAM, 512KB FLASH SSD with file system (format, load, save, dir, delete) 28 | 29 | ● Monochrome VGA output 400 x 240 pixels, PS/2, expansion slot and serial UART port 30 | 31 | ● 8MHz system clock, 6MHz CPU clock with 0.84Mips (2x Commodore 64) 32 | 33 | ● 128 instructions including conditional branching, subroutines, stack and word operations 34 | 35 | ● 2 data registers A, B plus two more "software" registers X, Y 36 | 37 | ● ALU supporting ADD, SUBTRACT, AND, OR with 3 flags (negative, carry and zero) 38 | 39 | ● Full native tool-chain: MinOS, text editor, assembler, fast Python-like interpreter 'MIN' 40 | 41 | ● Emulator, cross-assembler (Windows) and classic games (TETRIS clone, Space Invaders clone) 42 | 43 | ● Open-source emulators in JAVA/PROCESSING and JAVASCRIPT/p5.js https://editor.p5js.org/slu4coder/full/aOUivViNt 44 | 45 | See "CHANGE LOG" for a brief summary of the relevant updates. 46 | 47 | Have fun! 48 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/8-Bit CPU 32k.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | $CMP 74HC08 4 | D Quad And2 5 | K TTL and2 6 | F http://www.ti.com/lit/gpn/sn74LS08 7 | $ENDCMP 8 | # 9 | $CMP 74HC161 10 | D Synchronous 4-bit programmable binary Counter 11 | K TTL CNT CNT4 12 | F http://www.ti.com/lit/gpn/sn74LS161 13 | $ENDCMP 14 | # 15 | $CMP 74HC165 16 | D Shift Register 8-bit, parallel load 17 | K TTL SR SR8 18 | F http://www.ti.com/lit/gpn/sn74LS165 19 | $ENDCMP 20 | # 21 | $CMP 74HC173 22 | D 4-bit D-type Register, 3 state out 23 | K TTL REG REG4 3State DFF 24 | F http://www.ti.com/lit/gpn/sn74LS173 25 | $ENDCMP 26 | # 27 | $CMP 74HC174 28 | D Hex D-type Flip-Flop, reset 29 | K TTL REG REG6 DFF 30 | F http://www.ti.com/lit/gpn/sn74LS174 31 | $ENDCMP 32 | # 33 | $CMP 74HC193 34 | D Synchronous 4-bit Up/Down (2 clk) counter 35 | K TTL CNT CNT4 36 | F http://www.ti.com/lit/ds/symlink/sn74ls193.pdf 37 | $ENDCMP 38 | # 39 | $CMP 74HC245 40 | D Octal BUS Transceivers, 3-State outputs 41 | K HCMOS BUS 3State 42 | F http://www.ti.com/lit/gpn/sn74HC245 43 | $ENDCMP 44 | # 45 | $CMP 74HC283 46 | D 4-bit full Adder 47 | K TTL ADD Arith ALU 48 | F http://www.ti.com/lit/gpn/sn74LS283 49 | $ENDCMP 50 | # 51 | $CMP 74HC32 52 | D Quad 2-input OR 53 | K TTL Or2 54 | F http://www.ti.com/lit/gpn/sn74LS32 55 | $ENDCMP 56 | # 57 | $CMP 74LS09 58 | D Quad 2-input AND Open Collect 59 | K TTL and2 OpenCol 60 | F http://www.ti.com/lit/gpn/sn74LS09 61 | $ENDCMP 62 | # 63 | $CMP 74LS160 64 | D Synchronous 4-bit programmable decimal Counter 65 | K TTL CNT CNT4 66 | F http://www.ti.com/lit/gpn/sn74LS160 67 | $ENDCMP 68 | # 69 | $CMP 74LS162 70 | D Synchronous 4-bit programmable decimal Counter 71 | K TTL CNT CNT4 72 | F http://www.ti.com/lit/gpn/sn74LS162 73 | $ENDCMP 74 | # 75 | $CMP 74LS163 76 | D Synchronous 4-bit programmable binary Counter 77 | K TTL CNT CNT4 78 | F http://www.ti.com/lit/gpn/sn74LS163 79 | $ENDCMP 80 | # 81 | $CMP 74LS193 82 | D Synchronous 4-bit Up/Down (2 clk) counter 83 | K TTL CNT CNT4 84 | F http://www.ti.com/lit/ds/symlink/sn74ls193.pdf 85 | $ENDCMP 86 | # 87 | $CMP C2N_PCB_Connector 88 | D Generic connector, single row, 01x06, script generated (kicad-library-utils/schlib/autogen/connector/) 89 | K connector 90 | F ~ 91 | $ENDCMP 92 | # 93 | #End Doc Library 94 | -------------------------------------------------------------------------------- /Programs/min/std.min: -------------------------------------------------------------------------------- 1 | # -------------------- 2 | # MIN Standard Library 3 | # written by slu4 2023 4 | # -------------------- 5 | 6 | # returns the element size of a string 7 | def strlen(char s): char e; return &e-&s 8 | 9 | # returns the element size of an int array 10 | def intlen(int i): char e; return &e-&i >> 1 11 | 12 | # compare two strings (0: equal) 13 | def strcmp(char s1, char s2): 14 | int l1 = &s2 - &s1 15 | if l1 != &l1 - &s2: return -1 16 | int i=0 17 | while i < l1: 18 | if s1[i] != s2[i]: return -1 19 | i+=1 20 | return 0 21 | 22 | # convert a number to a string 23 | def str(int n): 24 | char v 25 | if n==0: return "0" 26 | if n>0: v="" 27 | else: n=-n; v="-" 28 | char s=s[|5] 29 | int i=5 30 | while n>0: 31 | i-=1 32 | int d=n/10 33 | s[i]=48+(n-d*10) 34 | n=d 35 | return v_s[i|5] 36 | 37 | # prints a string at cursor position 38 | def text(char s): 39 | char z=0 40 | char stack @ 0xff00 41 | char p @ 0xffff 42 | int sp = p and 0xff 43 | stack[sp-3] = &s 44 | stack[sp-4] = &s>>8 45 | call(0xb048, 27) 46 | 47 | # sets cursor position 48 | def pos(char x, char y): 49 | char posx @ 0xbccc = x 50 | char posy @ 0xbccd = y 51 | 52 | # returns a signed random number byte 53 | def rnd(): 54 | call(0xb021,0) 55 | char r @ 0xff02 56 | return r 57 | 58 | # non-blocking keyboard input (0: none) 59 | def key(): 60 | call(0xb027,0) 61 | char r @ 0xff02 62 | return r 63 | 64 | # clears the screeen 65 | def clear(): call(0xb030, 0) 66 | 67 | # draws a rect 68 | def rect(int x, int y, int w, int h): 69 | char stack @ 0xff00 70 | char p @ 0xffff 71 | int sp = p and 0xff 72 | stack[sp-3] = x 73 | stack[sp-4] = x>>8 74 | stack[sp-5] = y 75 | stack[sp-6] = w 76 | stack[sp-7] = w>>8 77 | stack[sp-8] = h 78 | call(0xb045, 31) 79 | 80 | def line(int x1, int y1, int x2, int y2): 81 | char stack @ 0xff00 82 | char p @ 0xffff 83 | int sp = p and 0xff 84 | stack[sp-3] = x1 85 | stack[sp-4] = x1>>8 86 | stack[sp-5] = y1 87 | stack[sp-6] = x2 88 | stack[sp-7] = x2>>8 89 | stack[sp-8] = y2 90 | call(0xb042, 31) 91 | 92 | def dot(int x, int y): 93 | char stack @ 0xff00 94 | char p @ 0xffff 95 | int sp = p and 0xff 96 | stack[sp-3] = x 97 | stack[sp-4] = x>>8 98 | stack[sp-5] = y 99 | call(0xb036, 28) 100 | -------------------------------------------------------------------------------- /Programs/asm/keyboard_us.txt: -------------------------------------------------------------------------------- 1 | ; USAGE: Open 'os.asm', search for 'PS2Table:' and replace the following two sections 2 | ; with the code below. For more information on how to update the OS type 'show manual'. 3 | 4 | PS2Table: ; US KEYBOARD LAYOUT 5 | ; state: PLAIN keys 6 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x09, 0, 0, ; 0x0_ 7 | 0, 0, 0, 0, 0, 'q', '1', 0, 0, 0, 'z', 's', 'a', 'w', '2', 0, ; 0x1_ 8 | 0, 'c', 'x', 'd', 'e', '4', '3', 0, 0, ' ', 'v', 'f', 't', 'r', '5', 0, ; 0x2_ 9 | 0, 'n', 'b', 'h', 'g', 'y', '6', 0, 0, 0, 'm', 'j', 'u', '7', '8', 0, ; 0x3_ 10 | 0, ',', 'k', 'i', 'o', '0', '9', 0, 0, '.', '/', 'l', ';', 'p', '-', 0, ; 0x4_ 11 | 0, 0, 39, 0, '[', '=', 0, 0, 0, 0, 10, ']', 0, '\', 0, 0, ; 0x5_ 12 | 0, '<', 0, 0, 0, 0, 8, 0, 0, 0xe6, 0, 0xe3, 0xe5, 0, 0, 0, ; 0x6_ 13 | 0, 0xf0, 0xe2, 0, 0xe4, 0xe1, 27, 0, 0, 0, 0xe8, 0, 0, 0xe7, 0, 0, ; 0x7_ 14 | ; -------------------------------------------------------------------------------------------------+------ 15 | ; 0x_0 0x_1 0x_2 0x_3 0x_4 0x_5 0x_6 0x_7 0x_8 0x_9 0x_a 0x_b 0x_c 0x_d 0x_e 0x_f ; scan 16 | ; ; code 17 | ; state: with SHIFT 18 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '~', 0, ; 0x0_ 19 | 0, 0, 0, 0, 0, 'Q', '!', 0, 0, 0, 'Z', 'S', 'A', 'W', '@', 0, ; 0x1_ 20 | 0, 'C', 'X', 'D', 'E', '$', '#', 0, 0, 0, 'V', 'F', 'T', 'R', '%', 0, ; 0x2_ 21 | 0, 'N', 'B', 'H', 'G', 'Y', '^', 0, 0, 0, 'M', 'J', 'U', '&', '*', 0, ; 0x3_ 22 | 0, '<', 'K', 'I', 'O', ')', '(', 0, 0, '>', '?', 'L', ':', 'P', '_', 0, ; 0x4_ 23 | 0, 0, '"', 0, '{', '+', 0, 0, 0, 0, 0, '}', 0, '|', 0, 0, ; 0x5_ 24 | 0, '>', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; 0x6_ 25 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; 0x7_ 26 | ; -------------------------------------------------------------------------------------------------+------ 27 | ; 0x_0 0x_1 0x_2 0x_3 0x_4 0x_5 0x_6 0x_7 0x_8 0x_9 0x_a 0x_b 0x_c 0x_d 0x_e 0x_f ; scan 28 | ; ; code 29 | -------------------------------------------------------------------------------- /Programs/asm/keyboard_german.txt: -------------------------------------------------------------------------------- 1 | ; USAGE: Open 'os.asm', search for 'PS2Table:' and replace the following two sections 2 | ; with the code below. For more information on how to update the OS type 'show manual'. 3 | 4 | PS2Table: ; GERMAN KEYBOARD LAYOUT 5 | ; state: PLAIN keys 6 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x09, '^', 0, ; 0x0_ 7 | 0, 0, 0, 0, 0, 'q', '1', 0, 0, 0, 'y', 's', 'a', 'w', '2', 0, ; 0x1_ 8 | 0, 'c', 'x', 'd', 'e', '4', '3', 0, 0, ' ', 'v', 'f', 't', 'r', '5', 0, ; 0x2_ 9 | 0, 'n', 'b', 'h', 'g', 'z', '6', 0, 0, 0, 'm', 'j', 'u', '7', '8', 0, ; 0x3_ 10 | 0, ',', 'k', 'i', 'o', '0', '9', 0, 0, '.', '-', 'l', 0, 'p', 0, 0, ; 0x4_ 11 | 0, 0, 0, 0, 0, 39, 0, 0, 0, 0, 10, '+', 0, '#', 0, 0, ; 0x5_ 12 | 0, '<', 0, 0, 0, 0, 8, 0, 0, 0xe6, 0, 0xe3, 0xe5, 0, 0, 0, ; 0x6_ 13 | 0, 0xf0, 0xe2, 0, 0xe4, 0xe1, 27, 0, 0, 0, 0xe8, 0, 0, 0xe7, 0, 0, ; 0x7_ 14 | ; -------------------------------------------------------------------------------------------------+------ 15 | ; 0x_0 0x_1 0x_2 0x_3 0x_4 0x_5 0x_6 0x_7 0x_8 0x_9 0x_a 0x_b 0x_c 0x_d 0x_e 0x_f ; scan 16 | ; ; code 17 | ; state: with SHIFT 18 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; 0x0_ 19 | 0, 0, 0, 0, 0, 'Q', '!', 0, 0, 0, 'Y', 'S', 'A', 'W', '"', 0, ; 0x1_ 20 | 0, 'C', 'X', 'D', 'E', '$', 0, 0, 0, 0, 'V', 'F', 'T', 'R', '%', 0, ; 0x2_ 21 | 0, 'N', 'B', 'H', 'G', 'Z', '&', 0, 0, 0, 'M', 'J', 'U', '/', '(', 0, ; 0x3_ 22 | 0, ';', 'K', 'I', 'O', '=', ')', 0, 0, ':', '_', 'L', 0, 'P', '?', 0, ; 0x4_ 23 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '*', 0, 39, 0, 0, ; 0x5_ 24 | 0, '>', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; 0x6_ 25 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ; 0x7_ 26 | ; -------------------------------------------------------------------------------------------------+------ 27 | ; 0x_0 0x_1 0x_2 0x_3 0x_4 0x_5 0x_6 0x_7 0x_8 0x_9 0x_a 0x_b 0x_c 0x_d 0x_e 0x_f ; scan 28 | ; ; code 29 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/ArduinoPC.pretty/VGA DSUB15HD_female.kicad_mod: -------------------------------------------------------------------------------- 1 | (module "VGA DSUB15HD_female" (layer F.Cu) (tedit 5F735B8C) 2 | (fp_text reference REF** (at 18 20) (layer F.SilkS) 3 | (effects (font (size 1 1) (thickness 0.15))) 4 | ) 5 | (fp_text value "VGA DSUB15HD_female" (at 0 -8) (layer F.Fab) 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | ) 8 | (fp_line (start 0 0) (end 16 0) (layer F.Fab) (width 0.12)) 9 | (fp_line (start 0 0) (end -16 0) (layer F.Fab) (width 0.12)) 10 | (fp_line (start -16 0) (end -16 16.1) (layer F.Fab) (width 0.12)) 11 | (fp_line (start 16 0) (end 16 16.1) (layer F.Fab) (width 0.12)) 12 | (fp_line (start -16 16.1) (end 16 16.1) (layer F.Fab) (width 0.12)) 13 | (fp_line (start 8.1 22) (end 8.1 16.1) (layer F.Fab) (width 0.12)) 14 | (fp_line (start -8.1 22) (end -8.1 16.1) (layer F.Fab) (width 0.12)) 15 | (fp_line (start -15 16.1) (end -15 20.6) (layer F.Fab) (width 0.12)) 16 | (fp_line (start -15 20.6) (end -9 20.6) (layer F.Fab) (width 0.12)) 17 | (fp_line (start -9 20.6) (end -9 16.1) (layer F.Fab) (width 0.12)) 18 | (fp_line (start 15 16.1) (end 15 20.6) (layer F.Fab) (width 0.12)) 19 | (fp_line (start 15 20.6) (end 9 20.6) (layer F.Fab) (width 0.12)) 20 | (fp_line (start 9 20.6) (end 9 16.1) (layer F.Fab) (width 0.12)) 21 | (fp_line (start 8.1 22) (end -8.1 22) (layer F.Fab) (width 0.12)) 22 | (pad 3 thru_hole circle (at 0 2.25) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 23 | (pad 2 thru_hole circle (at 2.25 2.25) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 24 | (pad 1 thru_hole circle (at 4.5 2.25) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 25 | (pad 4 thru_hole circle (at -2.25 2.25) (size 1.7 1.7) (drill 0.8) (layers *.Cu *.Mask)) 26 | (pad 5 thru_hole circle (at -4.5 2.25) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 27 | (pad 11 thru_hole circle (at 4.5 7.25) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 28 | (pad 12 thru_hole circle (at 2.25 7.25) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 29 | (pad 14 thru_hole circle (at -2.25 7.25) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 30 | (pad 15 thru_hole circle (at -4.5 7.25) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 31 | (pad 13 thru_hole circle (at 0 7.25) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 32 | (pad 6 thru_hole circle (at 5.625 4.75) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 33 | (pad 7 thru_hole circle (at 3.375 4.75) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 34 | (pad 9 thru_hole circle (at -1.125 4.75) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 35 | (pad 10 thru_hole circle (at -3.375 4.75) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 36 | (pad 8 thru_hole circle (at 1.125 4.75) (size 1.6 1.6) (drill 0.8) (layers *.Cu *.Mask)) 37 | (pad "" thru_hole circle (at 12.45 4.75) (size 5 5) (drill 3) (layers *.Cu *.Mask)) 38 | (pad "" thru_hole circle (at -12.45 4.75) (size 5 5) (drill 3) (layers *.Cu *.Mask)) 39 | ) 40 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/ArduinoPC.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # 74HC165 5 | # 6 | DEF 74HC165 U 0 40 Y Y 1 L N 7 | F0 "U" -300 750 50 H V C CNN 8 | F1 "74HC165" -300 -850 50 H V C CNN 9 | F2 "" 0 0 50 H I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | $FPLIST 12 | DIP?16* 13 | $ENDFPLIST 14 | DRAW 15 | S -300 700 300 -800 1 1 10 f 16 | X ~PL 1 -500 -600 200 R 50 50 1 0 I 17 | X DS 10 -500 600 200 R 50 50 1 0 I 18 | X D0 11 -500 500 200 R 50 50 1 0 I 19 | X D1 12 -500 400 200 R 50 50 1 0 I 20 | X D2 13 -500 300 200 R 50 50 1 0 I 21 | X D3 14 -500 200 200 R 50 50 1 0 I 22 | X ~CE 15 500 -600 200 L 50 50 1 0 I 23 | X VCC 16 0 900 200 D 50 50 1 0 W 24 | X CP 2 -500 -300 200 R 50 50 1 0 I 25 | X D4 3 -500 100 200 R 50 50 1 0 I 26 | X D5 4 -500 0 200 R 50 50 1 0 I 27 | X D6 5 -500 -100 200 R 50 50 1 0 I 28 | X D7 6 -500 -200 200 R 50 50 1 0 I 29 | X ~Q7 7 500 500 200 L 50 50 1 0 O 30 | X GND 8 0 -1000 200 U 50 50 1 0 W 31 | X Q7 9 500 600 200 L 50 50 1 0 O 32 | ENDDRAW 33 | ENDDEF 34 | # 35 | # 74HC173 36 | # 37 | DEF 74HC173 U 0 40 Y Y 1 L N 38 | F0 "U" -300 750 50 H V C CNN 39 | F1 "74HC173" -300 -750 50 H V C CNN 40 | F2 "" 0 0 50 H I C CNN 41 | F3 "" 0 0 50 H I C CNN 42 | $FPLIST 43 | DIP?16* 44 | $ENDFPLIST 45 | DRAW 46 | S -300 700 300 -700 1 1 10 f 47 | X ~OE1 1 -500 100 200 R 50 50 1 0 I 48 | X ~E2 10 -500 -300 200 R 50 50 1 0 I 49 | X D3 11 -500 300 200 R 50 50 1 0 I 50 | X D2 12 -500 400 200 R 50 50 1 0 I 51 | X D1 13 -500 500 200 R 50 50 1 0 I 52 | X D0 14 -500 600 200 R 50 50 1 0 I 53 | X MR 15 -500 -600 200 R 50 50 1 0 I 54 | X VCC 16 0 900 200 D 50 50 1 0 W 55 | X ~OE2 2 -500 0 200 R 50 50 1 0 I 56 | X Q0 3 500 600 200 L 50 50 1 0 T 57 | X Q1 4 500 500 200 L 50 50 1 0 T 58 | X Q2 5 500 400 200 L 50 50 1 0 T 59 | X Q3 6 500 300 200 L 50 50 1 0 T 60 | X CP 7 -500 -400 200 R 50 50 1 0 I C 61 | X GND 8 0 -900 200 U 50 50 1 0 W 62 | X ~E1 9 -500 -200 200 R 50 50 1 0 I 63 | ENDDRAW 64 | ENDDEF 65 | # 66 | # 74HC193 67 | # 68 | DEF 74HC193 U 0 20 Y Y 1 F N 69 | F0 "U" -300 550 50 H V C CNN 70 | F1 "74HC193" 200 550 50 H V C CNN 71 | F2 "" 0 0 50 H I C CNN 72 | F3 "" 0 0 50 H I C CNN 73 | ALIAS 74LS193 74 | $FPLIST 75 | SOIC*3.9x9.9mm*P1.27mm* 76 | DIP*W7.62mm* 77 | $ENDFPLIST 78 | DRAW 79 | S -300 500 300 -600 1 1 10 f 80 | X D1 1 -500 300 200 R 50 50 1 0 I 81 | X D2 10 -500 200 200 R 50 50 1 0 I 82 | X ~PL 11 -500 -100 200 R 50 50 1 0 I 83 | X ~TCU 12 500 -100 200 L 50 50 1 0 O 84 | X ~TCD 13 500 -300 200 L 50 50 1 0 O 85 | X MR 14 -500 -500 200 R 50 50 1 0 I 86 | X D0 15 -500 400 200 R 50 50 1 0 I 87 | X VCC 16 0 700 200 D 50 50 1 0 W 88 | X Q1 2 500 300 200 L 50 50 1 0 O 89 | X Q0 3 500 400 200 L 50 50 1 0 O 90 | X CPD 4 -500 -400 200 R 50 50 1 0 I C 91 | X CPU 5 -500 -300 200 R 50 50 1 0 I C 92 | X Q2 6 500 200 200 L 50 50 1 0 O 93 | X Q3 7 500 100 200 L 50 50 1 0 O 94 | X GND 8 0 -800 200 U 50 50 1 0 W 95 | X D3 9 -500 100 200 R 50 50 1 0 I 96 | ENDDRAW 97 | ENDDEF 98 | # 99 | #End Library 100 | -------------------------------------------------------------------------------- /Programs/min/MIN's EBNF language definition.txt: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------------- 2 | Extended Backus-Naur-Form (EBNF) of MIN written by Carsten Herting (slu4) Mar 17th 2023 3 | --------------------------------------------------------------------------------------- 4 | 5 | letter = 'a' | ... | 'z' | 'A' | ... | 'Z' 6 | digit = '0' | ... | '9' 7 | hexdigit = digit | 'a' | ... | 'f' 8 | rel-op = '==' | '!=' | '<=' | '<' | '>=' | '>' 9 | add-op = '+' | '-' 10 | mul-op = '*' | '/' 11 | logic-op = 'and' | 'or' | 'xor' | '>>' | '<<' 12 | type = 'int' | 'char' 13 | identifier = letter, { letter | digit } 14 | character = ? any ASCII character ? 15 | NEWLINE = '\n' 16 | ENDMARKER = '\0' 17 | IND++ = ? increase target indentation (start with -1) ? 18 | IND-- = ? decrease target indentation (start with -1) ? 19 | NOIND = ? check if indentation equals zero ? 20 | EQIND = ? check if indentation equals target ? 21 | 22 | program = { statement }, ENDMARKER 23 | block = simple-line 24 | | NEWLINE, IND++, { statement }, IND-- 25 | statement = { NEWLINE }, EQIND, simple-line 26 | | { NEWLINE }, EQIND, 'if', expr, [':'], block, 27 | { { NEWLINE }, EQIND, 'elif', expr, [':'], block }, 28 | [ { NEWLINE }, EQIND, 'else', [':'], block ] 29 | | { NEWLINE }, EQIND, 'while', expr, [':'], block 30 | | { NEWLINE }, NOIND, 'def', identifier, '(', { type, ['&'], identifier, [','] }, ')', [':'], block 31 | | { NEWLINE }, NOIND, 'use', '"', { character }, '"' (* import another file*) 32 | simple-line = simple-stmt, [';'], { simple-stmt, [';'] } 33 | simple-stmt = type, identifier, ['@', expr ], ['=', comp-expr ] (* variable definition *) 34 | | identifier, ['[', expr, ']'], '=', comp-expr (* assignment *) 35 | | identifier, ['[', expr, ']'], '+=', constant (* fast add *) 36 | | identifier, ['[', expr, ']'], '-=', constant (* fast sub *) 37 | | identifier, '(', { comp-expr, [','] }, ')' (* function call *) 38 | | 'return', [ comp-expr ] 39 | | 'break' 40 | | 'call', '(', factor, [','], factor, ')' (* only available on MINIMAL 64 *) 41 | | 'print', '(', { comp-expr, [','] }, ')' 42 | 43 | constant '0x', hexdigit, { hexdigit } (* int HEX number *) 44 | | digit, { digit } (* int DEC number *) 45 | factor = constant 46 | | '(', expr, ')' (* result of braced expression *) 47 | | 'key', '(', ')' (* MINIMAL 64 uses API function instead *) 48 | | '"', { character }, '"' (* char string *) 49 | | ['&'], identifier, ['[', [ expr ], ['|', [ expr ] ], ']'] (* [address of] variable [elements] *) 50 | | identifier, '(', { comp-expr, [','] }, ')' (* return value of function call *) 51 | term = factor, { mul-op, factor } 52 | base-expr = ['-'], term, { add-op, term } 53 | rel-expr = base-expr, { rel-op, base-expr } 54 | expr = ['not'], rel-expr, { logic-op, rel-expr } 55 | comp-expr = expr, {'_', expr } (* compound expressions of same data type *) 56 | -------------------------------------------------------------------------------- /Programs/asm/vga.asm: -------------------------------------------------------------------------------- 1 | #org 0x0000 2 | LDI 0xfe STA 0xffff ; initialize stack 3 | 4 | CLW _XPos 5 | reset: LXI 32 6 | again: INX BCS reset 7 | PHS JPS _PrintChar PLS 8 | LDA _YPos CPI 29 BCC weiter 9 | CLB _YPos 10 | weiter: JPS _ReadInput CPI 0 BEQ again 11 | 12 | LDI 0xff PHS JPS VGA_Fill PLS 13 | JPS _WaitInput 14 | 15 | JPS _Clear 16 | 17 | loop1: JPS _Random ANI 63 CPI 50 BCS loop1 STA _XPos 18 | JPS _Random ANI 31 CPI 29 BCS loop1 STA _YPos 19 | LDI text PHS JPS _Print PLS PLS 20 | JPS _ReadInput CPI 0 BEQ loop1 21 | 22 | JPS _Clear 23 | 24 | loop2: JPS _Random CPI 200 BCS loop2 25 | LSL STA rnd+0 LDI 0 ROL STA rnd+1 26 | JPS _Random ANI 1 ORA rnd+0 PHS LDA rnd+1 PHS 27 | loop70: JPS _Random CPI 240 BCS loop70 PHS 28 | JPS _SetPixel LDI 3 ADB 0xffff 29 | JPS _ReadInput CPI 0 BEQ loop2 30 | 31 | JPS _Clear 32 | 33 | loop4: JPS _Random PHS LDI 0 PHS JPS _Random LSR PHS ; x: 0-255, y:0-127 34 | LDI 144 PHS LDI 0 PHS LDI 112 PHS 35 | JPS _ScanPS2 36 | JPS _Rect LDI 6 ADB 0xffff 37 | JPS _ReadInput CPI 0 BEQ loop4 38 | 39 | JPS _Clear 40 | 41 | loop3: JPS _Random PHS CPI 144 BCS nulllsb1 42 | JPS _Random ANI 0x01 PHS JPA loop71 43 | nulllsb1: LDI 0 PHS 44 | loop71: JPS _Random CPI 240 BCS loop71 PHS 45 | JPS _Random PHS CPI 144 BCS nulllsb2 46 | JPS _Random ANI 0x01 PHS JPA loop6 47 | nulllsb2: LDI 0 PHS 48 | loop6: JPS _Random CPI 240 BCS loop6 PHS 49 | JPS _ScanPS2 50 | JPS _Line LDI 6 ADB 0xffff 51 | JPS _ReadInput CPI 0 BEQ loop3 52 | 53 | CLB _XPos LDI 29 STA _YPos ; set cusor to bottom left 54 | JPA _Prompt 55 | 56 | text: 'Hello, world!', 0 57 | rnd: 0xffff 58 | 59 | ; ******************************************************************************* 60 | ; Fills pixel area with 61 | ; push: 62 | ; pull: # 63 | ; ******************************************************************************* 64 | VGA_Fill: LDS 3 STA vf_loopx+1 65 | LDI <0xc30c STA vf_loopx+3 ; set start index 66 | LDI >0xc30c STA vf_loopx+4 67 | LYI 240 ; number of lines 68 | vf_loopy: LXI 50 ; number of cols 69 | vf_loopx: LDI 0xff STA 0xffff 70 | INB vf_loopx+3 71 | DEX BGT vf_loopx ; self-modifying code 72 | LDI 14 ADW vf_loopx+3 ; add blank cols 73 | DEY BGT vf_loopy 74 | RTS 75 | 76 | #mute ; MinOS label definitions generated by 'asm os.asm -s_' 77 | 78 | #org 0xb000 _Start: 79 | #org 0xb003 _Prompt: 80 | #org 0xb006 _ReadLine: 81 | #org 0xb009 _ReadSpace: 82 | #org 0xb00c _ReadHex: 83 | #org 0xb00f _SerialWait: 84 | #org 0xb012 _SerialPrint: 85 | #org 0xb015 _FindFile: 86 | #org 0xb018 _LoadFile: 87 | #org 0xb01b _SaveFile: 88 | #org 0xb01e _MemMove: 89 | #org 0xb021 _Random: 90 | #org 0xb024 _ScanPS2: 91 | #org 0xb027 _ReadInput: 92 | #org 0xb02a _WaitInput: 93 | #org 0xb02d _ClearVRAM: 94 | #org 0xb030 _Clear: 95 | #org 0xb033 _ClearRow: 96 | #org 0xb036 _SetPixel: 97 | #org 0xb039 _ClrPixel: 98 | #org 0xb03c _GetPixel: 99 | #org 0xb03f _Char: 100 | #org 0xb042 _Line: 101 | #org 0xb045 _Rect: 102 | #org 0xb048 _Print: 103 | #org 0xb04b _PrintChar: 104 | #org 0xb04e _PrintHex: 105 | #org 0xb051 _ScrollUp: 106 | #org 0xb054 _ScrollDn: 107 | #org 0xb057 _ResetPS2: 108 | 109 | #org 0xbcb0 _ReadPtr: 110 | #org 0xbcb2 _ReadNum: 111 | #org 0xbcc4 _RandomState: 112 | #org 0xbccc _XPos: 113 | #org 0xbccd _YPos: 114 | #org 0xbcce _ReadBuffer: 115 | -------------------------------------------------------------------------------- /Programs/asm/mandel.asm: -------------------------------------------------------------------------------- 1 | ; Displays the 'Mandelbrot Set' by projecting the area (-2.5..1) * (-1..1) onto 32 x 22 pixels 2 | ; using a maximum of 14 iterations and 16/32-bit math operations with 9-bit fixed-point integer values 3 | ; as used by ... in his video series '8-Bit Battle Royale' benchmarking various 8-bit systems. 4 | ; 5 | ; by Carsten Herting (slu4) 2023 6 | 7 | #org 0x8000 JPS _Clear 8 | 9 | CLB _YPos 10 | LDI 0xfe STA cb+1 LDI 0x06 STA cb+0 ; set cb 11 | 12 | newline: CLB _XPos 13 | LDI 0xfa STA ca+1 LDI 0xf8 STA ca+0 ; set ca 14 | 15 | nextpixel: LDA ca+0 STA za+0 LDA ca+1 STA za+1 ; inititialize iteration to za = ca and zb = cb 16 | LDA cb+0 STA zb+0 LDA cb+1 STA zb+1 17 | 18 | LYI 14 ; set maximum iteration steps to (n+1) 19 | 20 | interate: LDA za+0 STA inta+0 STA intb+0 ; calculate za^2 21 | LDA za+1 STA inta+1 STA intb+1 22 | JPS Multiply 23 | LDA intc+3 LSR 24 | LDA intc+2 ROR STA zaq+1 25 | LDA intc+1 ROR STA zaq+0 26 | 27 | LDA zb+0 STA inta+0 STA intb+0 ; calculate zb^2 28 | LDA zb+1 STA inta+1 STA intb+1 29 | JPS Multiply 30 | LDA intc+3 LSR 31 | LDA intc+2 ROR STA zbq+1 32 | LDA intc+1 ROR STA zbq+0 33 | 34 | LDA zaq+0 ADA zbq+0 ; quit iteration with white pixel if (za^2 + zb^2 >= 4) 35 | LDA zaq+1 ACA zbq+1 36 | CPI 0x08 BCS plotpixel 37 | 38 | LDA za+0 STA inta+0 LDA za+1 STA inta+1 ; zb = (za * zb)>>8 + cb 39 | LDA zb+0 STA intb+0 LDA zb+1 STA intb+1 40 | JPS Multiply 41 | LDA intc+1 STA zb+0 42 | LDA intc+2 ADA cb+1 STA zb+1 43 | LDA cb+0 ADW zb 44 | 45 | LDA zaq+0 STA za+0 LDA zaq+1 STA za+1 ; za = za^2 - zb^2 + ca 46 | LDA zbq+1 SBB za+1 LDA zbq+0 SBW za 47 | LDA ca+0 ADW za LDA ca+1 ADB za+1 48 | 49 | DEY BCS interate 50 | 51 | plotpixel: TYA ADI 33 PHS JPS _Char PLS ; plot current pixel 52 | LDI 56 ADW ca 53 | INB _XPos CPI 32 BCC nextpixel ; advance to next position 54 | LDI 46 ADW cb 55 | INB _YPos CPI 22 BCC newline ; advance to next line 56 | 57 | CLB _XPos JPA _Prompt 58 | 59 | ; 32-bit intc = (16-bit inta) * (16-bit intb) 60 | Multiply: CLB intsign 61 | LDA inta+1 CPI 0 BPL apos ; make A positive 62 | NOB intsign NEW inta 63 | apos: LDA intb+1 CPI 0 BPL bpos ; make B positive 64 | NOB intsign NEW intb 65 | bpos: LXI 16 CLW intc+0 CLW intc+2 JPA entry ; init unsigned multiplication 16bit x 16bit = 32bit 66 | next: LLW intc RLW intc+2 ; shift the current result up one step 67 | entry: LLW inta BCC bitisoff ; shift out the highest bit of A 68 | LDA intb+0 ADW intc+0 BCC firstok INW intc+2 ; add 16-bit B to 32-bit result 69 | firstok: LDA intb+1 ADB intc+1 BCC bitisoff INW intc+2 70 | bitisoff: DEX BNE next 71 | ADA intsign BPL exit ; add to A=0 72 | NOW intc NOW intc+2 ; negate 32-bit result 73 | INW intc BCC exit INW intc+2 74 | exit: RTS 75 | 76 | #mute 77 | 78 | ca: 0, 0 ; fixed-point Mandelbrot variables 79 | cb: 0, 0 80 | za: 0, 0 81 | zb: 0, 0 82 | zaq: 0, 0 83 | zbq: 0, 0 84 | 85 | inta: 0, 0 ; math registers 86 | intb: 0, 0 87 | intc: 0, 0, 0, 0 88 | intsign: 0 89 | 90 | #org 0xb030 _Clear: ; API routines used 91 | #org 0xb003 _Prompt: 92 | #org 0xbccc _XPos: 93 | #org 0xbccd _YPos: 94 | #org 0xb03f _Char: 95 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/gui_defaults.par: -------------------------------------------------------------------------------- 1 | 2 | (gui_defaults 3 | (windows 4 | (board_frame 5 | visible 6 | (bounds 7 | -8 -8 1936 1056 8 | ) 9 | ) 10 | (color_manager 11 | not_visible 12 | (bounds 13 | 0 600 1126 143 14 | ) 15 | ) 16 | (layer_visibility 17 | not_visible 18 | (bounds 19 | 0 450 343 188 20 | ) 21 | ) 22 | (object_visibility 23 | not_visible 24 | (bounds 25 | 0 550 362 512 26 | ) 27 | ) 28 | (display_miscellanious 29 | not_visible 30 | (bounds 31 | 0 350 236 348 32 | ) 33 | ) 34 | (snapshots 35 | not_visible 36 | (bounds 37 | 0 250 216 254 38 | ) 39 | ) 40 | (select_parameter 41 | visible 42 | (bounds 43 | 0 0 208 471 44 | ) 45 | ) 46 | (route_parameter 47 | not_visible 48 | (bounds 49 | 0 100 236 557 50 | ) 51 | ) 52 | (manual_rules 53 | not_visible 54 | (bounds 55 | 0 0 248 193 56 | ) 57 | ) 58 | (route_details 59 | not_visible 60 | (bounds 61 | 0 0 236 256 62 | ) 63 | ) 64 | (move_parameter 65 | not_visible 66 | (bounds 67 | 0 50 239 149 68 | ) 69 | ) 70 | (clearance_matrix 71 | not_visible 72 | (bounds 73 | 0 150 676 292 74 | ) 75 | ) 76 | (via_rules 77 | not_visible 78 | (bounds 79 | 50 150 284 448 80 | ) 81 | ) 82 | (edit_vias 83 | not_visible 84 | (bounds 85 | 100 150 418 147 86 | ) 87 | ) 88 | (edit_net_rules 89 | not_visible 90 | (bounds 91 | 100 200 918 147 92 | ) 93 | ) 94 | (assign_net_rules 95 | not_visible 96 | (bounds 97 | 100 250 235 386 98 | ) 99 | ) 100 | (padstack_info 101 | not_visible 102 | (bounds 103 | 100 30 0 0 104 | ) 105 | ) 106 | (package_info 107 | not_visible 108 | (bounds 109 | 200 30 0 0 110 | ) 111 | ) 112 | (component_info 113 | not_visible 114 | (bounds 115 | 300 30 0 0 116 | ) 117 | ) 118 | (net_info 119 | not_visible 120 | (bounds 121 | 350 30 0 0 122 | ) 123 | ) 124 | (incompletes_info 125 | not_visible 126 | (bounds 127 | 400 30 0 0 128 | ) 129 | ) 130 | (violations_info 131 | not_visible 132 | (bounds 133 | 500 30 0 0 134 | ) 135 | ) 136 | ) 137 | (colors 138 | (background 139 | 70 70 70 140 | ) 141 | (hilight 0.8 142 | 255 255 255 143 | ) 144 | (incompletes 1.0 145 | 255 255 255 146 | ) 147 | (outline 148 | 100 150 255 149 | ) 150 | (component_front 151 | 0 0 255 152 | ) 153 | (component_back 154 | 255 0 0 155 | ) 156 | (violations 157 | 255 0 255 158 | ) 159 | (length_matching 0.1 160 | 0 255 0 161 | ) 162 | (traces 0.4 163 | 255 0 0 164 | 0 0 255 165 | ) 166 | (fixed_traces 0.4 167 | 255 0 0 168 | 0 0 255 169 | ) 170 | (vias 0.6 171 | 200 200 0 172 | 200 200 0 173 | ) 174 | (fixed_vias 0.6 175 | 200 200 0 176 | 200 200 0 177 | ) 178 | (pins 0.6 179 | 150 50 0 180 | 160 80 0 181 | ) 182 | (conduction 0.2 183 | 0 150 0 184 | 100 100 0 185 | ) 186 | (keepout 0.2 187 | 0 110 110 188 | 0 100 160 189 | ) 190 | (via_keepout 0.2 191 | 100 100 100 192 | 100 100 100 193 | ) 194 | ) 195 | (parameter 196 | (selection_layers 197 | all_visible 198 | ) 199 | (selectable_items 200 | TRACES VIAS PINS FIXED UNFIXED 201 | ) 202 | (via_snap_to_smd_center 203 | on 204 | ) 205 | (route_mode 206 | dynamic 207 | ) 208 | (shove_enabled 209 | on 210 | ) 211 | (drag_components_enabled 212 | on 213 | ) 214 | (hilight_routing_obstacle 215 | off 216 | ) 217 | (pull_tight_region 218 | 2147483647 219 | ) 220 | (pull_tight_accuracy 221 | 500 222 | ) 223 | (clearance_compensation 224 | off 225 | ) 226 | (ignore_conduction_areas 227 | on 228 | ) 229 | (automatic_layer_dimming 230 | 0.7 231 | ) 232 | (deselected_snapshot_attributes 233 | ) 234 | ) 235 | ) -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/8-Bit CPU 32k.pro: -------------------------------------------------------------------------------- 1 | update=21/05/2021 20:05:09 2 | version=1 3 | last_client=kicad 4 | [general] 5 | version=1 6 | RootSch= 7 | BoardNm= 8 | [cvpcb] 9 | version=1 10 | NetIExt=net 11 | [eeschema] 12 | version=1 13 | LibDir= 14 | [eeschema/libraries] 15 | [pcbnew] 16 | version=1 17 | PageLayoutDescrFile= 18 | LastNetListRead=8-Bit CPU 32k.net 19 | CopperLayerCount=2 20 | BoardThickness=1.6 21 | AllowMicroVias=0 22 | AllowBlindVias=0 23 | RequireCourtyardDefinitions=0 24 | ProhibitOverlappingCourtyards=1 25 | MinTrackWidth=0.2 26 | MinViaDiameter=0.4 27 | MinViaDrill=0.3 28 | MinMicroViaDiameter=0.2 29 | MinMicroViaDrill=0.09999999999999999 30 | MinHoleToHole=0.25 31 | TrackWidth1=0.25 32 | ViaDiameter1=0.8 33 | ViaDrill1=0.4 34 | dPairWidth1=0.2 35 | dPairGap1=0.25 36 | dPairViaGap1=0.25 37 | SilkLineWidth=0.12 38 | SilkTextSizeV=1 39 | SilkTextSizeH=1 40 | SilkTextSizeThickness=0.15 41 | SilkTextItalic=0 42 | SilkTextUpright=1 43 | CopperLineWidth=0.2 44 | CopperTextSizeV=1.5 45 | CopperTextSizeH=1.5 46 | CopperTextThickness=0.3 47 | CopperTextItalic=0 48 | CopperTextUpright=1 49 | EdgeCutLineWidth=0.05 50 | CourtyardLineWidth=0.05 51 | OthersLineWidth=0.15 52 | OthersTextSizeV=1 53 | OthersTextSizeH=1 54 | OthersTextSizeThickness=0.15 55 | OthersTextItalic=0 56 | OthersTextUpright=1 57 | SolderMaskClearance=0.051 58 | SolderMaskMinWidth=0.25 59 | SolderPasteClearance=0 60 | SolderPasteRatio=-0 61 | [pcbnew/Layer.F.Cu] 62 | Name=F.Cu 63 | Type=0 64 | Enabled=1 65 | [pcbnew/Layer.In1.Cu] 66 | Name=In1.Cu 67 | Type=0 68 | Enabled=0 69 | [pcbnew/Layer.In2.Cu] 70 | Name=In2.Cu 71 | Type=0 72 | Enabled=0 73 | [pcbnew/Layer.In3.Cu] 74 | Name=In3.Cu 75 | Type=0 76 | Enabled=0 77 | [pcbnew/Layer.In4.Cu] 78 | Name=In4.Cu 79 | Type=0 80 | Enabled=0 81 | [pcbnew/Layer.In5.Cu] 82 | Name=In5.Cu 83 | Type=0 84 | Enabled=0 85 | [pcbnew/Layer.In6.Cu] 86 | Name=In6.Cu 87 | Type=0 88 | Enabled=0 89 | [pcbnew/Layer.In7.Cu] 90 | Name=In7.Cu 91 | Type=0 92 | Enabled=0 93 | [pcbnew/Layer.In8.Cu] 94 | Name=In8.Cu 95 | Type=0 96 | Enabled=0 97 | [pcbnew/Layer.In9.Cu] 98 | Name=In9.Cu 99 | Type=0 100 | Enabled=0 101 | [pcbnew/Layer.In10.Cu] 102 | Name=In10.Cu 103 | Type=0 104 | Enabled=0 105 | [pcbnew/Layer.In11.Cu] 106 | Name=In11.Cu 107 | Type=0 108 | Enabled=0 109 | [pcbnew/Layer.In12.Cu] 110 | Name=In12.Cu 111 | Type=0 112 | Enabled=0 113 | [pcbnew/Layer.In13.Cu] 114 | Name=In13.Cu 115 | Type=0 116 | Enabled=0 117 | [pcbnew/Layer.In14.Cu] 118 | Name=In14.Cu 119 | Type=0 120 | Enabled=0 121 | [pcbnew/Layer.In15.Cu] 122 | Name=In15.Cu 123 | Type=0 124 | Enabled=0 125 | [pcbnew/Layer.In16.Cu] 126 | Name=In16.Cu 127 | Type=0 128 | Enabled=0 129 | [pcbnew/Layer.In17.Cu] 130 | Name=In17.Cu 131 | Type=0 132 | Enabled=0 133 | [pcbnew/Layer.In18.Cu] 134 | Name=In18.Cu 135 | Type=0 136 | Enabled=0 137 | [pcbnew/Layer.In19.Cu] 138 | Name=In19.Cu 139 | Type=0 140 | Enabled=0 141 | [pcbnew/Layer.In20.Cu] 142 | Name=In20.Cu 143 | Type=0 144 | Enabled=0 145 | [pcbnew/Layer.In21.Cu] 146 | Name=In21.Cu 147 | Type=0 148 | Enabled=0 149 | [pcbnew/Layer.In22.Cu] 150 | Name=In22.Cu 151 | Type=0 152 | Enabled=0 153 | [pcbnew/Layer.In23.Cu] 154 | Name=In23.Cu 155 | Type=0 156 | Enabled=0 157 | [pcbnew/Layer.In24.Cu] 158 | Name=In24.Cu 159 | Type=0 160 | Enabled=0 161 | [pcbnew/Layer.In25.Cu] 162 | Name=In25.Cu 163 | Type=0 164 | Enabled=0 165 | [pcbnew/Layer.In26.Cu] 166 | Name=In26.Cu 167 | Type=0 168 | Enabled=0 169 | [pcbnew/Layer.In27.Cu] 170 | Name=In27.Cu 171 | Type=0 172 | Enabled=0 173 | [pcbnew/Layer.In28.Cu] 174 | Name=In28.Cu 175 | Type=0 176 | Enabled=0 177 | [pcbnew/Layer.In29.Cu] 178 | Name=In29.Cu 179 | Type=0 180 | Enabled=0 181 | [pcbnew/Layer.In30.Cu] 182 | Name=In30.Cu 183 | Type=0 184 | Enabled=0 185 | [pcbnew/Layer.B.Cu] 186 | Name=B.Cu 187 | Type=0 188 | Enabled=1 189 | [pcbnew/Layer.B.Adhes] 190 | Enabled=1 191 | [pcbnew/Layer.F.Adhes] 192 | Enabled=1 193 | [pcbnew/Layer.B.Paste] 194 | Enabled=1 195 | [pcbnew/Layer.F.Paste] 196 | Enabled=1 197 | [pcbnew/Layer.B.SilkS] 198 | Enabled=1 199 | [pcbnew/Layer.F.SilkS] 200 | Enabled=1 201 | [pcbnew/Layer.B.Mask] 202 | Enabled=1 203 | [pcbnew/Layer.F.Mask] 204 | Enabled=1 205 | [pcbnew/Layer.Dwgs.User] 206 | Enabled=1 207 | [pcbnew/Layer.Cmts.User] 208 | Enabled=1 209 | [pcbnew/Layer.Eco1.User] 210 | Enabled=1 211 | [pcbnew/Layer.Eco2.User] 212 | Enabled=1 213 | [pcbnew/Layer.Edge.Cuts] 214 | Enabled=1 215 | [pcbnew/Layer.Margin] 216 | Enabled=1 217 | [pcbnew/Layer.B.CrtYd] 218 | Enabled=1 219 | [pcbnew/Layer.F.CrtYd] 220 | Enabled=1 221 | [pcbnew/Layer.B.Fab] 222 | Enabled=1 223 | [pcbnew/Layer.F.Fab] 224 | Enabled=1 225 | [pcbnew/Layer.Rescue] 226 | Enabled=0 227 | [pcbnew/Netclasses] 228 | [pcbnew/Netclasses/Default] 229 | Name=Default 230 | Clearance=0.2 231 | TrackWidth=0.25 232 | ViaDiameter=0.8 233 | ViaDrill=0.4 234 | uViaDiameter=0.3 235 | uViaDrill=0.1 236 | dPairWidth=0.2 237 | dPairGap=0.25 238 | dPairViaGap=0.25 239 | [pcbnew/Netclasses/1] 240 | Name=Power 241 | Clearance=0.2 242 | TrackWidth=0.5 243 | ViaDiameter=0.8 244 | ViaDrill=0.4 245 | uViaDiameter=0.3 246 | uViaDrill=0.1 247 | dPairWidth=0.2 248 | dPairGap=0.25 249 | dPairViaGap=0.25 250 | [schematic_editor] 251 | version=1 252 | PageLayoutDescrFile= 253 | PlotDirectoryName= 254 | SubpartIdSeparator=0 255 | SubpartFirstId=65 256 | NetFmtName=Pcbnew 257 | SpiceAjustPassiveValues=0 258 | LabSize=50 259 | ERC_TestSimilarLabels=1 260 | -------------------------------------------------------------------------------- /Programs/min/blocks.min: -------------------------------------------------------------------------------- 1 | def pos(char x, char y): 2 | char posx @ 0xbccc = x 3 | char posy @ 0xbccd = y 4 | 5 | def rnd(): 6 | call(0xb021, 0) 7 | char r @ 0xff02 8 | return r 9 | 10 | def key(): 11 | call(0xb027, 0) 12 | char r @ 0xff02 13 | return r 14 | 15 | def clear(): call(0xb030, 0) 16 | 17 | # ------------------------- 18 | 19 | def drawIntro(): 20 | clear() 21 | pos(3, 8); print("M I N I M A L C P U B L O C K S") 22 | pos(3, 13); print("written in M I N 3 by slu4 (2023)") 23 | pos(11, 22); print("Press SPACE or ESC") 24 | 25 | def drawScreen(): 26 | clear(); int i=0 27 | while i<20: 28 | pos(12, i); print("") 29 | i+=1 30 | pos(12, 20); print("") 31 | pos(12, 21); print(" VVVVVVVVVV ") 32 | pos(0, 0); print("SCORE 0") 33 | pos(27, 0); print("HIGH ", high) 34 | pos(0, 3); print("CONTROLS") 35 | pos(0, 4); print("A - Left") 36 | pos(0, 5); print("D - Right") 37 | pos(0, 6); print("W - Rotate") 38 | pos(0, 7); print("S - Drop") 39 | 40 | def drawShape(char b, int x, int y): 41 | int i=0; x+=14 42 | while i<8: 43 | pos(x+shape[i], y+shape[i+1]); print(b) 44 | i+=2 45 | 46 | def newShape(): 47 | px=4; py=1; int m = (128 + rnd())/37 48 | shape = minos[10*m|10*m+10] 49 | return testShape(px, py) 50 | 51 | def testShape(int x, int y): 52 | int i=0 53 | while i<8: 54 | int tx=x+shape[i]; int ty=y+shape[i+1] 55 | if tx < 0 or tx > 9: return 0 56 | if ty < 0 or ty > 19: return 0 57 | if vram[tx + 10*ty] != ".": return 0 58 | i+=2 59 | return -1 60 | 61 | def rotShape(): 62 | int rotshape = shape 63 | int i=0 64 | while i<10: 65 | rotshape[i] = shape[i+1] 66 | rotshape[i+1] = -shape[i] 67 | i+=2 68 | shape = rotshape 69 | px=px+shape[8]; py=py+shape[9] # do the SRS offset correction 70 | 71 | def placeShape(): 72 | int i=0 73 | while i<8: 74 | vram[px+shape[i] + (py+shape[i+1])*10] = "#" 75 | i+=2 76 | 77 | def compare(char s1, char s2): 78 | int i=0 79 | while i < 10: 80 | if s1[i] != s2[i]: return -1 81 | i+=1 82 | return 0 83 | 84 | def updateVRAM(): 85 | int rows=0; int i=0; int d=0 86 | while i<20: 87 | d = 10*i 88 | if compare(vram[d|d+10], "##########") == 0: 89 | vram = ".........." _ vram[0|d] _ vram[d+10|200] 90 | rows+=1 91 | i+=1 92 | score=score+bonus[rows] 93 | wait-=1 94 | 95 | def drawField(): 96 | int i=0; int d=0 97 | while i<20: 98 | pos(14, i) 99 | d=10*i 100 | print(vram[d|d+10]) 101 | i+=1 102 | 103 | def clearField(): 104 | int i=0 105 | while i<200: vram[i] = "."; i+=1 106 | 107 | # ------------------------- 108 | 109 | int state=0 # game state 110 | int score=0; int high=2023 111 | int px=0; int py=0 # position of the current shape 112 | int wait # slowly decreasing time for one step 113 | int timer # step timer (always counts down from 'wait' to 0) 114 | char vram = vram[0|200] # allocate local memory for 20x10 field 115 | int bonus = 0_40_120_270_540 # bonus points for cleared rows 116 | 117 | int shape = 0_0_0_0_0_0_0_0_ 0_0 # current shape 118 | 119 | int minos = minos[0|70] # allocate local memory for 70 elements 120 | minos[0] = -1_-1_0_-1_0_0_1_0_ 0_0 # Z 121 | minos[10] = -1_0_0_0_0_-1_1_-1_ 0_0 # neg. Z 122 | minos[20] = -1_0_0_0_1_0_2_0_ 0_1 # I 123 | minos[30] = -1_0_0_0_1_0_0_-1_ 0_0 # stairs 124 | minos[40] = -1_-1_-1_0_0_0_1_0_ 0_0 # L 125 | minos[50] = -1_0_0_0_1_0_1_-1_ 0_0 # neg. L 126 | minos[60] = 0_0_1_0_0_-1_1_-1_ 0_1 # square 127 | 128 | # ------------------------- 129 | 130 | while state >= 0: 131 | char inkey=key() 132 | 133 | if state==0: # drawing the intro screen 134 | drawIntro(); state=1 135 | 136 | elif state==1: # waiting for game startup 137 | rnd() 138 | if inkey == "\e": state=-1 139 | if inkey == " ": 140 | drawScreen(); clearField(); drawField() 141 | newShape(); drawShape("#", px, py) 142 | wait=100 143 | timer=wait; score=0; state=2 144 | 145 | elif state==2: # game is running 146 | if inkey!=0: 147 | if inkey=="\e": state=0 148 | elif inkey=="a": 149 | if testShape(px-1, py): drawShape(".", px, py); px=px-1 150 | elif inkey=="d": 151 | if testShape(px+1, py): drawShape(".", px, py); px=px+1 152 | elif inkey=="s": 153 | timer=0; score+=1 154 | elif inkey=="w": 155 | drawShape(".", px, py) 156 | rotShape() 157 | if not testShape(px, py): 158 | if testShape(px-1, py): px-=1 159 | elif testShape(px+1, py): px+=1 160 | elif testShape(px-2, py): px-=2 161 | elif testShape(px+2, py): px+=2 162 | else: rotShape(); rotShape(); rotShape() 163 | drawShape("#", px, py) 164 | 165 | timer-=1 166 | if timer < 0: 167 | timer=wait 168 | if testShape(px, py+1): 169 | drawShape(".", px, py) # shape falls 170 | py+=1 171 | drawShape("#", px, py) 172 | else: 173 | placeShape() # shape lands 174 | updateVRAM() 175 | drawField() 176 | pos(6, 0); print(score) 177 | if score > high: high=score; pos(32, 0); print(high) 178 | if newShape(): drawShape("#", px, py) 179 | else: state=3 180 | 181 | elif state==3: # print the 'GAME OVER' screen 182 | pos(14, 10); print("GAME OVER") 183 | pos(10, 23); print("Press SPACE or ESC") 184 | state=4 185 | 186 | elif state==4: # waiting for quit or restart 187 | if inkey=="\e" or inkey==" ": state=0 188 | 189 | pos(0,0); clear() 190 | -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/8-Bit CPU 32k.rules: -------------------------------------------------------------------------------- 1 | 2 | (rules PCB 8-Bit CPU 32k 3 | (snap_angle 4 | fortyfive_degree 5 | ) 6 | (autoroute_settings 7 | (fanout off) 8 | (eu.mihosoft.freerouting.autoroute on) 9 | (postroute on) 10 | (vias on) 11 | (via_costs 600) 12 | (plane_via_costs 5) 13 | (start_ripup_costs 100) 14 | (start_pass_no 33029) 15 | (layer_rule F.Cu 16 | (active on) 17 | (preferred_direction horizontal) 18 | (preferred_direction_trace_costs 1.0) 19 | (against_preferred_direction_trace_costs 3.2) 20 | ) 21 | (layer_rule B.Cu 22 | (active on) 23 | (preferred_direction vertical) 24 | (preferred_direction_trace_costs 1.0) 25 | (against_preferred_direction_trace_costs 1.5) 26 | ) 27 | ) 28 | (rule 29 | (width 250.0) 30 | (clear 200.2) 31 | (clear 125.0 (type smd_to_turn_gap)) 32 | (clear 50.0 (type smd_smd)) 33 | ) 34 | (padstack "Via[0-1]_800:400_um" 35 | (shape 36 | (circle F.Cu 800.0 0.0 0.0) 37 | ) 38 | (shape 39 | (circle B.Cu 800.0 0.0 0.0) 40 | ) 41 | (attach off) 42 | ) 43 | (via 44 | "Via[0-1]_800:400_um" "Via[0-1]_800:400_um" default 45 | ) 46 | (via 47 | "Via[0-1]_800:400_um-kicad_default" "Via[0-1]_800:400_um" "kicad_default" 48 | ) 49 | (via 50 | "Via[0-1]_800:400_um-Power" "Via[0-1]_800:400_um" Power 51 | ) 52 | (via_rule 53 | default "Via[0-1]_800:400_um" 54 | ) 55 | (via_rule 56 | "kicad_default" "Via[0-1]_800:400_um-kicad_default" 57 | ) 58 | (via_rule 59 | Power "Via[0-1]_800:400_um-Power" 60 | ) 61 | (class default 62 | "/UART/UART_RTS" "/UART/UART_RX" "/UART/UART_TX" "Net-(J2-Pad1)" /ALU/BUS7 /ALU/BUS6 /ALU/BUS5 /ALU/BUS4 63 | /ALU/BUS3 /ALU/BUS2 /ALU/BUS1 /ALU/BUS0 "unconnected-(J3-Pad2)" "/Control Logic/~{AO}" "/ALU/FLAG_C" "unconnected-(U3-Pad15)" 64 | "unconnected-(U4-Pad1)" "/Control Logic/~{RO}" "/Control Logic/TI" "unconnected-(U4-Pad30)" "unconnected-(U5-Pad1)" "/Control Logic/AI" "unconnected-(U5-Pad30)" "unconnected-(U6-Pad1)" 65 | "/Control Logic/BI" "/ALU/FLAG_Z" /ALU/~{EO} /ALU/ES "unconnected-(J2-Pad4)" "unconnected-(J2-Pad11)" "unconnected-(J2-Pad12)" "Net-(J2-Pad14)" 66 | "unconnected-(J2-Pad15)" "Net-(J2-Pad13)" "unconnected-(J2-Pad9)" /Memory/~{INH} /Memory/MAR0 /Memory/MAR1 /Memory/MAR2 /Memory/MAR3 67 | /Memory/MAR4 /Memory/MAR5 /Memory/MAR6 "unconnected-(J1-Pad6)" "/Control Logic/~{BO}" /Memory/MAR7 "unconnected-(U6-Pad30)" /Memory/MAR8 68 | "/Control Logic/RI" "/Control Logic/CE" "Net-(U7-Pad15)" ~{RESET} "Net-(U8-Pad15)" "Net-(U1-Pad11)" "/Control Logic/Flag2" "/Control Logic/Flag1" 69 | "/Control Logic/Flag0" "/Control Logic/~{TO}" "/Control Logic/Step0" "/Control Logic/Inst4" "/Control Logic/Step1" "/Control Logic/Inst5" "/Control Logic/Step2" "/Control Logic/Step3" 70 | "/Control Logic/Inst0" "/Control Logic/Inst1" "/Control Logic/Inst2" "/Control Logic/Inst3" /Memory/MAR9 "/Control Logic/~{IC}" "Net-(U10-Pad10)" /Memory/MAR10 71 | /Memory/MAR11 /Memory/MAR12 "unconnected-(U11-Pad15)" /Memory/MAR13 "unconnected-(U10-Pad15)" "Net-(U14-Pad11)" /Memory/MAR14 "Net-(U14-Pad12)" 72 | "Net-(U14-Pad13)" "Net-(U14-Pad14)" "Net-(U14-Pad15)" /Memory/MAR15 "Net-(U15-Pad15)" "Net-(U15-Pad11)" "Net-(U15-Pad12)" "Net-(U15-Pad13)" 73 | "Net-(U15-Pad14)" "Net-(U17-Pad15)" "Net-(U17-Pad11)" "Net-(U17-Pad12)" /VGA/~{VSYNC} "Net-(U17-Pad13)" "Net-(U17-Pad14)" "Net-(U25-Pad11)" 74 | "Net-(U18-Pad11)" "unconnected-(U18-Pad15)" "Net-(U18-Pad12)" "Net-(U18-Pad13)" "Net-(U18-Pad14)" /ALU/EC /ALU/B4 /ALU/B5 75 | /ALU/B6 /ALU/B7 /ALU/A7 /ALU/A6 /ALU/A5 /ALU/A4 "/Control Logic/Flag3" /ALU/A3 76 | /ALU/A2 /ALU/A1 /ALU/A0 /ALU/B0 /ALU/B1 /ALU/B2 "/VGA/PIXEL_DATA" "Net-(U24-Pad2)" 77 | /VGA/~{HSYNC} "Net-(U24-Pad6)" "CPU_PULSE" "/Control Logic/Inst6" "Net-(U2-Pad11)" "Net-(U25-Pad2)" "Net-(U13-Pad30)" "/Control Logic/~{CIH}" 78 | "Net-(U25-Pad6)" "/Control Logic/~{COH}" "Net-(U20-Pad11)" "Net-(U24-Pad1)" "Net-(U24-Pad4)" "RAM_A8" "unconnected-(U38-Pad7)" "/Control Logic/~{CIL}" 79 | "/Control Logic/~{COL}" "/Control Logic/ME" "Net-(U24-Pad10)" "unconnected-(U2-Pad12)" "Net-(U24-Pad9)" "unconnected-(X1-Pad1)" "unconnected-(U33-Pad12)" "unconnected-(U33-Pad13)" 80 | "/Control Logic/~{MIH}" "/Control Logic/~{MIL}" "unconnected-(U34-Pad2)" "unconnected-(U34-Pad3)" "unconnected-(U34-Pad6)" "unconnected-(U34-Pad7)" "unconnected-(U34-Pad12)" "Net-(U38-Pad10)" 81 | "unconnected-(J4-Pad2)" "/PS2 Receiver/PS2_DAT" "unconnected-(J4-Pad6)" "/PS2 Receiver/PS2_CLK" "RAM_A9" "RAM_A10" "RAM_A11" "RAM_A12" 82 | "Net-(U37-Pad11)" "unconnected-(U37-Pad12)" "unconnected-(U37-Pad13)" "unconnected-(U37-Pad14)" "unconnected-(U37-Pad15)" "unconnected-(U39-Pad7)" "RAM_A13" "/Control Logic/II" 83 | "RAM_A14" /ALU/B3 "Net-(U24-Pad13)" "Net-(U33-Pad11)" "Net-(U25-Pad1)" "unconnected-(U33-Pad14)" "unconnected-(U33-Pad15)" "Net-(U25-Pad4)" 84 | "CPU_CLOCK0" "Net-(U25-Pad13)" "RAM_A15" "RAM_A4" "~{VGA_CONTROL}" "RAM_A5" "unconnected-(U29-Pad1)" "unconnected-(U29-Pad6)" 85 | "unconnected-(U29-Pad8)" "RAM_A6" "RAM_A7" "RAM_A3" "RAM_A2" "RAM_A1" "RAM_A0" "Net-(U1-Pad2)" 86 | "CPU_CLOCK2" "~{VGA_ADDRESS}" "/Control Logic/~{PS2_DR}" "/Control Logic/~{UART_DR}" "/Control Logic/~{KO}" "/Control Logic/~{NI}" "/Control Logic/Flag4" "/Control Logic/FI" 87 | /Memory/BANK3 /Memory/BANK2 /Memory/BANK1 /Memory/BANK0 /VGA/V128 "unconnected-(U13-Pad1)" "Net-(U13-Pad22)" "Net-(U32-Pad11)" 88 | /VGA/V64 /VGA/V32 /VGA/V16 "CPU_CLOCK1" "unconnected-(U35-Pad9)" /VGA/V8 "unconnected-(U36-Pad15)" "Net-(U1-Pad8)" 89 | "Net-(U22-Pad1)" "Net-(U22-Pad4)" /VGA/V4 "VGA_RAM_CE" "Net-(U22-Pad11)" "/ALU/FLAG_N" "/Global Signals/Y6" "Net-(U43-Pad3)" 90 | "Net-(U43-Pad5)" "Net-(U40-Pad8)" /Memory/BANK7 /Memory/BANK6 /Memory/BANK5 /Memory/BANK4 "Net-(U42-Pad3)" "Net-(U42-Pad8)" 91 | 2MHz "Net-(U40-Pad11)" /VGA/V256 "Net-(U31-Pad3)" "unconnected-(U41-Pad9)" /VGA/~{RESTART} "Net-(U41-Pad12)" /VGA/V2 92 | "Net-(U31-Pad4)" "UART_CLOCK" "Net-(U31-Pad6)" "Net-(U24-Pad11)" "unconnected-(U50-Pad11)" "unconnected-(U50-Pad15)" "unconnected-(U51-Pad9)" "Net-(U51-Pad12)" 93 | "unconnected-(U52-Pad2)" "unconnected-(U52-Pad6)" "unconnected-(U52-Pad7)" "unconnected-(U52-Pad12)" "Net-(U31-Pad8)" "PIXEL_PUMP" /VGA/H8 /VGA/H16 94 | /VGA/H32 /VGA/V1 /VGA/H2 /VGA/H4 "unconnected-(U45-Pad6)" /VGA/H1 "Net-(U47-Pad3)" "Net-(U47-Pad6)" 95 | "Net-(U47-Pad8)" "Net-(U47-Pad11)" "Net-(U40-Pad3)" "Net-(U52-Pad11)" "Net-(U51-Pad11)" "Net-(U42-Pad10)" "Net-(U56-Pad3)" "Net-(U56-Pad6)" 96 | "Net-(U56-Pad8)" "Net-(U56-Pad11)" "~{PIXEL_LOAD}" "Net-(U58-Pad3)" "Net-(U58-Pad6)" "Net-(U58-Pad8)" "Net-(U58-Pad11)" "Net-(U59-Pad3)" 97 | "Net-(U59-Pad6)" "Net-(U59-Pad8)" "Net-(U59-Pad11)" "Net-(U57-Pad2)" "/Global Signals/Y2" "Net-(U24-Pad15)" "Net-(U25-Pad15)" "unconnected-(U30-Pad6)" 98 | "unconnected-(U30-Pad8)" "unconnected-(U30-Pad13)" "Net-(U22-Pad5)" "/Global Signals/Y3" "/Global Signals/Y5" "Net-(U49-Pad8)" "Net-(U49-Pad13)" "Net-(U55-Pad3)" 99 | "Net-(U55-Pad6)" "Net-(U57-Pad10)" "unconnected-(J1-Pad3)" "unconnected-(U53-Pad12)" "unconnected-(U53-Pad13)" "unconnected-(U53-Pad14)" 100 | (clearance_class default) 101 | (via_rule default) 102 | (rule 103 | (width 250.0) 104 | ) 105 | (circuit 106 | (use_layer F.Cu B.Cu) 107 | ) 108 | ) 109 | (class "kicad_default" 110 | (clearance_class "kicad_default") 111 | (via_rule kicad_default) 112 | (rule 113 | (width 250.0) 114 | ) 115 | (circuit 116 | (use_layer F.Cu B.Cu) 117 | ) 118 | ) 119 | (class Power 120 | +5V GND 121 | (clearance_class Power) 122 | (via_rule Power) 123 | (rule 124 | (width 500.0) 125 | ) 126 | (circuit 127 | (use_layer F.Cu B.Cu) 128 | ) 129 | ) 130 | ) -------------------------------------------------------------------------------- /Revision 1.2/KiCAD/Minimal Expansion.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # 74HC21 5 | # 6 | DEF 74HC21 U 0 40 Y Y 3 L N 7 | F0 "U" 0 50 50 H V C CNN 8 | F1 "74HC21" 0 -50 50 H V C CNN 9 | F2 "" 0 0 50 H I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | $FPLIST 12 | DIP?12* 13 | $ENDFPLIST 14 | DRAW 15 | A -25 0 175 -899 899 1 1 10 f -25 -175 -25 175 16 | A -25 0 175 -899 899 2 1 10 f -25 -175 -25 175 17 | A -445 0 343 306 -306 1 2 10 N -150 175 -150 -175 18 | A -81 -56 238 137 768 1 2 10 f 150 0 -24 175 19 | A -81 56 238 -137 -768 1 2 10 f 150 0 -24 -175 20 | A -445 0 343 306 -306 2 2 10 N -150 175 -150 -175 21 | A -81 -56 238 137 768 2 2 10 f 150 0 -24 175 22 | A -81 56 238 -137 -768 2 2 10 f 150 0 -24 -175 23 | S -200 300 200 -300 3 1 10 f 24 | P 4 1 1 10 -25 175 -150 175 -150 -175 -25 -175 f 25 | P 4 2 1 10 -25 175 -150 175 -150 -175 -25 -175 f 26 | P 2 1 2 10 -150 -175 -25 -175 f 27 | P 2 1 2 10 -150 175 -25 175 f 28 | P 13 1 2 -1000 -25 175 -150 175 -150 175 -143 161 -122 115 -109 66 -103 17 -104 -34 -113 -83 -128 -131 -150 -175 -150 -175 -25 -175 f 29 | P 2 2 2 10 -150 -175 -25 -175 f 30 | P 2 2 2 10 -150 175 -25 175 f 31 | P 13 2 2 -1000 -25 175 -150 175 -150 175 -143 161 -122 115 -109 66 -103 17 -104 -34 -113 -83 -128 -131 -150 -175 -150 -175 -25 -175 f 32 | X VCC 14 0 500 200 D 50 50 3 0 W 33 | X GND 7 0 -500 200 U 50 50 3 0 W 34 | X ~ 1 -300 150 150 R 50 50 1 1 I 35 | X ~ 2 -300 50 150 R 50 50 1 1 I 36 | X ~ 4 -300 -50 150 R 50 50 1 1 I 37 | X ~ 5 -300 -150 150 R 50 50 1 1 I 38 | X ~ 6 300 0 150 L 50 50 1 1 O 39 | X ~ 10 -300 50 150 R 50 50 2 1 I 40 | X ~ 12 -300 -50 150 R 50 50 2 1 I 41 | X ~ 13 -300 -150 150 R 50 50 2 1 I 42 | X ~ 8 300 0 150 L 50 50 2 1 O 43 | X ~ 9 -300 150 150 R 50 50 2 1 I 44 | X ~ 1 -300 150 150 R 50 50 1 2 I I 45 | X ~ 2 -300 50 190 R 50 50 1 2 I I 46 | X ~ 4 -300 -50 190 R 50 50 1 2 I I 47 | X ~ 5 -300 -150 150 R 50 50 1 2 I I 48 | X ~ 6 300 0 150 L 50 50 1 2 O I 49 | X ~ 10 -300 50 190 R 50 50 2 2 I I 50 | X ~ 12 -300 -50 190 R 50 50 2 2 I I 51 | X ~ 13 -300 -150 150 R 50 50 2 2 I I 52 | X ~ 8 300 0 150 L 50 50 2 2 O I 53 | X ~ 9 -300 150 150 R 50 50 2 2 I I 54 | ENDDRAW 55 | ENDDEF 56 | # 57 | # 74HC4002 58 | # 59 | DEF 74HC4002 U 0 40 Y Y 3 L N 60 | F0 "U" 100 50 50 H V C CNN 61 | F1 "74HC4002" 200 -100 50 H V C CNN 62 | F2 "" -100 0 50 H I C CNN 63 | F3 "" -100 0 50 H I C CNN 64 | $FPLIST 65 | DIP?12* 66 | $ENDFPLIST 67 | DRAW 68 | A -310 0 258 354 -354 1 1 10 N -100 150 -100 -150 69 | A 3 -52 204 150 837 1 1 10 f 200 0 26 150 70 | A 3 52 204 -150 -837 1 1 10 f 200 0 26 -150 71 | A -310 0 258 354 -354 2 1 10 N -100 150 -100 -150 72 | A 3 -52 204 150 837 2 1 10 f 200 0 26 150 73 | A 3 52 204 -150 -837 2 1 10 f 200 0 26 -150 74 | A -445 0 343 306 -306 1 2 10 N -150 175 -150 -175 75 | A -81 -56 238 137 768 1 2 10 f 150 0 -24 175 76 | A -81 56 238 -137 -768 1 2 10 f 150 0 -24 -175 77 | A -445 0 343 306 -306 2 2 10 N -150 175 -150 -175 78 | A -81 -56 238 137 768 2 2 10 f 150 0 -24 175 79 | A -81 56 238 -137 -768 2 2 10 f 150 0 -24 -175 80 | C 225 0 25 1 1 0 N 81 | C 225 0 25 2 1 0 N 82 | S -200 300 200 -300 3 1 10 f 83 | P 2 1 1 10 -100 -150 25 -150 f 84 | P 2 1 1 10 -100 150 25 150 f 85 | P 12 1 1 -1000 25 150 -100 150 -100 150 -90 134 -69 89 -56 41 -53 -10 -59 -59 -75 -107 -100 -150 -100 -150 25 -150 f 86 | P 2 2 1 10 -100 -150 25 -150 f 87 | P 2 2 1 10 -100 150 25 150 f 88 | P 12 2 1 -1000 25 150 -100 150 -100 150 -90 134 -69 89 -56 41 -53 -10 -59 -59 -75 -107 -100 -150 -100 -150 25 -150 f 89 | P 2 1 2 10 -150 -175 -25 -175 f 90 | P 2 1 2 10 -150 175 -25 175 f 91 | P 13 1 2 -1000 -25 175 -150 175 -150 175 -143 161 -122 115 -109 66 -103 17 -104 -34 -113 -83 -128 -131 -150 -175 -150 -175 -25 -175 f 92 | P 2 2 2 10 -150 -175 -25 -175 f 93 | P 2 2 2 10 -150 175 -25 175 f 94 | P 13 2 2 -1000 -25 175 -150 175 -150 175 -143 161 -122 115 -109 66 -103 17 -104 -34 -113 -83 -128 -131 -150 -175 -150 -175 -25 -175 f 95 | X VCC 14 0 500 200 D 50 50 3 0 W 96 | X GND 7 0 -500 200 U 50 50 3 0 W 97 | X ~ 1 400 0 150 L 50 50 1 1 O 98 | X ~ 2 -250 150 150 R 50 50 1 1 I 99 | X ~ 3 -250 50 193 R 50 50 1 1 I 100 | X ~ 4 -250 -50 193 R 50 50 1 1 I 101 | X ~ 5 -250 -150 150 R 50 50 1 1 I 102 | X ~ 10 -250 50 193 R 50 50 2 1 I 103 | X ~ 11 -250 -50 193 R 50 50 2 1 I 104 | X ~ 12 -250 -150 150 R 50 50 2 1 I 105 | X ~ 13 400 0 150 L 50 50 2 1 O 106 | X ~ 9 -250 150 150 R 50 50 2 1 I 107 | X ~ 1 -300 150 150 R 50 50 1 2 I I 108 | X ~ 2 -300 50 190 R 50 50 1 2 I I 109 | X ~ 4 -300 -50 190 R 50 50 1 2 I I 110 | X ~ 5 -300 -150 150 R 50 50 1 2 I I 111 | X ~ 6 300 0 150 L 50 50 1 2 O I 112 | X ~ 10 -300 50 190 R 50 50 2 2 I I 113 | X ~ 12 -300 -50 190 R 50 50 2 2 I I 114 | X ~ 13 -300 -150 150 R 50 50 2 2 I I 115 | X ~ 8 300 0 150 L 50 50 2 2 O I 116 | X ~ 9 -300 150 150 R 50 50 2 2 I I 117 | ENDDRAW 118 | ENDDEF 119 | # 120 | # Expansion_Port 121 | # 122 | DEF Expansion_Port J 0 40 Y Y 1 F N 123 | F0 "J" 250 900 50 H V C CNN 124 | F1 "Expansion_Port" 300 -850 50 H V C CNN 125 | F2 "" 0 100 50 H I C CNN 126 | F3 "" 0 100 50 H I C CNN 127 | $FPLIST 128 | Connector*:*_2x??_* 129 | $ENDFPLIST 130 | DRAW 131 | S -50 850 550 -750 0 1 12 f 132 | S 250 -750 250 -750 0 1 0 N 133 | X GND 1 -200 800 150 R 50 50 1 1 w 134 | X Bus1 10 700 400 150 L 50 50 1 1 B 135 | X Bus2 11 -200 300 150 R 50 50 1 1 B 136 | X Bus3 12 700 300 150 L 50 50 1 1 B 137 | X Bus4 13 -200 200 150 R 50 50 1 1 B 138 | X Bus5 14 700 200 150 L 50 50 1 1 B 139 | X Bus6 15 -200 100 150 R 50 50 1 1 B 140 | X Bus7 16 700 100 150 L 50 50 1 1 B 141 | X M0 17 -200 0 150 R 50 50 1 1 O 142 | X M1 18 700 0 150 L 50 50 1 1 O 143 | X M2 19 -200 -100 150 R 50 50 1 1 O 144 | X NC 2 700 800 150 L 50 50 1 1 N 145 | X M3 20 700 -100 150 L 50 50 1 1 O 146 | X M4 21 -200 -200 150 R 50 50 1 1 O 147 | X M5 22 700 -200 150 L 50 50 1 1 O 148 | X M6 23 -200 -300 150 R 50 50 1 1 O 149 | X M7 24 700 -300 150 L 50 50 1 1 O 150 | X M8 25 -200 -400 150 R 50 50 1 1 O 151 | X M9 26 700 -400 150 L 50 50 1 1 O 152 | X M10 27 -200 -500 150 R 50 50 1 1 O 153 | X M11 28 700 -500 150 L 50 50 1 1 O 154 | X M12 29 -200 -600 150 R 50 50 1 1 O 155 | X VCC 3 -200 700 150 R 50 50 1 1 w 156 | X M13 30 700 -600 150 L 50 50 1 1 O 157 | X M14 31 -200 -700 150 R 50 50 1 1 O 158 | X M15 32 700 -700 150 L 50 50 1 1 O 159 | X ~RESET 4 700 700 150 L 50 50 1 1 B 160 | X CLOCK 5 -200 600 150 R 50 50 1 1 O 161 | X RI 6 700 600 150 L 50 50 1 1 O 162 | X ~RO 7 -200 500 150 R 50 50 1 1 O 163 | X ~INH 8 700 500 150 L 50 50 1 1 I 164 | X Bus0 9 -200 400 150 R 50 50 1 1 B 165 | ENDDRAW 166 | ENDDEF 167 | # 168 | # SST39SF040 169 | # 170 | DEF SST39SF040 U 0 20 Y Y 1 F N 171 | F0 "U" 0 -250 50 H V C CNN 172 | F1 "SST39SF040" 50 50 50 H V C CNN 173 | F2 "" 0 300 50 H I C CNN 174 | F3 "" 0 300 50 H I C CNN 175 | DRAW 176 | S -400 1250 400 -1150 0 1 10 f 177 | X GND 16 0 -1200 50 U 50 50 0 0 W 178 | X VCC 32 0 1300 50 D 50 50 0 0 W 179 | X A18 1 -600 -600 200 R 50 50 1 1 I 180 | X A2 10 -600 1000 200 R 50 50 1 1 I 181 | X A1 11 -600 1100 200 R 50 50 1 1 I 182 | X A0 12 -600 1200 200 R 50 50 1 1 I 183 | X D0 13 600 1200 200 L 50 50 1 1 T 184 | X D1 14 600 1100 200 L 50 50 1 1 T 185 | X D2 15 600 1000 200 L 50 50 1 1 T 186 | X D3 17 600 900 200 L 50 50 1 1 T 187 | X D4 18 600 800 200 L 50 50 1 1 T 188 | X D5 19 600 700 200 L 50 50 1 1 T 189 | X A16 2 -600 -400 200 R 50 50 1 1 I 190 | X D6 20 600 600 200 L 50 50 1 1 T 191 | X D7 21 600 500 200 L 50 50 1 1 T 192 | X ~CE 22 -600 -1000 200 R 50 50 1 1 I 193 | X A10 23 -600 200 200 R 50 50 1 1 I 194 | X ~OE 24 -600 -1100 200 R 50 50 1 1 I 195 | X A11 25 -600 100 200 R 50 50 1 1 I 196 | X A9 26 -600 300 200 R 50 50 1 1 I 197 | X A8 27 -600 400 200 R 50 50 1 1 I 198 | X A13 28 -600 -100 200 R 50 50 1 1 I 199 | X A14 29 -600 -200 200 R 50 50 1 1 I 200 | X A15 3 -600 -300 200 R 50 50 1 1 I 201 | X A17 30 -600 -500 200 R 50 50 1 1 I 202 | X ~WE 31 -600 -800 200 R 50 50 1 1 I 203 | X A12 4 -600 0 200 R 50 50 1 1 I 204 | X A7 5 -600 500 200 R 50 50 1 1 I 205 | X A6 6 -600 600 200 R 50 50 1 1 I 206 | X A5 7 -600 700 200 R 50 50 1 1 I 207 | X A4 8 -600 800 200 R 50 50 1 1 I 208 | X A3 9 -600 900 200 R 50 50 1 1 I 209 | ENDDRAW 210 | ENDDEF 211 | # 212 | #End Library 213 | -------------------------------------------------------------------------------- /Support/Assembler/Python/asm.py: -------------------------------------------------------------------------------- 1 | # Python Assembler for the 'MINIMAL 64 HOME COMPUTER' written by Carsten Herting (slu4) 2023 2 | 3 | # This assembler reads an assembly language source file, translates the instructions into machine code, 4 | # and emits the code in Intel Hex format. The program is structured into two main passes: Pass 1: Parse 5 | # the source code and store label definitions and their program counter (PC) values. Pass 2: Emit the 6 | # machine code based on the parsed instructions and label values. Here's an overview of the key components 7 | # and how they work together: 8 | # 1) File handling: The program reads the input assembly file specified as a command-line argument, 9 | # appends a null character ('\0') to mark the end of the file, and stores the content in a string 10 | # called src. 11 | # 2) findelem() function: This function iterates over the source code, counting lines and skipping 12 | # whitespaces and comments. It returns the length of the current element in the source code. It is 13 | # used in both Pass 1 and Pass 2. 14 | # 3) Pass 1: The program iterates through the source code using findelem() to identify label definitions, 15 | # mnemonics, preprocessor commands, and expressions. It stores the label definitions and their corresponding 16 | # PC values in a dictionary called labels. It also increments the PC based on the type of element encountered. 17 | # 4) Pass 2: The program resets the PC and iterates through the source code again, emitting machine code 18 | # based on the parsed instructions and label values. During this pass, it handles preprocessor commands 19 | # (e.g., #org, #mute, and #emit), label definitions, mnemonics, strings, operators, and expressions. The 20 | # generated machine code is stored in an IntelHex object called 'ih'. 21 | # 5) Output: The program writes the output to the console in Intel Hex format. 22 | 23 | mne = "NOP BNK BFF WIN INP INK OUT NOT NEG INC DEC CLC SEC LSL LL2 LL3 LL4 LL5 LL6 LL7 LSR ROL RL2 RL3 RL4 RL5 RL6 RL7 ROR LDI ADI SBI ACI SCI CPI ANI ORI XRI JPA LDA STA ADA SBA ACA SCA CPA ANA ORA XRA JPR LDR STR ADR SBR ACR SCR CPR ANR ORR CLB NOB NEB INB DEB ADB SBB ACB SCB ANB ORB LLB LRB RLB RRB CLW NOW NEW INW DEW ADW SBW ACW SCW LLW RLW JPS RTS PHS PLS LDS STS BNE BEQ BCC BCS BPL BMI BGT BLE TAX TXA TXY LXI LXA LTX INX DEX ADX SBX CPX ANX ORX XRX TAY TYA TYX LYI LYA LTA INY DEY ADY SBY CPY ANY ORY XRY HLT".split() 24 | 25 | import sys, re; from intelhex import IntelHex; ih = IntelHex(); src = ""; ep = 0; pc = 0; line = 1; labels={} 26 | try: file = open(sys.argv[1]); src = file.read() + "\0"; file.close() 27 | except (FileNotFoundError, IndexError): exit("USAGE: asm.py ") 28 | 29 | def findelem(): # SKIP WHITESPACES AND COMMENTS, COUNT LINES AND RETURN ELEMENT LENGTH 30 | global ep, line, src 31 | while ep < len(src): 32 | if src[ep] == '\n': ep += 1; line += 1 33 | elif m := re.match(r"[ ,\r\t]+|;[^\n\0]*", src[ep:]): ep += m.end() # skip whitespaces & comments 34 | else: m = re.match(r"'[^'\n\0]*'|[^ ,;\t\n\r\0]*", src[ep:]); return m.end() if m else None # length 35 | 36 | while size := findelem(): # PASS 1: STORE LABEL DEFINITIONS AND THEIR PC 37 | if src[ep:ep+size].endswith(':'): # elements ending with ':' are definitions 38 | definition = src[ep:ep+size-1] # extract the identifier 39 | if definition in labels: exit("Error in line " + str(line) + ": \'" + definition + "\' already exists.") 40 | else: labels[definition] = pc # add unique labels to the dictionary 41 | elif size == 3 and src[ep:ep+size] in mne: pc += 1 # check for mnemonics 42 | elif src[ep] == '#': # check for pre-processor commands 43 | if src[ep:].find("#org") == 0: # parse pre-processor stuff, only use #org here 44 | ep += size; size = findelem() # parse for the proceeding element which must be a hex address 45 | if re.fullmatch(r"0x[0-9a-f]+", src[ep:ep+size]): pc = int(src[ep:ep+size], 16) # set PC 46 | else: exit("Error in line " + str(line) + ": Expecting a hex address.") 47 | elif src[ep] == '\'': pc += size-2 # check for 'string' (errors due to missing closing ' are cought elsewhere) 48 | elif src[ep] == '<' or src[ep] == '>': pc += 1 # check for LSB/MSB operator 49 | else: # it must be an expression 50 | if src[ep] == '+' or src[ep] == '-': size -= 1; ep += 1 # consume optional leading + or - 51 | if re.fullmatch(r"0x[0-9a-f]{3}", src[ep:ep+5]): pc += 2 # check for HEX 0xabc... 52 | elif src[ep].isdigit(): pc += 1 # check for HEX 0x.. or DEC byte 53 | else: pc += 2 # all other stuff must be a label or * operator 54 | ep += size # move over this element 55 | 56 | ep = 0; pc = 0; line = 1; isemit = True # PASS 2: CODE EMISSION 57 | while size:= findelem(): # translate all elements 58 | if src[ep:].find("#mute") == 0: isemit = False # pre-processor commands 59 | elif src[ep:].find("#emit") == 0: isemit = True 60 | elif src[ep:].find("#org") == 0: # will influence the memory position of code emission 61 | ep += size; size = findelem() # only accept #org and change PC when emitting 62 | if isemit and re.fullmatch(r"0x[0-9a-f]+", src[ep:ep+size]): pc = int(src[ep:ep+size], 16) 63 | elif isemit: # is code emission on? 64 | if src[ep:ep+size].endswith(':'): pass # don't output anything 65 | elif src[ep] == '\'': # string content 66 | for c in src[ep+1:ep+size-1]: ih[pc] = ord(c); pc += 1 67 | elif size == 3 and src[ep:ep+size] in mne: ih[pc] = mne.index(src[ep:ep+size]); pc += 1 # mnemonic 68 | else: # EXPRESSION PARSING 69 | x = ep; type = ""; term = 0; expr = 0; sign = 1; signs = {'+': 1, '-': -1} 70 | if src[x] == '<' or src[x] == '>': type = src[x]; x += 1 # take LSB and MSB operators 71 | while x < ep+size: # look for terms 'label+0xffff-50+*': THE FIRST ELEMENT DETERMINS THE SIZE 72 | if src[x] in signs: sign = signs[src[x]]; x += 1; term = 0 # take a leading sign & reset term 73 | if src[x] == '*': term = pc; x += 1; type = 'w' if type == "" else type # use current PC as a term 74 | elif hex := re.match(r"0x[0-9a-f]+", src[x:]): # hex value 75 | term = int(hex.group(), 16); x += hex.end(); type = 'w' if type == "" and hex.end() > 4 else type 76 | elif num := re.match(r"[0-9]+", src[x:]): term = int(num.group()); x += num.end() # dec (byte!) value 77 | elif (ref := re.match(r"[_a-zA-Z][_a-zA-Z0-9]*", src[x:])) and ref.group() in labels: # label reference 78 | term = labels[ref.group()]; x += ref.end(); type = 'w' if type == "" else type 79 | else: exit("Error in line " + str(line) + ": Unknown expression \'" + src[x:ep+size] + "\'") # catches anything else 80 | expr += sign * term # add/subtract this term to the expression 81 | if type == 'w': ih[pc] = expr & 0xff; ih[pc+1] = (expr & 0xff00)>>8; pc += 2 # emit expression word 82 | elif type == '>': ih[pc] = (expr & 0xff00)>>8; pc += 1 # emit MSB only 83 | else: ih[pc] = expr & 0x00ff; pc += 1 # emit LSB (standard) 84 | ep += size # consume current element after having it processed 85 | ih.write_hex_file(sys.stdout) # output the hexfile to the console 86 | 87 | # Language Definition (EBNF) by Carsten Herting (slu4) 2023 88 | 89 | # char = ? any character ? 90 | # letter = 'a' | ... | 'z' | 'A' | ... | 'Z' 91 | # digit = '0' | ... | '9' 92 | # hexdigit = digit | 'a' | ... | 'f' (* only lower-case allowed *) 93 | # hexnum = '0x', hexdigit, {hexdigit} 94 | # dec_lsb = digit, {digit} (* only the lsb part of dec numbers will be used *) 95 | # label = ('_' | letter), {'_' | letter | digit} 96 | # gap = ' ' | ',' | '\t' | '\r' | '\n' 97 | # add-op = '+' | '-' 98 | # lsbmsb-op = '<' | '>' 99 | # mnemonic = 'NOP' | ... | 'HLT' 100 | # pre-proc = '#emit' | '#mute' | ( '#org', gap, {gap}, hexnum ) 101 | # comment = ';', { char - ( '\n' | '\0' ) } 102 | # definition = label, ':' 103 | # string = "'", { char - ( '\n' | '\0' | "'" ) }, "'" 104 | # program = {gap}, [ element, { gap, {gap}, element } ], {gap}, '\0' 105 | # element = pre-proc | comment | string | mnemonic | definition | expression 106 | # expression = [ lsbmsb-op ], [ add-op ], term, { add-op, term } (* 1st term determines size *) 107 | # term = hexnum | dec_lsb | label | '*' 108 | 109 | # LICENSING INFORMATION 110 | # This file is free software: you can redistribute it and/or modify it under the terms of the 111 | # GNU General Public License as published by the Free Software Foundation, either 112 | # version 3 of the License, or (at your option) any later version. 113 | # This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 114 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 115 | # License for more details. You should have received a copy of the GNU General Public License along 116 | # with this program. If not, see https://www.gnu.org/licenses/. 117 | -------------------------------------------------------------------------------- /Programs/asm/balls.asm: -------------------------------------------------------------------------------- 1 | ; -------------------------------------------------------------------------- 2 | ; VGA demo moving any number between 1..255 of 16 x 16 bouncing ball sprites 3 | ; by C. Herting (slu4) 2022 4 | ; -------------------------------------------------------------------------- 5 | #org 0x8000 6 | 7 | start: LDI 0xfe STA 0xffff 8 | JPS _Clear 9 | 10 | JPS _ReadSpace JPS _ReadHex ; skip spaces and parse first address 11 | LDA _ReadNum+2 CPI 0xf0 BEQ randomize ; wurde eine Zahl eingelesen? 12 | LDA _ReadNum+0 STA number ; use this many bubbles 13 | 14 | ; generate random balls 15 | randomize: LDI table STA ptr+1 16 | LYA number 17 | randloop: LDI 0 STR ptr INW ptr ; xpos 18 | JPS _Random ANI 1 STR ptr 19 | redox: JPS _Random CPI 192 BCS redox 20 | LSL ORR ptr STR ptr 21 | LDI 0 ROL PHS INW ptr 22 | PLS STR ptr INW ptr 23 | LDI 0 STR ptr INW ptr ; ypos 24 | redoy: JPS _Random CPI 224 BCS redoy 25 | STR ptr INW ptr 26 | LDI 0 STR ptr INW ptr ; clear xold/yold 27 | LDI 0 STR ptr INW ptr 28 | LDI 0 STR ptr INW ptr 29 | JPS _Random STR ptr INW ptr ; vx/vy 30 | JPS _Random STR ptr INW ptr 31 | DEY BGT randloop 32 | 33 | mainloop: ; draw all balls that have changed pixel position 34 | LDI table+1 STA xposlptr+1 35 | LDI table+2 STA xposmptr+1 36 | LDI table+4 STA yposptr+1 37 | LDI table+5 STA xoldlptr+1 38 | LDI table+6 STA xoldmptr+1 39 | LDI table+7 STA yoldptr+1 40 | LYA number 41 | drawloop: LDR xoldlptr CPR xposlptr BNE drawit 42 | LDR yoldptr CPR yposptr BEQ drawdone 43 | drawit: CLB mask 44 | LDR xoldlptr PHS LDR xoldmptr PHS LDR yoldptr PHS 45 | JPS DrawSprite PLS PLS PLS 46 | INB mask 47 | LDR xposlptr STR xoldlptr PHS 48 | LDR xposmptr STR xoldmptr PHS 49 | LDR yposptr STR yoldptr PHS 50 | JPS DrawSprite PLS PLS PLS 51 | drawdone: LDI 10 ADW xposlptr LDI 10 ADW xposmptr 52 | LDI 10 ADW xoldlptr LDI 10 ADW xoldmptr 53 | LDI 10 ADW yposptr LDI 10 ADW yoldptr 54 | DEY BGT drawloop 55 | 56 | ; move all the balls 57 | LDI table+0 STA xpos0ptr+1 58 | LDI table+1 STA xposlptr+1 59 | LDI table+2 STA xposmptr+1 60 | LDI table+3 STA ypos0ptr+1 61 | LDI table+4 STA yposptr+1 62 | LDI table+5 STA xoldlptr+1 63 | LDI table+6 STA xoldmptr+1 64 | LDI table+7 STA yoldptr+1 65 | LDI table+8 STA vxptr+1 66 | LDI table+9 STA vyptr+1 67 | LYA number 68 | moveloop: LDR vxptr CPI 0 BMI vxneg 69 | ADR xpos0ptr STR xpos0ptr 70 | LDI 0 ACR xposlptr STR xposlptr 71 | LDI 0 ACR xposmptr STR xposmptr BEQ movey 72 | LDR xposlptr CPI 128 BCC movey 73 | LDI 127 STR xposlptr 74 | LDR vxptr NEG STR vxptr JPA movey 75 | vxneg: ADR xpos0ptr STR xpos0ptr 76 | LDR xposlptr SCI 0 STR xposlptr 77 | LDR xposmptr SCI 0 STR xposmptr BCS movey 78 | LDI 0 STR xposlptr STR xposmptr 79 | LDR vxptr NEG STR vxptr 80 | movey: LDR vyptr CPI 0 BMI vyneg 81 | ADR ypos0ptr STR ypos0ptr 82 | LDI 0 ACR yposptr STR yposptr 83 | CPI 224 BCC movedone 84 | LDI 223 STR yposptr 85 | LDR vyptr NEG STR vyptr 86 | JPA movedone 87 | vyneg: ADR ypos0ptr STR ypos0ptr 88 | LDR yposptr SCI 0 STR yposptr BCS movedone 89 | LDI 0 STR yposptr 90 | LDR vyptr NEG STR vyptr 91 | movedone: LDI 10 ADW xpos0ptr LDI 10 ADW xposlptr LDI 10 ADW xposmptr 92 | LDI 10 ADW ypos0ptr LDI 10 ADW yposptr 93 | LDI 10 ADW xoldlptr LDI 10 ADW xoldmptr LDI 10 ADW yoldptr 94 | LDI 10 ADW vxptr LDI 10 ADW vyptr 95 | DEY BGT moveloop 96 | JPA mainloop 97 | 98 | ; ------------------------------------------------ 99 | ; Draws a 16x16 pixel sprite at the given position 100 | ; push: x_lsb, x_msb, y 101 | ; pull: #, #, # 102 | ; modifies: X 103 | ; ------------------------------------------------ 104 | DrawSprite: LDS 3 LL6 STA addr+0 ; use ypos 105 | LDS 3 RL7 ANI 63 ADI 0xc3 STA addr+1 106 | LDS 4 DEC LDS 5 ; add xpos 107 | RL6 ANI 63 ADI 12 ORB addr+0 ; preprare target address 108 | LDS 5 ANI 7 STA shift ; calc bit pos 109 | LDI data STA dptr+1 ; data is hard-coded 110 | lineloop: LDR dptr STA buffer+0 INW dptr 111 | LDR dptr STA buffer+1 CLB buffer+2 112 | LXA shift DEX BCC shiftdone ; shift that buffer to pixel position 113 | shiftloop: LLW buffer+0 RLB buffer+2 DEX BCS shiftloop 114 | shiftdone: NEB mask BEQ clearit 115 | LDA buffer+0 ORR addr STR addr INW addr ; store line buffer to VRAM addr 116 | LDA buffer+1 ORR addr STR addr INW addr 117 | LDA buffer+2 ORR addr STR addr 118 | JPA common 119 | clearit: LDA buffer+0 NOT ANR addr STR addr INW addr ; store line buffer to VRAM addr 120 | LDA buffer+1 NOT ANR addr STR addr INW addr 121 | LDA buffer+2 NOT ANR addr STR addr 122 | common: LDI 62 ADW addr ; ... and move to the next line 123 | INW dptr LDA dptr+0 CPI ] starts execution at hex address . 17 | 18 | 'dir' displays the file directory of the SSD. 19 | 20 | 'del ' deletes a file on the SSD. 21 | 22 | 'show ' displays a text file page by page. 23 | 24 | 'format' formats SSD user area (banks 3..127). 25 | 26 | 'defrag' frees up unused SSD storage fragments. 27 | 28 | 'memset ' fills RAM .. with .% 29 | 1. OS COMMANDS (2/2) 30 | 31 | 'mon []' starts a memory monitor [at ]. 32 | ESC exits the monitor to the OS prompt. 33 | changes the monitor address to . 34 | []. displays an address range. 35 | :[ ] deposits at current address++. 36 | # activates SSD bank , 0x80 for RAM 37 | , , can be a HEX value '0' to 'ffff'. 38 | 39 | 'memmove ' moves memory area .. 40 | to . Source and destination may overlap. 41 | 42 | 'receive' receives an 'Intel HEX File' you paste 43 | via UART terminal and writes the data into RAM. 44 | 45 | 'save ' saves memory area .. 46 | under the filename onto the SSD. 47 | 48 | 'flash' updates the OS 'in-situ'. The user's SSD 49 | area remains unchanged. Full update procedure: 50 | 51 | o Assemble the OS with 'asm os.asm' on your PC. 52 | This will output a 'HEX file' to the console. 53 | o On the Minimal, type 'memset 0 2fff ff ENTER' 54 | to clear the RAM. 55 | o Type 'receive ENTER' and paste the HEX file 56 | image to the Minimal's RAM as serial input. 57 | o On the Minimal, type 'flash ENTER' and reset.% 58 | 2. MEMORY MAP 59 | 60 | 0x0000..0x0fff 4KB of selected FLASH bank or RAM: 61 | 62 | bank 0: OS kernel & API image 63 | bank 1: OS data (charset, tables) 64 | bank 2: protected core OS commands 65 | bank 3..127: user SSD area 66 | bank >= 128: RAM (FLASH disabled), 67 | 68 | 0x1000..0xafff 40KB free RAM 69 | 70 | 0xb000..0xbcff 3KB OS kernel & API 71 | 0xbcb0..0xbccd 30 bytes of OS variables 72 | 0xbcce..0xbcff 50 bytes of OS line input buffer 73 | 0xbd00..0xbeff 512 bytes of OS 'command memory' 74 | 75 | 0xbf00..0xbfff reserved for expansions cards 76 | 77 | 0xc000..0xfeff 16KB video RAM (252 x 64 bytes) 78 | 0xc30c start of 400 x 240 pixels viewport 79 | 80 | 0xff00 CPU X register 81 | 0xff01 CPU Y register 82 | 0xff02..0xfffe CPU stack memory 83 | 0xffff CPU stack pointer LSB% 84 | 3. TEXT EDITOR 'edit []' 85 | 86 | The text editor resides in RAM 0x0000..0x0fff. 87 | Text data is stored from address 0x1000 onwards. 88 | Once loaded, the editor can be restarted by 89 | typing 'run', preserving your text document. 90 | 91 | CTRL q or ESC quits the editor. 92 | CTRL n Starts a new document. 93 | 94 | CTRL l Dialog line to input a filename to load. 95 | CTRL s Dialog line to save the text as a file. 96 | 97 | CTRL a Marks the start of a text block. 98 | CTRL x Marks the end of a text blocks and cuts 99 | out the marked text block to clipboard. 100 | CTRL c Marks the end of a text block and copies 101 | the marked text block to clipboard. 102 | CTRL v Inserts a text block from clipboard at 103 | the current cursor position. 104 | 105 | CTRL r Receives text via UART and inserts it at 106 | the current position. Press ESC to end. 107 | CTRL t Transmits the current text file via UART.% 108 | 4. HIGH-LEVEL LANGUAGE 'min' 109 | 110 | MIN is a fast high-level Python-like interpreted 111 | programming language. 'min ' executes your 112 | program from SSD. 'min' directly starts a program 113 | at 0x1000. 114 | MIN occupies the RAM area 0x8000..0x9fff and uses 115 | 0xa000..0xafff for runtime data storage. 116 | 117 | The following list of features and commands will 118 | get you started (for more information see the 119 | exact language definition in EBNF): 120 | 121 | o Python-style code block indentation (2 SPACES) 122 | o control structure 'if-elif-else', 'while-break' 123 | o variables with C-style static explicit typing 124 | o data types 'char' (8-bit) and 'int' (16-bit) 125 | o local and global variables, @ address operator 126 | o 'def-return', C-style '&' variable references 127 | o 'call(..)' for assembly/API routine integration 128 | o full expression handling including '+=', '-=' 129 | o bitwise/logical operators 'and/or/xor/not' 130 | o [..|..] element access and '_' concatenation 131 | o decimal and HEX '0xffff' numbers, ".." strings 132 | o print(..) for text and decimal number output 133 | o 'use ""' for recursive file import 134 | o 'std.min' library implements: pos, rnd, clear, 135 | line, rect, dot, str, len, strcmp, key, etc.% 136 | 5. ASSEMBLER 'asm' (1/2) 137 | 138 | ASM is MINIMAL's native assembler. To assemble 139 | a sourcefile from SSD, type 'asm '. 140 | In case the source text already resides in RAM 141 | you can simply assemble with 'asm'. ASM uses the 142 | RAM area 0x9000..0x9fff. Range 0xa000..0xafff 143 | holds label definitions during assembly. 144 | 145 | Note: While assembling a program, ASM uses two 146 | pointers: a memory counter (MC) and a program 147 | counter (PC). Data is always emitted to MC. 148 | Labels are defined with respect to the PC. 149 | Default for MC and PC is address 0x8000. 150 | 151 | #emit starts data emission to MC 152 | #mute mutes data emission to MC, but 153 | keeps updating PC while assembling 154 | * alias for current MC address value 155 | #org sets PC, sets MC only when emitting 156 | 157 | o Write mnemonics in capital letters (e.g., LDI). 158 | o Write HEX numbers in lower case (e.g., 0xff). 159 | o Separate elements with a space and/or comma.% 160 | 5. ASSEMBLER 'asm' (2/2) 161 | 162 | label: defines a label as the current PC 163 | ; comment makes the rest of the line a comment 164 |