├── .gitattributes ├── .gitignore ├── Bin ├── 65asm.hexe ├── 65dasm.hexe ├── 65gen.hexe ├── 65opt.hexe ├── 65tests.cmd ├── 65testsx.cmd ├── CODEGEN.hexe ├── Compile.hexe ├── DASM.hexe ├── HopperNET.exe ├── Options │ ├── Configuration.options │ ├── GPIO.options │ ├── RainbowNeo.options │ ├── TestGPIO.options │ ├── VGMtoHopper.options │ ├── blinknoram.options │ └── mrvt.options ├── PreProcess.hexe ├── Z80DASM.hexe ├── Z80Gen.hexe ├── Z80Opt.hexe ├── asm.cmd ├── baud.hexe ├── cd.hexe ├── cls.hexe ├── compile2.hexe ├── copy.hexe ├── dbg.cmd ├── debug.hexe ├── del.hexe ├── dir.hexe ├── e6502.hexe ├── eZ80.hexe ├── ed.cmd ├── edit.hexe ├── help.hexe ├── hm.hexe ├── mkdir.hexe ├── optimize.hexe ├── port.hexe ├── r.cmd ├── rmdir.hexe ├── rsod.hexe ├── sdfs.hexe ├── shell.hexe ├── show.hexe ├── sys.cmd ├── tc.cmd ├── tcc.hexe ├── tcpp.hexe ├── term.hexe └── tools.cmd ├── Docs ├── Chat GPTs wishlist for Hopper improvements.hs ├── Claude │ ├── Hopper Microcontroller Library Reference.md │ ├── Hopper Programming Language Overview.md │ └── Hopper System Library Reference.md ├── Hopper 6502 Assembly Runtime Library.md ├── Hopper 6502 Assembly Syntax and Format.md ├── Hopper Language.md ├── Hopper Language.pdf ├── Hopper MCU library by Claude.md ├── Hopper Minimal Runtime Reference.md ├── Hopper Programming Language Overview for GPT.md ├── Hopper VM.md ├── Hopper notes for Chat GPT.md ├── System Library Reference.md └── Unbrick Pins.txt ├── LICENSE ├── README.md ├── Runtimes ├── 6502 │ └── Assembly │ │ ├── Firmware │ │ ├── constants.asm │ │ ├── firmware.asm │ │ ├── keyboardconstants.asm │ │ ├── keyboarddriver.asm │ │ ├── lcdconstants.asm │ │ ├── lcddriver.asm │ │ ├── serialdriver.asm │ │ └── timerdriver.asm │ │ ├── Hopper │ │ ├── Allocate.asm │ │ ├── Array.asm │ │ ├── Char.asm │ │ ├── Defines.asm │ │ ├── Diagnostics.asm │ │ ├── Dictionary.asm │ │ ├── Free.asm │ │ ├── GC.asm │ │ ├── HeapWalk.asm │ │ ├── Hopper.asm │ │ ├── IncDec.asm │ │ ├── Int.asm │ │ ├── List.asm │ │ ├── ListUtilities.asm │ │ ├── Long.asm │ │ ├── Memory.asm │ │ ├── OpCodes.asm │ │ ├── Pair.asm │ │ ├── Pop.asm │ │ ├── Push.asm │ │ ├── Shared.asm │ │ ├── Stacks.asm │ │ ├── String.asm │ │ ├── StringUtilities.asm │ │ ├── SysCalls.asm │ │ ├── UInt.asm │ │ └── Variant.asm │ │ ├── VASM │ │ ├── cygwin1.dll │ │ ├── vasm6502_oldstyle.exe │ │ └── vobjdump.exe │ │ └── build.cmd ├── Arduino │ ├── 8bitforce │ │ ├── k6502_Hopper │ │ │ ├── k6502_Hopper.ino │ │ │ ├── pins2_arduino.h │ │ │ └── romImage.h │ │ ├── k6502_minimal │ │ │ ├── k6502_minimal.ino │ │ │ └── pins2_arduino.h │ │ ├── t6502_Hopper │ │ │ ├── memorymap.h │ │ │ ├── portmap.h │ │ │ ├── romImage.h │ │ │ ├── setuphold.h │ │ │ └── t6502_Hopper.ino │ │ └── tz80_Hopper │ │ │ ├── memorymap.h │ │ │ ├── portmap.h │ │ │ ├── romImage.h │ │ │ ├── setuphold.h │ │ │ └── tz80_Hopper.ino │ ├── HopperPortable │ │ ├── HopperConfiguration.h │ │ ├── HopperFile.cpp │ │ ├── HopperFile.h │ │ ├── HopperPortable.ino │ │ ├── HopperServer.cpp │ │ ├── HopperTimer.cpp │ │ ├── HopperTimer.h │ │ ├── HopperWifi.cpp │ │ ├── HopperWifi.h │ │ ├── Platform.cpp │ │ ├── Platform.h │ │ ├── README.md │ │ ├── Runtime.cpp │ │ └── Runtime.h │ └── Teensy │ │ └── Probe │ │ ├── Probe.ino │ │ └── portmap.h ├── RP2040 │ ├── BuildInstructions.txt │ ├── CMakeLists.txt │ ├── Common.h │ ├── Hopper.cpp │ ├── HopperArray.cpp │ ├── HopperArray.h │ ├── HopperDictionary.cpp │ ├── HopperDictionary.h │ ├── HopperList.cpp │ ├── HopperList.h │ ├── HopperMemory.cpp │ ├── HopperMemory.h │ ├── HopperPair.cpp │ ├── HopperPair.h │ ├── HopperString.cpp │ ├── HopperString.h │ ├── HopperVariant.cpp │ ├── HopperVariant.h │ ├── LibCalls.cpp │ ├── OpCodes.cpp │ ├── OpCodes.h │ ├── SysCalls.cpp │ ├── assembly source.png │ └── pico_sdk_import.cmake ├── Universal │ ├── Hopper.zip │ ├── Hopper │ │ ├── Hopper.csproj │ │ ├── Hopper.sln │ │ ├── Program.cs │ │ └── Properties │ │ │ └── PublishProfiles │ │ │ └── FolderProfile.pubxml │ └── Readme.md └── Windows │ ├── HopperNET │ ├── .vs │ │ └── HopperNET │ │ │ └── v17 │ │ │ └── Solution.VC.db │ ├── App.config │ ├── Console.cs │ ├── Diagnostics.cs │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── HopperFile.cs │ ├── HopperNET.csproj │ ├── HopperNET.sln │ ├── HopperSystem.cs │ ├── HopperTime.cs │ ├── IHopper.cs │ ├── Keyboard.cs │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── Runtime.cs │ ├── Screen.cs │ ├── Serial.cs │ ├── Settings.Designer.cs │ ├── Settings.settings │ └── Variant.cs │ └── Restart │ ├── App.config │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Restart.csproj │ └── Restart.sln └── Source ├── 6502 ├── Firmware │ ├── Hardware.hs │ └── Memory.hs ├── Samples │ ├── Blink.hs │ ├── FiboUInt.hs │ ├── GIBL.hs │ ├── GIBL │ │ ├── Errors.hs │ │ ├── Expression.hs │ │ ├── HopperCode.hs │ │ ├── RAM.hs │ │ ├── Runtime.hs │ │ ├── Source.hs │ │ └── Tokenizer.hs │ ├── Mandelbrot.hs │ ├── NRL.hs │ └── Sieve.hs ├── System.hs └── Testing │ ├── Blink.hs │ └── Sieve.hs ├── Compiler ├── 65DASM.hs ├── 65asm.hs ├── 65gen.hs ├── 65opt.hs ├── CODEGEN.hs ├── CodeGen │ ├── Asm6502.hs │ ├── AsmZ80.hs │ ├── Block.hs │ ├── CodeStream.hs │ ├── Instructions.hs │ ├── Peephole.hs │ ├── SourceStream.hs │ ├── Z80Library.hs │ └── Z80LibraryGenerated.hs ├── CodeModel │ ├── AsmPoints.hs │ ├── CodePoints.hs │ ├── ModelUtilities.hs │ ├── Z80Code.hs │ └── Z80Points.hs ├── Collection.hs ├── Compile.hs ├── Constant.hs ├── DASM.hs ├── Directives.hs ├── Expression.hs ├── JSON │ ├── Code.hs │ ├── Configuration.hs │ └── JSON.hs ├── Optimize.hs ├── PreProcess.hs ├── Record.hs ├── Symbols.hs ├── Tokens │ ├── Dependencies.hs │ ├── LibCalls.hs │ ├── Parser.hs │ ├── Scanner.hs │ ├── SysCallTable.md │ ├── SysCalls.hs │ └── Token.hs ├── Translate.hs ├── TranslateExpression.hs ├── Types.hs ├── Z80DASM.hs ├── Z80Gen.hs ├── Z80Opt.hs ├── c.cmd ├── h.cmd └── p.cmd ├── Debugger ├── 6502 │ ├── Monitor.hs │ ├── Pages.hs │ └── ZeroPage.hs ├── Chips │ ├── 6502.hs │ ├── ACIA.hs │ └── Z80.hs ├── ConsoleCapture.hs ├── Debug.hs ├── DebugCommand.hs ├── DebugOptions.hs ├── Emulator │ ├── Display.hs │ ├── Emulator.hs │ └── Shared.hs ├── HM.hs ├── Output.hs ├── RSOD.hs ├── Source.hs ├── e6502.hs └── eZ80.hs ├── Editor ├── ClickStack.hs ├── Commands.hs ├── Commands │ ├── BuildCommand.hs │ ├── BuildOptions.hs │ └── ExitCommand.hs ├── Edit.hs ├── Editor.hs ├── Highlighter.hs ├── JournalEntry.hs ├── MenuBar.hs ├── MessageBox.hs ├── Panel.hs ├── PopupMenu.hs ├── StatusBar.hs └── TextBuffer.hs ├── Languages ├── Basic │ ├── Errors.hs │ ├── Expression.hs │ ├── GIBL │ │ ├── MANUAL.TXT │ │ ├── Mandelbrot.bas │ │ ├── byte.bas │ │ ├── nrl.bas │ │ ├── prime.bas │ │ └── sieve.bas │ ├── HopperCode.hs │ ├── Memory.hs │ ├── Platform.hs │ ├── Source.hs │ ├── TiggerBASIC.hs │ └── Tokenizer.hs ├── FORTH │ ├── Chores.md │ ├── hopperforth.hs │ └── readme.md ├── Python │ └── Samples │ │ ├── PicoTetris.py │ │ ├── Snake.py │ │ ├── blink.py │ │ ├── breakout.py │ │ ├── explorer.pong.py │ │ ├── fibo.py │ │ └── snakeForSSD1306.py └── TiggerC │ ├── 64K EEPROM File System.md │ ├── Library.md │ ├── ReadMe.md │ ├── Samples │ ├── ascii-art.txt │ ├── blink.tc │ ├── bytesievec.png │ ├── fibouint.tc │ ├── lcd.tc │ ├── machine.tc │ ├── mandelbrot.tc │ ├── nrl.tc │ ├── nrl32.tc │ ├── shell.tc │ ├── sieve.tc │ ├── test.tc │ └── tigger.txt │ ├── TCC.hs │ ├── TCCode.hs │ ├── TCCompile.hs │ ├── TCConstant.hs │ ├── TCExpression.hs │ ├── TCGen.hs │ ├── TCOps.asm │ ├── TCOps.hs │ ├── TCPP.hs │ ├── TCScanner.hs │ ├── TCStatement.hs │ ├── TCSymbols.hs │ ├── TCSys.asm │ ├── TCToken.hs │ ├── TCType.hs │ ├── Testing │ ├── test.tc │ ├── testconst.tc │ ├── testfile.tc │ ├── teststr.tc │ └── testsuite.tc │ ├── file.tc │ ├── i2c.tc │ ├── long.tc │ ├── string.tc │ ├── system.tc │ └── time.tc ├── Library ├── Audio │ └── SNVGMPlayer.hs ├── Boards │ ├── AdafruitFeather.hs │ ├── AdafruitFeatherAdalogger.hs │ ├── AdafruitFeatherCAN.hs │ ├── AdafruitFeatherDVI.hs │ ├── AdafruitFeatherPropMaker.hs │ ├── AdafruitFeatherRFM.hs │ ├── AdafruitFeatherRP2350Hstx.hs │ ├── AdafruitFeatherScorpio.hs │ ├── AdafruitFeatherThinkInk.hs │ ├── AdafruitFeatherUSBHost.hs │ ├── AdafruitItsyBitsy.hs │ ├── AdafruitKb2040.hs │ ├── AdafruitMacropad2040.hs │ ├── AdafruitMetro.hs │ ├── AdafruitQTPy.hs │ ├── AdafruitTrinkeyRP2040QT.hs │ ├── ArduinoNanoConnect.hs │ ├── Attribution.md │ ├── BenEater6502.hs │ ├── Challenger2040LTE.hs │ ├── Challenger2040LoRa.hs │ ├── Challenger2040NFC.hs │ ├── Challenger2040SDRTC.hs │ ├── Challenger2040SubGHz.hs │ ├── Challenger2040UWB.hs │ ├── Challenger2040WiFi.hs │ ├── Challenger2040WiFi6BLE.hs │ ├── Challenger2040WiFiBLE.hs │ ├── Challenger2350Bconnect.hs │ ├── Challenger2350WiFi6Ble5.hs │ ├── ChallengerNB2040WiFi.hs │ ├── CytronIrivIoController.hs │ ├── CytronMakerNanoRP2040.hs │ ├── CytronMakerPiRP2040.hs │ ├── CytronMakerUnoRP2040.hs │ ├── CytronMotion2350Pro.hs │ ├── DFRobotBeetleRP2040.hs │ ├── Hopper6502.hs │ ├── MECB6502.hs │ ├── PD6502.hs │ ├── PiPico.hs │ ├── PiPico2.hs │ ├── PiPico2W.hs │ ├── PiPicoW.hs │ ├── PimoroniPGA2040.hs │ ├── PimoroniPGA2350.hs │ ├── PimoroniPicoPlus2.hs │ ├── PimoroniPicoPlus2W.hs │ ├── PimoroniPlasma2040.hs │ ├── PimoroniPlasma2350.hs │ ├── PimoroniTiny2040.hs │ ├── PimoroniTiny2350.hs │ ├── SeeedIndicatorRP2040.hs │ ├── SeeedXIAORP2040.hs │ ├── SolderpartyRP2040Stamp.hs │ ├── SolderpartyRP2350Stamp.hs │ ├── SolderpartyRP2350StampXl.hs │ ├── SparkfunMicromodRP2040.hs │ ├── SparkfunProMicroRP2040.hs │ ├── SparkfunProMicrorp2350.hs │ ├── SparkfunThingPlusRP2040.hs │ ├── WaveshareRP2040LCD096.hs │ ├── WaveshareRP2040LCD128.hs │ ├── WaveshareRP2040Matrix.hs │ ├── WaveshareRP2040One.hs │ ├── WaveshareRP2040Pizero.hs │ ├── WaveshareRP2040Plus16MB.hs │ ├── WaveshareRP2040Plus4MB.hs │ └── WaveshareRP2040Zero.hs ├── Devices │ ├── Adafruit128x64OLEDFeatherwing.hs │ ├── Adafruit14Segment.hs │ ├── Adafruit160x80ColorTFT.hs │ ├── Adafruit240x135ColorTFT.hs │ ├── AdafruitAdaloggerRTCSDFeatherwing.hs │ ├── AdafruitDS3231PrecisionRTCFeatherwing.hs │ ├── AdafruitEInk213Mono.hs │ ├── AdafruitEInk213TriColor.hs │ ├── AdafruitMetro.hs │ ├── AdafruitNeoPixelFeatherWing.hs │ ├── AdafruitThinkInk290Gray.hs │ ├── AdafruitThinkInk290TriColor.hs │ ├── Badger2040.hs │ ├── Challenger2040SDRTC.hs │ ├── Generic160x128ST7735TFT.hs │ ├── Generic320x200ILI9341TFT.hs │ ├── Generic320x240TFT.hs │ ├── Generic480x320ST7796TFT.hs │ ├── GenericRTC.hs │ ├── HW111RTC.hs │ ├── SparkfunThingPlusRP2040.hs │ ├── WSPico8SEGLED.hs │ ├── WSPicoLCD096.hs │ ├── WSPicoLCD114.hs │ ├── WSPicoLCD144.hs │ ├── WSPicoRTCDS3231.hs │ ├── WSPicoePaper213.hs │ ├── WSPicoePaper290.hs │ ├── WSPicoePaper4200.hs │ ├── WSRP2040LCD096.hs │ └── hx711.hs ├── Display.hs ├── Displays │ ├── HD44780.hs │ ├── HT16K33.hs │ ├── LEDMatrixDriver.hs │ ├── MatrixDriver.hs │ ├── OLEDSSD1306.hs │ ├── SH110XDriver.hs │ ├── TFTDriver.hs │ ├── UC8151Driver.hs │ ├── UC8176Driver.hs │ ├── epdIL0373.hs │ └── epdssd1680.hs ├── File │ ├── BlockFileSystem.hs │ ├── Directory.hs │ ├── File.hs │ └── SerialEEPROM.hs ├── Fonts │ ├── Arduino6x8.hs │ ├── Hitachi5x7.hs │ ├── System5x7.hs │ └── Verdana5x8.hs ├── GPIO.hs ├── GPS.hs ├── Graphics │ └── Vectors.hs ├── MCU.hs ├── NeoPixel.hs ├── RTC.hs ├── RTCs │ ├── DS1307Driver.hs │ ├── DS3231Driver.hs │ ├── DS3232Driver.hs │ ├── MCP79410Driver.hs │ └── PCF8523Driver.hs ├── SD.hs ├── SPI.hs ├── Screen.hs ├── StorageMedia.hs ├── Timer.hs ├── UART.hs ├── Ultrasonic.hs ├── WebClient.hs ├── WebServer.hs └── Wire.hs ├── Minimal ├── Array.hs ├── Bool.hs ├── Byte.hs ├── Char.hs ├── Diagnostics.hs ├── Directory.hs ├── File.hs ├── Float.hs ├── GC.hs ├── IO.hs ├── Int.hs ├── List.hs ├── Long.hs ├── MCU.hs ├── Memory.hs ├── Path.hs ├── Runtime.hs ├── Serial.hs ├── String.hs ├── System.hs ├── Time.hs ├── Type.hs ├── UInt.hs └── Wire.hs ├── Projects ├── 6809 │ ├── Instructions.md │ ├── Library │ │ ├── Devices │ │ │ ├── ACIA6850.asm │ │ │ ├── AppleI.asm │ │ │ └── W65C22.asm │ │ ├── I2C.asm │ │ ├── MemoryMap.asm │ │ ├── Serial.asm │ │ ├── Time.asm │ │ └── ZeroPage.asm │ ├── Samples │ │ ├── Blink.asm │ │ └── Hello.asm │ └── Tools │ │ ├── 6809asm.hs │ │ ├── 6809dasm.hs │ │ ├── 6809gen.hs │ │ ├── 6809opt.hs │ │ └── asm6809.hs ├── 6502SBC │ ├── ABNielsen.asm │ ├── BitBang.hs │ ├── BitBangMega │ │ └── BitBangMega.ino │ ├── BlinkHopper.asm │ ├── BlinkNoRAM.asm │ ├── BlinkRAM.asm │ ├── Buttons.asm │ ├── CPLD │ │ ├── 6502BE.PLD │ │ ├── 6502BE.abs │ │ ├── 6502BE.jed │ │ ├── 6502BE.pdf │ │ ├── 6502BE.sim │ │ ├── 6502MECB8K.PLD │ │ ├── 6502MECB8K.abs │ │ ├── 6502MECB8K.jed │ │ ├── 6502MECB8K.pdf │ │ ├── 6502MECB8K.sim │ │ ├── 6502RETRO.PLD │ │ ├── 6502RETRO.abs │ │ ├── 6502RETRO.pdf │ │ ├── 6502RETRO.sim │ │ ├── 6502Retro.jed │ │ ├── 6502SBC.PLD │ │ ├── 6502SBC.abs │ │ ├── 6502SBC.jed │ │ ├── 6502SBC.pdf │ │ ├── 6502SBC.sim │ │ ├── 6502SBC48K.PLD │ │ ├── 6502SBC48K.abs │ │ ├── 6502SBC48K.jed │ │ ├── 6502SBC48K.pdf │ │ ├── 6502SBC48K.sim │ │ ├── 6502SBC56K.PLD │ │ ├── 6502SBC56K.abs │ │ ├── 6502SBC56K.jed │ │ ├── 6502SBC56K.pdf │ │ ├── 6502SBC56K.sim │ │ ├── G20V8_6502SBC.jed │ │ └── G22V10_6502SBC.jed │ ├── Display.asm │ ├── EasyEDA │ │ ├── 6502 Machine │ │ │ ├── 6502 Machine.json │ │ │ ├── Gerber_6502-v2_PCB_6502-v2.1_2024-05-04.zip │ │ │ ├── PCB_6502 Machine.json │ │ │ ├── Schematic_6502-v2_2024-05-02.pdf │ │ │ └── info │ │ ├── Tigger.svg │ │ └── projects │ │ │ ├── 6502 v2 │ │ │ ├── 6502 v2.json │ │ │ ├── Gerber_6502-v2_PCB_6502-v3_2024-05-10.zip │ │ │ ├── Gerber_6502-v2_PCB_6502-v4_2024-05-15.zip │ │ │ ├── PCB_6502 v2.1.json │ │ │ ├── PCB_6502 v3.json │ │ │ ├── PCB_6502 v4.json │ │ │ ├── Schematic_6502-v2_2024-05-10.pdf │ │ │ ├── Schematic_6502-v2_2024-05-15.pdf │ │ │ └── info │ │ │ └── uuidMap.json │ ├── Game.asm │ ├── HopperEcho.asm │ ├── I2C.asm │ ├── I2C.hs │ ├── Probe │ │ ├── EEPROM Jig.json │ │ ├── Gerber_EEPROM-Jig_PCB_EEPROM-Jig_2_2024-10-27.zip │ │ ├── PCB_EEPROM Jig_2.json │ │ └── info │ ├── RIOT.asm │ ├── SSD1306.asm │ ├── SSD1306.hs │ ├── Sparky.hs │ ├── Sprites.asm │ ├── StackTest.asm │ └── rev12 │ │ ├── 6502 v2.json │ │ ├── BillOfMaterials.md │ │ ├── Gerber_6502-v2_PCB_6502-v4_2024-05-15.zip │ │ ├── PCB_6502 v4.json │ │ ├── ReadMe.md │ │ └── Schematic_6502-v2_2024-05-15.pdf ├── 65uino │ ├── Blink.asm │ ├── BlinkNoRAM.asm │ ├── Buttons.asm │ ├── Display.asm │ ├── Game.asm │ ├── I2C.asm │ ├── NOP.asm │ ├── RIOT.asm │ ├── SSD1306.asm │ ├── Sprites.asm │ ├── Test.asm │ ├── Utilities.asm │ └── Zero.asm ├── CHIP8 │ ├── Games │ │ ├── Blinky.ch8 │ │ ├── Brix.ch8 │ │ └── Invaders.ch8 │ ├── Tests │ │ ├── 1.ch8 │ │ ├── 2.ch8 │ │ ├── 3.ch8 │ │ ├── 4.ch8 │ │ ├── 5.ch8 │ │ ├── 6.ch8 │ │ ├── README.md │ │ └── opcode.ch8 │ ├── chip8.hs │ └── readme.md ├── Games │ ├── DisplayHelper.hs │ ├── GameGrid.hs │ ├── HopperTetris.hs │ ├── Input.hs │ └── Pieces.hs ├── MCUShell │ ├── Eject.hs │ ├── MCUShell.hs │ ├── Mount.hs │ ├── Show.hs │ ├── Speed.hs │ ├── fibo.cmd │ ├── ms.cmd │ └── n.cmd ├── MECB6502 │ ├── ACIABlink.asm │ ├── CPLD │ │ ├── MECB_CHIPSELECT_6502_CPU.PLD │ │ ├── MECB_CHIPSELECT_6502_CPU.abs │ │ ├── MECB_CHIPSELECT_6502_CPU.pdf │ │ ├── MECB_CHIPSELECT_6502_CPU.sim │ │ └── MECB_ChipSelect_6502_CPU.jed │ ├── HelloWorld.asm │ ├── PIABlink.asm │ └── PTMBlink.asm ├── Michael │ ├── DumbWatch │ │ └── DumbWatch.hs │ ├── EEFiles │ │ ├── EEShell.hs │ │ └── EETest.hs │ ├── LoadCells │ │ ├── ChallengerHardware.hs │ │ ├── PiPicoWHardware.hs │ │ └── Scale.hs │ ├── SunsetLights │ │ ├── DateTime.hs │ │ ├── SunsetLights.hs │ │ └── WebTime.hs │ └── SunsetSwitch │ │ ├── AmbientLog.hs │ │ ├── GarageBox.hs │ │ ├── HouseBox.hs │ │ ├── HouseReceive.hs │ │ ├── Proximity.hs │ │ ├── ProximityEvent.hs │ │ └── sunsetswitch.hs ├── PyPorts │ ├── BreakOut │ │ ├── Ball.hs │ │ ├── BreakOut.hs │ │ ├── Bricks.hs │ │ ├── Paddle.hs │ │ ├── Utilities.hs │ │ └── breakout.py │ └── Fibo │ │ ├── Fibo.hs │ │ ├── FiboUInt.hs │ │ └── fibo.py ├── Python │ └── readme.md ├── Rowan │ └── CheeseBytes.hs ├── Sprites │ ├── 0 memory layout.png │ ├── 1 memory layout sprites.png │ ├── 2 memory layout bytes.png │ ├── Game.hs │ ├── Sprites.hs │ ├── TS.hs │ └── Tools.hs └── VGM │ ├── Samples │ ├── AlleyCat.vgz │ ├── Christmas.hs │ ├── Ghost.hs │ └── Sonata.hs │ ├── VGMDemo.hs │ ├── VGMPlayer.hs │ └── VGMtoHopper.hs ├── Runtime ├── 6502 │ ├── Allocate.asm │ ├── Array.asm │ ├── Breakpoints.asm │ ├── Devices │ │ ├── ACIA6551.asm │ │ ├── ACIA6850.asm │ │ ├── AppleI.asm │ │ ├── PIA6821.asm │ │ ├── SerialEEPROM.asm │ │ └── W65C22.asm │ ├── Diagnostics.asm │ ├── Float.asm │ ├── Free.asm │ ├── GC.asm │ ├── I2C.asm │ ├── Instructions.asm │ ├── IntMath.asm │ ├── LibCalls.asm │ ├── Long.asm │ ├── Memory.asm │ ├── MemoryMap.asm │ ├── Parallel.asm │ ├── Serial.asm │ ├── Stacks.asm │ ├── String.asm │ ├── SysCalls.asm │ ├── Time.asm │ ├── Types.asm │ ├── Utilities.asm │ ├── ZeroPage.asm │ ├── list.asm │ └── variant.asm ├── Emulation │ ├── Diagnostics.hs │ ├── Directory.hs │ ├── File.hs │ ├── Float.hs │ ├── Long.hs │ ├── Memory.hs │ ├── Minimal.hs │ ├── System.hs │ ├── Time.hs │ └── WiFi.hs ├── HopperVM.hs ├── Platform │ ├── Array.hs │ ├── Byte.hs │ ├── Char.hs │ ├── Desktop.hs │ ├── Dictionary.hs │ ├── Directory.hs │ ├── External.hs │ ├── File.hs │ ├── Float.hs │ ├── GC.hs │ ├── Instructions.hs │ ├── Int.hs │ ├── LibCalls.hs │ ├── Library.hs │ ├── List.hs │ ├── Long.hs │ ├── NeoPixel.hs │ ├── OpCodes.hs │ ├── Pair.hs │ ├── SPI.hs │ ├── String.hs │ ├── SysCalls.hs │ ├── Types.hs │ ├── UInt.hs │ ├── Variant.hs │ └── Wire.hs ├── Runtime.hs ├── Z80 │ ├── Array.hs │ ├── GC.hs │ ├── Memory.hs │ └── String.hs ├── Z80Gen.hs ├── mb.cmd └── r6502.asm ├── Samples ├── Asm │ └── WozMon.asm ├── ColorTest.hs ├── Content │ ├── Tigger.path │ ├── Tigger.png │ ├── Tigger.svg │ ├── grace.bin │ ├── grace.jpg │ ├── grace.txt │ ├── rp2040.bin │ ├── rp2040.jpg │ ├── rp2040.txt │ ├── tigger128.bin │ ├── tigger128.txt │ ├── tigger32.bin │ ├── tigger32.txt │ ├── tigger64.bin │ ├── tigger64.txt │ ├── tiggerrelaxed.bin │ ├── tiggerrelaxed.png │ └── tiggerrelaxed.txt ├── Displays.hs ├── Embed.hs ├── ExploreFS.hs ├── Ferns.hs ├── FiboUInt.hs ├── Hello.hs ├── I2CDemo.hs ├── Inline.hs ├── MCU │ ├── 6502RTCClock.hs │ ├── 8x8Matrix.hs │ ├── AdafruitRTCClock.hs │ ├── Adalogger.hs │ ├── AnalogRead.hs │ ├── AnalogWrite.hs │ ├── Badger.hs │ ├── BadgerTigger.hs │ ├── Blink.hs │ ├── BlinkNeo.hs │ ├── BlinkRGB.hs │ ├── Challenger.hs │ ├── ChallengerRTCClock.hs │ ├── ColourMandelbrot.hs │ ├── Ferns.hs │ ├── GPIO.hs │ ├── GPSContinuous.hs │ ├── GPSDemo.hs │ ├── HC12 │ │ ├── DoorIndicator.hs │ │ ├── DoorSensor.hs │ │ ├── Gerber_Tiny-2350_PCB_Tiny-2350_2_2024-12-22.zip │ │ ├── HC12Config.hs │ │ ├── LEDDemo.hs │ │ ├── Pico433Rx.hs │ │ └── Pico433Tx.hs │ ├── I2CDemo.hs │ ├── LED14.hs │ ├── LittleFS.hs │ ├── MakerNano │ │ ├── Button.hs │ │ ├── LEDSweep.hs │ │ ├── Melody.hs │ │ ├── Neo.hs │ │ └── Pitches.hs │ ├── NeoPixelFeather.hs │ ├── OLED.hs │ ├── PimoroniRTCClock.hs │ ├── RTCDemo.hs │ ├── RTCTest.hs │ ├── RainbowNeo.hs │ ├── SDFS.hs │ ├── SH1107.hs │ ├── SSD1306.hs │ ├── Secrets │ │ └── Connect.hs │ ├── TFT.hs │ ├── TFTSD.hs │ ├── TestGPIO.hs │ ├── TextDemo.hs │ ├── ThinkInkFeather.hs │ ├── Timers.hs │ ├── WSPicoRTC.hs │ ├── WebAPServer.hs │ ├── WebClient.hs │ ├── WebServer.hs │ ├── ePaperMandelbrot.hs │ ├── mandelbrot.txt │ ├── ws096.hs │ ├── ws114.hs │ ├── ws144.hs │ ├── ws8SEG.hs │ ├── wsEP42.hs │ └── wsRP096.hs ├── Mandelbrot.bas ├── Mandelbrot.hs ├── Memory.hs ├── NRL.hs ├── NRLUInt.hs ├── Newton.hs ├── PiSpigot.hs ├── Primes.hs ├── Sieve.hs ├── Switch.hs ├── TextDemo.hs ├── hexdump.hs └── matrix.hs ├── Shell ├── Baud.hs ├── CD.hs ├── Cls.hs ├── Common.hs ├── Copy.hs ├── DEL.hs ├── Dir.hs ├── HELP.hs ├── MkDir.hs ├── Port.hs ├── RmDir.hs ├── Shell.hs ├── Show.hs └── Term.hs ├── System ├── Array.hs ├── Bool.hs ├── Byte.hs ├── Char.hs ├── Clipboard.hs ├── Colour.hs ├── DateTime.hs ├── Diagnostics.hs ├── Dictionary.hs ├── Directory.hs ├── EditControl.hs ├── File.hs ├── Float.hs ├── IO.hs ├── Int.hs ├── Keyboard.hs ├── List.hs ├── Long.hs ├── Memory.hs ├── Pair.hs ├── Path.hs ├── Runtime.hs ├── Screen.hs ├── Serial.hs ├── Serialize.hs ├── String.hs ├── System.hs ├── Time.hs ├── Type.hs ├── UInt.hs ├── Variant.hs └── WiFi.hs └── Testing ├── Minimal ├── Blink.hs ├── Clear.hs ├── Count.hs ├── EEPROM.hs ├── Fibo.hs ├── FiboZ80.hs ├── HighLow.hs ├── LCD.hs ├── Lists.hs ├── MRVT.hs ├── Mand.hs ├── Mandelbrot.hs ├── Memory.hs ├── NRL.hs ├── NRL32.hs ├── Numbers.hs ├── OLED.hs ├── PiSpigot.hs ├── SSD1306.hs ├── Sieve.hs ├── Strings.hs ├── Test.hs ├── Timing.hs ├── VTR.hs ├── ahl.hs ├── suite.hs └── testfloat.hs ├── TestDS3231.hs ├── TestFiles.hs ├── TestJSON.hs ├── TestMCP79410.hs ├── TestNumbers.hs ├── TestPCF8523.hs ├── TestStrings.hs ├── TestSuite.hs ├── example.json ├── t.cmd ├── test.asm └── ts.cmd /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | *.hs linguist-language=Hopper 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.hasm 2 | *.hex 3 | *.ihex 4 | *.log 5 | *.mem 6 | *.uf2 7 | *.local 8 | 9 | *.suo 10 | *.vsidx 11 | *.user 12 | \obj 13 | 14 | Runtimes/Arduino/8bitforceOriginals 15 | 16 | Runtimes/Windows/HopperNet/bin 17 | Runtimes/Windows/Restart/bin 18 | Source/Samples/MCU/Secrets2 19 | Temp/Errors.txt 20 | Bin/Auto.crc 21 | Bin/Auto.hexe 22 | Temp/IPCisRunning.bin 23 | Runtimes/Windows/HopperNET/.vs/HopperNET/v17/DocumentLayout.json 24 | *.lst 25 | Temp/testpath.json 26 | *.bin 27 | Runtimes/Windows/Restart/.vs/Restart/v17/DocumentLayout.json 28 | 29 | Source/Projects/6502SBC/EasyEDA/offline_projects_backup 30 | Runtimes/Universal/Hopper/bin 31 | Runtimes/Universal/Hopper/.vs 32 | Runtimes/Universal/Hopper/Publish 33 | /Runtimes/Windows/HopperNET/.vs 34 | -------------------------------------------------------------------------------- /Bin/65asm.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/65asm.hexe -------------------------------------------------------------------------------- /Bin/65dasm.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/65dasm.hexe -------------------------------------------------------------------------------- /Bin/65gen.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/65gen.hexe -------------------------------------------------------------------------------- /Bin/65opt.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/65opt.hexe -------------------------------------------------------------------------------- /Bin/65tests.cmd: -------------------------------------------------------------------------------- 1 | cd /source/testing/minimal 2 | preprocess mrvt 3 | compile -o mrvt 4 | optimize mrvt 5 | codegen mrvt -ihex 6 | dasm mrvt 7 | hm -l mrvt -x 8 | -------------------------------------------------------------------------------- /Bin/65testsx.cmd: -------------------------------------------------------------------------------- 1 | hm -l mrvt -x 2 | -------------------------------------------------------------------------------- /Bin/CODEGEN.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/CODEGEN.hexe -------------------------------------------------------------------------------- /Bin/Compile.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/Compile.hexe -------------------------------------------------------------------------------- /Bin/DASM.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/DASM.hexe -------------------------------------------------------------------------------- /Bin/HopperNET.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/HopperNET.exe -------------------------------------------------------------------------------- /Bin/Options/GPIO.options: -------------------------------------------------------------------------------- 1 | { 2 | "buildoptions": 3 | { 4 | "checkedBuild": "false" 5 | , "runOptimizer": "true" 6 | , "runDisassembler": "false" 7 | , "autoSaveOnBuild": "true" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Bin/Options/RainbowNeo.options: -------------------------------------------------------------------------------- 1 | { 2 | "buildoptions": 3 | { 4 | "checkedBuild": "false" 5 | , "runOptimizer": "true" 6 | , "runDisassembler": "false" 7 | , "autoSaveOnBuild": "true" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Bin/Options/TestGPIO.options: -------------------------------------------------------------------------------- 1 | { 2 | "buildoptions": 3 | { 4 | "checkedBuild": "false" 5 | , "runOptimizer": "false" 6 | , "runDisassembler": "false" 7 | , "autoSaveOnBuild": "true" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Bin/Options/VGMtoHopper.options: -------------------------------------------------------------------------------- 1 | { 2 | "buildoptions": 3 | { 4 | "checkedBuild": "false" 5 | , "runOptimizer": "true" 6 | , "runDisassembler": "true" 7 | , "autoSaveOnBuild": "true" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Bin/Options/blinknoram.options: -------------------------------------------------------------------------------- 1 | { 2 | "buildoptions": 3 | { 4 | "checkedBuild": "false" 5 | , "runOptimizer": "true" 6 | , "runDisassembler": "true" 7 | , "autoSaveOnBuild": "true" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Bin/Options/mrvt.options: -------------------------------------------------------------------------------- 1 | { 2 | "buildoptions": 3 | { 4 | "checkedBuild": "false" 5 | , "runOptimizer": "true" 6 | , "runDisassembler": "true" 7 | , "autoSaveOnBuild": "true" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Bin/PreProcess.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/PreProcess.hexe -------------------------------------------------------------------------------- /Bin/Z80DASM.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/Z80DASM.hexe -------------------------------------------------------------------------------- /Bin/Z80Gen.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/Z80Gen.hexe -------------------------------------------------------------------------------- /Bin/Z80Opt.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/Z80Opt.hexe -------------------------------------------------------------------------------- /Bin/baud.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/baud.hexe -------------------------------------------------------------------------------- /Bin/cd.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/cd.hexe -------------------------------------------------------------------------------- /Bin/cls.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/cls.hexe -------------------------------------------------------------------------------- /Bin/compile2.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/compile2.hexe -------------------------------------------------------------------------------- /Bin/copy.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/copy.hexe -------------------------------------------------------------------------------- /Bin/dbg.cmd: -------------------------------------------------------------------------------- 1 | preprocess /source/shell/term 2 | preprocess /source/shell/port 3 | preprocess /source/shell/baud 4 | preprocess /source/debugger/hm 5 | preprocess /source/debugger/debug 6 | preprocess /source/debugger/rsod 7 | preprocess /source/editor/edit 8 | 9 | compile term -o 10 | compile port -o 11 | compile baud -o 12 | compile hm -o 13 | compile debug -o 14 | compile rsod -o 15 | compile edit -o 16 | 17 | optimize term 18 | optimize port 19 | optimize baud 20 | optimize hm 21 | optimize debug 22 | optimize rsod 23 | optimize edit 24 | 25 | codegen term 26 | codegen port 27 | codegen baud 28 | codegen hm 29 | codegen debug 30 | codegen rsod 31 | codegen edit 32 | 33 | dasm term 34 | dasm port 35 | dasm baud 36 | dasm hm 37 | dasm debug 38 | dasm rsod 39 | dasm edit 40 | 41 | -------------------------------------------------------------------------------- /Bin/debug.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/debug.hexe -------------------------------------------------------------------------------- /Bin/del.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/del.hexe -------------------------------------------------------------------------------- /Bin/dir.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/dir.hexe -------------------------------------------------------------------------------- /Bin/e6502.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/e6502.hexe -------------------------------------------------------------------------------- /Bin/eZ80.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/eZ80.hexe -------------------------------------------------------------------------------- /Bin/ed.cmd: -------------------------------------------------------------------------------- 1 | cd /source/runtime 2 | edit r6502 3 | -------------------------------------------------------------------------------- /Bin/edit.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/edit.hexe -------------------------------------------------------------------------------- /Bin/help.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/help.hexe -------------------------------------------------------------------------------- /Bin/hm.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/hm.hexe -------------------------------------------------------------------------------- /Bin/mkdir.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/mkdir.hexe -------------------------------------------------------------------------------- /Bin/optimize.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/optimize.hexe -------------------------------------------------------------------------------- /Bin/port.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/port.hexe -------------------------------------------------------------------------------- /Bin/r.cmd: -------------------------------------------------------------------------------- 1 | cd /source/runtime 2 | preprocess runtime 3 | compile runtime -o 4 | //optimize runtime 5 | codegen runtime 6 | dasm runtime 7 | 8 | runtime 9 | 10 | -------------------------------------------------------------------------------- /Bin/rmdir.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/rmdir.hexe -------------------------------------------------------------------------------- /Bin/rsod.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/rsod.hexe -------------------------------------------------------------------------------- /Bin/sdfs.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/sdfs.hexe -------------------------------------------------------------------------------- /Bin/shell.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/shell.hexe -------------------------------------------------------------------------------- /Bin/show.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/show.hexe -------------------------------------------------------------------------------- /Bin/sys.cmd: -------------------------------------------------------------------------------- 1 | preprocess /source/shell/show 2 | preprocess /source/shell/shell 3 | preprocess /source/shell/cd 4 | preprocess /source/shell/cls 5 | preprocess /source/shell/dir 6 | preprocess /source/shell/del 7 | preprocess /source/shell/mkdir 8 | preprocess /source/shell/rmdir 9 | preprocess /source/shell/copy 10 | preprocess /source/shell/del 11 | preprocess /source/shell/help 12 | 13 | compile show -o 14 | compile shell -o 15 | compile cd -o 16 | compile cls -o 17 | compile dir -o 18 | compile del -o 19 | compile mkdir -o 20 | compile rmdir -o 21 | compile copy -o 22 | compile help -o 23 | 24 | optimize show 25 | optimize shell 26 | optimize cd 27 | optimize cls 28 | optimize dir 29 | optimize del 30 | optimize mkdir 31 | optimize rmdir 32 | optimize copy 33 | optimize help 34 | 35 | codegen show 36 | codegen shell 37 | codegen cd 38 | codegen cls 39 | codegen dir 40 | codegen del 41 | codegen mkdir 42 | codegen rmdir 43 | codegen copy 44 | codegen help 45 | 46 | dasm show 47 | dasm shell 48 | dasm cd 49 | dasm cls 50 | dasm dir 51 | dasm del 52 | dasm mkdir 53 | dasm rmdir 54 | dasm copy 55 | dasm help 56 | 57 | -------------------------------------------------------------------------------- /Bin/tc.cmd: -------------------------------------------------------------------------------- 1 | cd /source/languages/TiggerC/samples 2 | -------------------------------------------------------------------------------- /Bin/tcc.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/tcc.hexe -------------------------------------------------------------------------------- /Bin/tcpp.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/tcpp.hexe -------------------------------------------------------------------------------- /Bin/term.hexe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Bin/term.hexe -------------------------------------------------------------------------------- /Bin/tools.cmd: -------------------------------------------------------------------------------- 1 | cd /source/compiler 2 | 3 | PreProcess DASM 4 | Compile DASM -o 5 | Optimize DASM 6 | CODEGEN DASM 7 | DASM DASM 8 | 9 | PreProcess Optimize 10 | Compile Optimize -o 11 | Optimize Optimize 12 | CODEGEN Optimize 13 | DASM Optimize 14 | 15 | PreProcess CODEGEN 16 | Compile CODEGEN -o 17 | Optimize CODEGEN 18 | CODEGEN CODEGEN 19 | DASM CODEGEN 20 | 21 | PreProcess PreProcess 22 | Compile PreProcess -o 23 | Optimize PreProcess 24 | CODEGEN PreProcess 25 | DASM PreProcess 26 | 27 | PreProcess Compile 28 | Compile Compile -o 29 | Optimize Compile 30 | CODEGEN Compile 31 | DASM Compile 32 | 33 | PreProcess Translate 34 | Compile Translate -o 35 | Optimize Translate 36 | CODEGEN Translate 37 | DASM Translate 38 | 39 | -------------------------------------------------------------------------------- /Docs/Hopper Language.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Docs/Hopper Language.pdf -------------------------------------------------------------------------------- /Docs/Unbrick Pins.txt: -------------------------------------------------------------------------------- 1 | Raspberry Pi 2 | Pico 3 | 0..7 are low by default : suggest taking 0 high 4 | Pico W 5 | 0..7 are low by default : suggest taking 0 high 6 | 7 | Pimoroni 8 | Tiny 2040 9 | 0..7 are low by default : suggest taking 0 high 10 | 11 | Challenger 12 | WiFi 13 | 0..3 and 6..7 are low by default: suggest taking 0 high 14 | WiFi NB 15 | 16 | Waveshare 17 | RP2040-One 18 | 0..7 are low by default : suggest taking 0 high 19 | RP2040-Matrix 20 | 0..7 are low by default : suggest taking 0 high 21 | RP2040-Plus 22 | 0..7 are low by default : suggest taking 0 high 23 | 24 | Adafruit 25 | Trinkey RP2040 26 | The boot button is also on GPIO 12. High by default, low when pressed. 27 | 28 | Cytron 29 | Maker Nano RP2040 30 | 0..7 are low by default : suggest taking 0 high (lights up an LED) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Michael Cartwright 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Runtimes/6502/Assembly/Firmware/lcdconstants.asm: -------------------------------------------------------------------------------- 1 | ; ######################## LCD firmware table ######################## 2 | 3 | .org $fff0 4 | lcdRowStart: 5 | .byte $00 ; 20x4 and 16x2 6 | .byte $40 ; 20x4 and 16x2 7 | .byte $14 ; 20x4 8 | .byte $54 ; 20x4 9 | -------------------------------------------------------------------------------- /Runtimes/6502/Assembly/VASM/cygwin1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Runtimes/6502/Assembly/VASM/cygwin1.dll -------------------------------------------------------------------------------- /Runtimes/6502/Assembly/VASM/vasm6502_oldstyle.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Runtimes/6502/Assembly/VASM/vasm6502_oldstyle.exe -------------------------------------------------------------------------------- /Runtimes/6502/Assembly/VASM/vobjdump.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Runtimes/6502/Assembly/VASM/vobjdump.exe -------------------------------------------------------------------------------- /Runtimes/6502/Assembly/build.cmd: -------------------------------------------------------------------------------- 1 | VASM\vasm6502_oldstyle.exe -dotdir -wdc02 -Fbin %1\%2.asm -I .\Firmware -L Output\Listings\%2.lst -o Output\Binary\%2.out -------------------------------------------------------------------------------- /Runtimes/Arduino/8bitforce/t6502_Hopper/memorymap.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEMORY_MAP_H 2 | #define _MEMORY_MAP_H 3 | 4 | //////////////////////////////////////////////////////////////////// 5 | // MEMORY LAYOUT 6 | //////////////////////////////////////////////////////////////////// 7 | 8 | # include "romImage.h" 9 | 10 | // 48K MEMORY 11 | #define RAM_START 0x0000 12 | #define RAM_END (ROM_START-1) 13 | byte RAM[RAM_END-RAM_START+1]; 14 | 15 | #endif // _MEMORYMAP_H -------------------------------------------------------------------------------- /Runtimes/Arduino/8bitforce/tz80_Hopper/memorymap.h: -------------------------------------------------------------------------------- 1 | #ifndef _MEMORY_MAP_H 2 | #define _MEMORY_MAP_H 3 | 4 | //////////////////////////////////////////////////////////////////// 5 | // MEMORY LAYOUT 6 | //////////////////////////////////////////////////////////////////// 7 | 8 | # include "romImage.h" 9 | 10 | #define RAM_START ROM_END + 1 11 | #define RAM_END 0xFFFF 12 | byte RAM[RAM_END-RAM_START+1]; 13 | 14 | 15 | 16 | #define ROM rom_bin 17 | 18 | 19 | 20 | #endif // _MEMORYMAP_H -------------------------------------------------------------------------------- /Runtimes/Arduino/HopperPortable/HopperPortable.ino: -------------------------------------------------------------------------------- 1 | #include "Platform.h" 2 | 3 | void setup() 4 | { 5 | Serial.begin(57600); // always stick to 56K (it also works on 6502 and Z80 for the client side) 6 | delay(2000); 7 | 8 | Machine_Initialize(); 9 | Platform_Initialize(); 10 | 11 | 12 | #ifndef RP2040PICO 13 | // Flashing LED_BUILTIN causes grief when a Pi Pico device uses pin 25 for something else (like the backlight for the LCD for Waveshare RP2040-LCD-0.96) 14 | 15 | #if !defined(SEEEDESP32C3) && !defined(WAVESHARERP2040ONE) 16 | // flicker LED_BUILTIN to show that initialization completed 17 | pinMode(LED_BUILTIN, OUTPUT); 18 | for (int i = 0; i < 5; i++) 19 | { 20 | digitalWrite(LED_BUILTIN, HIGH); 21 | delay(50); 22 | digitalWrite(LED_BUILTIN, LOW); 23 | delay(50); 24 | } 25 | #endif 26 | #ifdef LOLIND1MINI 27 | digitalWrite(LED_BUILTIN, HIGH); // high is "off" on the D1 Mini 28 | #endif 29 | 30 | #endif 31 | 32 | } 33 | 34 | void loop() 35 | { 36 | if (!Machine_GetExited()) 37 | { 38 | HopperEntryPoint(); 39 | Platform_Release(); 40 | Machine_SetExited(true); 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Runtimes/Arduino/HopperPortable/HopperTimer.h: -------------------------------------------------------------------------------- 1 | #ifndef HOPPERTIMER_H 2 | #define HOPPERTIMER_H 3 | 4 | #include 5 | #include "Runtime.h" 6 | #include "Platform.h" 7 | 8 | void External_TimerInitialize(); 9 | void External_TimerRelease(); 10 | 11 | UInt External_TimerStart(UInt msInterval, TimerISRDelegate timerISRDelegate); 12 | UInt External_TimerStartLong(UInt hrmsInterval, TimerISRDelegate timerISRDelegate); 13 | void External_TimerStop(UInt timerID); 14 | 15 | UInt External_TimerAlarm(UInt msInterval, TimerISRDelegate timerISRDelegate); 16 | UInt External_TimerAlarmLong(UInt hrmsInterval, TimerISRDelegate timerISRDelegate); 17 | void External_TimerCancel(UInt alarmID); 18 | 19 | #endif -------------------------------------------------------------------------------- /Runtimes/Arduino/HopperPortable/HopperWifi.h: -------------------------------------------------------------------------------- 1 | #ifndef HOPPERWIFI_H 2 | #define HOPPERWIFI_H 3 | 4 | #include 5 | #include "Runtime.h" 6 | #include "Platform.h" 7 | 8 | #if defined(USESWIFICYW43) || defined(ARDUINONANO_RP2040) || defined(USESWIFIESP) 9 | #define USEWIFI // WiFi for Raspberry Pi Pico W 10 | #define USESERVER 11 | #endif 12 | 13 | #ifndef USEWIFI 14 | #define USEWIFISTUBS // no WiFi for Pi Pico, Seeed XIA0 RP2040 or Pimoroni Tiny 2040 15 | #define USERSERVERSTUBS 16 | #endif 17 | 18 | #if defined(USESWIFICYW43) 19 | #include 20 | #include 21 | #include 22 | #endif 23 | 24 | #ifdef ARDUINONANO_RP2040 25 | #include 26 | #include 27 | #endif 28 | 29 | #ifdef USESWIFIESP 30 | #include 31 | #include 32 | #endif 33 | 34 | 35 | #ifdef USEWIFI 36 | Bool IsWiFiConnected(); 37 | #endif 38 | 39 | #endif // HOPPERWIFI_H -------------------------------------------------------------------------------- /Runtimes/RP2040/BuildInstructions.txt: -------------------------------------------------------------------------------- 1 | VS Developer console: 2 | d: 3 | cd D:\Pico\Hopper\build 4 | cmake -G "NMake Makefiles" .. 5 | nmake -------------------------------------------------------------------------------- /Runtimes/RP2040/HopperArray.h: -------------------------------------------------------------------------------- 1 | #ifndef HOPPERARRAY_H 2 | #define HOPPERARRAY_H 3 | 4 | #include "Common.h" 5 | 6 | UInt HRArray_New(Type htype, UInt count); 7 | UInt HRArray_GetCount(UInt _this); 8 | UInt HRArray_GetItem(UInt _this, UInt index, Type & etype); 9 | void HRArray_SetItem(UInt _this, UInt index, UInt value); 10 | void HRArray_Dump(UInt address, UInt indent); 11 | 12 | #endif // HOPPERARRAY_H -------------------------------------------------------------------------------- /Runtimes/RP2040/HopperDictionary.h: -------------------------------------------------------------------------------- 1 | #ifndef HOPPERDICTIONARY_H 2 | #define HOPPERDICTIONARY_H 3 | 4 | #include "Common.h" 5 | 6 | UInt HRDictionary_New(Type ktype, Type vtype); 7 | void HRDictionary_Clear(UInt _this); 8 | void HRDictionary_Set(UInt _this, UInt key, Type ktype, UInt32 value, Type vtype); 9 | bool HRDictionary_Next(UInt _this, UInt & iterator, UInt & hrpair); 10 | Bool HRDictionary_Contains(UInt _this, UInt key); 11 | UInt32 HRDictionary_Get(UInt _this, UInt key, Type & vtype); 12 | UInt HRDictionary_Clone(UInt original); 13 | void HRDictionary_Dump(UInt address, UInt indent); 14 | UInt HRDictionary_GetCount(UInt _this); 15 | 16 | #endif // HOPPERDICTIONARY_H -------------------------------------------------------------------------------- /Runtimes/RP2040/HopperList.h: -------------------------------------------------------------------------------- 1 | #ifndef HOPPERLIST_H 2 | #define HOPPERLIST_H 3 | 4 | #include "Common.h" 5 | 6 | UInt HRList_New(Type htype); 7 | UInt HRList_Clone(UInt original); 8 | void HRList_Clear(UInt _this); 9 | UInt HRList_GetLength(UInt _this); 10 | UInt32 HRList_GetItem(UInt _this, UInt index, Type & itype); 11 | void HRList_SetItem(UInt _this, UInt index, UInt32 item, Type itype); 12 | void HRList_Insert(UInt _this, UInt index, UInt32 item, Type itype); 13 | void HRList_Append(UInt _this, UInt32 item, Type itype); 14 | bool HRList_Contains(UInt _this, UInt32 item, Type itype); 15 | void HRList_Remove(UInt _this, UInt index); 16 | void HRList_Dump(UInt address, UInt indent); 17 | 18 | #endif // HOPPERLIST_H -------------------------------------------------------------------------------- /Runtimes/RP2040/HopperMemory.h: -------------------------------------------------------------------------------- 1 | #ifndef HOPPERMEMORY_H 2 | #define HOPPERMEMORY_H 3 | 4 | #include "Common.h" 5 | 6 | UInt Memory_HeapStart_Get(); 7 | UInt Memory_HeapSize_Get(); 8 | UInt Memory_FreeList_Get(); 9 | void Memory_Free(UInt address); 10 | void Memory_Initialize(UInt start, UInt size); 11 | UInt Memory_Allocate(UInt size); 12 | void Memory_Set(UInt memory, Byte value, UInt size); 13 | void GC_Release(UInt address); 14 | UInt GC_New(UInt size, Type htype); 15 | UInt GC_Clone(UInt original); 16 | void GC_AddReference(UInt address); 17 | Bool IsReferenceType(Type htype); 18 | void GC_Dump(UInt address); 19 | void GC_Dump(UInt address, UInt indent); 20 | 21 | 22 | 23 | #endif // HOPPERMEMORY_H 24 | -------------------------------------------------------------------------------- /Runtimes/RP2040/HopperPair.h: -------------------------------------------------------------------------------- 1 | #ifndef HOPPERPAIR_H 2 | #define HOPPERPAIR_H 3 | 4 | #include "Common.h" 5 | 6 | UInt HRPair_New(Type ktype, UInt key, Type vtype, UInt32 value); 7 | UInt HRPair_Clone(UInt original); 8 | void HRPair_Clear(UInt _this); 9 | UInt HRPair_GetKey(UInt _this, Type & ktype); 10 | UInt32 HRPair_GetValue(UInt _this, Type & vtype); 11 | void HRPair_Dump(UInt address, UInt indent); 12 | 13 | #endif // HOPPERPAIR_H -------------------------------------------------------------------------------- /Runtimes/RP2040/HopperVariant.h: -------------------------------------------------------------------------------- 1 | #ifndef HOPPERVARIANT_H 2 | #define HOPPERVARIANT_H 3 | 4 | #include "Common.h" 5 | 6 | UInt HRVariant_CreateValueVariant(UInt32 value, Type vtype); 7 | UInt HRVariant_New(UInt32 value, Type vtype); 8 | UInt32 HRVariant_GetValue(UInt _this, Type & vtype); 9 | UInt32 HRVariant_UnBox(UInt _this, Type & vtype); 10 | UInt HRVariant_Clone(UInt original); 11 | void HRVariant_Clear(UInt _this); 12 | bool HRVariant_IsEqual(UInt32 left, Type ltype, UInt32 right, Type rtype); 13 | void HRVariant_Dump(UInt address, UInt indent); 14 | 15 | #endif // HOPPERVARIANT_H -------------------------------------------------------------------------------- /Runtimes/RP2040/assembly source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Runtimes/RP2040/assembly source.png -------------------------------------------------------------------------------- /Runtimes/Universal/Hopper.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Runtimes/Universal/Hopper.zip -------------------------------------------------------------------------------- /Runtimes/Universal/Hopper/Hopper.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Runtimes/Universal/Hopper/Hopper.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.9.34701.34 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hopper", "Hopper.csproj", "{B8AF8E51-6E17-4D75-956B-7EF69C0CA8D9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B8AF8E51-6E17-4D75-956B-7EF69C0CA8D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {B8AF8E51-6E17-4D75-956B-7EF69C0CA8D9}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {B8AF8E51-6E17-4D75-956B-7EF69C0CA8D9}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {B8AF8E51-6E17-4D75-956B-7EF69C0CA8D9}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {86832465-68C3-494B-8CE4-E3150BD964BA} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Runtimes/Universal/Hopper/Properties/PublishProfiles/FolderProfile.pubxml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | Release 8 | Any CPU 9 | D:\Repos\Hopper\Runtimes\Universal\Hopper\Publish 10 | FileSystem 11 | <_TargetId>Folder 12 | 13 | -------------------------------------------------------------------------------- /Runtimes/Windows/HopperNET/.vs/HopperNET/v17/Solution.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Runtimes/Windows/HopperNET/.vs/HopperNET/v17/Solution.VC.db -------------------------------------------------------------------------------- /Runtimes/Windows/HopperNET/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | False 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Runtimes/Windows/HopperNET/HopperNET.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.32929.386 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HopperNET", "HopperNET.csproj", "{98BDC3FA-1D25-4987-99C0-52FE389D5037}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {98BDC3FA-1D25-4987-99C0-52FE389D5037}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {98BDC3FA-1D25-4987-99C0-52FE389D5037}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {98BDC3FA-1D25-4987-99C0-52FE389D5037}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {98BDC3FA-1D25-4987-99C0-52FE389D5037}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {A6812FEB-35BA-41AA-AD7B-9E98B9E700F1} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Runtimes/Windows/HopperNET/HopperTime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace HopperNET 8 | { 9 | class HopperTime 10 | { 11 | static DateTime startTime = DateTime.Now; 12 | static public UInt16 Seconds 13 | { 14 | get 15 | { 16 | UInt16 seconds = (UInt16)(Millis / 1000); 17 | return seconds; 18 | } 19 | } 20 | static public Int32 Millis 21 | { 22 | get 23 | { 24 | DateTime now = DateTime.Now; 25 | TimeSpan elapsed = now - startTime; 26 | return (Int32)elapsed.TotalMilliseconds; 27 | } 28 | } 29 | /* 30 | static public Int32 Micros 31 | { 32 | get 33 | { 34 | DateTime now = DateTime.Now; 35 | TimeSpan elapsed = now - startTime; 36 | double ms = elapsed.Ticks / TimeSpan.TicksPerMillisecond; 37 | double us = ms * 1000; 38 | throw new NotImplementedException(); // does this work correctly? 39 | return (Int32)us; 40 | } 41 | } 42 | */ 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Runtimes/Windows/HopperNET/IHopper.cs: -------------------------------------------------------------------------------- 1 | namespace HopperNET 2 | { 3 | public interface IHopper 4 | { 5 | bool Exiting { get; set; } 6 | void HopperInvalidate(); 7 | bool HasClipboardText(); 8 | void SetClipboardText(string text); 9 | string GetClipboardText(); 10 | } 11 | } -------------------------------------------------------------------------------- /Runtimes/Windows/HopperNET/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Forms; 4 | 5 | namespace HopperNET 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// The main entry point for the application. 11 | /// 12 | [STAThread] 13 | static void Main() 14 | { 15 | try 16 | { 17 | CultureInfo.CurrentCulture = new CultureInfo("en-US"); 18 | 19 | Application.EnableVisualStyles(); 20 | Application.SetCompatibleTextRenderingDefault(false); 21 | 22 | Application.Run(new Hopper()); 23 | } 24 | catch (Exception ex) 25 | { 26 | MessageBox.Show(ex.StackTrace.ToString(), "Hopper Exception:" + ex.Message); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Runtimes/Windows/HopperNET/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace HopperNET.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.11.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Runtimes/Windows/HopperNET/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Runtimes/Windows/HopperNET/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | False 7 | 8 | 9 | -------------------------------------------------------------------------------- /Runtimes/Windows/Restart/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Runtimes/Windows/Restart/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Restart 10 | { 11 | internal class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | Process[] processes = Process.GetProcessesByName("hoppernet"); 16 | foreach (var process in processes) 17 | { 18 | process.Kill(); 19 | } 20 | System.Threading.Thread.Sleep(1000); 21 | File.Delete(@"D:\Repos\Hopper\Temp\IPCPipeName.bin"); 22 | 23 | Process hopper = new Process(); 24 | hopper.StartInfo.FileName = @"D:\Repos\Hopper\Bin\HopperNET.exe"; 25 | hopper.Start(); 26 | hopper.Start(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Runtimes/Windows/Restart/Restart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.9.34701.34 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Restart", "Restart.csproj", "{00C1BB11-7BCA-46F2-A9B2-FE657455FC81}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {00C1BB11-7BCA-46F2-A9B2-FE657455FC81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {00C1BB11-7BCA-46F2-A9B2-FE657455FC81}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {00C1BB11-7BCA-46F2-A9B2-FE657455FC81}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {00C1BB11-7BCA-46F2-A9B2-FE657455FC81}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {C1BD908D-9C1A-4042-98A4-7290EDD05E8E} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Source/6502/Firmware/Hardware.hs: -------------------------------------------------------------------------------- 1 | unit Hardware 2 | { 3 | bool LED { set system; } 4 | } 5 | -------------------------------------------------------------------------------- /Source/6502/Firmware/Memory.hs: -------------------------------------------------------------------------------- 1 | unit Memory 2 | { 3 | byte ReadByte(uint address) system; 4 | WriteByte(uint address, byte value) system; 5 | 6 | uint Available() system; 7 | uint Maximum() system; 8 | 9 | Free(uint address) system; 10 | uint Allocate(uint size) system; 11 | 12 | byte ReadBit(uint address, uint index) system; 13 | WriteBit(uint address, uint index, byte value) system; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Source/6502/Samples/Blink.hs: -------------------------------------------------------------------------------- 1 | program Blink 2 | { 3 | uses "/Source/6502/System" 4 | { 5 | loop 6 | { 7 | LED = true; 8 | Delay(500); 9 | LED = false; 10 | Delay(500); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Source/6502/Samples/FiboUInt.hs: -------------------------------------------------------------------------------- 1 | program FiboUInt 2 | { 3 | uses "/Source/6502/System" 4 | uses "/Source/System/IO" 5 | 6 | // https://forums.raspberrypi.com/viewtopic.php?t=303458 7 | 8 | delegate uint FiboDelegate(uint n); 9 | 10 | uint Fibo(uint n) 11 | { 12 | if ( n <= 1 ) 13 | { return n; } 14 | else 15 | { return Fibo(n-1) + Fibo(n-2); } 16 | } 17 | 18 | Benchmark(string name, FiboDelegate func, uint arg, uint loops) 19 | { 20 | long start = Millis; // start timing 21 | uint result = 0; 22 | for(uint count=0; count < loops; count++) 23 | { 24 | result = func(arg); 25 | } 26 | long ms = (Millis - start); // stop timing 27 | WriteLn(name + "(" + arg.ToString() + ") = " + result.ToString() + " in " + (ms / loops).ToString() + "ms"); 28 | } 29 | 30 | { 31 | FiboDelegate fiboDelegate = Fibo; 32 | Benchmark("Fibo", fiboDelegate, 24, 1); // Fibo(24) = 46368 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/6502/Samples/NRL.hs: -------------------------------------------------------------------------------- 1 | program NRL 2 | { 3 | uses "/Source/6502/System" 4 | uses "/Source/System/IO" 5 | 6 | { 7 | uint i; 8 | uint j; 9 | long s; 10 | 11 | long start = Millis; // start timing 12 | 13 | for (i=1; i <= 10; i++) 14 | { 15 | s = 0; 16 | for (j=1; j <= 1000; j++) 17 | { 18 | s = s + j; 19 | } 20 | Write('.'); 21 | } 22 | WriteLn(s.ToString()); // should be '500500' 23 | long ms = (Millis - start); // stop timing 24 | WriteLn(ms.ToString() + "ms"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Source/6502/System.hs: -------------------------------------------------------------------------------- 1 | unit System 2 | { 3 | #define HOPPER_6502 4 | 5 | 6 | uses "/Source/6502/Firmware/Hardware" 7 | uses "/Source/6502/Firmware/Memory" 8 | 9 | uses "/Source/System/Char" 10 | uses "/Source/System/Bool" 11 | uses "/Source/System/Byte" 12 | uses "/Source/System/Int" 13 | uses "/Source/System/UInt" 14 | 15 | uses "/Source/System/Long" 16 | uses "/Source/System/String" 17 | uses "/Source/System/Array" 18 | uses "/Source/System/List" 19 | uses "/Source/System/Dictionary" 20 | uses "/Source/System/Pair" 21 | uses "/Source/System/Type" 22 | 23 | uses "/Source/System/Screen" 24 | uses "/Source/System/Diagnostics" // for Diagnostics.Die and Diagnostics.Trace 25 | uses "/Source/System/Time" 26 | uses "/Source/System/Serial" 27 | uses "/Source/System/IO" 28 | 29 | bool Trace { get system; set system; } 30 | bool Warp { get system; set system; } 31 | 32 | // execute an array of Hopper opCodes inline (starting at the opcode at 'index') 33 | // (use & operator to determine offsets of locals and globals) 34 | uint Inline(byte[] code, uint index) system; 35 | } 36 | -------------------------------------------------------------------------------- /Source/6502/Testing/Blink.hs: -------------------------------------------------------------------------------- 1 | program Blink 2 | { 3 | uses "/Source/6502/System" 4 | { 5 | loop 6 | { 7 | LED = true; 8 | Delay(500); 9 | LED = false; 10 | Delay(500); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Source/Compiler/c.cmd: -------------------------------------------------------------------------------- 1 | preprocess /source/compiler/compile 2 | compile /debug/obj/compile -o 3 | Optimize /debug/obj/compile 4 | codegen /debug/obj/compile 5 | dasm /bin/compile 6 | 7 | -------------------------------------------------------------------------------- /Source/Compiler/h.cmd: -------------------------------------------------------------------------------- 1 | preprocess /source/samples/hello 2 | compile /debug/obj/hello 3 | codegen /debug/obj/hello 4 | dasm /bin/hello 5 | 6 | -------------------------------------------------------------------------------- /Source/Compiler/p.cmd: -------------------------------------------------------------------------------- 1 | preprocess /source/compiler/preprocess 2 | compile /debug/obj/preprocess 3 | codegen /debug/obj/preprocess 4 | dasm /bin/preprocess 5 | 6 | -------------------------------------------------------------------------------- /Source/Editor/JournalEntry.hs: -------------------------------------------------------------------------------- 1 | unit JournalEntry 2 | { 3 | // JournalEntry 4 | // c : char 5 | // x : uint 6 | // y : uint 7 | // t : uint 0=insertion, type 1=deletion 8 | 9 | // JournalRecord < JournalEntry > 10 | 11 | < > New() 12 | { 13 | < > instance; 14 | 15 | //instance["c"] = 0; // empty char, uninitialized 16 | //instance["x"] = 0; 17 | //instance["y"] = 0; 18 | //instance["t"] = 0; 19 | 20 | return instance; 21 | } 22 | 23 | < < > > NewJournalRecord() 24 | { 25 | < < > > instance; 26 | return instance; 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /Source/Languages/Basic/GIBL/Mandelbrot.bas: -------------------------------------------------------------------------------- 1 | NEW 2 | 100VDU12:PRINT "Mandelbrot - Gordon's TinyBasic - Integers" 3 | 110PRINT "Start" 4 | 120!160=0:REM Initialise TIME 5 | 130Z=TOP:$Z=".,'~=+:;*%&$OXB#@ " 6 | 140F=50 7 | 150FOR Y = -12 TO 12 8 | 160FOR X = -49 TO 29 9 | 170C=X*229/100 10 | 180D=Y*416/100 11 | 190A=C:B=D:I=0 12 | 200Q=B/F:S=B-(Q*F) 13 | 210T=((A*A)-(B*B))/F+C 14 | 220B=2*((A*Q)+(A*S/F))+D 15 | 230A=T: P=A/F:Q=B/F 16 | 240IF ((P*P)+(Q*Q))>=5 GOTO 280 17 | 250I=I+1:IF I<16 GOTO 200 18 | 260PRINT" "; 19 | 270GOTO 290 20 | 280VDU ?(Z+I) 21 | 290NEXT X 22 | 300PRINT "" 23 | 310NEXT Y 24 | 320Q=!160 25 | 330PRINT"Finished" 26 | 340PRINT "Time: ",Q/10; 27 | 350VDU(46):VDU(Q%10+48):PRINT" seconds" 28 | 360END 29 | -------------------------------------------------------------------------------- /Source/Languages/Basic/GIBL/byte.bas: -------------------------------------------------------------------------------- 1 | NEW 2 | 1 VDU12:PRINT "1983 BYTE Magazine Sieve Benchmark (in GIBL)" 3 | 5 !160=0 4 | 10 S = 8190 5 | 20 F=TOP 6 | 30 PRINT "10 iterations" 7 | 40 FOR L = 1 TO 10 8 | 50 C = 0 9 | 60 FOR I = 0 TO S 10 | 70 @(F,I) = 1 11 | 80 NEXT I 12 | 90 FOR I = 0 TO S 13 | 100 IF @(F,I) = 0 GOTO 180 14 | 110 P = I + I + 3 15 | 115 REM PRINT P 16 | 120 K = I + P 17 | 130 IF K > S GOTO 170 18 | 140 @(F,K) = 0 19 | 150 K = K + P 20 | 160 GOTO 130 21 | 170 C = C + 1 22 | 180 NEXT I 23 | 185 PRINT "."; : NEXT L 24 | 190 PRINT C, "Primes" 25 | 200 E = !(160):E = E / 10: PRINT "Time: ",E/10; 26 | 210VDU(46):VDU(E%10+48):PRINT" seconds" 27 | 220END 28 | -------------------------------------------------------------------------------- /Source/Languages/Basic/GIBL/nrl.bas: -------------------------------------------------------------------------------- 1 | NEW 2 | 10REM Noels Retro Lab BASIC Benchmark 3 | 15!160=0:PRINT"S" 4 | 20FOR I=1 TO 10 5 | 25S=0 6 | 30FOR J=1 TO 1000 7 | 35S=S+I 8 | 40NEXT J 9 | 45PRINT "."; 10 | 50NEXT I 11 | 55PRINT S 12 | 60PRINT"E":Z=!160:PRINT "Time: ",Z/10; 13 | 70VDU(46):VDU(Z%10+48):PRINT" seconds" 14 | 80END 15 | -------------------------------------------------------------------------------- /Source/Languages/Basic/GIBL/sieve.bas: -------------------------------------------------------------------------------- 1 | NEW 2 | 90VDU12 3 | 100REM Sieve of Eratosthenes 4 | 110REM Limit will be 78*29 so we fit a screen 5 | 120L=78*29-1 6 | 130C=TOP : $C=".*" 7 | 135Z=C+4 : REM The array 8 | 140REM Initialise it - Everything is true until proven otherwise... 9 | 150FOR I = 0 TO L : ?(Z+I) = 1 : NEXT I 10 | 160?(Z+0)=0:?(Z+1)=0 : REM We know 0 and 1 are not prime... 11 | 12 | 180REM Get upper limit - square root of the number we're looking at 13 | 190S=L : GOSUB 1000 : U = Q 14 | 200PRINT "Upper limit is: ",U 15 | 210PRINT "Finding..." 16 | 220GOSUB 600 17 | 230GOSUB 2000 18 | 240END 19 | 20 | 600REM Find Primes 21 | 610F=2 22 | 620DO 23 | 630 P=?(Z+F) 24 | 640 IF P=1 GOSUB 800 25 | 650 F=F+1 26 | 660UNTIL F > U 27 | 670RETURN 28 | 29 | 800REM Strikeout 30 | 810REM F is the found Prime. Uses J. 31 | 820J=F+F 32 | 830DO 33 | 840 ?(Z+J)=0 34 | 850 J=J+F 35 | 860UNTIL J >= L 36 | 870RETURN 37 | 38 | 1000REM Integer Square Root - Herons method. 39 | 1010REM Input: S, Output Q, uses X,Y 40 | 1100IF S < 2 Q=S : RETURN 41 | 1110X=S/2 42 | 1120Y=(S/X+X)/2 43 | 1130DO 44 | 1140 X=Y 45 | 1150 Y=(S/X+X)/2 46 | 1160UNTIL X <= Y 47 | 1170Q=X 48 | 1180RETURN 49 | 50 | 2000REM Print 51 | 2010REM Uses I,J 52 | 2020J=0:FOR I = 0 TO L 53 | 2030 VDU ?(C+?(Z+I)) 54 | 2040 J=J+1:IF J=78 PR "" : J=0 55 | 2050NEXT I 56 | 2060RETURN 57 | -------------------------------------------------------------------------------- /Source/Languages/Python/Samples/blink.py: -------------------------------------------------------------------------------- 1 | import machine 2 | import utime 3 | import sys 4 | 5 | ledPin = machine.Pin(25, machine.Pin.OUT) 6 | 7 | sys.stdout.write('!') 8 | 9 | while True: 10 | ledPin.value(True) 11 | sys.stdout.write('+') 12 | utime.sleep_ms(500) 13 | ledPin.value(False) 14 | sys.stdout.write('-') 15 | utime.sleep_ms(500) -------------------------------------------------------------------------------- /Source/Languages/Python/Samples/fibo.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | def Fibo(n): 4 | if n <= 1 : return n 5 | else : return Fibo(n-1) + Fibo(n-2) 6 | 7 | def Benchmark(name, func, arg=0, loops=1): 8 | elapsed = time.time() 9 | for count in range(loops): 10 | result = func(arg) 11 | elapsed = (time.time() - elapsed) / loops 12 | print("{}({}) = {} in {} seconds".format(name, arg, result, elapsed)) 13 | 14 | Benchmark("Fibo", Fibo, 24, 10) # Fibo(24) = 46368 -------------------------------------------------------------------------------- /Source/Languages/TiggerC/Samples/blink.tc: -------------------------------------------------------------------------------- 1 | #define EXPERIMENTAL 2 | #define ZEROPAGEGLOBALS 3 | 4 | #define ZEROPAGE_IO 5 | //#define BENEATER_IO 6 | 7 | #include "../system.tc" 8 | #include "../time.tc" // for delay 9 | 10 | // Blink an LED on GPIO pin 0 every second and send a message over serial 11 | func main() { 12 | byte pin; 13 | const char[] welcome_message = "\nHello, 6502!"; 14 | bool led_on = false; 15 | 16 | pinMode(pin, OUTPUT); // Set pin mode to output 17 | pinSet(pin, false); // Ensure LED is off 18 | puts(welcome_message); // Send welcome message 19 | 20 | // Main loop 21 | while (true) { 22 | if (led_on) { 23 | pinSet(pin, false); // Turn LED off 24 | led_on = false; 25 | } else { 26 | pinSet(pin, true); // Turn LED on 27 | led_on = true; 28 | } 29 | delay(1000); // Delay for 1 second 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Source/Languages/TiggerC/Samples/bytesievec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Languages/TiggerC/Samples/bytesievec.png -------------------------------------------------------------------------------- /Source/Languages/TiggerC/Samples/fibouint.tc: -------------------------------------------------------------------------------- 1 | //#define APPLE_I // rather than the default ACIA_6850 for E6502 2 | #define EXPERIMENTAL 3 | #define ROM_8K 4 | 5 | #define ZEROPAGEGLOBALS 6 | 7 | #include "../system.tc" // for puts, writeWord, putc 8 | #include "../time.tc" // for millis, elapsedMillis 9 | 10 | func word Fibo(word n) { 11 | 12 | if (n <= 1) { 13 | return n; 14 | } else { 15 | return Fibo(n - 1) + Fibo(n - 2); 16 | } 17 | } 18 | 19 | func Benchmark(const char[] name, word arg, word loops) { 20 | 21 | putc('\n'); 22 | 23 | // Start timing 24 | byte[] start = millis(); 25 | 26 | word result = 0; 27 | for (word count = 0; count < loops; count++) { 28 | result = Fibo(arg); 29 | } 30 | 31 | // Stop timing 32 | word ms = elapsedMillis(start); 33 | word sec = elapsedSeconds(start); 34 | free(start); 35 | 36 | puts(name); 37 | putc('('); 38 | writeWord(arg); 39 | puts(") = "); 40 | writeWord(result); 41 | puts(" in "); 42 | writeWord(sec); 43 | puts(" seconds ("); 44 | writeWord(ms); 45 | puts(" ms)\n"); 46 | } 47 | 48 | func main() { 49 | Benchmark("Fibo", 24, 1); // Fibo(24) = 46368 50 | } 51 | -------------------------------------------------------------------------------- /Source/Languages/TiggerC/Samples/machine.tc: -------------------------------------------------------------------------------- 1 | 2 | #include "../system.tc" // for puts, writeWord, putc 3 | #include "../time.tc" // for delay 4 | 5 | #define EXPERIMENTAL 6 | 7 | func Setup() 8 | { 9 | asm("SMB0 0xF3 // DDRA"); 10 | puts("Initialized."); 11 | } 12 | func __LEDOn() 13 | { 14 | asm("SMB0 0xF1 // PORTA"); 15 | } 16 | func __LEDOff() 17 | { 18 | asm("RMB0 0xF1 // PORTA"); 19 | } 20 | 21 | // Blink an LED on GPIO pin 0 every second 22 | func main() { 23 | bool ledState; 24 | 25 | Setup(); 26 | __LEDOff(); 27 | 28 | while (true) { 29 | if (ledState) { 30 | __LEDOff(); 31 | ledState = false; 32 | } else { 33 | __LEDOn(); 34 | ledState = true; 35 | } 36 | delay(1000); // Delay for 1 second 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Languages/TiggerC/Samples/nrl32.tc: -------------------------------------------------------------------------------- 1 | //#define APPLE_I // rather than the default ACIA_6850 for E6502 2 | #define EXPERIMENTAL 3 | #include "../system.tc" 4 | 5 | func main() { 6 | byte i; 7 | word j; 8 | byte[4] s; 9 | 10 | puts("\nNRL32:\n"); 11 | 12 | // start timing 13 | byte[] start = millis(); 14 | 15 | for (i = 1; i <= 10; i++) { 16 | zeroLong(s); 17 | for (j = 1; j <= 1000; j++) { 18 | addWordToLong(s, j); 19 | } 20 | putc('.'); 21 | } 22 | 23 | putc('\n');writeHex(s[3]);writeHex(s[2]);writeHex(s[1]);writeHex(s[0]); 24 | 25 | // stop timing 26 | word ms = elapsedMillis(start); 27 | word sec = elapsedSeconds(start); 28 | free(start); 29 | 30 | puts("\n"); 31 | writeWord(ms);puts(" ms\n"); 32 | writeWord(sec);puts(" s\n"); 33 | } 34 | -------------------------------------------------------------------------------- /Source/Languages/TiggerC/Samples/sieve.tc: -------------------------------------------------------------------------------- 1 | //#define APPLE_I // rather than the default ACIA_6850 for E6502 2 | #define EXPERIMENTAL 3 | #define ZEROPAGEGLOBALS 4 | #include "../system.tc" 5 | #include "../time.tc" 6 | 7 | const word SIZEPL = 8191; 8 | bool[SIZEPL] flagsGlobal; 9 | 10 | func main() { 11 | word i; 12 | word prime; 13 | word k; 14 | word count; 15 | byte iter; 16 | 17 | puts("\n10 iterations\n"); 18 | 19 | byte[] start = millis(); 20 | 21 | for (iter = 1; iter <= 10; iter++) { 22 | count = 0; 23 | 24 | for (i = 0; i < SIZEPL; i++) { 25 | flagsGlobal[i] = true; 26 | } 27 | for (i = 0; i < SIZEPL; i++) { 28 | if (flagsGlobal[i]) { 29 | prime = i + i + 3; 30 | for (k = i + prime; k < SIZEPL; k += prime) { 31 | flagsGlobal[k] = false; 32 | } 33 | count++; 34 | } 35 | } 36 | } 37 | 38 | word ms = elapsedMillis(start); 39 | word sec = elapsedSeconds(start); 40 | free(start); 41 | 42 | puts("Done.\n"); 43 | writeWord(count); 44 | puts(" primes\n\n"); 45 | writeWord(ms);puts(" ms\n"); 46 | writeWord(sec);puts(" s\n"); 47 | } 48 | -------------------------------------------------------------------------------- /Source/Languages/TiggerC/Samples/tigger.txt: -------------------------------------------------------------------------------- 1 | 2 | __ _-==-=_,-. 3 | /--`' \_@-@.--< 4 | `--'\ \ <___/. The wonderful thing about Tiggers, 5 | \ \\ " / is Tiggers are wonderful things. 6 | >=\\_/`< Their tops are made out of rubber, 7 | ____ /= | \_/ their bottoms are made out of springs. 8 | _' `\ _/=== \__/ They're bouncy, trouncy, flouncy, pouncy, 9 | `___/ //\./=/~\====\ Fun, fun, fun, fun, fun. 10 | \ // / | ===: But the most wonderful thing about Tiggers is, 11 | | ._/_,__|_ ==: __ I'm the only one. 12 | \/ \\ \\`--| / \\ 13 | | _ \\: /==:-\ 14 | `.__' `-____/ |--|==: 15 | \ \ ===\ :==:`-' 16 | _> \ ===\ /==/ 17 | /==\ | ===\__/--/ 18 | <=== \ / ====\ \\/ 19 | _`-- \/ === \/--' 20 | | \ ==== | 21 | -`------/`--' / 22 | \___-' 23 | -------------------------------------------------------------------------------- /Source/Languages/TiggerC/TCSys.asm: -------------------------------------------------------------------------------- 1 | unit TCSys 2 | { 3 | Millis() 4 | { 5 | LDA # 4 6 | STA ZP.ACCL 7 | STZ ZP.ACCH 8 | Allocate.Allocate(); 9 | 10 | // return the 16 bit address of the start of the 4 timer tick bytes -> word[2] 11 | 12 | LDY # 3 13 | LDA ZP.TICK3 // all 4 get updated when you read TICK3 (on the emulator) 14 | STA [IDX], Y 15 | DEY 16 | LDA ZP.TICK2 17 | STA [IDX], Y 18 | DEY 19 | LDA ZP.TICK1 20 | STA [IDX], Y 21 | DEY 22 | LDA ZP.TICK0 23 | STA [IDX], Y 24 | } 25 | 26 | I2CScan() 27 | { 28 | TSX 29 | 30 | // return address 31 | INX 32 | INX 33 | 34 | // byte address : SP - 1 35 | INX 36 | LDA 0x0100, X 37 | 38 | // I2C address in A 39 | I2C.Scan(); 40 | if (Z) 41 | { 42 | LDA # 1 // found = true 43 | STA ZP.TOPL 44 | } 45 | else 46 | { 47 | // not found 48 | STZ ZP.TOPL 49 | } 50 | STZ ZP.TOPH 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Source/Languages/TiggerC/Testing/test.tc: -------------------------------------------------------------------------------- 1 | #define APPLE_I 2 | #define EXPERIMENTAL 3 | #define ZEROPAGEGLOBALS 4 | 5 | #include "../system" 6 | 7 | word ten = 10; 8 | 9 | func Empty() 10 | { 11 | writeWord(ten); 12 | } 13 | func FuncA(char[] arg) 14 | { 15 | puts(arg); 16 | } 17 | 18 | func FuncB(word a, word b) 19 | { 20 | puts("\n"); 21 | writeWord(a); 22 | puts("\n"); 23 | writeWord(b); 24 | puts("\n"); 25 | } 26 | 27 | func main() 28 | { 29 | FuncA("Hello"); 30 | FuncB(42, 84); 31 | Empty(); 32 | } 33 | -------------------------------------------------------------------------------- /Source/Languages/TiggerC/i2c.tc: -------------------------------------------------------------------------------- 1 | const byte SSD1306Address = 0x3C; 2 | const byte SerialEEPROMAddress = 0x50; 3 | 4 | 5 | func bool i2cScan(byte address); // true if found 6 | 7 | // EEPROM 8 | func writePage(word address, const byte[] data); // System function to write a 256 byte page of data to serial EEPROM 9 | func readPage(word address, byte[] buffer); // System function to read a 256 byte page page of data from serial EEPROM 10 | -------------------------------------------------------------------------------- /Source/Languages/TiggerC/time.tc: -------------------------------------------------------------------------------- 1 | #include "long.tc" 2 | #include "system.tc" 3 | 4 | // Timing 5 | func byte[] millis(); // System function to return a 4-byte array of the current millis count 6 | func delay(word milliseconds); // System function to delay execution for a specified time 7 | 8 | func word elapsedMillis(byte[] start) { 9 | byte[] end = millis(); 10 | byte[] elapsed = longSub(end, start); 11 | word msLow = elapsed[0] + ((elapsed[1] as word) << 8); 12 | free(elapsed); 13 | free(end); 14 | return msLow; 15 | } 16 | 17 | func word elapsedSeconds(byte[] start) { 18 | byte[] end = millis(); 19 | byte[] elapsed = longSub(end, start); 20 | word msLow = elapsed[0] + ((elapsed[1] as word) << 8); 21 | word msHigh = elapsed[2] + ((elapsed[3] as word) << 8); 22 | free(elapsed); 23 | free(end); 24 | 25 | // Convert msHigh to seconds and add to msLow converted to seconds 26 | word secondsHigh = msHigh / 1000; 27 | word secondsLow = msLow / 1000; 28 | 29 | word seconds = secondsLow + secondsHigh; 30 | 31 | return seconds; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Source/Library/Boards/AdafruitKb2040.hs: -------------------------------------------------------------------------------- 1 | unit Board // Adafruit Kb2040 2 | { 3 | #define ADAFRUIT_KB2040 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_NEOPIXEL 11 | #define BOARD_HAS_LED 12 | #define BOARD_HAS_I2C 13 | #define BOARD_HAS_NO_SPI1 14 | #define BOARD_HAS_SPI 15 | #define BOARD_HAS_A0 16 | #define BOARD_HAS_A1 17 | #define BOARD_HAS_A2 18 | #define BOARD_HAS_A3 19 | 20 | const byte BuiltInLED = 31; 21 | const byte BuiltInNeoPixel = 17; 22 | const byte BuiltInNeoPixelLength = 1; 23 | 24 | const byte A0 = 26; 25 | const byte A1 = 27; 26 | const byte A2 = 28; 27 | const byte A3 = 29; 28 | const byte ADCResolution = 12; 29 | 30 | const byte I2CSDA0 = 12; 31 | const byte I2CSCL0 = 13; 32 | const byte I2CSDA1 = 2; 33 | const byte I2CSCL1 = 3; 34 | 35 | const byte SPI0Tx = 19; 36 | const byte SPI0Rx = 20; 37 | const byte SPI0SCK = 18; 38 | const byte SPI0SS = 31; 39 | 40 | const byte UART1Tx = 0; 41 | const byte UART1Rx = 1; 42 | 43 | 44 | uses "/Source/Library/MCU" 45 | 46 | string BoardName { get { return "Adafruit Kb2040"; } } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Source/Library/Boards/AdafruitMacropad2040.hs: -------------------------------------------------------------------------------- 1 | unit Board // Adafruit Macropad2040 2 | { 3 | #define ADAFRUIT_MACROPAD2040 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_NEOPIXEL 11 | #define BOARD_HAS_LED 12 | #define BOARD_HAS_I2C 13 | #define BOARD_HAS_NO_I2C1 14 | #define BOARD_HAS_NO_SPI0 15 | #define BOARD_HAS_SPI 16 | #define BOARD_HAS_A0 17 | #define BOARD_HAS_A1 18 | #define BOARD_HAS_A2 19 | #define BOARD_HAS_A3 20 | 21 | const byte BuiltInLED = 13; 22 | const byte BuiltInNeoPixel = 19; 23 | const byte BuiltInNeoPixelLength = 12; 24 | 25 | const byte A0 = 26; 26 | const byte A1 = 27; 27 | const byte A2 = 28; 28 | const byte A3 = 29; 29 | const byte ADCResolution = 12; 30 | 31 | const byte I2CSDA0 = 20; 32 | const byte I2CSCL0 = 21; 33 | 34 | const byte SPI1Tx = 27; 35 | const byte SPI1Rx = 28; 36 | const byte SPI1SCK = 26; 37 | const byte SPI1SS = 31; 38 | 39 | 40 | uses "/Source/Library/MCU" 41 | 42 | string BoardName { get { return "Adafruit Macropad2040"; } } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Source/Library/Boards/AdafruitMetro.hs: -------------------------------------------------------------------------------- 1 | unit Board // Adafruit Metro 2 | { 3 | #define ADAFRUIT_METRO 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_NEOPIXEL 11 | #define BOARD_HAS_LED 12 | #define BOARD_HAS_I2C 13 | #define BOARD_HAS_NO_SPI1 14 | #define BOARD_HAS_SPI 15 | #define BOARD_HAS_A0 16 | #define BOARD_HAS_A1 17 | #define BOARD_HAS_A2 18 | #define BOARD_HAS_A3 19 | 20 | const byte BuiltInLED = 13; 21 | const byte BuiltInNeoPixel = 14; 22 | const byte BuiltInNeoPixelLength = 1; 23 | 24 | const byte A0 = 26; 25 | const byte A1 = 27; 26 | const byte A2 = 28; 27 | const byte A3 = 29; 28 | const byte ADCResolution = 12; 29 | 30 | const byte I2CSDA0 = 16; 31 | const byte I2CSCL0 = 17; 32 | const byte I2CSDA1 = 2; 33 | const byte I2CSCL1 = 3; 34 | 35 | const byte SPI0Tx = 19; 36 | const byte SPI0Rx = 20; 37 | const byte SPI0SCK = 18; 38 | const byte SPI0SS = 23; 39 | 40 | const byte UART1Tx = 0; 41 | const byte UART1Rx = 1; 42 | 43 | 44 | uses "/Source/Library/MCU" 45 | 46 | string BoardName { get { return "Adafruit Metro"; } } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Source/Library/Boards/Attribution.md: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | The RP2040 board definitions have been machine generated with the help 4 | of the board variants from EFP3's library (which is included 5 | by Hopper for the .uf2 for RP2040 and RP2350 boards). 6 | 7 | Here is the license for the code that was mined: 8 | 9 | 10 | 11 | Copyright (c) 2021 Earle F. Philhower, III 12 | 13 | This library is free software; you can redistribute it and/or 14 | modify it under the terms of the GNU Lesser General Public 15 | License as published by the Free Software Foundation; either 16 | version 2.1 of the License, or (at your option) any later version. 17 | 18 | This library is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | Lesser General Public License for more details. 22 | 23 | You should have received a copy of the GNU Lesser General Public 24 | License along with this library; if not, write to the Free Software 25 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 | 27 | */ -------------------------------------------------------------------------------- /Source/Library/Boards/BenEater6502.hs: -------------------------------------------------------------------------------- 1 | unit Board 2 | { 3 | #define MCU_BOARD_DEFINED 4 | 5 | const byte GP0 = 0; 6 | const byte GP1 = 1; 7 | const byte GP2 = 2; 8 | const byte GP3 = 3; 9 | const byte GP4 = 4; 10 | const byte GP5 = 5; 11 | const byte GP6 = 6; 12 | const byte GP7 = 7; 13 | 14 | const byte GP8 = 8; 15 | const byte GP9 = 9; 16 | const byte GP10 = 10; 17 | const byte GP11 = 11; 18 | const byte GP12 = 12; 19 | const byte GP13 = 13; 20 | const byte GP14 = 14; 21 | const byte GP15 = 15; 22 | 23 | const byte BuiltInLED = Board.GP0; 24 | 25 | const byte I2CSDA0 = 17; 26 | const byte I2CSCL0 = 16; 27 | 28 | #define BENEATER_IO 29 | 30 | const uint PORTB = 0x6000; 31 | const uint PORTA = 0x6001; 32 | const uint DDRB = 0x6002; 33 | const uint DDRA = 0x6003; 34 | 35 | uses "/Source/Minimal/System" 36 | uses "/Source/Minimal/MCU" 37 | 38 | string BoardName { get { return "Ben Eater 6502"; } } 39 | } 40 | -------------------------------------------------------------------------------- /Source/Library/Boards/CytronIrivIoController.hs: -------------------------------------------------------------------------------- 1 | unit Board // Cytron Iriv Io Controller 2 | { 3 | #define CYTRON_IRIV_IO_CONTROLLER 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_LED 11 | #define BOARD_HAS_I2C 12 | #define BOARD_HAS_NO_I2C1 13 | #define BOARD_HAS_NO_SPI1 14 | #define BOARD_HAS_SPI 15 | #define BOARD_HAS_A0 16 | #define BOARD_HAS_A1 17 | #define BOARD_HAS_A2 18 | #define BOARD_HAS_A3 19 | 20 | const byte BuiltInLED = 29; 21 | 22 | const byte A0 = 26; 23 | const byte A1 = 27; 24 | const byte A2 = 28; 25 | const byte A3 = 29; 26 | const byte ADCResolution = 12; 27 | 28 | const byte I2CSDA0 = 16; 29 | const byte I2CSCL0 = 17; 30 | 31 | const byte SPI0Tx = 19; 32 | const byte SPI0Rx = 20; 33 | const byte SPI0SCK = 22; 34 | const byte SPI0SS = 21; 35 | 36 | const byte UART2Tx = 24; 37 | const byte UART2Rx = 25; 38 | 39 | 40 | uses "/Source/Library/MCU" 41 | 42 | string BoardName { get { return "Cytron Iriv Io Controller"; } } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Source/Library/Boards/CytronMakerNanoRP2040.hs: -------------------------------------------------------------------------------- 1 | unit Board // Cytron Maker Nano RP2040 2 | { 3 | #define CYTRON_MAKER_NANO_RP2040 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_NEOPIXEL 11 | #define BOARD_HAS_LED 12 | #define BOARD_HAS_I2C 13 | #define BOARD_HAS_NO_SPI1 14 | #define BOARD_HAS_SPI 15 | #define BOARD_HAS_A0 16 | #define BOARD_HAS_A1 17 | #define BOARD_HAS_A2 18 | #define BOARD_HAS_A3 19 | 20 | const byte BuiltInLED = 2; 21 | const byte BuiltInNeoPixel = 11; 22 | const byte BuiltInNeoPixelLength = 2; 23 | 24 | const byte A0 = 26; 25 | const byte A1 = 27; 26 | const byte A2 = 28; 27 | const byte A3 = 29; 28 | const byte ADCResolution = 12; 29 | 30 | const byte I2CSDA0 = 0; 31 | const byte I2CSCL0 = 1; 32 | const byte I2CSDA1 = 26; 33 | const byte I2CSCL1 = 27; 34 | 35 | const byte SPI0Tx = 19; 36 | const byte SPI0Rx = 16; 37 | const byte SPI0SCK = 18; 38 | const byte SPI0SS = 17; 39 | 40 | const byte UART1Tx = 0; 41 | const byte UART1Rx = 1; 42 | 43 | 44 | uses "/Source/Library/MCU" 45 | 46 | string BoardName { get { return "Cytron Maker Nano RP2040"; } } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Source/Library/Boards/CytronMakerUnoRP2040.hs: -------------------------------------------------------------------------------- 1 | unit Board // Cytron Maker Uno RP2040 2 | { 3 | #define CYTRON_MAKER_UNO_RP2040 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_NEOPIXEL 11 | #define BOARD_HAS_LED 12 | #define BOARD_HAS_I2C 13 | #define BOARD_HAS_NO_SPI1 14 | #define BOARD_HAS_SPI 15 | #define BOARD_HAS_A0 16 | #define BOARD_HAS_A1 17 | #define BOARD_HAS_A2 18 | #define BOARD_HAS_A3 19 | 20 | const byte BuiltInLED = 3; 21 | const byte BuiltInNeoPixel = 25; 22 | const byte BuiltInNeoPixelLength = 2; 23 | 24 | const byte A0 = 26; 25 | const byte A1 = 27; 26 | const byte A2 = 28; 27 | const byte A3 = 29; 28 | const byte ADCResolution = 12; 29 | 30 | const byte I2CSDA0 = 20; 31 | const byte I2CSCL0 = 21; 32 | const byte I2CSDA1 = 26; 33 | const byte I2CSCL1 = 27; 34 | 35 | const byte SPI0Tx = 11; 36 | const byte SPI0Rx = 12; 37 | const byte SPI0SCK = 10; 38 | const byte SPI0SS = 13; 39 | 40 | const byte UART1Tx = 0; 41 | const byte UART1Rx = 1; 42 | 43 | 44 | uses "/Source/Library/MCU" 45 | 46 | string BoardName { get { return "Cytron Maker Uno RP2040"; } } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Source/Library/Boards/CytronMotion2350Pro.hs: -------------------------------------------------------------------------------- 1 | unit Board // Cytron Motion 2350 Pro 2 | { 3 | #define CYTRON_MOTION_2350_PRO 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2350 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_NEOPIXEL 11 | #define BOARD_HAS_LED 12 | #define BOARD_HAS_I2C 13 | #define BOARD_HAS_NO_SPI1 14 | #define BOARD_HAS_SPI 15 | #define BOARD_HAS_A0 16 | #define BOARD_HAS_A1 17 | #define BOARD_HAS_A2 18 | #define BOARD_HAS_A3 19 | 20 | const byte BuiltInLED = 2; 21 | const byte BuiltInNeoPixel = 23; 22 | const byte BuiltInNeoPixelLength = 2; 23 | 24 | const byte A0 = 26; 25 | const byte A1 = 27; 26 | const byte A2 = 28; 27 | const byte A3 = 29; 28 | const byte ADCResolution = 12; 29 | 30 | const byte I2CSDA0 = 16; 31 | const byte I2CSCL0 = 17; 32 | const byte I2CSDA1 = 26; 33 | const byte I2CSCL1 = 27; 34 | 35 | const byte SPI0Tx = 7; 36 | const byte SPI0Rx = 4; 37 | const byte SPI0SCK = 6; 38 | const byte SPI0SS = 5; 39 | 40 | const byte UART1Tx = 0; 41 | const byte UART1Rx = 1; 42 | 43 | 44 | uses "/Source/Library/MCU" 45 | 46 | string BoardName { get { return "Cytron Motion 2350 Pro"; } } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Source/Library/Boards/DFRobotBeetleRP2040.hs: -------------------------------------------------------------------------------- 1 | unit Board // DFRobot Beetle RP2040 2 | { 3 | #define DFROBOT_BEETLE_RP2040 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_LED 11 | #define BOARD_HAS_I2C 12 | #define BOARD_HAS_NO_SPI1 13 | #define BOARD_HAS_SPI 14 | #define BOARD_HAS_A0 15 | #define BOARD_HAS_A1 16 | #define BOARD_HAS_A2 17 | #define BOARD_HAS_A3 18 | 19 | const byte BuiltInLED = 13; 20 | 21 | const byte A0 = 26; 22 | const byte A1 = 27; 23 | const byte A2 = 28; 24 | const byte A3 = 29; 25 | const byte ADCResolution = 12; 26 | 27 | const byte I2CSDA0 = 4; 28 | const byte I2CSCL0 = 5; 29 | const byte I2CSDA1 = 2; 30 | const byte I2CSCL1 = 3; 31 | 32 | const byte SPI0Tx = 3; 33 | const byte SPI0Rx = 0; 34 | const byte SPI0SCK = 2; 35 | const byte SPI0SS = 1; 36 | 37 | const byte UART1Tx = 28; 38 | const byte UART1Rx = 29; 39 | const byte UART2Tx = 4; 40 | const byte UART2Rx = 5; 41 | 42 | 43 | uses "/Source/Library/MCU" 44 | 45 | string BoardName { get { return "DFRobot Beetle RP2040"; } } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Source/Library/Boards/Hopper6502.hs: -------------------------------------------------------------------------------- 1 | unit Board 2 | { 3 | #define MCU_BOARD_DEFINED 4 | #define HOPPER_6502_SBC 5 | 6 | const byte GP0 = 0; 7 | const byte GP1 = 1; 8 | const byte GP2 = 2; 9 | const byte GP3 = 3; 10 | const byte GP4 = 4; 11 | const byte GP5 = 5; 12 | const byte GP6 = 6; 13 | const byte GP7 = 7; 14 | 15 | const byte GP8 = 8; 16 | const byte GP9 = 9; 17 | const byte GP10 = 10; 18 | const byte GP11 = 11; 19 | const byte GP12 = 12; 20 | const byte GP13 = 13; 21 | const byte GP14 = 14; 22 | const byte GP15 = 15; 23 | 24 | const byte BuiltInLED = Board.GP0; 25 | 26 | const byte I2CSCL0 = GP8; 27 | const byte I2CSDA0 = GP9; 28 | 29 | #define ZEROPAGE_IO 30 | 31 | const byte PORTB = 0xF0; 32 | const byte PORTA = 0xF1; 33 | const byte DDRB = 0xF2; 34 | const byte DDRA = 0xF3; 35 | 36 | uses "/Source/Minimal/System" 37 | uses "/Source/Minimal/MCU" 38 | 39 | string BoardName { get { return "Hopper 6502 SBC"; } } 40 | } 41 | -------------------------------------------------------------------------------- /Source/Library/Boards/MECB6502.hs: -------------------------------------------------------------------------------- 1 | unit Board 2 | { 3 | #define MCU_BOARD_DEFINED 4 | #define MECB_6502 5 | #define M6821_PIA 6 | 7 | const byte GP0 = 0; 8 | const byte GP1 = 1; 9 | const byte GP2 = 2; 10 | const byte GP3 = 3; 11 | const byte GP4 = 4; 12 | const byte GP5 = 5; 13 | const byte GP6 = 6; 14 | const byte GP7 = 7; 15 | 16 | const byte GP8 = 8; 17 | const byte GP9 = 9; 18 | const byte GP10 = 10; 19 | const byte GP11 = 11; 20 | const byte GP12 = 12; 21 | const byte GP13 = 13; 22 | const byte GP14 = 14; 23 | const byte GP15 = 15; 24 | 25 | const byte BuiltInLED = Board.GP0; 26 | 27 | const byte I2CSDA0 = 17; 28 | const byte I2CSCL0 = 16; 29 | 30 | const uint PORTA = 0xF010; 31 | const uint PORTB = 0xF011; 32 | 33 | const uint CRA = 0xF012; // Control Register A 34 | const uint CRB = 0xF013; // Control Register B 35 | 36 | const uint DDRA = 0xF010; 37 | const uint DDRB = 0xF011; 38 | 39 | uses "/Source/Minimal/System" 40 | uses "/Source/Minimal/MCU" 41 | 42 | string BoardName { get { return "MECB 6502"; } } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Library/Boards/PD6502.hs: -------------------------------------------------------------------------------- 1 | unit Board 2 | { 3 | #define MCU_BOARD_DEFINED 4 | 5 | const byte GP0 = 0; 6 | const byte GP1 = 1; 7 | const byte GP2 = 2; 8 | const byte GP3 = 3; 9 | const byte GP4 = 4; 10 | const byte GP5 = 5; 11 | const byte GP6 = 6; 12 | const byte GP7 = 7; 13 | 14 | const byte GP8 = 8; 15 | const byte GP9 = 9; 16 | const byte GP10 = 10; 17 | const byte GP11 = 11; 18 | const byte GP12 = 12; 19 | const byte GP13 = 13; 20 | const byte GP14 = 14; 21 | const byte GP15 = 15; 22 | 23 | const byte BuiltInLED = Board.GP0; 24 | 25 | const byte I2CSDA0 = 17; 26 | const byte I2CSCL0 = 16; 27 | 28 | #define X16_IO 29 | const uint PORTB = 0x9F20; 30 | const uint PORTA = 0x9F21; 31 | const uint DDRB = 0x9F22; 32 | const uint DDRA = 0x9F23; 33 | 34 | uses "/Source/Minimal/System" 35 | uses "/Source/Minimal/MCU" 36 | 37 | string BoardName { get { return "PD6502"; } } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Library/Boards/PimoroniPGA2040.hs: -------------------------------------------------------------------------------- 1 | unit Board // Pimoroni PGA2040 2 | { 3 | #define PIMORONI_PGA2040 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_LED 11 | #define BOARD_HAS_I2C 12 | #define BOARD_HAS_SPI 13 | #define BOARD_HAS_A0 14 | #define BOARD_HAS_A1 15 | #define BOARD_HAS_A2 16 | #define BOARD_HAS_A3 17 | 18 | const byte BuiltInLED = 25; 19 | 20 | const byte A0 = 26; 21 | const byte A1 = 27; 22 | const byte A2 = 28; 23 | const byte A3 = 29; 24 | const byte ADCResolution = 12; 25 | 26 | const byte I2CSDA0 = 4; 27 | const byte I2CSCL0 = 5; 28 | const byte I2CSDA1 = 26; 29 | const byte I2CSCL1 = 27; 30 | 31 | const byte SPI0Tx = 19; 32 | const byte SPI0Rx = 16; 33 | const byte SPI0SCK = 18; 34 | const byte SPI0SS = 17; 35 | const byte SPI1Tx = 15; 36 | const byte SPI1Rx = 12; 37 | const byte SPI1SCK = 14; 38 | const byte SPI1SS = 13; 39 | 40 | const byte UART1Tx = 0; 41 | const byte UART1Rx = 1; 42 | const byte UART2Tx = 8; 43 | const byte UART2Rx = 9; 44 | 45 | 46 | uses "/Source/Library/MCU" 47 | 48 | string BoardName { get { return "Pimoroni PGA2040"; } } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /Source/Library/Boards/PimoroniPGA2350.hs: -------------------------------------------------------------------------------- 1 | unit Board // Pimoroni PGA2350 2 | { 3 | #define PIMORONI_PGA2350 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2350 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_LED 11 | #define BOARD_HAS_I2C 12 | #define BOARD_HAS_SPI 13 | #define BOARD_HAS_A0 14 | #define BOARD_HAS_A1 15 | #define BOARD_HAS_A2 16 | #define BOARD_HAS_A3 17 | 18 | const byte BuiltInLED = 25; 19 | 20 | const byte A0 = 26; 21 | const byte A1 = 27; 22 | const byte A2 = 28; 23 | const byte A3 = 29; 24 | const byte ADCResolution = 12; 25 | 26 | const byte I2CSDA0 = 4; 27 | const byte I2CSCL0 = 5; 28 | const byte I2CSDA1 = 26; 29 | const byte I2CSCL1 = 27; 30 | 31 | const byte SPI0Tx = 19; 32 | const byte SPI0Rx = 16; 33 | const byte SPI0SCK = 18; 34 | const byte SPI0SS = 17; 35 | const byte SPI1Tx = 15; 36 | const byte SPI1Rx = 12; 37 | const byte SPI1SCK = 14; 38 | const byte SPI1SS = 13; 39 | 40 | const byte UART1Tx = 0; 41 | const byte UART1Rx = 1; 42 | const byte UART2Tx = 8; 43 | const byte UART2Rx = 9; 44 | 45 | 46 | uses "/Source/Library/MCU" 47 | 48 | string BoardName { get { return "Pimoroni PGA2350"; } } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /Source/Library/Boards/SeeedIndicatorRP2040.hs: -------------------------------------------------------------------------------- 1 | unit Board // Seeed Indicator RP2040 2 | { 3 | #define SEEED_INDICATOR_RP2040 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_I2C 11 | #define BOARD_HAS_SPI 12 | #define BOARD_HAS_A0 13 | #define BOARD_HAS_A1 14 | #define BOARD_HAS_A2 15 | #define BOARD_HAS_A3 16 | 17 | const byte A0 = 26; 18 | const byte A1 = 27; 19 | const byte A2 = 28; 20 | const byte A3 = 29; 21 | const byte ADCResolution = 12; 22 | 23 | const byte I2CSDA0 = 20; 24 | const byte I2CSCL0 = 21; 25 | const byte I2CSDA1 = 14; 26 | const byte I2CSCL1 = 15; 27 | 28 | const byte SPI0Tx = 3; 29 | const byte SPI0Rx = 0; 30 | const byte SPI0SCK = 2; 31 | const byte SPI0SS = 1; 32 | const byte SPI1Tx = 11; 33 | const byte SPI1Rx = 12; 34 | const byte SPI1SCK = 10; 35 | const byte SPI1SS = 13; 36 | 37 | const byte UART1Tx = 16; 38 | const byte UART1Rx = 17; 39 | const byte UART2Tx = 8; 40 | const byte UART2Rx = 9; 41 | 42 | 43 | uses "/Source/Library/MCU" 44 | 45 | string BoardName { get { return "Seeed Indicator RP2040"; } } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Source/Library/Boards/SolderpartyRP2350Stamp.hs: -------------------------------------------------------------------------------- 1 | unit Board // Solderparty RP2350 Stamp 2 | { 3 | #define SOLDERPARTY_RP2350_STAMP 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2350 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_LED 11 | #define BOARD_HAS_I2C 12 | #define BOARD_HAS_SPI 13 | #define BOARD_HAS_A0 14 | #define BOARD_HAS_A1 15 | #define BOARD_HAS_A2 16 | #define BOARD_HAS_A3 17 | 18 | const byte BuiltInLED = 3; 19 | 20 | const byte A0 = 26; 21 | const byte A1 = 27; 22 | const byte A2 = 28; 23 | const byte A3 = 29; 24 | const byte ADCResolution = 12; 25 | 26 | const byte I2CSDA0 = 4; 27 | const byte I2CSCL0 = 5; 28 | const byte I2CSDA1 = 2; 29 | const byte I2CSCL1 = 3; 30 | 31 | const byte SPI0Tx = 23; 32 | const byte SPI0Rx = 20; 33 | const byte SPI0SCK = 22; 34 | const byte SPI0SS = 21; 35 | const byte SPI1Tx = 11; 36 | const byte SPI1Rx = 8; 37 | const byte SPI1SCK = 10; 38 | const byte SPI1SS = 9; 39 | 40 | const byte UART1Tx = 0; 41 | const byte UART1Rx = 1; 42 | const byte UART2Tx = 24; 43 | const byte UART2Rx = 25; 44 | 45 | 46 | uses "/Source/Library/MCU" 47 | 48 | string BoardName { get { return "Solderparty RP2350 Stamp"; } } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /Source/Library/Boards/SparkfunProMicrorp2350.hs: -------------------------------------------------------------------------------- 1 | unit Board // Sparkfun ProMicro rp2350 2 | { 3 | #define SPARKFUN_PROMICRORP2350 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2350 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_NEOPIXEL 11 | #define BOARD_HAS_LED 12 | #define BOARD_HAS_I2C 13 | #define BOARD_HAS_NO_I2C1 14 | #define BOARD_HAS_NO_SPI1 15 | #define BOARD_HAS_SPI 16 | #define BOARD_HAS_A0 17 | #define BOARD_HAS_A1 18 | #define BOARD_HAS_A2 19 | #define BOARD_HAS_A3 20 | 21 | const byte BuiltInLED = 25; 22 | const byte BuiltInNeoPixel = 25; 23 | const byte BuiltInNeoPixelLength = 1; 24 | 25 | const byte A0 = 26; 26 | const byte A1 = 27; 27 | const byte A2 = 28; 28 | const byte A3 = 29; 29 | const byte ADCResolution = 12; 30 | 31 | const byte I2CSDA0 = 16; 32 | const byte I2CSCL0 = 17; 33 | 34 | const byte SPI0Tx = 23; 35 | const byte SPI0Rx = 20; 36 | const byte SPI0SCK = 22; 37 | const byte SPI0SS = 21; 38 | 39 | const byte UART1Tx = 0; 40 | const byte UART1Rx = 1; 41 | const byte UART2Tx = 8; 42 | const byte UART2Rx = 9; 43 | 44 | 45 | uses "/Source/Library/MCU" 46 | 47 | string BoardName { get { return "Sparkfun ProMicro rp2350"; } } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Source/Library/Boards/WaveshareRP2040LCD096.hs: -------------------------------------------------------------------------------- 1 | unit Board // Waveshare RP2040 LCD 0.96 2 | { 3 | #define WAVESHARE_RP2040_LCD_096 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_I2C 11 | #define BOARD_HAS_SPI 12 | #define BOARD_HAS_A0 13 | #define BOARD_HAS_A1 14 | #define BOARD_HAS_A2 15 | #define BOARD_HAS_A3 16 | 17 | const byte A0 = 26; 18 | const byte A1 = 27; 19 | const byte A2 = 28; 20 | const byte A3 = 29; 21 | const byte ADCResolution = 12; 22 | 23 | const byte I2CSDA0 = 8; 24 | const byte I2CSCL0 = 9; 25 | const byte I2CSDA1 = 6; 26 | const byte I2CSCL1 = 7; 27 | 28 | const byte SPI0Tx = 19; 29 | const byte SPI0Rx = 16; 30 | const byte SPI0SCK = 18; 31 | const byte SPI0SS = 17; 32 | const byte SPI1Tx = 15; 33 | const byte SPI1Rx = 12; 34 | const byte SPI1SCK = 14; 35 | const byte SPI1SS = 13; 36 | 37 | const byte UART1Tx = 0; 38 | const byte UART1Rx = 1; 39 | const byte UART2Tx = 8; 40 | const byte UART2Rx = 9; 41 | 42 | 43 | uses "/Source/Library/MCU" 44 | 45 | string BoardName { get { return "Waveshare RP2040 LCD 0.96"; } } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Source/Library/Boards/WaveshareRP2040LCD128.hs: -------------------------------------------------------------------------------- 1 | unit Board // Waveshare RP2040 LCD 1.28 2 | { 3 | #define WAVESHARE_RP2040_LCD_128 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_I2C 11 | #define BOARD_HAS_SPI 12 | #define BOARD_HAS_A0 13 | #define BOARD_HAS_A1 14 | #define BOARD_HAS_A2 15 | #define BOARD_HAS_A3 16 | 17 | const byte A0 = 26; 18 | const byte A1 = 27; 19 | const byte A2 = 28; 20 | const byte A3 = 29; 21 | const byte ADCResolution = 12; 22 | 23 | const byte I2CSDA0 = 8; 24 | const byte I2CSCL0 = 9; 25 | const byte I2CSDA1 = 6; 26 | const byte I2CSCL1 = 7; 27 | 28 | const byte SPI0Tx = 19; 29 | const byte SPI0Rx = 16; 30 | const byte SPI0SCK = 18; 31 | const byte SPI0SS = 17; 32 | const byte SPI1Tx = 15; 33 | const byte SPI1Rx = 12; 34 | const byte SPI1SCK = 14; 35 | const byte SPI1SS = 13; 36 | 37 | const byte UART1Tx = 0; 38 | const byte UART1Rx = 1; 39 | const byte UART2Tx = 8; 40 | const byte UART2Rx = 9; 41 | 42 | 43 | uses "/Source/Library/MCU" 44 | 45 | string BoardName { get { return "Waveshare RP2040 LCD 1.28"; } } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Source/Library/Boards/WaveshareRP2040Pizero.hs: -------------------------------------------------------------------------------- 1 | unit Board // Waveshare RP2040 Pizero 2 | { 3 | #define WAVESHARE_RP2040_PIZERO 4 | 5 | #define MCU_BOARD_DEFINED 6 | #define MCU_BOARD_RP2040 7 | 8 | // Note: see Attribution.md (in the same folder as this file) 9 | 10 | #define BOARD_HAS_I2C 11 | #define BOARD_HAS_SPI 12 | #define BOARD_HAS_A0 13 | #define BOARD_HAS_A1 14 | #define BOARD_HAS_A2 15 | #define BOARD_HAS_A3 16 | 17 | const byte A0 = 26; 18 | const byte A1 = 27; 19 | const byte A2 = 28; 20 | const byte A3 = 29; 21 | const byte ADCResolution = 12; 22 | 23 | const byte I2CSDA0 = 4; 24 | const byte I2CSCL0 = 5; 25 | const byte I2CSDA1 = 26; 26 | const byte I2CSCL1 = 27; 27 | 28 | const byte SPI0Tx = 19; 29 | const byte SPI0Rx = 20; 30 | const byte SPI0SCK = 18; 31 | const byte SPI0SS = 21; 32 | const byte SPI1Tx = 15; 33 | const byte SPI1Rx = 12; 34 | const byte SPI1SCK = 14; 35 | const byte SPI1SS = 13; 36 | 37 | const byte UART1Tx = 0; 38 | const byte UART1Rx = 1; 39 | const byte UART2Tx = 8; 40 | const byte UART2Rx = 9; 41 | 42 | 43 | uses "/Source/Library/MCU" 44 | 45 | string BoardName { get { return "Waveshare RP2040 Pizero"; } } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Source/Library/Devices/AdafruitAdaloggerRTCSDFeatherwing.hs: -------------------------------------------------------------------------------- 1 | unit RTCDevice 2 | { 3 | 4 | #if !defined(MCU_BOARD_DEFINED) 5 | uses "/Source/Library/Boards/AdafruitFeather" // good default since it is a FeatherWing 6 | #endif 7 | 8 | uses "/Source/Library/RTCs/PCF8523Driver" 9 | 10 | bool Begin() 11 | { 12 | bool success; 13 | loop 14 | { 15 | 16 | SD.SPIController = 0; 17 | SD.ClkPin = Board.SPI0SCK; 18 | SD.TxPin = Board.SPI0Tx; 19 | SD.RxPin = Board.SPI0Rx; 20 | 21 | SD.CSPin = Board.GP10; 22 | 23 | /* Don't fail if there is no SD card in the board: 24 | if (!SD.Mount()) 25 | { 26 | break; 27 | } 28 | */ 29 | 30 | // Wire defaults should be correct since it is a FeatherWing: 31 | if (!RTCDriver.begin(Wire.DefaultI2CController, Wire.DefaultI2CSDAPin, Wire.DefaultI2CSCLPin, 0x68)) 32 | { 33 | break; 34 | } 35 | success = true; 36 | break; 37 | } 38 | return success; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Source/Library/Devices/AdafruitDS3231PrecisionRTCFeatherwing.hs: -------------------------------------------------------------------------------- 1 | unit RTCDevice 2 | { 3 | 4 | #if !defined(MCU_BOARD_DEFINED) 5 | uses "/Source/Library/Boards/AdafruitFeather" // good default since it is a FeatherWing 6 | #endif 7 | 8 | uses "/Source/Library/RTCs/DS3231Driver" 9 | 10 | bool Begin() 11 | { 12 | // Wire defaults should be correct since it is a FeatherWing: 13 | return RTCDriver.begin(Wire.DefaultI2CController, Wire.DefaultI2CSDAPin, Wire.DefaultI2CSCLPin, 0x68); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Source/Library/Devices/AdafruitEInk213Mono.hs: -------------------------------------------------------------------------------- 1 | unit DeviceDriver 2 | { 3 | #if !defined(MCU_BOARD_DEFINED) 4 | uses "/Source/Library/Boards/AdafruitFeather" // avoid modifying the automatically generated Board file 5 | #endif 6 | 7 | friend DisplayDriver; 8 | 9 | const int pw = 250; 10 | const int ph = 122; 11 | 12 | uses "/Source/Library/Displays/EPDSSD1680.hs" 13 | 14 | #define EPD_NO_RX 15 | 16 | const byte sdCS = Board.GP7; // SD 17 | const byte srCS = Board.GP8; // SRAM 18 | const byte csPin = Board.GP9; // E-Ink 19 | 20 | const byte dcPin = Board.GP10; 21 | const byte clkPin = Board.SPI0SCK; 22 | const byte txPin = Board.SPI0Tx; 23 | const byte spiController = 0; 24 | 25 | const uint defaultRefreshDelay = 1; // seconds 26 | 27 | const bool epdBlack0 = true; 28 | const bool epdRed0 = true; 29 | const bool epdWhite0 = false; 30 | 31 | bool Begin() 32 | { 33 | // https://learn.adafruit.com/adafruit-eink-display-breakouts/pinouts-2 34 | // Settings for Hopper SD unit: 35 | SD.SPIController = 0; 36 | SD.ClkPin = Board.SPI0SCK; 37 | SD.TxPin = Board.SPI0Tx; 38 | SD.RxPin = Board.SPI0Rx; 39 | SD.CSPin = sdCS; 40 | 41 | return Display.Begin(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Library/Devices/AdafruitMetro.hs: -------------------------------------------------------------------------------- 1 | unit BoardDevice 2 | { 3 | #if !defined(MCU_BOARD_DEFINED) 4 | uses "/Source/Library/Boards/AdafruitMetro" // avoid modifying the automatically generated Board file 5 | #endif 6 | 7 | bool Begin() 8 | { 9 | bool success; 10 | loop 11 | { 12 | // https://learn.adafruit.com/adafruit-metro-rp2040/sd-card-example 13 | // Settings for Hopper SD unit: 14 | SD.SPIController = 0; 15 | SD.ClkPin = Board.SPI0SCK; 16 | SD.TxPin = Board.SPI0Tx; 17 | SD.RxPin = Board.SPI0Rx; 18 | SD.CSPin = Board.SPI0SS; 19 | 20 | success = true; 21 | break; 22 | } 23 | return success; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Source/Library/Devices/Challenger2040SDRTC.hs: -------------------------------------------------------------------------------- 1 | unit BoardDevice 2 | { 3 | 4 | #if !defined(MCU_BOARD_DEFINED) 5 | uses "/Source/Library/Boards/Challenger2040SDRTC" // avoid modifying the automatically generated Board file 6 | #endif 7 | 8 | uses "/Source/Library/RTCs/MCP79410Driver" 9 | 10 | const byte IntPin = 25; 11 | const byte DetectPin = 13; 12 | 13 | bool SDPresent { get { return !DigitalRead(DetectPin); } } 14 | 15 | bool Begin() 16 | { 17 | bool success; 18 | loop 19 | { 20 | MCU.PinMode(DetectPin, PinModeOption.Input); 21 | 22 | // https://ilabs.se/challenger-rp2040-sd-rtc-datasheet/ 23 | // Settings for Hopper SD unit: 24 | SD.SPIController = 1; 25 | SD.ClkPin = 10; 26 | SD.TxPin = 11; 27 | SD.RxPin = 12; 28 | SD.CSPin = 9; 29 | 30 | if (!RTCDriver.begin(Wire.DefaultI2CController, Wire.DefaultI2CSDAPin, Wire.DefaultI2CSCLPin, 0x6F)) 31 | { 32 | break; 33 | } 34 | success = true; 35 | break; 36 | } 37 | return success; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Source/Library/Devices/Generic320x240TFT.hs: -------------------------------------------------------------------------------- 1 | unit DeviceDriver 2 | { 3 | 4 | #if !defined(MCU_BOARD_DEFINED) 5 | uses "/Source/Library/Boards/PiPico" 6 | #endif 7 | 8 | // TODO TFT uses "/Source/Library/Displays/EPDIL0373.hs" 9 | 10 | friend DisplayDriver; 11 | 12 | const int pw = 320; 13 | const int ph = 240; 14 | 15 | // Adafruit Feather defaults 16 | byte spi = 0; 17 | byte sdCS = Board.GP7; // SD 18 | byte sck = Board.GP18; 19 | byte tx = Board.GP19; 20 | byte rx = Board.GP20; 21 | 22 | byte SPIController { get { return spi; } set { spi = value; } } 23 | byte SPISCK { get { return sck; } set { sck = value; } } 24 | byte SPITx { get { return tx; } set { tx = value; } } 25 | byte SPIRx { get { return rx; } set { rx = value; } } 26 | byte SDCS { get { return sdCS; } set { sdCS = value; } } 27 | 28 | bool Begin() 29 | { 30 | // https://learn.adafruit.com/adafruit-1-14-240x135-color-tft-breakout 31 | 32 | // Settings for Hopper SD unit: 33 | SD.SPIController = spi; 34 | SD.ClkPin = sck; 35 | SD.TxPin = tx; 36 | SD.RxPin = rx; 37 | SD.CSPin = sdCS; 38 | 39 | return true; // TODO : Display.Begin(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Source/Library/Devices/GenericRTC.hs: -------------------------------------------------------------------------------- 1 | unit RTCDevice 2 | { 3 | bool Begin() 4 | { 5 | return RTCDriver.begin(Wire.DefaultI2CController, Wire.DefaultI2CSDAPin, Wire.DefaultI2CSCLPin, 0x68); 6 | } 7 | 8 | bool Begin(byte i2cController, byte sdaPin, byte sclPin, byte address) 9 | { 10 | return RTCDriver.begin(i2cController, sdaPin, sclPin, address); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Source/Library/Devices/HW111RTC.hs: -------------------------------------------------------------------------------- 1 | unit RTCDevice 2 | { 3 | uses "/Source/Library/RTCs/DS1307Driver" 4 | 5 | bool Begin() 6 | { 7 | return RTCDriver.begin(Wire.DefaultI2CController, Wire.DefaultI2CSDAPin, Wire.DefaultI2CSCLPin, 0x68); 8 | } 9 | 10 | bool Begin(byte i2cController, byte sdaPin, byte sclPin, byte address) 11 | { 12 | return RTCDriver.begin(i2cController, sdaPin, sclPin, address); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Source/Library/Devices/SparkfunThingPlusRP2040.hs: -------------------------------------------------------------------------------- 1 | unit BoardDevice 2 | { 3 | 4 | #if !defined(MCU_BOARD_DEFINED) 5 | uses "/Source/Library/Boards/SparkfunThingPlusRP2040" // avoid modifying the automatically generated Board file 6 | #endif 7 | 8 | // TODO: Flash Memory - 16MB in a W25Q128JVPIM chip 9 | 10 | bool Begin() 11 | { 12 | bool success; 13 | loop 14 | { 15 | // https://learn.sparkfun.com/tutorials/rp2040-thing-plus-hookup-guide/hardware-overview 16 | // Settings for Hopper SD unit: 17 | SD.SPIController = 1; 18 | SD.ClkPin = Board.SPI1SCK; 19 | SD.TxPin = Board.SPI1Tx; 20 | SD.RxPin = Board.SPI1Rx; 21 | SD.CSPin = Board.SPI1SS; 22 | 23 | success = true; 24 | break; 25 | } 26 | return success; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Source/Library/Devices/WSPicoRTCDS3231.hs: -------------------------------------------------------------------------------- 1 | unit RTCDevice 2 | { 3 | 4 | #if !defined(MCU_BOARD_DEFINED) 5 | uses "/Source/Library/Boards/PiPico" 6 | #endif 7 | 8 | uses "/Source/Library/RTCs/DS3231Driver" 9 | 10 | bool Begin() 11 | { 12 | return RTCDriver.begin(0, Board.GP20, Board.GP21, 0x68); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Source/Library/Devices/WSPicoePaper213.hs: -------------------------------------------------------------------------------- 1 | unit DeviceDriver 2 | { 3 | // TODO : not working yet (in progress) 4 | 5 | #if !defined(MCU_BOARD_DEFINED) 6 | // plugs directly into the Pi Pico so no board defined, assume generic Pi Pico 7 | uses "/Source/Library/Boards/PiPico" 8 | #endif 9 | 10 | // https://www.waveshare.com/wiki/Pico-ePaper-2.13 11 | #define WAVESHARE_PICO_ePAPER_213 12 | #define HAS_RESET_PIN 13 | 14 | uses "/Source/Library/Displays/UC8151Driver" 15 | 16 | friend DisplayDriver; 17 | 18 | const int pw = 250; 19 | const int ph = 122; 20 | 21 | const byte spiController = 1; 22 | 23 | const byte dcPin = Board.GP8; 24 | const byte csPin = Board.GP9; 25 | const byte clkPin = Board.GP10; 26 | const byte txPin = Board.GP11; 27 | const byte rstPin = Board.GP12; 28 | const byte busyPin = Board.GP13; 29 | 30 | bool Begin() 31 | { 32 | return Display.Begin(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/Library/Devices/WSPicoePaper290.hs: -------------------------------------------------------------------------------- 1 | unit DeviceDriver 2 | { 3 | // TODO : not working yet (in progress) 4 | 5 | #if !defined(MCU_BOARD_DEFINED) 6 | // plugs directly into the Pi Pico so no board defined, assume generic Pi Pico 7 | uses "/Source/Library/Boards/PiPico" 8 | #endif 9 | 10 | // https://www.waveshare.com/wiki/Pico-ePaper-2.90 11 | #define WAVESHARE_PICO_ePAPER_290 12 | #define HAS_RESET_PIN 13 | #define HAS_RED 14 | 15 | uses "/Source/Library/Displays/UC8151Driver" 16 | 17 | friend DisplayDriver; 18 | 19 | const int pw = 296; 20 | const int ph = 128; 21 | 22 | const byte spiController = 1; 23 | 24 | const byte dcPin = Board.GP8; 25 | const byte csPin = Board.GP9; 26 | const byte clkPin = Board.GP10; 27 | const byte txPin = Board.GP11; 28 | const byte rstPin = Board.GP12; 29 | const byte busyPin = Board.GP13; 30 | 31 | bool Begin() 32 | { 33 | return Display.Begin(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Source/Library/SD.hs: -------------------------------------------------------------------------------- 1 | unit SD 2 | { 3 | byte SPIController { get library; set library; } 4 | 5 | byte CSPin { get library; set library; } 6 | byte ClkPin { get library; set library; } 7 | byte TxPin { get library; set library; } // MOSI 8 | byte RxPin { get library; set library; } // MISO 9 | 10 | bool Mount() library; 11 | Eject() library; 12 | } 13 | -------------------------------------------------------------------------------- /Source/Library/Timer.hs: -------------------------------------------------------------------------------- 1 | unit Timer 2 | { 3 | delegate TimerISRDelegate(uint timerID); 4 | 5 | // Timers: repeating 6 | uint Start(uint msInterval, TimerISRDelegate timerISR) library; 7 | uint Start(long msInterval, TimerISRDelegate timerISR) library; 8 | Stop(uint timerID) library; 9 | 10 | // Alarms: one-shot 11 | uint Alarm(uint msInterval, TimerISRDelegate timerISR) library; 12 | uint Alarm(long msInterval, TimerISRDelegate timerISR) library; 13 | Cancel(uint alarmID) library; 14 | } 15 | -------------------------------------------------------------------------------- /Source/Library/UART.hs: -------------------------------------------------------------------------------- 1 | unit UART 2 | { 3 | Setup (uint baud, byte txPin, byte rxPin) library; 4 | Setup() 5 | { 6 | Setup(9600, UART0Tx, UART0Rx); 7 | } 8 | Setup(uint baud) 9 | { 10 | Setup(baud, UART0Tx, UART0Rx); 11 | } 12 | 13 | bool IsAvailable { get library; } 14 | char ReadChar() library; 15 | WriteChar(char ch) library; 16 | 17 | WriteString(string str) 18 | { 19 | foreach (var ch in str) 20 | { 21 | UART.WriteChar(ch); 22 | Time.Delay(10); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Source/Library/WebClient.hs: -------------------------------------------------------------------------------- 1 | unit WebClient 2 | { 3 | // or just call this .. ;-) 4 | bool GetRequest(string url, ref string response) library; 5 | } 6 | -------------------------------------------------------------------------------- /Source/Library/WebServer.hs: -------------------------------------------------------------------------------- 1 | unit WebServer 2 | { 3 | delegate HandlerDelegate(string uri, string method, arguments); 4 | 5 | Begin() library; // default is port=80 6 | Begin(uint port) library; 7 | Close() library; 8 | Events() library; 9 | 10 | Send(uint httpCode, headerContent, string content) library; 11 | Send(uint httpCode, string contentType, string content) 12 | { 13 | headerContent; 14 | headerContent["Content-Type"] = contentType; 15 | Send(httpCode, headerContent, content); 16 | } 17 | Send(string content) 18 | { 19 | Send(200, "text/plain", content); 20 | } 21 | 22 | On(string uri, HandlerDelegate handler) library; 23 | OnNotFound(HandlerDelegate handler) library; 24 | } 25 | -------------------------------------------------------------------------------- /Source/Minimal/Array.hs: -------------------------------------------------------------------------------- 1 | unit Array 2 | { 3 | uint Count { get system; } 4 | #ifndef CPU_Z80 5 | SetItem(V[] this, uint index, V value) system; 6 | V GetItem(V[] this, uint index) system; 7 | 8 | V[] New(uint length, type elementType) system; 9 | type ItemType { get system; } 10 | V[] Slice(V[] this, uint start) 11 | { 12 | uint length; 13 | uint sLength = this.Count; 14 | if (sLength > start) 15 | { 16 | length = sLength - start; 17 | } 18 | V[] result = Array.New(length, this.ItemType); 19 | for (uint i = 0; i < length; i++) 20 | { 21 | Array.SetItem(result, i, Array.GetItem(this, i+start)); 22 | } 23 | return result; 24 | } 25 | V[] Slice(V[] this, uint start, uint length) 26 | { 27 | uint sLength = this.Count; 28 | if (start + length > sLength) 29 | { 30 | length = sLength - start; 31 | } 32 | V[] result = Array.New(length, this.ItemType); 33 | for (uint i = 0; i < length; i++) 34 | { 35 | Array.SetItem(result, i, Array.GetItem(this, i+start)); 36 | } 37 | return result; 38 | } 39 | 40 | 41 | #endif 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Source/Minimal/Bool.hs: -------------------------------------------------------------------------------- 1 | unit Bool 2 | { 3 | // Converts a boolean to its string representation: "true" or "false" 4 | string ToString(bool this) 5 | { 6 | if (this) 7 | { 8 | return "true"; 9 | } 10 | else 11 | { 12 | return "false"; 13 | } 14 | } 15 | 16 | // Converts a string to a boolean value. Returns true if string is "true", false otherwise. 17 | bool TryParse(string content, ref bool returnValue) 18 | { 19 | if (content.ToLower() == "true") 20 | { 21 | returnValue = true; 22 | return true; 23 | } 24 | else if (content.ToLower() == "false") 25 | { 26 | returnValue = false; 27 | return true; 28 | } 29 | return false; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Source/Minimal/Diagnostics.hs: -------------------------------------------------------------------------------- 1 | unit Diagnostics 2 | { 3 | Die(uint error) system; 4 | #ifdef CPU_Z80 5 | SetError(uint error) system; 6 | #endif 7 | } 8 | -------------------------------------------------------------------------------- /Source/Minimal/GC.hs: -------------------------------------------------------------------------------- 1 | unit GC 2 | { 3 | 4 | -------------------------------------------------------------------------------- /Source/Minimal/List.hs: -------------------------------------------------------------------------------- 1 | unit List 2 | { 3 | uint Count { get system; } 4 | Append( this, V value) system; 5 | Remove( this, uint index) system; 6 | V GetItem( this, uint index) system; 7 | SetItem( this, uint index, V value) system; 8 | Insert( this, uint index, V value) system; 9 | Clear( this) system; 10 | 11 | bool Contains( this, V value) system; 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Source/Minimal/Memory.hs: -------------------------------------------------------------------------------- 1 | unit Memory 2 | { 3 | byte ReadByte(uint address) system; 4 | WriteByte(uint address, byte value) system; 5 | #ifndef CPU_Z80 6 | uint ReadWord(uint address) { return ReadByte(address) + ReadByte(address+1) << 8; } 7 | WriteWord(uint address, uint value) { WriteByte(address, byte(value & 0xFF)); WriteByte(address+1, byte(value>> 8)); } 8 | #else 9 | uint ReadWord(uint address) system; 10 | WriteWord(uint address, uint value) system; 11 | #endif 12 | uint Allocate(uint size) system; 13 | Free(uint address) system; 14 | uint Available() system; 15 | uint Maximum() system; 16 | } 17 | -------------------------------------------------------------------------------- /Source/Minimal/Runtime.hs: -------------------------------------------------------------------------------- 1 | unit Runtime 2 | { 3 | #if defined(HOPPER_6502_SBC) || defined(MCU) 4 | // used from RTC.SetFromDebugger(..) 5 | bool InDebugger { get system; } 6 | string DateTime { get system; } 7 | #endif 8 | } 9 | -------------------------------------------------------------------------------- /Source/Minimal/Serial.hs: -------------------------------------------------------------------------------- 1 | unit Serial 2 | { 3 | #if !defined(MINIMAL_RUNTIME) && !defined(CPU_Z80) 4 | Connect() system; 5 | #endif 6 | WriteChar(char ch) system; 7 | char ReadChar() system; 8 | bool IsAvailable { get system; } 9 | } 10 | -------------------------------------------------------------------------------- /Source/Minimal/System.hs: -------------------------------------------------------------------------------- 1 | unit System 2 | { 3 | #define MINIMAL_RUNTIME 4 | #ifdef CPU_Z80 5 | #define NO_JIX_INSTRUCTIONS 6 | #endif 7 | //#define NO_PACKED_INSTRUCTIONS 8 | 9 | uses "Char" 10 | uses "Bool" 11 | uses "Byte" 12 | uses "Int" 13 | uses "UInt" 14 | uses "Time" 15 | uses "String" 16 | uses "Array" 17 | uses "Type" 18 | 19 | uses "Long" 20 | uses "Float" 21 | uses "List" 22 | 23 | uses "Path" 24 | 25 | uses "Serial" 26 | uses "Diagnostics" 27 | 28 | uses "Runtime" 29 | 30 | #if defined(BLOCKFILESYSTEM) 31 | string CurrentDirectory 32 | { 33 | get { return FileSystem.getCwd(); } 34 | set { _ = FileSystem.chDir(value); } // error check? 35 | } 36 | #endif 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Source/Minimal/Time.hs: -------------------------------------------------------------------------------- 1 | unit Time 2 | { 3 | Delay(uint ms) system; 4 | DelaySeconds(uint s) 5 | { 6 | s *= 2; 7 | for (uint i=0; i < s; i++) 8 | { 9 | Delay(500); // allows debugger to break into long delays 10 | } 11 | } 12 | uint Seconds { get system; } 13 | long Millis { get system; } 14 | uint SampleMicros { get system; set system; } 15 | } 16 | -------------------------------------------------------------------------------- /Source/Minimal/Type.hs: -------------------------------------------------------------------------------- 1 | unit Type 2 | { 3 | enum Type 4 | { 5 | Undefined = 0x00, 6 | Char = 0x01, 7 | Int = 0x02, 8 | Byte = 0x03, 9 | UInt = 0x04, 10 | Reference = 0x05, 11 | Bool = 0x06, 12 | 13 | Type = 0x0C, 14 | 15 | Float = 0x0D, 16 | Long = 0x0E, 17 | String = 0x0F, 18 | Pair = 0x10, 19 | Array = 0x12, 20 | Dictionary = 0x13, 21 | Variant = 0x14, 22 | File = 0x15, 23 | Directory = 0x16, 24 | List = 0x19, 25 | ListItem = 0x1A, /// testing only 26 | } 27 | 28 | bool IsReferenceType(Type htype) 29 | { 30 | return (byte(htype) >= 0x0D); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/BitBang.hs: -------------------------------------------------------------------------------- 1 | program BitBang 2 | { 3 | uses "/Source/Library/Boards/PiPico" 4 | 5 | uses "I2C" 6 | uses "SSD1306" 7 | 8 | Hopper() 9 | { 10 | // good defaults 11 | I2C.Address = 0x3C; // address of the device (78 on the back of the module is 3C << 1) 12 | 13 | I2C.Initialize(); 14 | 15 | loop 16 | { 17 | Delay(250); 18 | SSD1306.Initialize(); 19 | Delay(250); 20 | SSD1306.Clear(0xFF); 21 | Delay(250); 22 | SSD1306.Clear(0xAA); 23 | Delay(250); 24 | SSD1306.Clear(0x00); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/BlinkRAM.asm: -------------------------------------------------------------------------------- 1 | program Blink 2 | { 3 | #define CPU_65C02S 4 | #define ROM_16K 5 | 6 | uses "/Source/Runtime/6502/ZeroPage" 7 | 8 | NMI() 9 | { 10 | } 11 | Delay() 12 | { 13 | LDX # 0 14 | loop 15 | { 16 | LDY # 0 17 | loop 18 | { 19 | DEY 20 | if (Z) { break;} 21 | } 22 | 23 | DEX 24 | if (Z) { break;} 25 | } 26 | } 27 | Hopper() 28 | { 29 | SEI 30 | 31 | LDA # 0b00000001 // PA0 is output (LED) 32 | STA ZP.DDRA 33 | 34 | LDA # 0b00000000 // PB all inputs 35 | STA ZP.DDRB 36 | 37 | loop 38 | { 39 | LDA # 0b00000000 // LED off 40 | STA ZP.PORTA 41 | Delay(); 42 | 43 | LDA # 0b00000001 // LED on 44 | STA ZP.PORTA 45 | Delay(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/Buttons.asm: -------------------------------------------------------------------------------- 1 | unit Buttons 2 | { 3 | 4 | Initialize() 5 | { 6 | // buttons as inputs 7 | #ifdef CPU_65C02S 8 | RMB2 ZP.DDRA 9 | RMB3 ZP.DDRA 10 | #else 11 | LDA ZP.DDRA 12 | AND # 0b11110011 13 | STA ZP.DDRA 14 | #endif 15 | } 16 | ButtonOneDown() 17 | { 18 | LDA ZP.PORTA 19 | AND # 0b00000100 20 | } 21 | ButtonTwoDown() 22 | { 23 | LDA ZP.PORTA 24 | AND # 0b00001000 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502BE.PLD: -------------------------------------------------------------------------------- 1 | Name 6502BE ; 2 | PartNo 00 ; 3 | Date 6/07/2024 ; 4 | Revision 01 ; 5 | Designer Michael Cartwright ; 6 | Company None ; 7 | Assembly None ; 8 | Location ; 9 | Device G22V10 ; 10 | 11 | 12 | /* G20V8A G22V10 */ 13 | 14 | /* Inputs: All are signals from the 6502 */ 15 | 16 | Pin 1 = CLK; 17 | Pin 2 = A15; 18 | Pin 3 = A14; 19 | Pin 4 = A13; 20 | Pin 5 = A12; 21 | Pin 6 = A11; 22 | Pin 7 = A10; 23 | Pin 8 = A9; 24 | Pin 9 = A8; 25 | Pin 10 = A7; 26 | Pin 11 = A6; 27 | /* Pin 12 is GND */ 28 | Pin 13 = A5; 29 | Pin 14 = A4; 30 | /* WinCUPL doesn't seem to like 15 as an input */ 31 | Pin 16 = A3; 32 | Pin 17 = A2; 33 | Pin 23 = A1; 34 | 35 | 36 | /* Outputs: define outputs - all are simple combinatorial */ 37 | 38 | Pin 22 = CSRAM; 39 | Pin 21 = CSROM; 40 | Pin 20 = CSVIA; 41 | Pin 19 = CSACIA; 42 | Pin 18 = OERAM; 43 | 44 | /* ACIA and VIA locations for Ben Eater 6502 board */ 45 | 46 | ACIA = !A15 & A14 & !A13 & A12; /* 0x5000 to 0x5003*/ 47 | VIA = !A15 & A14 & A13 & !A12; /* 0x6000 to 0x600F */ 48 | RAM = !A15 & !(VIA # ACIA); 49 | 50 | CSACIA = !ACIA; 51 | CSVIA = !VIA; 52 | CSRAM = !(RAM & CLK); 53 | OERAM = !RAM; 54 | CSROM = !A15; 55 | 56 | 57 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502BE.abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/CPLD/6502BE.abs -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502BE.sim: -------------------------------------------------------------------------------- 1 | %SIGNAL 2 | PIN 23 = A1 3 | PIN 17 = A2 4 | PIN 16 = A3 5 | PIN 14 = A4 6 | PIN 13 = A5 7 | PIN 11 = A6 8 | PIN 10 = A7 9 | PIN 9 = A8 10 | PIN 8 = A9 11 | PIN 7 = A10 12 | PIN 6 = A11 13 | PIN 5 = A12 14 | PIN 4 = A13 15 | PIN 3 = A14 16 | PIN 2 = A15 17 | PIN 1 = CLK 18 | PIN 19 = CSACIA 19 | PIN 22 = CSRAM 20 | PIN 21 = CSROM 21 | PIN 20 = CSVIA 22 | PIN 18 = OERAM 23 | %END 24 | 25 | %FIELD 26 | %END 27 | 28 | %EQUATION 29 | ACIA => 30 | A12 & !A13 & A14 & !A15 31 | 32 | CSACIA => 33 | A12 & !A13 & A14 & !A15 34 | 35 | CSRAM => 36 | !A14 & !A15 & CLK 37 | # A12 & A13 & !A15 & CLK 38 | # !A12 & !A13 & !A15 & CLK 39 | 40 | CSROM => 41 | !A15 42 | 43 | CSVIA => 44 | !A12 & A13 & A14 & !A15 45 | 46 | OERAM => 47 | !A14 & !A15 48 | # !A12 & !A13 & !A15 49 | # A12 & A13 & !A15 50 | 51 | RAM => 52 | !A14 & !A15 53 | # !A12 & !A13 & !A15 54 | # A12 & A13 & !A15 55 | 56 | VIA => 57 | !A12 & A13 & A14 & !A15 58 | 59 | CSACIA.oe => 60 | 1 61 | 62 | CSRAM.oe => 63 | 1 64 | 65 | CSROM.oe => 66 | 1 67 | 68 | CSVIA.oe => 69 | 1 70 | 71 | OERAM.oe => 72 | 1 73 | 74 | %END 75 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502MECB8K.PLD: -------------------------------------------------------------------------------- 1 | Name 6502MECB8K ; 2 | PartNo 00 ; 3 | Date 6/07/2024 ; 4 | Revision 01 ; 5 | Designer Michael Cartwright ; 6 | Company None ; 7 | Assembly None ; 8 | Location ; 9 | Device G20V8A ; 10 | 11 | 12 | /* G20V8A G22V10 */ 13 | 14 | /* Inputs: All are signals from the 6502 */ 15 | 16 | Pin 1 = CLK; 17 | Pin 2 = A15; 18 | Pin 3 = A14; 19 | Pin 4 = A13; 20 | Pin 5 = A12; 21 | Pin 6 = A11; 22 | Pin 7 = A10; 23 | Pin 8 = A9; 24 | Pin 9 = A8; 25 | Pin 10 = A7; 26 | Pin 11 = A6; 27 | /* Pin 12 is GND */ 28 | Pin 13 = A5; 29 | Pin 14 = A4; 30 | /* WinCUPL doesn't seem to like 15 as an input */ 31 | Pin 16 = A3; 32 | Pin 17 = A2; 33 | Pin 23 = A1; 34 | 35 | 36 | /* Outputs: define outputs - all are simple combinatorial */ 37 | 38 | Pin 22 = CSRAM; 39 | Pin 21 = CSROM; 40 | Pin 20 = CSVIA; 41 | Pin 19 = CSACIA; 42 | Pin 18 = OERAM; 43 | 44 | IO = A15 & A14 & A13 & !A12 & !A11 & !A10 & !A9 & !A8; /* 0xE000 to 0xE0FF */ 45 | 46 | /* ACIA and VIA locations for I/O card on the MECB */ 47 | 48 | VIA = IO & A4; /* 0xE010 */ 49 | ACIA = IO & !A4 & A3; /* 0xE008 */ 50 | 51 | 52 | CSACIA = !ACIA; 53 | CSVIA = !VIA; 54 | CSRAM = !(!A15 & CLK); 55 | OERAM = A15; 56 | CSROM = !(A15 & !IO); 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502MECB8K.abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/CPLD/6502MECB8K.abs -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502MECB8K.sim: -------------------------------------------------------------------------------- 1 | %SIGNAL 2 | PIN 23 = A1 3 | PIN 17 = A2 4 | PIN 16 = A3 5 | PIN 14 = A4 6 | PIN 13 = A5 7 | PIN 11 = A6 8 | PIN 10 = A7 9 | PIN 9 = A8 10 | PIN 8 = A9 11 | PIN 7 = A10 12 | PIN 6 = A11 13 | PIN 5 = A12 14 | PIN 4 = A13 15 | PIN 3 = A14 16 | PIN 2 = A15 17 | PIN 1 = CLK 18 | PIN 19 = CSACIA 19 | PIN 22 = CSRAM 20 | PIN 21 = CSROM 21 | PIN 20 = CSVIA 22 | PIN 18 = OERAM 23 | %END 24 | 25 | %FIELD 26 | %END 27 | 28 | %EQUATION 29 | ACIA => 30 | A3 & !A4 & !A8 & !A9 & !A10 & !A11 & !A12 & A13 & A14 & A15 31 | 32 | CSACIA => 33 | A3 & !A4 & !A8 & !A9 & !A10 & !A11 & !A12 & A13 & A14 & A15 34 | 35 | CSRAM => 36 | !A15 & CLK 37 | 38 | CSROM => 39 | !A14 & A15 40 | # !A13 & A15 41 | # A12 & A15 42 | # A11 & A15 43 | # A10 & A15 44 | # A9 & A15 45 | # A8 & A15 46 | 47 | CSVIA => 48 | A4 & !A8 & !A9 & !A10 & !A11 & !A12 & A13 & A14 & A15 49 | 50 | IO => 51 | !A8 & !A9 & !A10 & !A11 & !A12 & A13 & A14 & A15 52 | 53 | OERAM => 54 | A15 55 | 56 | VIA => 57 | A4 & !A8 & !A9 & !A10 & !A11 & !A12 & A13 & A14 & A15 58 | 59 | %END 60 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502RETRO.PLD: -------------------------------------------------------------------------------- 1 | Name 6502Retro ; 2 | PartNo 00 ; 3 | Date 6/07/2024 ; 4 | Revision 01 ; 5 | Designer Michael Cartwright ; 6 | Company None ; 7 | Assembly None ; 8 | Location ; 9 | Device G22V10 ; 10 | 11 | 12 | /* G20V8A G22V10 */ 13 | 14 | /* Inputs: All are signals from the 6502 */ 15 | 16 | Pin 1 = CLK; 17 | Pin 2 = A15; 18 | Pin 3 = A14; 19 | Pin 4 = A13; 20 | Pin 5 = A12; 21 | Pin 6 = A11; 22 | Pin 7 = A10; 23 | Pin 8 = A9; 24 | Pin 9 = A8; 25 | Pin 10 = A7; 26 | Pin 11 = A6; 27 | /* Pin 12 is GND */ 28 | Pin 13 = A5; 29 | Pin 14 = A4; 30 | /* WinCUPL doesn't seem to like 15 as an input */ 31 | Pin 16 = A3; 32 | Pin 17 = A2; 33 | Pin 23 = A1; 34 | 35 | 36 | /* Outputs: define outputs - all are simple combinatorial */ 37 | 38 | Pin 22 = CSRAM; 39 | Pin 21 = CSROM; 40 | Pin 20 = CSVIA; 41 | Pin 19 = CSACIA; 42 | Pin 18 = OERAM; 43 | 44 | IO = A15 & !A14 & !A13 & A12 & A11 & A10 & A9 & A8; /* 0x9Fxx */ 45 | 46 | /* ACIA and VIA locations for 6502 Retro board */ 47 | 48 | ACIA = IO & !A7 & !A6 & !A5 & A4; /* 0x9F10 to 0x9F13*/ 49 | VIA = IO & !A7 & !A6 & A5 & !A4; /* 0x9F20 to 0x9F2F */ 50 | 51 | CSACIA = !ACIA; 52 | CSVIA = !VIA; 53 | CSRAM = !(!A15 & CLK); 54 | OERAM = A15; 55 | CSROM = !(A15 & !IO); 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502RETRO.abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/CPLD/6502RETRO.abs -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502SBC.PLD: -------------------------------------------------------------------------------- 1 | Name 6502SBC ; 2 | PartNo 00 ; 3 | Date 4/07/2023 ; 4 | Revision 01 ; 5 | Designer Michael Cartwright ; 6 | Company None ; 7 | Assembly None ; 8 | Location ; 9 | Device G20V8 ; 10 | 11 | /* G20V8 G22V10 */ 12 | 13 | /* Inputs: All are signals from the 6502 */ 14 | 15 | Pin 1 = CLK; 16 | Pin 2 = A15; 17 | Pin 3 = A14; 18 | Pin 4 = A13; 19 | Pin 5 = A12; 20 | Pin 6 = A11; 21 | Pin 7 = A10; 22 | Pin 8 = A9; 23 | Pin 9 = A8; 24 | Pin 10 = A7; 25 | Pin 11 = A6; 26 | /* Pin 12 is GND */ 27 | Pin 13 = A5; 28 | Pin 14 = A4; 29 | /* WinCUPL doesn't seem to like 15 as an input */ 30 | Pin 16 = A3; 31 | Pin 17 = A2; 32 | Pin 23 = A1; 33 | 34 | 35 | /* Outputs: define outputs - all are simple combinatorial */ 36 | 37 | Pin 22 = CSRAM; 38 | Pin 21 = CSROM; 39 | Pin 20 = CSVIA; 40 | Pin 19 = CSACIA; 41 | Pin 18 = OERAM; 42 | 43 | 44 | ZEROPAGE = !A15 & !A14 & !A13 & !A12 & !A11 & !A10 & !A9 & !A8; 45 | 46 | CSACIA = !(ZEROPAGE & A7 & A6 & A5 & !A4 & A3 & A2); 47 | CSVIA = !(ZEROPAGE & A7 & A6 & A5 & A4); 48 | CSRAM = !((!A15 & CSVIA & CSACIA) & CLK); 49 | OERAM = !(!A15 & CSVIA & CSACIA); 50 | CSROM = !A15; 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502SBC.abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/CPLD/6502SBC.abs -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502SBC.jed: -------------------------------------------------------------------------------- 1 |  2 | CUPL(WM) 5.0a Serial# 60008009 3 | Device g20v8ma Library DLIB-h-40-3 4 | Created Sat May 18 13:07:48 2024 5 | Name 6502SBC 6 | Partno 00 7 | Revision 01 8 | Date 4/07/2023 9 | Designer Michael Cartwright 10 | Company None 11 | Assembly None 12 | Location 13 | *QP24 14 | *QF2706 15 | *G0 16 | *F0 17 | *L00000 11111111111111111111111111111111 18 | *L00032 11111111100111111111110111011111 19 | *L00064 11111111111111110000000000000000 20 | *L00320 11111111111111111111111111111111 21 | *L00352 11111111101111111111111111111111 22 | *L00384 11111111111111110000000000000000 23 | *L00640 11111111111111111111111111111111 24 | *L00672 11111111101110111011101110111011 25 | *L00704 10111011010101010000000000000000 26 | *L00960 11111111111111111111111111111111 27 | *L00992 11111111101110111011101110111011 28 | *L01024 10011001011001010000000000000000 29 | *L01280 11111111111111111111111111111111 30 | *L01312 11111111101111111111110111011111 31 | *L01344 11111111111111110000000000000000 32 | *L02560 01000000001100000011000000100000 33 | *L02624 00000000111111111111111111111111 34 | *L02656 11111111111111111111111111111111 35 | *L02688 111111111111111111 36 | *C3852 37 | *E39B -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502SBC.sim: -------------------------------------------------------------------------------- 1 | %SIGNAL 2 | PIN 23 = A1 3 | PIN 17 = A2 4 | PIN 16 = A3 5 | PIN 14 = A4 6 | PIN 13 = A5 7 | PIN 11 = A6 8 | PIN 10 = A7 9 | PIN 9 = A8 10 | PIN 8 = A9 11 | PIN 7 = A10 12 | PIN 6 = A11 13 | PIN 5 = A12 14 | PIN 4 = A13 15 | PIN 3 = A14 16 | PIN 2 = A15 17 | PIN 1 = CLK 18 | PIN 19 = CSACIA 19 | PIN 22 = CSRAM 20 | PIN 21 = CSROM 21 | PIN 20 = CSVIA 22 | PIN 18 = OERAM 23 | %END 24 | 25 | %FIELD 26 | %END 27 | 28 | %EQUATION 29 | CSACIA => 30 | A2 & A3 & !A4 & A5 & A6 & A7 & !A8 & !A9 & !A10 & !A11 & !A12 & !A13 & !A14 & !A15 31 | 32 | CSRAM => 33 | !A15 & CLK & CSACIA & CSVIA 34 | 35 | CSROM => 36 | !A15 37 | 38 | CSVIA => 39 | A4 & A5 & A6 & A7 & !A8 & !A9 & !A10 & !A11 & !A12 & !A13 & !A14 & !A15 40 | 41 | OERAM => 42 | !A15 & CSACIA & CSVIA 43 | 44 | ZEROPAGE => 45 | !A8 & !A9 & !A10 & !A11 & !A12 & !A13 & !A14 & !A15 46 | 47 | A2.oe => 48 | 0 49 | 50 | A3.oe => 51 | 0 52 | 53 | CSACIA.oe => 54 | 1 55 | 56 | CSRAM.oe => 57 | 1 58 | 59 | CSROM.oe => 60 | 1 61 | 62 | CSVIA.oe => 63 | 1 64 | 65 | OERAM.oe => 66 | 1 67 | 68 | %END 69 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502SBC48K.PLD: -------------------------------------------------------------------------------- 1 | Name 6502SBC48K ; 2 | PartNo 00 ; 3 | Date 4/07/2023 ; 4 | Revision 01 ; 5 | Designer Michael Cartwright ; 6 | Company None ; 7 | Assembly None ; 8 | Location ; 9 | Device G20V8 ; 10 | 11 | /* G20V8 G22V10 */ 12 | 13 | /* Inputs: All are signals from the 6502 */ 14 | 15 | Pin 1 = CLK; 16 | Pin 2 = A15; 17 | Pin 3 = A14; 18 | Pin 4 = A13; 19 | Pin 5 = A12; 20 | Pin 6 = A11; 21 | Pin 7 = A10; 22 | Pin 8 = A9; 23 | Pin 9 = A8; 24 | Pin 10 = A7; 25 | Pin 11 = A6; 26 | /* Pin 12 is GND */ 27 | Pin 13 = A5; 28 | Pin 14 = A4; 29 | /* WinCUPL doesn't seem to like 15 as an input */ 30 | Pin 16 = A3; 31 | Pin 17 = A2; 32 | Pin 23 = A1; 33 | 34 | 35 | /* Outputs: define outputs - all are simple combinatorial */ 36 | 37 | Pin 22 = CSRAM; /* active low */ 38 | Pin 21 = CSROM; /* active low */ 39 | Pin 20 = CSVIA; /* active low */ 40 | Pin 19 = CSACIA; /* active low */ 41 | Pin 18 = OERAM; /* active low */ 42 | 43 | 44 | ZEROPAGE = !A15 & !A14 & !A13 & !A12 & !A11 & !A10 & !A9 & !A8; 45 | SRAMANDIO = !(A15 & A14); 46 | 47 | CSACIA = !(ZEROPAGE & A7 & A6 & A5 & !A4 & A3 & A2); 48 | CSVIA = !(ZEROPAGE & A7 & A6 & A5 & A4); 49 | CSRAM = !((SRAMANDIO & CSVIA & CSACIA) & CLK); 50 | OERAM = !(SRAMANDIO & CSVIA & CSACIA); 51 | CSROM = SRAMANDIO; 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502SBC48K.abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/CPLD/6502SBC48K.abs -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502SBC48K.sim: -------------------------------------------------------------------------------- 1 | %SIGNAL 2 | PIN 23 = A1 3 | PIN 17 = A2 4 | PIN 16 = A3 5 | PIN 14 = A4 6 | PIN 13 = A5 7 | PIN 11 = A6 8 | PIN 10 = A7 9 | PIN 9 = A8 10 | PIN 8 = A9 11 | PIN 7 = A10 12 | PIN 6 = A11 13 | PIN 5 = A12 14 | PIN 4 = A13 15 | PIN 3 = A14 16 | PIN 2 = A15 17 | PIN 1 = CLK 18 | PIN 19 = CSACIA 19 | PIN 22 = CSRAM 20 | PIN 21 = CSROM 21 | PIN 20 = CSVIA 22 | PIN 18 = OERAM 23 | %END 24 | 25 | %FIELD 26 | %END 27 | 28 | %EQUATION 29 | CSACIA => 30 | A2 & A3 & !A4 & A5 & A6 & A7 & !A8 & !A9 & !A10 & !A11 & !A12 & !A13 & !A14 & !A15 31 | 32 | CSRAM => 33 | !A14 & CLK & CSACIA & CSVIA 34 | # !A15 & CLK & CSACIA & CSVIA 35 | 36 | CSROM => 37 | A14 & A15 38 | 39 | CSVIA => 40 | A4 & A5 & A6 & A7 & !A8 & !A9 & !A10 & !A11 & !A12 & !A13 & !A14 & !A15 41 | 42 | OERAM => 43 | !A15 & CSACIA & CSVIA 44 | # !A14 & CSACIA & CSVIA 45 | 46 | SRAMANDIO => 47 | !A15 48 | # !A14 49 | 50 | ZEROPAGE => 51 | !A8 & !A9 & !A10 & !A11 & !A12 & !A13 & !A14 & !A15 52 | 53 | A2.oe => 54 | 0 55 | 56 | A3.oe => 57 | 0 58 | 59 | CSACIA.oe => 60 | 1 61 | 62 | CSRAM.oe => 63 | 1 64 | 65 | CSROM.oe => 66 | 1 67 | 68 | CSVIA.oe => 69 | 1 70 | 71 | OERAM.oe => 72 | 1 73 | 74 | %END 75 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502SBC56K.PLD: -------------------------------------------------------------------------------- 1 | Name 6502SBC56K ; 2 | PartNo 00 ; 3 | Date 4/07/2023 ; 4 | Revision 01 ; 5 | Designer Michael Cartwright ; 6 | Company None ; 7 | Assembly None ; 8 | Location ; 9 | Device G20V8 ; 10 | 11 | /* G20V8 G22V10 */ 12 | 13 | /* Inputs: All are signals from the 6502 */ 14 | 15 | Pin 1 = CLK; 16 | Pin 2 = A15; 17 | Pin 3 = A14; 18 | Pin 4 = A13; 19 | Pin 5 = A12; 20 | Pin 6 = A11; 21 | Pin 7 = A10; 22 | Pin 8 = A9; 23 | Pin 9 = A8; 24 | Pin 10 = A7; 25 | Pin 11 = A6; 26 | /* Pin 12 is GND */ 27 | Pin 13 = A5; 28 | Pin 14 = A4; 29 | /* WinCUPL doesn't seem to like 15 as an input */ 30 | Pin 16 = A3; 31 | Pin 17 = A2; 32 | Pin 23 = A1; 33 | 34 | 35 | /* Outputs: define outputs - all are simple combinatorial */ 36 | 37 | Pin 22 = CSRAM; /* active low */ 38 | Pin 21 = CSROM; /* active low */ 39 | Pin 20 = CSVIA; /* active low */ 40 | Pin 19 = CSACIA; /* active low */ 41 | Pin 18 = OERAM; /* active low */ 42 | 43 | 44 | ZEROPAGE = !A15 & !A14 & !A13 & !A12 & !A11 & !A10 & !A9 & !A8; 45 | SRAMANDIO = !(A15 & A14 & A13); 46 | 47 | CSACIA = !(ZEROPAGE & A7 & A6 & A5 & !A4 & A3 & A2); 48 | CSVIA = !(ZEROPAGE & A7 & A6 & A5 & A4); 49 | CSRAM = !((SRAMANDIO & CSVIA & CSACIA) & CLK); 50 | OERAM = !(SRAMANDIO & CSVIA & CSACIA); 51 | CSROM = SRAMANDIO; 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/6502SBC56K.abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/CPLD/6502SBC56K.abs -------------------------------------------------------------------------------- /Source/Projects/6502SBC/CPLD/G20V8_6502SBC.jed: -------------------------------------------------------------------------------- 1 |  2 | CUPL(WM) 5.0a Serial# 60008009 3 | Device g20v8ma Library DLIB-h-40-3 4 | Created Thu Jul 04 09:19:09 2024 5 | Name 6502SBC 6 | Partno 00 7 | Revision 01 8 | Date 4/07/2023 9 | Designer Michael Cartwright 10 | Company None 11 | Assembly None 12 | Location 13 | *QP24 14 | *QF2706 15 | *G0 16 | *F0 17 | *L00000 11111111111111111111111111111111 18 | *L00032 11111111100111111111110111011111 19 | *L00064 11111111111111110000000000000000 20 | *L00320 11111111111111111111111111111111 21 | *L00352 11111111101111111111111111111111 22 | *L00384 11111111111111110000000000000000 23 | *L00640 11111111111111111111111111111111 24 | *L00672 11111111101110111011101110111011 25 | *L00704 10111011010101010000000000000000 26 | *L00960 11111111111111111111111111111111 27 | *L00992 11111111101110111011101110111011 28 | *L01024 10011001011001010000000000000000 29 | *L01280 11111111111111111111111111111111 30 | *L01312 11111111101111111111110111011111 31 | *L01344 11111111111111110000000000000000 32 | *L02560 01000000001100000011000000100000 33 | *L02624 00000000111111111111111111111111 34 | *L02656 11111111111111111111111111111111 35 | *L02688 111111111111111111 36 | *C3852 37 | *E3A8 -------------------------------------------------------------------------------- /Source/Projects/6502SBC/EasyEDA/6502 Machine/Gerber_6502-v2_PCB_6502-v2.1_2024-05-04.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/EasyEDA/6502 Machine/Gerber_6502-v2_PCB_6502-v2.1_2024-05-04.zip -------------------------------------------------------------------------------- /Source/Projects/6502SBC/EasyEDA/6502 Machine/Schematic_6502-v2_2024-05-02.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/EasyEDA/6502 Machine/Schematic_6502-v2_2024-05-02.pdf -------------------------------------------------------------------------------- /Source/Projects/6502SBC/EasyEDA/projects/6502 v2/Gerber_6502-v2_PCB_6502-v3_2024-05-10.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/EasyEDA/projects/6502 v2/Gerber_6502-v2_PCB_6502-v3_2024-05-10.zip -------------------------------------------------------------------------------- /Source/Projects/6502SBC/EasyEDA/projects/6502 v2/Gerber_6502-v2_PCB_6502-v4_2024-05-15.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/EasyEDA/projects/6502 v2/Gerber_6502-v2_PCB_6502-v4_2024-05-15.zip -------------------------------------------------------------------------------- /Source/Projects/6502SBC/EasyEDA/projects/6502 v2/Schematic_6502-v2_2024-05-10.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/EasyEDA/projects/6502 v2/Schematic_6502-v2_2024-05-10.pdf -------------------------------------------------------------------------------- /Source/Projects/6502SBC/EasyEDA/projects/6502 v2/Schematic_6502-v2_2024-05-15.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/EasyEDA/projects/6502 v2/Schematic_6502-v2_2024-05-15.pdf -------------------------------------------------------------------------------- /Source/Projects/6502SBC/EasyEDA/projects/uuidMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "78aca1eeb5287cc5715be2ebab320c20": "6502 SM", 3 | "11bd88dd94c1f8e5d00598037850b349": "6502 SM\\6502 SM.json?Sheet_1", 4 | "3939621b48be74c8eebc5948164284b4": "6502 v2", 5 | "3c506664b47db881983ed9add9ffbbc5": "6502 v2\\6502 v2.json?Hopper 6502 SBC", 6 | "7b24172fffecf2a472b8fb102b1d4600": "6502 v2\\6502 v2.json?VIA", 7 | "d82cf5c4af1edf2f4f1d8d478c8d63af": "6502 v2\\6502 v2.json?ACIA", 8 | "42e556a53494413b55538589e52e54c8": "6502 v2\\6502 v2.json?Memory", 9 | "c0318a914f00600031f6f841063351a7": "6502 v2\\PCB_6502 v2.1.json", 10 | "eb99a42399b21d4f36edb3bd6e4c3a14": "6502 v2\\PCB_6502 v3.json", 11 | "12efc521997e8658b65100420f21183e": "6502 v2\\PCB_6502 v4.json" 12 | } -------------------------------------------------------------------------------- /Source/Projects/6502SBC/HopperEcho.asm: -------------------------------------------------------------------------------- 1 | program HopperEcho 2 | { 3 | #define CPU_65C02S 4 | #define ROM_4K 5 | 6 | uses "/Source/Runtime/6502/Serial" 7 | 8 | const string Echo = "\nHopper Echo:\n"; 9 | 10 | IRQ() 11 | { 12 | Serial.ISR(); 13 | } 14 | NMI() 15 | { 16 | } 17 | 18 | Hopper() 19 | { 20 | SEI 21 | 22 | Serial.Initialize(); 23 | 24 | LDX # 0x00 // Initialise character offset pointer 25 | loop 26 | { 27 | LDA Echo, X // Get next character to send 28 | if (Z) { break; } // If it's the zero string terminator, we're done! 29 | Serial.WriteChar(); 30 | INX // Increment character offset pointer 31 | // Loop to process next character 32 | } 33 | 34 | loop 35 | { 36 | Serial.WaitForChar(); 37 | Serial.WriteChar(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/Probe/Gerber_EEPROM-Jig_PCB_EEPROM-Jig_2_2024-10-27.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/Probe/Gerber_EEPROM-Jig_PCB_EEPROM-Jig_2_2024-10-27.zip -------------------------------------------------------------------------------- /Source/Projects/6502SBC/RIOT.asm: -------------------------------------------------------------------------------- 1 | unit RIOT 2 | { 3 | 4 | // W65C22 VIA 5 | const byte DRB = 0xF0; 6 | const byte DRA = 0xF1; 7 | const byte DDRB = 0xF2; 8 | const byte DDRA = 0xF3; 9 | } 10 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/Sparky.hs: -------------------------------------------------------------------------------- 1 | program Sparky 2 | { 3 | uses "/Source/Library/Boards/SparkfunProMicroRP2040" 4 | 5 | { 6 | PinMode(GP2, PinModeOption.Output); 7 | PinMode(GP4, PinModeOption.Output); 8 | NeoPixel.BuiltIn(); 9 | 10 | // For 25 cycles, reset is asserted low. 11 | // During reset, the NeoPixel blinks the 12 | // clock ticks as purple. After reset, 13 | // it blinks blue. 14 | 15 | DigitalWrite(GP4, false); // reset .. 16 | uint resetCycles = 25; 17 | uint delay = 50; 18 | byte reset = 255; 19 | loop 20 | { 21 | NeoPixel.SetColor(0, reset, 0, 255); 22 | NeoPixel.Show(); 23 | DigitalWrite(GP2, true); 24 | Delay(delay); 25 | 26 | NeoPixel.SetColor(0, 0, 0, 0); 27 | NeoPixel.Show(); 28 | DigitalWrite(GP2, false); 29 | Delay(delay); 30 | if (resetCycles != 0) 31 | { 32 | resetCycles--; 33 | if (resetCycles == 0) 34 | { 35 | DigitalWrite(GP4, true); 36 | delay = 50; 37 | reset = 0; 38 | } 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Projects/6502SBC/rev12/Gerber_6502-v2_PCB_6502-v4_2024-05-15.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/rev12/Gerber_6502-v2_PCB_6502-v4_2024-05-15.zip -------------------------------------------------------------------------------- /Source/Projects/6502SBC/rev12/Schematic_6502-v2_2024-05-15.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/6502SBC/rev12/Schematic_6502-v2_2024-05-15.pdf -------------------------------------------------------------------------------- /Source/Projects/65uino/Blink.asm: -------------------------------------------------------------------------------- 1 | program Blink 2 | { 3 | #define CPU_65UINO 4 | 5 | uses "RIOT" 6 | uses "Utilities" 7 | 8 | Delay500() 9 | { 10 | // 1024 ticks x A = 1.024ms X A (at a CPU speed of 1MHz) 11 | // 244 x 2 = 488 x 1.024 = 499.712ms, close enough 12 | LDA # 244 13 | DelayLong(); 14 | LDA # 244 15 | DelayLong(); 16 | } 17 | 18 | Hopper() 19 | { 20 | LDA # 0b00000000 // PA all input 21 | STA RIOT.DDRA 22 | 23 | LDA # 0b10000000 // PB7 is output (GREEN LED) 24 | STA RIOT.DDRB 25 | 26 | LDA # 0b00000000 // GREEN LED on to start 27 | STA RIOT.DRB 28 | loop 29 | { 30 | BIT RIOT.DRB // read BTN 31 | if (NV) 32 | { 33 | LDA # 0b00000000 // set GREEN LED on 34 | STA RIOT.DRB 35 | Delay500(); 36 | } 37 | LDA # 0b10000000 // set GREEN LED off 38 | STA RIOT.DRB 39 | Delay500(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Projects/65uino/BlinkNoRAM.asm: -------------------------------------------------------------------------------- 1 | program Blink 2 | { 3 | #define CPU_65UINO 4 | 5 | uses "RIOT" 6 | uses "Utilities" 7 | 8 | Delay500() 9 | { 10 | // 1024 ticks x A = 1.024ms X A (at a CPU speed of 1MHz) 11 | // 244 x 2 = 488 x 1.024 = 499.712ms, close enough 12 | LDA # 244 13 | DelayLong(); 14 | LDA # 244 15 | DelayLong(); 16 | } 17 | 18 | Hopper() 19 | { 20 | LDA # 0b00000000 // PA all input 21 | STA RIOT.DDRA 22 | 23 | LDA # 0b10000000 // PB7 is output (GREEN LED) 24 | STA RIOT.DDRB 25 | 26 | LDA # 0b00000000 // GREEN LED on to start 27 | STA RIOT.DRB 28 | loop 29 | { 30 | BIT RIOT.DRB // read BTN 31 | if (NV) 32 | { 33 | LDA # 0b00000000 // set GREEN LED on 34 | STA RIOT.DRB 35 | Delay500(); 36 | } 37 | LDA # 0b10000000 // set GREEN LED off 38 | STA RIOT.DRB 39 | Delay500(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Projects/65uino/Buttons.asm: -------------------------------------------------------------------------------- 1 | unit Buttons 2 | { 3 | 4 | Initialize() 5 | { 6 | // buttons as inputs 7 | LDA RIOT.DDRA 8 | AND # 0b11110011 9 | STA RIOT.DDRA 10 | } 11 | ButtonOneDown() 12 | { 13 | LDA RIOT.DRA 14 | AND # 0b00000100 15 | } 16 | ButtonTwoDown() 17 | { 18 | LDA RIOT.DRA 19 | AND # 0b00001000 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Source/Projects/65uino/NOP.asm: -------------------------------------------------------------------------------- 1 | program DoNothing 2 | { 3 | #define CPU_65UINO 4 | 5 | { 6 | loop { } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Source/Projects/65uino/Test.asm: -------------------------------------------------------------------------------- 1 | program Blink 2 | { 3 | #define CPU_65UINO 4 | 5 | uses "RIOT" 6 | uses "Utilities" 7 | uses "I2C" 8 | uses "SSD1306" 9 | 10 | Hopper() 11 | { 12 | LDA # 0b00000000 // PA all input 13 | STA RIOT.DDRA 14 | 15 | LDA # 0b10000000 // PB7 is output (GREEN LED) 16 | STA RIOT.DDRB 17 | 18 | 19 | LDA # 0x3C // Address of the device (78 on the back of the module is 3C << 1) 20 | STA ZP.I2CADDR 21 | SSD1306.Initialize(); // Initialize SSD1306 display 22 | SSD1306.Clear(); 23 | 24 | loop 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Projects/65uino/Utilities.asm: -------------------------------------------------------------------------------- 1 | unit Utilities 2 | { 3 | // Original written by Anders Nielsen, 2023-2024 4 | // License: https://creativecommons.org/licenses/by-nc/4.0/legalcode 5 | 6 | uses "RIOT" 7 | 8 | DelayShort() 9 | { 10 | STA WTD8DI // Divide by 8 = A contains ticks to delay/8 11 | loop 12 | { 13 | NOP // Sample every 8 cycles instead of every 6 14 | LDA READTDI 15 | if (Z) { break; } 16 | } 17 | } 18 | 19 | DelayLong() 20 | { 21 | STA WTD1KDI 22 | loop 23 | { 24 | LDA READTDI 25 | if (Z) { break; } // Loop until timer runs out 26 | } 27 | } 28 | 29 | LEDOff() 30 | { 31 | LDA RIOT.DRB 32 | ORA # 0b10000000 // set GREEN LED off 33 | STA RIOT.DRB 34 | } 35 | LEDOn() 36 | { 37 | LDA RIOT.DRB 38 | AND # 0b01111111 // set GREEN LED on 39 | STA RIOT.DRB 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Source/Projects/65uino/Zero.asm: -------------------------------------------------------------------------------- 1 | unit ZP 2 | { 3 | const byte I2CADDR = 0x00; // Reserve 1 byte for I2CADDR 4 | const byte OutB = I2CADDR + 1; // Reserve 1 byte for OutB - used for I2C 5 | } 6 | -------------------------------------------------------------------------------- /Source/Projects/6809/Library/MemoryMap.asm: -------------------------------------------------------------------------------- 1 | unit Address 2 | { 3 | const uint SerialInBuffer = 0x0200; // 256-byte buffer 0x0200-0x02FF 4 | 5 | const uint CallStackLSB = 0x0300; // LSBs of 256 call stack slots 6 | const uint CallStackMSB = 0x0400; // MSBs of 256 call stack slots 7 | 8 | const uint TypeStackLSB = 0x0500; // 256 type stack slots 9 | 10 | const uint ValueStackLSB = 0x0600; // LSBs of 256 value stack slots 11 | const uint ValueStackMSB = 0x0700; // MSBs of 256 value stack slots 12 | 13 | const uint I2CInBuffer = 0x0800; // 256-byte buffer 0x0800-0x08FF for I2C.RequestFrom 14 | 15 | const uint HopperData = 0x0900; // start of Hopper RAM (program, then heap) 16 | 17 | const uint RamSize = 0x8000; // we assume RAM always starts at 0x0000 and that we have 32K, for now 18 | } 19 | -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Games/Blinky.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Games/Blinky.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Games/Brix.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Games/Brix.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Games/Invaders.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Games/Invaders.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Tests/1.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Tests/1.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Tests/2.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Tests/2.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Tests/3.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Tests/3.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Tests/4.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Tests/4.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Tests/5.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Tests/5.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Tests/6.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Tests/6.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/Tests/opcode.ch8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/CHIP8/Tests/opcode.ch8 -------------------------------------------------------------------------------- /Source/Projects/CHIP8/readme.md: -------------------------------------------------------------------------------- 1 | Sure, here's the list of places to find CHIP-8 game files in Markdown format: 2 | 3 | ### Sources for CHIP-8 Game Files 4 | 5 | 1. **[CHIP-8 Archive on GitHub](https://github.com/dmatlack/chip8)**: 6 | - This repository contains a large collection of CHIP-8 games and programs. It's a great place to start for classic CHIP-8 games. 7 | 8 | 2. **[CHIP-8 Programs by David Winter](http://devernay.free.fr/hacks/chip8/C8TECH10.HTM#2.4)**: 9 | - David Winter's CHIP-8 documentation includes links to several CHIP-8 programs and games. 10 | 11 | 3. **[Zophar's Domain CHIP-8 Games](https://www.zophar.net/pdroms/chip8.html)**: 12 | - Zophar's Domain hosts a collection of public domain CHIP-8 games. 13 | 14 | 4. **[Awesome CHIP-8](https://github.com/tobiasvl/awesome-chip-8)**: 15 | - This is a curated list of resources related to CHIP-8, including links to games, interpreters, and documentation. 16 | 17 | These sources should provide you with a good selection of CHIP-8 game files to test and use with your emulator. -------------------------------------------------------------------------------- /Source/Projects/MCUShell/Eject.hs: -------------------------------------------------------------------------------- 1 | program Eject 2 | { 3 | uses "/Source/Library/Boards/PiPicoW" 4 | 5 | { 6 | SD.Eject(); 7 | WriteLn("SD card can now be safely removed."); 8 | string current = (System.CurrentDirectory).ToLower(); 9 | if (current.StartsWith("/sd/") || (current == "/sd")) 10 | { 11 | System.CurrentDirectory = "/"; 12 | } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Source/Projects/MCUShell/Mount.hs: -------------------------------------------------------------------------------- 1 | program Mount 2 | { 3 | uses "/Source/Library/Boards/PiPico" 4 | 5 | { 6 | #if defined(BOARD_HAS_NO_SPI0) 7 | SD.SPIController = 1; 8 | SD.ClkPin = Board.SPI1SCK; 9 | SD.TxPin = Board.SPI1Tx; 10 | SD.RxPin = Board.SPI1Rx; 11 | SD.CSPin = Board.SPI1SS; 12 | #else 13 | SD.SPIController = 0; 14 | SD.ClkPin = Board.SPI0SCK; 15 | SD.TxPin = Board.SPI0Tx; 16 | SD.RxPin = Board.SPI0Rx; 17 | SD.CSPin = Board.SPI0SS; 18 | #endif 19 | if (SD.Mount()) 20 | { 21 | WriteLn("Successfully mounted SD card at '/sd/'"); 22 | } 23 | else 24 | { 25 | WriteLn("Failed to mount SD card"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Projects/MCUShell/fibo.cmd: -------------------------------------------------------------------------------- 1 | speed 0 2 | fibouint 3 | speed 1 4 | fibouint 5 | speed 3 6 | fibouint 7 | -------------------------------------------------------------------------------- /Source/Projects/MCUShell/n.cmd: -------------------------------------------------------------------------------- 1 | speed 0 2 | nrl 3 | speed 1 4 | nrl 5 | speed 3 6 | nrl 7 | -------------------------------------------------------------------------------- /Source/Projects/MECB6502/CPLD/MECB_CHIPSELECT_6502_CPU.abs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/MECB6502/CPLD/MECB_CHIPSELECT_6502_CPU.abs -------------------------------------------------------------------------------- /Source/Projects/MECB6502/CPLD/MECB_CHIPSELECT_6502_CPU.sim: -------------------------------------------------------------------------------- 1 | %SIGNAL 2 | PIN 7 = a10 3 | PIN 5 = a11 4 | PIN 8 = a12 5 | PIN 11 = a13 6 | PIN 6 = a14 7 | PIN 9 = a15 8 | PIN 2 = clk 9 | PIN 3 = cpu_phi2o 10 | PIN 4 = cpu_rw 11 | PIN 15 = !cs_ram 12 | PIN 14 = !cs_rom 13 | PIN 16 = !cs_spare 14 | PIN 13 = ecb_clk 15 | PIN 17 = !ecb_iorq 16 | PIN 12 = !ecb_mreq 17 | PIN 18 = !ecb_rd 18 | PIN 19 = !ecb_wr 19 | PIN 1 = !ioaddr 20 | %END 21 | 22 | %FIELD 23 | %END 24 | 25 | %EQUATION 26 | cs_ram => 27 | !a15 & !ecb_mreq 28 | # !a14 & !ecb_mreq 29 | 30 | cs_rom => 31 | a14 & a15 & !ecb_mreq 32 | 33 | cs_spare => 34 | clk & !ioaddr 35 | 36 | ecb_clk => 37 | clk 38 | 39 | ecb_iorq => 40 | clk & !ioaddr 41 | 42 | ecb_mreq => 43 | clk & ioaddr 44 | 45 | ecb_rd => 46 | clk & cpu_rw 47 | 48 | ecb_wr => 49 | clk & !cpu_rw 50 | 51 | %END 52 | -------------------------------------------------------------------------------- /Source/Projects/MECB6502/CPLD/MECB_ChipSelect_6502_CPU.jed: -------------------------------------------------------------------------------- 1 |  2 | CUPL(WM) 5.0a Serial# 60008009 3 | Device g16v8as Library DLIB-h-40-2 4 | Created Sun Jul 14 16:44:51 2024 5 | Name MECB_ChipSelect_6502_CPU 6 | Partno CA0001 7 | Revision 01 8 | Date 06/2024 9 | Designer Greg 10 | Company Digicool Things 11 | Assembly None 12 | Location None 13 | *QP20 14 | *QF2194 15 | *G0 16 | *F0 17 | *L00000 01111111101111111111111111111111 18 | *L00256 01111111011111111111111111111111 19 | *L00512 01101111111111111111111111111111 20 | *L00768 01101111111111111111111111111111 21 | *L01024 11111111111111111111111111101011 22 | *L01056 11111111111111111011111111101111 23 | *L01280 11111111111111110111111111100111 24 | *L01536 01111111111111111111111111111111 25 | *L01792 01011111111111111111111111111111 26 | *L02048 00000010010000110100000100110000 27 | *L02080 00110000001100000011000100000000 28 | *L02112 00000000000000001111111111111111 29 | *L02144 11111111111111111111111111111111 30 | *L02176 111111111111111110 31 | *C2DA1 32 | *C32B -------------------------------------------------------------------------------- /Source/Projects/Michael/LoadCells/ChallengerHardware.hs: -------------------------------------------------------------------------------- 1 | unit Hardware 2 | { 3 | uses "/Source/Library/Boards/ChallengerNB2040WiFi" 4 | uses "/Source/Library/Devices/Adafruit128x64OLEDFeatherwing" 5 | 6 | const byte CELLDATA = GP17; 7 | const byte CELLCLOCK = GP16; 8 | 9 | const byte textLeft = 0; 10 | const byte textWidth = 10; 11 | 12 | byte TextLeft { get { return textLeft; } } 13 | byte TextWidth { get { return textWidth; } } 14 | 15 | bool Initialize(ref LoadCell cell, PinISRDelegate buttonDelegate) 16 | { 17 | ClockSpeed = RPClockSpeed.Overclock250; 18 | IsPortrait = true; 19 | 20 | if (!DeviceDriver.Begin(buttonDelegate)) 21 | { 22 | IO.WriteLn("Failed to initialize Adafruit 128x64 OLED Featherwing"); 23 | return false; 24 | } 25 | cell = HX711.Create(CELLDATA, CELLCLOCK); 26 | return true; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Projects/Michael/SunsetSwitch/HouseReceive.hs: -------------------------------------------------------------------------------- 1 | program HouseRecieve 2 | { 3 | uses "/Source/Library/Boards/ChallengerNB2040WiFi" 4 | 5 | Hopper() 6 | { 7 | string message; 8 | UART.Setup(9600); 9 | 10 | long lastMessage; 11 | loop 12 | { 13 | Time.Delay(250); 14 | while (UART.IsAvailable) 15 | { 16 | char ch = UART.ReadChar(); 17 | if (ch == Char.EOL) 18 | { 19 | long thisMessage = Time.Millis; 20 | IO.WriteLn("Message: '" + message + "' " + thisMessage.ToString() + " " + (thisMessage - lastMessage).ToString()); 21 | lastMessage = thisMessage; 22 | message = ""; 23 | break; 24 | } 25 | else 26 | { 27 | byte b = byte(ch); 28 | if (b >= 32) 29 | { 30 | IO.Write("'" + ch + "' "); 31 | } 32 | IO.WriteLn((byte(ch)).ToHexString(2)); 33 | message += ch; 34 | } 35 | } 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Source/Projects/Michael/SunsetSwitch/Proximity.hs: -------------------------------------------------------------------------------- 1 | program Proximity 2 | { 3 | uses "/Source/Library/Boards/PiPicoW" 4 | 5 | const byte sensorPin = GP16; 6 | const byte ledPin = GP17; 7 | 8 | Hopper() 9 | { 10 | MCU.PinMode(sensorPin, PinModeOption.Input); 11 | MCU.PinMode(ledPin, PinModeOption.Output); 12 | 13 | long lightUntil = Time.Millis; 14 | loop 15 | { 16 | bool triggered = MCU.DigitalRead(sensorPin); 17 | if (triggered) 18 | { 19 | // keep lit for 3 seconds after sensor goes low 20 | lightUntil = Time.Millis + 3000; 21 | } 22 | MCU.DigitalWrite(ledPin, Time.Millis < lightUntil); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Source/Projects/Michael/SunsetSwitch/ProximityEvent.hs: -------------------------------------------------------------------------------- 1 | program ProximityEvent 2 | { 3 | uses "/Source/Library/Boards/PiPicoW" 4 | 5 | const byte sensorPin = GP16; 6 | const byte ledPin = GP17; 7 | 8 | long lightUntil = Time.Millis; 9 | 10 | sensorEvent(byte pin, PinStatus status) 11 | { 12 | // keep lit for 3 seconds after sensor goes low 13 | lightUntil = Time.Millis + 3000; 14 | } 15 | 16 | Hopper() 17 | { 18 | MCU.PinMode(ledPin, PinModeOption.Output); 19 | if (!MCU.AttachToPin(sensorPin, sensorEvent, PinStatus.Falling)) 20 | { 21 | IO.WriteLn("Failed to attach to pin " + (sensorPin).ToString()); 22 | } 23 | 24 | loop 25 | { 26 | MCU.DigitalWrite(ledPin, Time.Millis < lightUntil); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Source/Projects/PyPorts/BreakOut/Utilities.hs: -------------------------------------------------------------------------------- 1 | unit Utilities 2 | { 3 | uint rnd; 4 | 5 | uint Random(uint max) 6 | { 7 | // Pseudorandom generator from here: (fast and good enough) 8 | // https://codebase64.org/doku.php?id=base:16bit_xorshift_random_generator 9 | rnd = rnd ^ (rnd << 7); 10 | rnd = rnd ^ (rnd >> 9); 11 | rnd = rnd ^ (rnd << 8); 12 | return (rnd % max); 13 | } 14 | RandomSeed(uint seed) 15 | { 16 | rnd = seed == 0 ? 1 : seed; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Source/Projects/PyPorts/Fibo/Fibo.hs: -------------------------------------------------------------------------------- 1 | program Fibo 2 | { 3 | #define SERIAL_CONSOLE 4 | uses "/Source/System/System" 5 | uses "/Source/System/IO" 6 | 7 | delegate long FiboDelegate(long n); 8 | 9 | long Fibo(long n) 10 | { 11 | if ( n <= 1 ) 12 | { return n; } 13 | else 14 | { return Fibo(n-1) + Fibo(n-2); } 15 | } 16 | 17 | Benchmark(string name, FiboDelegate func, long arg, uint loops) 18 | { 19 | long start = Millis; // start timing 20 | long result = 0; 21 | for(uint count=0; count < loops; count++) 22 | { 23 | result = func(arg); 24 | } 25 | long ms = (Millis - start); // stop timing 26 | WriteLn(name + "(" + arg.ToString() + ") = " + result.ToString() + " in " + (ms / loops).ToString() + "ms"); 27 | } 28 | 29 | { 30 | FiboDelegate fiboDelegate = Fibo; 31 | Benchmark("Fibo", fiboDelegate, long(24), 5); // Fibo(24) = 46368 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Projects/PyPorts/Fibo/FiboUInt.hs: -------------------------------------------------------------------------------- 1 | program FiboUInt 2 | { 3 | uses "/Source/Library/Boards/PiPico" 4 | 5 | // https://forums.raspberrypi.com/viewtopic.php?t=303458 6 | 7 | delegate uint FiboDelegate(uint n); 8 | 9 | uint Fibo(uint n) 10 | { 11 | if ( n <= 1 ) 12 | { return n; } 13 | else 14 | { return Fibo(n-1) + Fibo(n-2); } 15 | } 16 | 17 | Benchmark(string name, FiboDelegate func, uint arg, uint loops) 18 | { 19 | long start = Millis; // start timing 20 | uint result = 0; 21 | for(uint count=0; count < loops; count++) 22 | { 23 | result = func(arg); 24 | } 25 | long ms = (Millis - start); // stop timing 26 | float seconds = ms / 1000.0; 27 | WriteLn(name + "(" + arg.ToString() + ") = " + result.ToString() + " in " + (seconds / loops).ToString() + " seconds"); 28 | } 29 | 30 | { 31 | FiboDelegate fiboDelegate = Fibo; 32 | Benchmark("Fibo", fiboDelegate, 24, 1); // Fibo(24) = 46368 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/Projects/PyPorts/Fibo/fibo.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | def Fibo(n): 4 | if n <= 1 : return n 5 | else : return Fibo(n-1) + Fibo(n-2) 6 | 7 | def Benchmark(name, func, arg=0, loops=1): 8 | elapsed = time.time() 9 | for count in range(loops): 10 | result = func(arg) 11 | elapsed = (time.time() - elapsed) / loops 12 | print("{}({}) = {} in {} seconds".format(name, arg, result, elapsed)) 13 | 14 | Benchmark("Fibo", Fibo, 24, 10) # Fibo(24) = 46368 -------------------------------------------------------------------------------- /Source/Projects/Sprites/0 memory layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/Sprites/0 memory layout.png -------------------------------------------------------------------------------- /Source/Projects/Sprites/1 memory layout sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/Sprites/1 memory layout sprites.png -------------------------------------------------------------------------------- /Source/Projects/Sprites/2 memory layout bytes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/Sprites/2 memory layout bytes.png -------------------------------------------------------------------------------- /Source/Projects/Sprites/TS.hs: -------------------------------------------------------------------------------- 1 | program TS 2 | { 3 | //uses "/Source/Library/Boards/PiPico" // MCU 4 | uses "/Source/Minimal/System" // 6502 5 | 6 | uses "/Source/Library/Displays/OLEDSSD1306" 7 | 8 | uses "Tools" 9 | uses "Sprites" 10 | 11 | Restart() 12 | { 13 | Sprites.Initialize(); 14 | Display.Suspend(); 15 | Display.Clear(Colour.Black); 16 | Display.Resume(); 17 | Sprites.Render(); 18 | } 19 | Hopper() 20 | { 21 | Seed(); 22 | if (!Display.Begin()) 23 | { 24 | IO.WriteLn("Failed to initialize display"); 25 | return; 26 | } 27 | PinMode(GP2, PinModeOption.Input); 28 | PinMode(GP3, PinModeOption.Input); 29 | 30 | Restart(); 31 | 32 | byte iSprite; 33 | loop 34 | { 35 | Sprites.Move(ref iSprite); 36 | if (!DigitalRead(GP2)) 37 | { 38 | Restart(); 39 | iSprite = 0; 40 | } 41 | if (!DigitalRead(GP3)) 42 | { 43 | IO.Write("3"); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Source/Projects/VGM/Samples/AlleyCat.vgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Projects/VGM/Samples/AlleyCat.vgz -------------------------------------------------------------------------------- /Source/Projects/VGM/VGMDemo.hs: -------------------------------------------------------------------------------- 1 | program SNVGM 2 | { 3 | //uses "/Source/Library/Boards/PiPico" 4 | uses "/Source/Library/Boards/Hopper6502" 5 | 6 | 7 | uses "/Source/Library/Audio/SNVGMPlayer" 8 | 9 | //uses "Samples/Ghost" 10 | uses "Samples/GB" 11 | //uses "Samples/Christmas" 12 | //uses "Samples/Sonata" 13 | //uses "Samples/AlleyCat" 14 | //uses "Samples/Kings" 15 | //uses "Samples/BruceLee" 16 | //uses "Samples/allaturca" 17 | 18 | Hopper() 19 | { 20 | Initialize(); 21 | Play(VGMDATA); 22 | Silence(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Source/Runtime/6502/MemoryMap.asm: -------------------------------------------------------------------------------- 1 | unit Address 2 | { 3 | const uint SerialInBuffer = 0x0200; // 256-byte buffer 0x0200-0x02FF 4 | 5 | const uint CallStackLSB = 0x0300; // LSBs of 256 call stack slots 6 | const uint CallStackMSB = 0x0400; // MSBs of 256 call stack slots 7 | 8 | const uint TypeStackLSB = 0x0500; // 256 type stack slots 9 | 10 | const uint ValueStackLSB = 0x0600; // LSBs of 256 value stack slots 11 | const uint ValueStackMSB = 0x0700; // MSBs of 256 value stack slots 12 | 13 | const uint I2CInBuffer = 0x0800; // 256-byte buffer 0x0800-0x08FF for I2C.RequestFrom 14 | 15 | const uint HopperData = 0x0900; // start of Hopper RAM (program, then heap) 16 | 17 | #if defined(BENEATER_IO) 18 | const uint RamSize = 0x5000; // the IO ports on the Ben Eater 6502 start at 0x5000 .. 19 | #endif 20 | #if defined(PD6502) 21 | const uint RamSize = 0x9F00; // stop just below bank switching IO for Dave's board 22 | #endif 23 | 24 | #if !defined(BENEATER_IO) && !defined(PD6502) 25 | const uint RamSize = 0x8000; // we assume RAM starts at 0x0000 and that we have at least 32K .. 26 | #endif 27 | } 28 | -------------------------------------------------------------------------------- /Source/Runtime/6502/Parallel.asm: -------------------------------------------------------------------------------- 1 | unit Parallel 2 | { 3 | uses "/Source/Runtime/6502/ZeroPage" 4 | #ifdef W65C22_VIA 5 | uses "/Source/Runtime/6502/Devices/W65C22" 6 | #endif 7 | #ifdef M6821_PIA 8 | uses "/Source/Runtime/6502/Devices/PIA6821" 9 | #endif 10 | 11 | Initialize() 12 | { 13 | #ifdef W65C22_VIA 14 | W65C22.initialize(); 15 | #endif 16 | #ifdef M6821_PIA 17 | PIA6821.initialize(); 18 | #endif 19 | } 20 | ISR() 21 | { 22 | #ifdef W65C22_VIA 23 | W65C22.isr(); 24 | #endif 25 | #ifdef M6821_PIA 26 | PIA6821.isr(); 27 | #endif 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Source/Runtime/Emulation/Diagnostics.hs: -------------------------------------------------------------------------------- 1 | unit Diagnostics 2 | { 3 | SetError(uint error) system; 4 | } 5 | -------------------------------------------------------------------------------- /Source/Runtime/Emulation/Directory.hs: -------------------------------------------------------------------------------- 1 | unit Directory 2 | { 3 | bool Exists(string path) system; 4 | Delete(string path) system; 5 | bool IsValid(directory this) system; 6 | directory Open(string fullpath) system; 7 | Create(string path) system; 8 | uint GetDirectoryCount(directory this) system; 9 | uint GetDirectoryCount(directory this, ref uint skipped) system; 10 | uint GetFileCount(directory this) system; 11 | uint GetFileCount(directory this, ref uint skipped) system; 12 | string GetDirectory(directory this, uint index) system; 13 | string GetFile(directory this, uint index) system; 14 | string GetTime(string path) system; 15 | string GetDate(string path) system; 16 | } 17 | -------------------------------------------------------------------------------- /Source/Runtime/Emulation/File.hs: -------------------------------------------------------------------------------- 1 | unit File 2 | { 3 | bool Exists(string path) system; 4 | Delete(string path) system; 5 | bool IsValid(file this) system; 6 | file Open(string fullpath) system; 7 | file Create(string fullpath) system; 8 | byte Read(file this) system; 9 | byte Read(file this, long seekPosition) system; 10 | Append(file this, byte content) system; 11 | Flush(file this) system; 12 | long GetSize(string path) system; 13 | long GetTimeStamp(string path) system; 14 | string GetTime(string path) system; 15 | string GetDate(string path) system; 16 | } 17 | -------------------------------------------------------------------------------- /Source/Runtime/Emulation/Float.hs: -------------------------------------------------------------------------------- 1 | unit Float 2 | { 3 | byte GetByte(float this, byte index) system; 4 | float FromBytes(byte b0, byte b1, byte b2, byte b3) system; 5 | string ToString(float this) system; 6 | 7 | float Sin(float angle) system; 8 | float Cos(float angle) system; 9 | float ATan2(float y, float x) system; 10 | float Sqrt(float value) system; 11 | } 12 | -------------------------------------------------------------------------------- /Source/Runtime/Emulation/Long.hs: -------------------------------------------------------------------------------- 1 | unit Long 2 | { 3 | byte GetByte(long this, byte index) system; 4 | long FromBytes(byte b0, byte b1, byte b2, byte b3) system; 5 | string ToString(long this) system; 6 | } 7 | -------------------------------------------------------------------------------- /Source/Runtime/Emulation/Minimal.hs: -------------------------------------------------------------------------------- 1 | unit Minimal 2 | { 3 | #ifdef VALUE_TYPE_RUNTIME 4 | uses "/Source/Minimal/Char" 5 | uses "/Source/Minimal/Byte" 6 | uses "/Source/Minimal/UInt" 7 | uses "/Source/Minimal/Int" 8 | #else 9 | uses "/Source/System/Char" 10 | uses "/Source/System/Byte" 11 | uses "/Source/System/UInt" 12 | uses "/Source/System/Int" 13 | 14 | #endif 15 | uses "System" 16 | uses "Diagnostics" 17 | uses "Time" 18 | 19 | uses "/Source/System/IO" 20 | 21 | 22 | #ifdef INCLUDE_LONGS 23 | uses "Long" 24 | #endif 25 | #ifdef INCLUDE_FLOATS 26 | uses "Float" 27 | #endif 28 | 29 | byte error; 30 | byte Error 31 | { set { error = value; SetError(error); } get { return error; }} 32 | } 33 | -------------------------------------------------------------------------------- /Source/Runtime/Emulation/System.hs: -------------------------------------------------------------------------------- 1 | unit System 2 | { 3 | uses "Memory" 4 | } 5 | -------------------------------------------------------------------------------- /Source/Runtime/Emulation/Time.hs: -------------------------------------------------------------------------------- 1 | unit Time 2 | { 3 | long Millis { get system; } 4 | Delay(uint ms) system; 5 | uint SampleMicros { get system; set system; } 6 | } 7 | -------------------------------------------------------------------------------- /Source/Runtime/Emulation/WiFi.hs: -------------------------------------------------------------------------------- 1 | unit WiFi 2 | { 3 | bool Connect(string ssid, string password) system; 4 | } 5 | -------------------------------------------------------------------------------- /Source/Runtime/Platform/Byte.hs: -------------------------------------------------------------------------------- 1 | unit HRByte 2 | { 3 | char ToHex(byte h) 4 | { 5 | if (h < 10) 6 | { 7 | h = h + 48; // +0 8 | } 9 | else 10 | { 11 | h = h + 55; // +A - 10 12 | } 13 | return char(h); 14 | } 15 | char ToDigit(byte d) 16 | { 17 | d = d + 48; // +0 18 | return char(d); 19 | } 20 | } -------------------------------------------------------------------------------- /Source/Runtime/Platform/Int.hs: -------------------------------------------------------------------------------- 1 | unit HRInt 2 | { 3 | uint ToLong(uint ichunk) 4 | { 5 | uint this = HRLong.New(); 6 | WriteWord(this+2, ichunk); 7 | if ((0x8000 & ichunk) != 0) 8 | { 9 | WriteWord(this+4, 0xFFFF); 10 | } 11 | else 12 | { 13 | WriteWord(this+4, 0); 14 | } 15 | return this; 16 | } 17 | uint FromBytes(byte b0, byte b1) 18 | { 19 | return b0 + (b1 << 8); 20 | } 21 | byte GetByte(uint ichunk, uint i) 22 | { 23 | return (i == 0) ? byte(ichunk & 0xFF) : byte(ichunk >> 8); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Source/Runtime/Platform/NeoPixel.hs: -------------------------------------------------------------------------------- 1 | unit HRNeoPixel 2 | { 3 | Begin(uint length, byte pin, uint pixelType) { ErrorDump(150); Error = 0x0A; } 4 | byte GetBrightness() { ErrorDump(151); Error = 0x0A; return 0; } 5 | SetBrightness(byte brightness) { ErrorDump(152); Error = 0x0A; } 6 | SetColor(uint pixel, byte r, byte g, byte b, byte w) { ErrorDump(153); Error = 0x0A; } 7 | Show() { ErrorDump(154); Error = 0x0A; } 8 | uint GetLength() { ErrorDump(155); Error = 0x0A; return 0; } 9 | } 10 | -------------------------------------------------------------------------------- /Source/Runtime/Platform/Types.hs: -------------------------------------------------------------------------------- 1 | unit Types 2 | { 3 | enum Type 4 | { 5 | Undefined = 0x00, 6 | Char = 0x01, 7 | Int = 0x02, 8 | Byte = 0x03, 9 | UInt = 0x04, 10 | Reference = 0x05, 11 | Bool = 0x06, 12 | 13 | Type = 0x0C, 14 | 15 | Float = 0x0D, 16 | Long = 0x0E, 17 | String = 0x0F, 18 | Pair = 0x10, 19 | Array = 0x12, 20 | Dictionary = 0x13, 21 | Variant = 0x14, 22 | File = 0x15, 23 | Directory = 0x16, 24 | List = 0x19, 25 | } 26 | 27 | bool IsReferenceType(Type htype) 28 | { 29 | return (byte(htype) >= 0x0D); 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Source/Runtime/Platform/UInt.hs: -------------------------------------------------------------------------------- 1 | unit HRUInt 2 | { 3 | uint ToLong(uint ui) 4 | { 5 | uint this = HRLong.New(); 6 | WriteWord(this+2, ui); 7 | WriteWord(this+4, 0); 8 | return this; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Source/Runtime/Platform/Wire.hs: -------------------------------------------------------------------------------- 1 | unit HRWire 2 | { 3 | // I2C APIs 4 | bool Begin(byte controller) 5 | { 6 | ErrorDump(133); Error = 0x0A; // not implemented on Windows 7 | return false; 8 | } 9 | 10 | BeginTx(byte controller, byte address) 11 | { 12 | ErrorDump(134); Error = 0x0A; // not implemented on Windows 13 | } 14 | 15 | byte EndTx(byte controller) 16 | { 17 | ErrorDump(135); Error = 0x0A; // not implemented on Windows 18 | return 0; 19 | } 20 | 21 | Write(byte controller, byte data) 22 | { 23 | ErrorDump(136); Error = 0x0A; // not implemented on Windows 24 | } 25 | Write(byte controller, uint hrarray, uint startIndex, uint length) 26 | { 27 | ErrorDump(136); Error = 0x0A; // not implemented on Windows 28 | } 29 | Configure(byte controller, byte sdaPin, byte sclPin, uint freqkHz) 30 | { 31 | ErrorDump(136); Error = 0x0A; // not implemented on Windows 32 | } 33 | byte RequestFrom(byte controller, byte address, byte bytes) 34 | { 35 | ErrorDump(136); Error = 0x0A; // not implemented on Windows 36 | return 0; 37 | } 38 | byte Read(byte controller) 39 | { 40 | ErrorDump(136); Error = 0x0A; // not implemented on Windows 41 | return 0; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Source/Runtime/Z80Gen.hs: -------------------------------------------------------------------------------- 1 | program rZ80Gen 2 | { 3 | #define CPU_Z80 4 | #define ROM_16K 5 | 6 | uses "/Source/Minimal/Type" 7 | uses "/Source/Minimal/Diagnostics" 8 | 9 | uses "Z80/String" 10 | uses "Z80/Memory" 11 | uses "Z80/GC" 12 | uses "Z80/Array" 13 | 14 | Hopper() 15 | { 16 | uint str = String.New(); 17 | str = String.NewFromConstant0(0, 0); 18 | _ = String.NewFromConstant1(0xAA55); 19 | _ = GC.Clone(str); 20 | _ = String.GetChar(str, 0); 21 | GC.Release(str); 22 | 23 | _ = Memory.Available(); 24 | _ = Memory.Maximum(); 25 | 26 | String.BuildClear(ref str); 27 | String.BuildChar(ref str, 'a'); 28 | String.BuildString(ref str, str); 29 | String.BuildFront(ref str, 'a'); 30 | 31 | _ = String.GetLength(str); 32 | uint arr = Array.New(10, Type.UInt); 33 | _ = Array.NewFromConstant(0, 10, Type.Byte); 34 | _ = Array.GetCount(arr); 35 | _ = Array.GetItem(arr, 0); 36 | Array.SetItem(arr, 0, 0); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Runtime/mb.cmd: -------------------------------------------------------------------------------- 1 | preprocess /source/samples/mandelbrot 2 | compile mandelbrot -o 3 | optimize mandelbrot -v 4 | codegen mandelbrot -ihex 5 | dasm mandelbrot 6 | 7 | -------------------------------------------------------------------------------- /Source/Samples/Content/Tigger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/Tigger.png -------------------------------------------------------------------------------- /Source/Samples/Content/grace.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/grace.bin -------------------------------------------------------------------------------- /Source/Samples/Content/grace.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/grace.jpg -------------------------------------------------------------------------------- /Source/Samples/Content/rp2040.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/rp2040.bin -------------------------------------------------------------------------------- /Source/Samples/Content/rp2040.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/rp2040.jpg -------------------------------------------------------------------------------- /Source/Samples/Content/tigger128.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/tigger128.bin -------------------------------------------------------------------------------- /Source/Samples/Content/tigger32.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/tigger32.bin -------------------------------------------------------------------------------- /Source/Samples/Content/tigger64.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/tigger64.bin -------------------------------------------------------------------------------- /Source/Samples/Content/tiggerrelaxed.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/tiggerrelaxed.bin -------------------------------------------------------------------------------- /Source/Samples/Content/tiggerrelaxed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/Content/tiggerrelaxed.png -------------------------------------------------------------------------------- /Source/Samples/FiboUInt.hs: -------------------------------------------------------------------------------- 1 | program FiboUInt 2 | { 3 | uses "/Source/Library/Boards/PiPico" 4 | 5 | // https://forums.raspberrypi.com/viewtopic.php?t=303458 6 | 7 | delegate uint FiboDelegate(uint n); 8 | 9 | uint Fibo(uint n) 10 | { 11 | if ( n <= 1 ) 12 | { return n; } 13 | else 14 | { return Fibo(n-1) + Fibo(n-2); } 15 | } 16 | 17 | Benchmark(string name, FiboDelegate func, uint arg, uint loops) 18 | { 19 | long start = Millis; // start timing 20 | uint result = 0; 21 | for(uint count=0; count < loops; count++) 22 | { 23 | result = func(arg); 24 | } 25 | long ms = (Millis - start); // stop timing 26 | float seconds = ms / 1000.0; 27 | WriteLn(name + "(" + arg.ToString() + ") = " + result.ToString() + " in " + (seconds / loops).ToString() + " seconds"); 28 | } 29 | 30 | { 31 | FiboDelegate fiboDelegate = Fibo; 32 | Benchmark("Fibo", fiboDelegate, 24, 1); // Fibo(24) = 46368 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/Samples/Hello.hs: -------------------------------------------------------------------------------- 1 | program Hello 2 | { 3 | #define RP2040 4 | 5 | uses "/Source/System/MCU" 6 | 7 | { 8 | WriteLn("Hello Hopper!"); 9 | for (uint i = 0; i < 10; i++) 10 | { 11 | LED = true; 12 | Delay(500); 13 | LED = false; 14 | Delay(500); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Source/Samples/MCU/AnalogRead.hs: -------------------------------------------------------------------------------- 1 | program AnalogRead 2 | { 3 | uses "/Source/Library/Boards/ChallengerNB2040WiFi" 4 | 5 | { 6 | loop 7 | { 8 | uint a0 = A0; 9 | uint a1 = A1; 10 | uint a2 = A2; 11 | uint a3 = A3; 12 | 13 | WriteLn(a0.ToString() + ", " + a1.ToString() + ", " + a2.ToString() + ", " + a3.ToString()); 14 | Delay(50); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Source/Samples/MCU/AnalogWrite.hs: -------------------------------------------------------------------------------- 1 | program AnalogWrite 2 | { 3 | //uses "/Source/Library/Boards/AdaFruitItsyBitsy" 4 | //uses "/Source/Library/Boards/AdaFruitQTPy" 5 | uses "/Source/Library/Boards/AdaFruitFeather" 6 | 7 | const byte ledA = A0; 8 | const byte ledB = A1; 9 | { 10 | AnalogWriteResolution(10); 11 | uint fade; 12 | bool flip; 13 | loop 14 | { 15 | fade = (flip ? fade - 1 : fade + 1); 16 | if ((fade & 0x03FF) == 0x0000) 17 | { 18 | flip = !flip; 19 | fade = (flip ? fade - 1 : fade + 1); 20 | } 21 | AnalogWrite(ledA, fade); 22 | AnalogWrite(ledB, 0x03FF-fade); 23 | Delay(5); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Source/Samples/MCU/Blink.hs: -------------------------------------------------------------------------------- 1 | program Blink 2 | { 3 | //uses "/Source/Library/Boards/PiPico2" 4 | //uses "/Source/Library/Boards/PimoroniPicoPlus2W" 5 | //uses "/Source/Library/Boards/AdafruitFeatherRP2350Hstx" 6 | uses "/Source/Library/Boards/PimoroniTiny2350" 7 | 8 | Hopper() 9 | { 10 | bool on; 11 | MCU.PinMode(GP6, MCU.PinModeOption.Output); 12 | 13 | loop 14 | { 15 | Delay(500); 16 | 17 | LED = !LED; 18 | 19 | DigitalWrite(GP6, on); 20 | on = !on; 21 | 22 | WriteLn((Time.Seconds).ToString() + " seconds"); 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Source/Samples/MCU/BlinkNeo.hs: -------------------------------------------------------------------------------- 1 | program BlinkRGB 2 | { 3 | //uses "/Source/Library/Boards/WaveshareRP2040Matrix" 4 | //uses "/Source/Library/Boards/AdafruitFeather" 5 | //uses "/Source/Library/Boards/SeeedXIAORP2040" 6 | uses "/Source/Library/Boards/AdafruitQTPy" 7 | 8 | { 9 | NeoPixel.BuiltIn(); 10 | 11 | uint totalPixels = NeoPixel.Length; 12 | 13 | loop 14 | { 15 | for (byte pixel = 0; pixel < totalPixels; pixel++) 16 | { 17 | NeoPixel.SetColor(pixel, 255, 0, 0); 18 | NeoPixel.Show(); 19 | WriteLn(pixel.ToString() + "R"); 20 | Delay(500); 21 | 22 | NeoPixel.SetColor(pixel, 0, 255, 0); 23 | NeoPixel.Show(); 24 | WriteLn(pixel.ToString() + "G"); 25 | Delay(500); 26 | 27 | NeoPixel.SetColor(pixel, 0, 0, 255); 28 | NeoPixel.Show(); 29 | WriteLn(pixel.ToString() + "B"); 30 | Delay(500); 31 | 32 | NeoPixel.SetColor(pixel, 0, 0, 0); 33 | NeoPixel.Show(); 34 | WriteLn(pixel.ToString() + "0"); 35 | Delay(500); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Source/Samples/MCU/BlinkRGB.hs: -------------------------------------------------------------------------------- 1 | program BlinkRGB 2 | { 3 | //uses "/Source/Library/Boards/PimoroniTiny2040" 4 | uses "/Source/Library/Boards/PimoroniTiny2350" 5 | //uses "/Source/Library/Boards/SeeedXIAORP2040" 6 | 7 | //uses "/Source/Library/Boards/PimoroniPlasma2350" 8 | 9 | { 10 | loop 11 | { 12 | Write(LEDR ? 'R' : '-'); 13 | Delay(500); 14 | LEDR = !LEDR; 15 | 16 | Write(LEDG ? 'G' : '-'); 17 | Delay(500); 18 | LEDG = !LEDG; 19 | 20 | Write(LEDB ? 'B' : '-'); 21 | Delay(500); 22 | LEDB = !LEDB; 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Source/Samples/MCU/GPIO.hs: -------------------------------------------------------------------------------- 1 | program Blink 2 | { 3 | uses "/Source/Library/Boards/ChallengerNB2040WiFi" 4 | 5 | Hopper() 6 | { 7 | //for (byte pin = 0; pin <= 28; pin++) 8 | //{ 9 | 10 | byte pin = 20; 11 | //byte pin = 23; 12 | 13 | MCU.PinMode(pin, MCU.PinModeOption.Output); 14 | 15 | IO.WriteLn("Pin: " + pin.ToString()); 16 | for (byte i=0; i < 10; i++) 17 | { 18 | MCU.DigitalWrite(pin, i % 2 == 0); 19 | Delay(500); 20 | } 21 | MCU.DigitalWrite(pin, false); 22 | 23 | 24 | //} 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Source/Samples/MCU/HC12/Gerber_Tiny-2350_PCB_Tiny-2350_2_2024-12-22.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sillycowvalley/Hopper/330dd0a94449de03706ea4e72d8e6100f98130fe/Source/Samples/MCU/HC12/Gerber_Tiny-2350_PCB_Tiny-2350_2_2024-12-22.zip -------------------------------------------------------------------------------- /Source/Samples/MCU/HC12/LEDDemo.hs: -------------------------------------------------------------------------------- 1 | program LEDDemo 2 | { 3 | uses "/Source/Library/Boards/PimoroniTiny2350" 4 | 5 | Tiny2350LEDOff() 6 | { 7 | // Pimoroni Tiny 2350 built in RGB is active low 8 | MCU.PinMode(GP18, PinModeOption.Output); 9 | MCU.PinMode(GP19, PinModeOption.Output); 10 | MCU.PinMode(GP20, PinModeOption.Output); 11 | MCU.DigitalWrite(GP18, true); 12 | MCU.DigitalWrite(GP19, true); 13 | MCU.DigitalWrite(GP20, true); 14 | } 15 | 16 | Hopper() 17 | { 18 | Tiny2350LEDOff(); 19 | 20 | PinMode(GP5, PinModeOption.Output); 21 | PinMode(GP6, PinModeOption.Output); 22 | PinMode(GP7, PinModeOption.Output); 23 | 24 | DigitalWrite(GP5, false); 25 | DigitalWrite(GP6, false); 26 | DigitalWrite(GP7, false); 27 | 28 | loop 29 | { 30 | DigitalWrite(GP5, true); 31 | Delay(500); 32 | DigitalWrite(GP5, false); 33 | DigitalWrite(GP6, true); 34 | Delay(500); 35 | DigitalWrite(GP6, false); 36 | DigitalWrite(GP7, true); 37 | Delay(500); 38 | DigitalWrite(GP7, false); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Source/Samples/MCU/HC12/Pico433Rx.hs: -------------------------------------------------------------------------------- 1 | program Pico433Rx 2 | { 3 | //uses "/Source/Library/Boards/PiPicoW" 4 | //uses "/Source/Library/Boards/AdaFruitFeatherRP2350HSTX" 5 | //uses "/Source/Library/Boards/ChallengerNB2040WiFi" 6 | uses "/Source/Library/Boards/PimoroniTiny2350" 7 | 8 | const byte ledPin = GP5; 9 | 10 | Hopper() 11 | { 12 | string captured; 13 | 14 | PinMode(ledPin, PinModeOption.Output); 15 | 16 | UART.Setup(9600); 17 | 18 | loop // reception loop 19 | { 20 | if (UART.IsAvailable) 21 | { 22 | char ch = UART.ReadChar(); 23 | Serial.WriteChar(ch); 24 | captured += ch; 25 | if (ch == Char.EOL) 26 | { 27 | // return the content on Char.EOL 28 | DigitalWrite(ledPin, true); 29 | UART.WriteString("Returned: " +captured); 30 | captured = ""; 31 | Delay(250); 32 | DigitalWrite(ledPin, false); 33 | } 34 | 35 | } 36 | } // reception loop 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Samples/MCU/Secrets/Connect.hs: -------------------------------------------------------------------------------- 1 | unit Connect 2 | { 3 | string Password { get { return "XXXX"; } } 4 | string SSID { get { return "XXXX"; } } 5 | } 6 | -------------------------------------------------------------------------------- /Source/Samples/MCU/WSPicoRTC.hs: -------------------------------------------------------------------------------- 1 | program Test 2 | { 3 | uses "/Source/Library/Devices/WSPicoRTCDS3231" 4 | uses "/Source/Library/Devices/WSPico8SEGLED" 5 | 6 | { 7 | if (!RTCDevice.Begin()) 8 | { 9 | IO.WriteLn("Failed to initialize RTC"); 10 | return; 11 | } 12 | if (!Pico8SEGLED.Begin()) 13 | { 14 | IO.WriteLn("Failed to initialize 8 SEG Display"); 15 | return; 16 | } 17 | Pico8SEGLED.DecimalPosition = 3; 18 | Pico8SEGLED.LeadingZeroes = true; 19 | 20 | _ = RTC.SetFromDebugger(); 21 | 22 | uint hours; 23 | uint minutes; 24 | loop 25 | { 26 | string time = RTC.Time; // "10:20:40" 27 | parts = time.Split(':'); 28 | _ = UInt.TryParse(parts[0], ref hours); 29 | _ = UInt.TryParse(parts[1], ref minutes); 30 | Pico8SEGLED.Show(hours * 100 + minutes); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Samples/MCU/ws8SEG.hs: -------------------------------------------------------------------------------- 1 | program Waveshare8SEGLED 2 | { 3 | uses "/Source/Library/Devices/WSPico8SEGLED" 4 | StopWatch() 5 | { 6 | Pico8SEGLED.Hex = false; 7 | Pico8SEGLED.DecimalPosition = 0; 8 | Pico8SEGLED.LeadingZeroes = false; 9 | for (long tick = 0; tick < 99999; tick++) 10 | { 11 | for (uint i = 1; i < 100; i ++) 12 | { 13 | Pico8SEGLED.Show(tick); 14 | // Show(..) takes 8ms so +2ms gives us a 1/100 second counter 15 | Time.Delay(2); 16 | } 17 | } 18 | } 19 | HexCounter() 20 | { 21 | Pico8SEGLED.Hex = true; 22 | Pico8SEGLED.DecimalPosition = 0; 23 | Pico8SEGLED.LeadingZeroes = true; 24 | for (long value = 0; value <= 0xFFFF; value++) 25 | { 26 | Pico8SEGLED.Show(value); 27 | // Show(..) takes 8ms so +2ms gives us a 1/100 second counter 28 | Time.Delay(2); 29 | } 30 | } 31 | 32 | { 33 | if (!Pico8SEGLED.Begin()) 34 | { 35 | IO.WriteLn("Failed to initialize Waveshare Pico-8SEG-LED"); 36 | return; 37 | } 38 | loop 39 | { 40 | StopWatch(); 41 | //HexCounter(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Source/Samples/Mandelbrot.bas: -------------------------------------------------------------------------------- 1 | // https://www.dos4ever.com/SCMP/NIBL.html 2 | 3 | 100 VDU12:PRINT "Mandelbrot - Gordons TinyBasic - Integers" 4 | 110 PRINT "Start" 5 | 120 !160=0:REM Initialise TIME 6 | 130 Z=TOP:$Z=".,'~=+:;*%&$OXB#@ " 7 | 140 F=50 8 | 150 FOR Y = -12 TO 12 9 | 160 FOR X = -49 TO 29 10 | 170 C=X*229/100 11 | 180 D=Y*416/100 12 | 190 A=C:B=D:I=0 13 | 200 Q=B/F:S=B-(Q*F) 14 | 210 T=((A*A)-(B*B))/F+C 15 | 220 B=2*((A*Q)+(A*S/F))+D 16 | 230 A=T: P=A/F:Q=B/F 17 | 240 IF ((P*P)+(Q*Q))>=5 GOTO 280 18 | 250 I=I+1:IF I<16 GOTO 200 19 | 260 PRINT" "; 20 | 270 GOTO 290 21 | 280 VDU ?(Z+I) 22 | 290 NEXT X 23 | 300 PRINT "" 24 | 310 NEXT Y 25 | 320 Q=!160 26 | 330 PRINT"Finished" 27 | 340 PRINT"Time: ", Q/100, " secs." 28 | -------------------------------------------------------------------------------- /Source/Samples/NRL.hs: -------------------------------------------------------------------------------- 1 | program NRL 2 | { 3 | #define SERIAL_CONSOLE 4 | uses "/Source/System/System" 5 | uses "/Source/System/IO" 6 | 7 | { 8 | uint i; 9 | uint j; 10 | long s; 11 | 12 | long start = Millis; // start timing 13 | 14 | for (i=1; i <= 10; i++) 15 | { 16 | s = 0; 17 | for (j=1; j <= 1000; j++) 18 | { 19 | s = s + j; 20 | } 21 | Write('.'); 22 | } 23 | WriteLn(s.ToString()); // should be '500500' 24 | long ms = (Millis - start); // stop timing 25 | WriteLn(ms.ToString() + "ms"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Source/Samples/NRLUInt.hs: -------------------------------------------------------------------------------- 1 | program NRLUInt 2 | { 3 | uses "/Source/System/System" 4 | uses "/Source/System/IO" 5 | 6 | { 7 | uint i; 8 | uint j; 9 | uint s; 10 | 11 | long start = Millis; // start timing 12 | 13 | for (i=1; i <= 10; i++) 14 | { 15 | s = 0; 16 | for (j=1; j <= 1000; j++) 17 | { 18 | s = s + j; 19 | } 20 | Write('.'); 21 | } 22 | WriteLn(s.ToString()); // should be '500500' 23 | long ms = (Millis - start); // stop timing 24 | WriteLn(ms.ToString() + "ms"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Source/Samples/Newton.hs: -------------------------------------------------------------------------------- 1 | program Newton 2 | { 3 | uses "/Source/System/System" 4 | uses "/Source/System/IO" 5 | 6 | const long interations = 100000; 7 | 8 | { 9 | IO.Clear(); 10 | IO.WriteLn(); 11 | IO.WriteLn(" Newton's method for approximating pi - floating point benchmark"); 12 | 13 | long start = Millis; 14 | 15 | float x = 1.0; 16 | float temp; 17 | float pi=1.0; 18 | 19 | for (long i = 2; i < interations; i++) 20 | { 21 | x = x * -1.0; 22 | pi = pi + x / (2.0 * i - 1.0); 23 | temp = 40000000.0 * pi; 24 | } 25 | pi = pi * 4; 26 | 27 | long ms = (Millis - start); 28 | IO.WriteLn(" pi = " + pi.ToString()); 29 | IO.WriteLn(" interations = " + (interations).ToString()); 30 | IO.WriteLn(" " + ms.ToString() + " " + " ms"); 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/Samples/Primes.hs: -------------------------------------------------------------------------------- 1 | program Primes 2 | { 3 | 4 | uses "/Source/System/System" 5 | uses "/Source/System/Screen" 6 | 7 | // Python benchmarks: 8 | // https://forum.micropython.org/viewtopic.php?t=2659 9 | // https://github.com/shaoziyang/micropython_benchmarks/blob/master/1.9.4-479/benchmark.py 10 | 11 | uint isPrime(uint n) 12 | { 13 | uint n2 = n/2; 14 | for (uint i=2; i <= n2; i++) 15 | { 16 | if ((n % i) == 0) 17 | { 18 | return 0; 19 | } 20 | } 21 | return 1; 22 | } 23 | { 24 | //for (uint j=0; j < 100; j++) 25 | //{ 26 | long start = Millis; 27 | 28 | 29 | uint numPrimes = 0; 30 | for (uint i=2; i < 65535; i++) 31 | { 32 | numPrimes = numPrimes + isPrime(i); 33 | } 34 | 35 | long end = Millis; 36 | long elapsed = end - start; 37 | float seconds = elapsed / 1000.0; 38 | 39 | PrintLn(numPrimes.ToString() + " primes, Elapsed time: " + seconds.ToString() + " seconds"); 40 | PrintLn("(goal is < 1 second)"); 41 | //} 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Source/Shell/Cls.hs: -------------------------------------------------------------------------------- 1 | program Command 2 | { 3 | //#define SERIAL_CONSOLE 4 | uses "Common" 5 | 6 | string Name { get { return "CLS"; } } 7 | string Description { get { return "clear the screen"; } } 8 | 9 | bool SupportsSource { get { return false; } } // directory with or without mask as source 10 | bool SupportsSourceFile { get { return false; } } // single file as source (never confirm) 11 | bool SupportsDestination { get { return false; } } 12 | bool SupportsMask { get { return false; } } // *.* 13 | bool SupportsRecursive { get { return false; } } // -s 14 | bool SupportsConfirmation { get { return false; } } // -y 15 | bool RequiresArguments { get { return false; } } 16 | 17 | ShowArguments() {} 18 | bool Argument(string arg) { return false; } 19 | bool OnDirectory(string path) { return true; } 20 | bool OnFile(string path, bool first, uint maxLength) { return true; } 21 | 22 | { 23 | if (Common.Arguments()) 24 | { 25 | #ifdef SERIAL_CONSOLE 26 | IO.Clear(); 27 | #else 28 | Screen.Clear(); 29 | #endif 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Source/Shell/DEL.hs: -------------------------------------------------------------------------------- 1 | program Command 2 | { 3 | //#define SERIAL_CONSOLE 4 | uses "Common" 5 | 6 | string Name { get { return "DEL"; } } 7 | string Description { get { return "delete one or more files (alias RM)"; } } 8 | 9 | bool SupportsSource { get { return true; } } // directory with or without mask as source 10 | bool SupportsSourceFile { get { return true; } } // single file as source (never confirm) 11 | bool SupportsDestination { get { return false; } } 12 | bool SupportsMask { get { return true; } } // *.* 13 | bool SupportsRecursive { get { return true; } } // -s 14 | bool SupportsConfirmation { get { return true; } } // -y 15 | bool RequiresArguments { get { return true; } } 16 | 17 | ShowArguments() {} 18 | bool Argument(string arg) { return false; } 19 | bool OnDirectory(ShellObject shellObject) { return true; } 20 | 21 | bool OnFile(ShellObject shellObject, bool first, uint maxLength) 22 | { 23 | string path = shellObject.Path; 24 | Write(path.Pad(' ', maxLength), Colour.MatrixBlue); 25 | File.Delete(path); 26 | WriteLn(" deleted", Colour.MatrixRed); 27 | return true; 28 | } 29 | 30 | { 31 | if (Common.Arguments()) { Common.Walk(); } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Source/System/Array.hs: -------------------------------------------------------------------------------- 1 | unit Array 2 | { 3 | uint Count { get system; } 4 | 5 | SetItem(V[] this, uint index, V value) system; 6 | V GetItem(V[] this, uint index) system; 7 | V[] Slice(V[] this, uint start) system; 8 | V[] Slice(V[] this, uint start, uint length) system; 9 | type ItemType { get system; } 10 | } 11 | -------------------------------------------------------------------------------- /Source/System/Bool.hs: -------------------------------------------------------------------------------- 1 | unit Bool 2 | { 3 | string ToString(bool this) 4 | { 5 | if (this) 6 | { 7 | return "true"; 8 | } 9 | return "false"; 10 | } 11 | } -------------------------------------------------------------------------------- /Source/System/Byte.hs: -------------------------------------------------------------------------------- 1 | unit Byte 2 | { 3 | string ToString(byte this) 4 | { 5 | int value; 6 | value = int(this); 7 | return value.ToString(); 8 | } 9 | string ToHexString(byte this, byte digits) 10 | { 11 | int digit; 12 | char c; 13 | int i; 14 | string result; 15 | for (i = digits; i > 0; i--) 16 | { 17 | digit = this % 16; 18 | c = Byte.ToHex(byte(digit)); 19 | String.BuildFront(ref result, c); 20 | this = this / 16; 21 | } 22 | return result; 23 | } 24 | string ToBinaryString(byte this) 25 | { 26 | int digit; 27 | char c; 28 | int i; 29 | string result; 30 | for (i = 8; i > 0; i--) 31 | { 32 | digit = this % 2; 33 | c = Byte.ToHex(byte(digit)); 34 | String.BuildFront(ref result, c); 35 | this = this / 2; 36 | } 37 | return result; 38 | } 39 | 40 | char ToHex(byte this) system; 41 | char ToDigit(byte this) system; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Source/System/Clipboard.hs: -------------------------------------------------------------------------------- 1 | unit Clipboard 2 | { 3 | bool HasText { get system; } 4 | char GetChar() system; 5 | string GetText() system; 6 | SetText(string text) system; 7 | } 8 | -------------------------------------------------------------------------------- /Source/System/Diagnostics.hs: -------------------------------------------------------------------------------- 1 | unit Diagnostics 2 | { 3 | Assert(bool assertion, string message) system; 4 | Assert(bool assertion, string message, string src, uint ln) system; 5 | 6 | SetError(uint error) system; 7 | 8 | // lastError codes: 9 | // 0x00 - ok 10 | // 0x01 - list index out of range 11 | // 0x02 - array index out of range 12 | // 0x03 - no entry for key in dictionary 13 | // 0x04 - division by zero attempted 14 | // 0x05 - string index out of range 15 | // 0x06 - call stack overflow 16 | // 0x07 - argument stack overflow 17 | // 0x08 - failed dynamic cast 18 | // 0x09 - invalid variant type 19 | // 0x0A - feature not implemented 20 | // 0x0B - system failure (internal error) 21 | // 0x0C - memory allocation failure 22 | // 0x0D - numeric type out of range/overflow 23 | // 0x0E - user error (like compilation failure) 24 | // 0x0F - invalid or uninitialized delegate 25 | Die(uint error) system; 26 | 27 | OutputDebug(string output) system; 28 | OutputDebug( output) system; 29 | OutputDebug( output) system; 30 | OutputDebug(< > output) system; 31 | OutputDebug(< > output) system; 32 | OutputDebug(< uint > output) system; 33 | } 34 | -------------------------------------------------------------------------------- /Source/System/Dictionary.hs: -------------------------------------------------------------------------------- 1 | unit Dictionary 2 | { 3 | uint Count { get system; } 4 | Set( this, K key, V value) system; 5 | bool Contains( this, K key) system; 6 | V Get( this, K key) system; 7 | Clear( this) system; 8 | 9 | string ToString( this) 10 | { 11 | string result = "<"; 12 | foreach (var di in this) 13 | { 14 | if (result != "<") 15 | { 16 | result += ", "; 17 | } 18 | result += "<" + (di.key).ToString() + ", " + (di.value).ToString() + ">"; 19 | } 20 | result += ">"; 21 | return result; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/System/Directory.hs: -------------------------------------------------------------------------------- 1 | unit Directory 2 | { 3 | bool Exists(string path) system; 4 | Delete(string path) system; 5 | bool IsValid(directory this) system; 6 | directory Open(string fullpath) system; 7 | Create(string path) system; 8 | uint GetDirectoryCount(directory this) system; 9 | uint GetDirectoryCount(directory this, ref uint skipped) system; 10 | uint GetFileCount(directory this) system; 11 | uint GetFileCount(directory this, ref uint skipped) system; 12 | string GetDirectory(directory this, uint index) system; 13 | string GetFile(directory this, uint index) system; 14 | string GetTime(string path) system; 15 | string GetDate(string path) system; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Source/System/Memory.hs: -------------------------------------------------------------------------------- 1 | unit Memory 2 | { 3 | byte ReadByte(uint address) system; 4 | WriteByte(uint address, byte value) system; 5 | 6 | uint Allocate(uint size) system; 7 | Free(uint address) system; 8 | uint Available() system; 9 | uint Maximum() system; 10 | } 11 | -------------------------------------------------------------------------------- /Source/System/Pair.hs: -------------------------------------------------------------------------------- 1 | unit Pair 2 | { 3 | //Set( this, K key, V value) system; 4 | V Value( this) system; 5 | K Key( this) system; 6 | } -------------------------------------------------------------------------------- /Source/System/Runtime.hs: -------------------------------------------------------------------------------- 1 | unit Runtime 2 | { 3 | 4 | #if defined(MCU) || defined(SERIAL_CONSOLE) 5 | // used from RTC.SetFromDebugger(..) 6 | bool InDebugger { get system; } 7 | string DateTime { get system; } 8 | #endif 9 | 10 | // launch another application 11 | // (on exit, restore the currently running one) 12 | uint Execute(string programPath, arguments) system; 13 | 14 | // base address of the inline code RuntTime.Inline(..) 15 | uint UserCode { get system; } 16 | 17 | // execute an array of Hopper opCodes inline 18 | // (use & operator to determine offsets of locals and globals) 19 | uint Inline(byte[] code, uint startIndex) system; 20 | 21 | // currently used in TiggerBasic to get current line number from PC - probably doesn't work as expected 22 | uint PC { get system; } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Source/System/Serial.hs: -------------------------------------------------------------------------------- 1 | unit Serial 2 | { 3 | Connect() system; 4 | Connect(uint port) system; 5 | Connect(uint port, string baud) system; 6 | Close() system; 7 | bool IsValid() system; 8 | bool IsAvailable { get system; } 9 | char ReadChar() system; 10 | WriteChar(char ch) system; 11 | WriteString(string str) system; 12 | 13 | Ports { get system ; } 14 | } 15 | -------------------------------------------------------------------------------- /Source/System/System.hs: -------------------------------------------------------------------------------- 1 | unit System 2 | { 3 | 4 | const string HexeExtension = ".hexe"; 5 | const string HasmExtension = ".hasm"; 6 | 7 | 8 | uses "Char" 9 | uses "Bool" 10 | uses "Byte" 11 | uses "Int" 12 | uses "UInt" 13 | uses "Long" 14 | uses "Float" 15 | uses "Time" 16 | uses "String" 17 | uses "List" 18 | uses "Dictionary" 19 | uses "Pair" 20 | uses "Array" 21 | uses "Path" 22 | uses "Type" 23 | uses "Variant" 24 | 25 | #if !defined(BLOCKFILESYSTEM) 26 | uses "File" 27 | uses "Directory" 28 | #endif 29 | 30 | Arguments { get system; } 31 | #if !defined(BLOCKFILESYSTEM) 32 | string CurrentDirectory { get system; set system; } 33 | #else 34 | string CurrentDirectory 35 | { 36 | get { return FileSystem.getCwd(); } 37 | set { _ = FileSystem.chDir(value); } // error check? 38 | } 39 | #endif 40 | Beep() system; 41 | } 42 | -------------------------------------------------------------------------------- /Source/System/Time.hs: -------------------------------------------------------------------------------- 1 | unit Time 2 | { 3 | long Millis { get system; } 4 | uint Seconds { get system; } 5 | 6 | #if defined(MCU) 7 | Delay(uint ms) system; 8 | uint SampleMicros { set system; get system; } 9 | #else 10 | Delay(uint ms) 11 | { 12 | long endTime = Millis + ms; 13 | loop 14 | { 15 | if (Millis >= endTime) 16 | { 17 | break; 18 | } 19 | } 20 | } 21 | #endif 22 | DelaySeconds(uint s) 23 | { 24 | s *= 2; 25 | for (uint i=0; i < s; i++) 26 | { 27 | Delay(500); // allows debugger to break into long delays 28 | } 29 | } 30 | #if !defined(MCU) 31 | string Time { get system; } 32 | string Date { get system; } 33 | #endif 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Source/Testing/Minimal/Blink.hs: -------------------------------------------------------------------------------- 1 | program Blink 2 | { 3 | uses "/Source/Library/Boards/Hopper6502" 4 | //uses "/Source/Library/Boards/BenEater6502" 5 | //uses "/Source/Library/Boards/PD6502" 6 | //uses "/Source/Library/Boards/MECB6502" 7 | 8 | //uses "/Source/Library/Boards/PiPico" 9 | 10 | Hopper() 11 | { 12 | //SampleMicros = 1000; 13 | loop 14 | { 15 | LED = !LED; 16 | WriteLn((Time.Seconds).ToString()); 17 | Delay(500); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Source/Testing/Minimal/Count.hs: -------------------------------------------------------------------------------- 1 | program Count 2 | { 3 | uses "/Source/Library/Boards/Hopper6502" 4 | 5 | Hopper() 6 | { 7 | Memory.WriteByte(DDRA, 0b11111111); 8 | Memory.WriteByte(DDRB, 0b11111111); 9 | 10 | uint counter; 11 | 12 | loop 13 | { 14 | Memory.WriteByte(PORTA, byte(counter & 0xFF)); 15 | Memory.WriteByte(PORTB, byte(counter >> 8)); 16 | 17 | Delay(50); 18 | counter++; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Source/Testing/Minimal/Fibo.hs: -------------------------------------------------------------------------------- 1 | program Fibo 2 | { 3 | //#define MCU 4 | 5 | uses "/Source/Minimal/IO" 6 | 7 | delegate uint FiboDelegate(uint n); 8 | 9 | uint Fibo(uint n) 10 | { 11 | if ( n <= 1 ) 12 | { return n; } 13 | else 14 | { return Fibo(n-1) + Fibo(n-2); } 15 | } 16 | Benchmark(string name, FiboDelegate func, uint arg, uint loops) 17 | { 18 | uint start = Time.Seconds; 19 | uint result = 0; 20 | for(uint count=0; count < loops; count++) 21 | { 22 | result = func(arg); 23 | } 24 | uint elapsed = Time.Seconds - start; 25 | WriteLn(); 26 | WriteLn(name + " (" + arg.ToString() + ") = " + result.ToString() + " in " + elapsed.ToString() + " seconds"); 27 | } 28 | Hopper() 29 | { 30 | FiboDelegate fiboDelegate = Fibo; 31 | // 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 32 | Benchmark("Fibo", fiboDelegate, 24, 1); // Fibo(24) = 46368 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/Testing/Minimal/FiboZ80.hs: -------------------------------------------------------------------------------- 1 | program Fibo 2 | { 3 | #define CPU_Z80 4 | //#define MCU 5 | 6 | uses "/Source/Minimal/IO" 7 | 8 | uint Fibo(uint n) 9 | { 10 | if ( n <= 1 ) 11 | { return n; } 12 | else 13 | { return Fibo(n-1) + Fibo(n-2); } 14 | } 15 | Benchmark(string name, uint arg, uint loops) 16 | { 17 | //uint start = Time.Seconds; 18 | uint result = 0; 19 | for(uint count=0; count < loops; count++) 20 | { 21 | result = Fibo(arg); 22 | } 23 | //uint elapsed = Time.Seconds - start; 24 | WriteLn(); 25 | WriteLn(name + " (" + arg.ToString() + ") = " + result.ToString() /*+ " in " + elapsed.ToString() + " seconds"*/); 26 | } 27 | Hopper() 28 | { 29 | // 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 30 | Benchmark("Fibo", 10, 1); // Fibo(24) = 46368 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Source/Testing/Minimal/LCD.hs: -------------------------------------------------------------------------------- 1 | program LCDDemo 2 | { 3 | uses "/Source/Minimal/System" 4 | uses "/Source/Library/Boards/Hopper6502" 5 | uses "/Source/Library/Displays/HD44780" 6 | 7 | Hopper() 8 | { 9 | LCD.Initialize(); 10 | foreach (var c in "Hello Hopper!") 11 | { 12 | LCD.Character(c); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Source/Testing/Minimal/NRL32.hs: -------------------------------------------------------------------------------- 1 | program NRL 2 | { 3 | //#define CPU_Z80 4 | uses "/Source/Minimal/System" 5 | uses "/Source/Minimal/IO" 6 | 7 | { 8 | uint i; 9 | uint j; 10 | long s; 11 | 12 | IO.WriteLn(); 13 | 14 | //uint start = Seconds; 15 | long start = Millis; 16 | 17 | for (i=1; i <= 10; i++) 18 | { 19 | s = 0; 20 | for (j=1; j <= 1000; j++) 21 | { 22 | s = s + j; 23 | } 24 | IO.Write('.'); 25 | } 26 | IO.WriteLn(); 27 | IO.WriteLn(s.ToString()); 28 | 29 | //uint elapsed = (Seconds - start); 30 | long elapsed = (Millis - start); 31 | IO.WriteLn(); 32 | IO.WriteLn(elapsed.ToString() + " " + " ms"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Source/Testing/Minimal/Test.hs: -------------------------------------------------------------------------------- 1 | program Test 2 | { 3 | uses "/Source/Library/Boards/Hopper6502" 4 | 5 | Hopper() 6 | { 7 | WriteLn(); 8 | WriteLn("All Good!"); 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Source/Testing/Minimal/testfloat.hs: -------------------------------------------------------------------------------- 1 | program TestFloat 2 | { 3 | //#define FAST_6502_RUNTIME 4 | 5 | uses "/Source/Library/Boards/Hopper6502" 6 | 7 | Hopper() 8 | { 9 | long start = Millis; 10 | for (float i=1; i <= 10; i += 0.25) 11 | { 12 | float f = i; 13 | float g = f * i; 14 | float h = g / i; 15 | 16 | float j = f * f; 17 | LED = true; 18 | float k = Float.Sqrt(j); 19 | LED = false; 20 | 21 | IO.WriteLn(); 22 | IO.Write(i.ToString() + ": " + f.ToString() + " " + g.ToString() + " " + h.ToString() + " " + j.ToString() + " " + k.ToString()); 23 | } 24 | long elapsed = Millis - start; 25 | WriteLn(); 26 | WriteLn(elapsed.ToString() + " ms"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Source/Testing/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "firstName": "John", 3 | "lastName": "Smith", 4 | "isAlive": true, 5 | "age": 25, 6 | "height_cm": 167.6, 7 | "address": { 8 | "streetAddress": "21 2nd Street", 9 | "city": "New York", 10 | "state": "NY", 11 | "postalCode": "10021-3100" 12 | }, 13 | "phoneNumbers": [ 14 | { 15 | "type": "home", 16 | "number": "212 555-1234" 17 | }, 18 | { 19 | "type": "office", 20 | "number": "646 555-4567" 21 | } 22 | ], 23 | "children": [], 24 | "spouse": null 25 | } 26 | -------------------------------------------------------------------------------- /Source/Testing/t.cmd: -------------------------------------------------------------------------------- 1 | preprocess TestSuite 2 | compile TestSuite -o 3 | optimize TestSuite -v 4 | codegen TestSuite 5 | dasm TestSuite 6 | 7 | preprocess TestNumbers 8 | compile TestNumbers -o 9 | optimize TestNumbers -v 10 | codegen TestNumbers 11 | dasm TestNumbers 12 | 13 | preprocess TestStrings 14 | compile TestStrings -o -x 15 | optimize TestStrings -v 16 | codegen TestStrings 17 | dasm TestStrings 18 | 19 | TestSuite 20 | TestNumbers 21 | TestStrings 22 | -------------------------------------------------------------------------------- /Source/Testing/test.asm: -------------------------------------------------------------------------------- 1 | program Test 2 | { 3 | #define CPU_6502 4 | 5 | const string data2 = {45, 46, 47, 48 }; 6 | const string data = "abcde"; 7 | 8 | Hopper() 9 | { 10 | LDY # 0 11 | LDA data, Y 12 | LDA data2, Y 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Source/Testing/ts.cmd: -------------------------------------------------------------------------------- 1 | preprocess test 2 | compile test -o 3 | optimize test -x 4 | codegen test 5 | dasm test 6 | 7 | --------------------------------------------------------------------------------