├── roms ├── readme.txt ├── basic_generic.rom ├── kernal_generic.rom └── chargen_openroms.rom ├── img ├── mega.png ├── rom.png ├── favicon.ico ├── vc64web.png ├── icon-72x72.png ├── icon-96x96.png ├── rom_empty.png ├── rom_mega65.png ├── icon-128x128.png ├── icon-144x144.png ├── icon-152x152.png ├── icon-192x192.png ├── icon-384x384.png ├── icon-512x512.png └── rom_patched.png ├── sounds ├── step.mp3 ├── eject.mp3 ├── insert.mp3 ├── key_space.mp3 ├── key_standard.mp3 └── key_backspace.mp3 ├── .github └── FUNDING.yml ├── css ├── C64_Pro_Mono-STYLE.ttf └── cm │ └── show-hint.css ├── start.sh ├── mainsdl.h ├── README.md ├── js ├── cm │ ├── addon │ │ ├── display │ │ │ ├── fullscreen.css │ │ │ ├── fullscreen.js │ │ │ └── autorefresh.js │ │ ├── search │ │ │ └── matchesonscrollbar.css │ │ ├── fold │ │ │ ├── foldgutter.css │ │ │ ├── markdown-fold.js │ │ │ └── indent-fold.js │ │ ├── dialog │ │ │ └── dialog.css │ │ ├── hint │ │ │ ├── show-hint.css │ │ │ └── anyword-hint.js │ │ ├── mode │ │ │ └── multiplex_test.js │ │ ├── edit │ │ │ └── trailingspace.js │ │ ├── tern │ │ │ └── worker.js │ │ ├── lint │ │ │ ├── yaml-lint.js │ │ │ ├── css-lint.js │ │ │ ├── json-lint.js │ │ │ └── coffeescript-lint.js │ │ ├── runmode │ │ │ └── colorize.js │ │ └── scroll │ │ │ ├── simplescrollbars.css │ │ │ └── scrollpastend.js │ └── mode │ │ └── javascript │ │ └── typescript.html └── ringbuffer.js ├── Emulator ├── Peripherals │ ├── Network │ │ ├── CMakeLists.txt │ │ └── RS232Types.h │ ├── Monitor │ │ └── CMakeLists.txt │ ├── Paddle │ │ ├── CMakeLists.txt │ │ └── PaddleTypes.h │ ├── Datasette │ │ ├── CMakeLists.txt │ │ └── DatasetteTypes.h │ ├── Joystick │ │ └── CMakeLists.txt │ ├── Keyboard │ │ ├── CMakeLists.txt │ │ └── KeyboardTypes.h │ ├── Mouse │ │ ├── CMakeLists.txt │ │ └── MouseTypes.h │ ├── Drive │ │ ├── CMakeLists.txt │ │ ├── DiskAnalyzerTypes.h │ │ ├── ParCableTypes.h │ │ └── DriveMemoryBase.cpp │ └── CMakeLists.txt ├── Misc │ ├── RegressionTester │ │ ├── CMakeLists.txt │ │ ├── RegressionTesterTypes.h │ │ └── RegressionTesterBase.cpp │ ├── Recorder │ │ ├── CMakeLists.txt │ │ ├── NamedPipe.h │ │ ├── FFmpeg.h │ │ └── NamedPipe.cpp │ ├── CMakeLists.txt │ ├── RemoteServers │ │ ├── CMakeLists.txt │ │ ├── RshServer.h │ │ └── RemoteManagerTypes.h │ └── RetroShell │ │ ├── CMakeLists.txt │ │ └── TextStorage.h ├── Base │ ├── HostTypes.h │ ├── CMakeLists.txt │ ├── Suspendable.cpp │ ├── Inspectable.cpp │ ├── Serializable.cpp │ ├── Synchronizable.cpp │ ├── Dumpable.cpp │ ├── Wakeable.h │ ├── CoreObject.cpp │ ├── Wakeable.cpp │ ├── Suspendable.h │ ├── Error.h │ ├── Dumpable.h │ ├── CmdQueue.cpp │ ├── Synchronizable.h │ ├── CoreComponentTypes.h │ ├── CmdQueue.h │ ├── ThreadTypes.h │ ├── SubComponent.cpp │ ├── MsgQueue.h │ ├── Configurable.h │ └── SubComponent.h ├── Components │ ├── CPU │ │ ├── CMakeLists.txt │ │ ├── Peddle │ │ │ ├── CMakeLists.txt │ │ │ ├── PeddleUtils.cpp │ │ │ ├── PeddleDebuggerTypes.h │ │ │ └── PeddleUtils.h │ │ └── CPUTypes.h │ ├── CIA │ │ ├── CMakeLists.txt │ │ ├── TODTypes.h │ │ └── TODBase.cpp │ ├── Memory │ │ ├── CMakeLists.txt │ │ └── Heatmap.h │ ├── SID │ │ ├── CMakeLists.txt │ │ └── resid │ │ │ ├── CMakeLists.txt │ │ │ ├── version.cc │ │ │ ├── resid-config.h │ │ │ ├── pot.cc │ │ │ ├── dac.h │ │ │ └── pot.h │ ├── VICII │ │ ├── CMakeLists.txt │ │ ├── VICIIInfo.cpp │ │ └── BusTypes.h │ ├── CMakeLists.txt │ └── Ports │ │ ├── CMakeLists.txt │ │ ├── SerialPortTypes.h │ │ ├── VideoPortTypes.h │ │ ├── UserPort.cpp │ │ ├── SerialPortBase.cpp │ │ ├── AudioPortTypes.h │ │ ├── ControlPortBase.cpp │ │ ├── ControlPortTypes.h │ │ ├── ExpansionPortTypes.h │ │ ├── UserPortTypes.h │ │ ├── VideoPortBase.cpp │ │ ├── PowerPortTypes.h │ │ ├── PowerPortBase.cpp │ │ ├── PowerPort.cpp │ │ ├── VideoPort.cpp │ │ └── UserPortBase.cpp ├── FileSystems │ └── CMakeLists.txt ├── Media │ ├── Cartridges │ │ ├── CMakeLists.txt │ │ └── CustomCartridges │ │ │ ├── CMakeLists.txt │ │ │ ├── Dinamic.cpp │ │ │ ├── Westermann.cpp │ │ │ ├── Gmod2.cpp │ │ │ ├── Dinamic.h │ │ │ ├── MikroAss.cpp │ │ │ ├── Funplay.h │ │ │ ├── Ocean.h │ │ │ ├── Rex.h │ │ │ ├── Rex.cpp │ │ │ ├── MikroAss.h │ │ │ ├── Westermann.h │ │ │ ├── StructuredBasic.h │ │ │ ├── SimonsBasic.cpp │ │ │ ├── Funplay.cpp │ │ │ ├── Zaxxon.h │ │ │ ├── Gmod2.h │ │ │ ├── Ocean.cpp │ │ │ ├── SimonsBasic.h │ │ │ ├── Comal80.h │ │ │ ├── Mach5.h │ │ │ ├── CustomCartridges.h │ │ │ ├── MagicDesk.h │ │ │ ├── Kingsoft.h │ │ │ ├── SuperGames.cpp │ │ │ ├── Mach5.cpp │ │ │ ├── Comal80.cpp │ │ │ ├── StructuredBasic.cpp │ │ │ ├── Zaxxon.cpp │ │ │ ├── WarpSpeed.h │ │ │ ├── FreezeFrame.h │ │ │ ├── WarpSpeed.cpp │ │ │ ├── Kcs.h │ │ │ ├── SuperGames.h │ │ │ ├── MagicDesk.cpp │ │ │ ├── FreezeFrame.cpp │ │ │ └── GameKiller.h │ ├── CMakeLists.txt │ ├── Script.cpp │ ├── AnyCollection.cpp │ ├── Script.h │ ├── Folder.cpp │ ├── AnyCollection.h │ └── PRGFile.cpp ├── Utilities │ ├── CMakeLists.txt │ ├── Concurrency.cpp │ ├── Concurrency.h │ ├── Checksum.h │ ├── BasicTypes.h │ └── Exception.h ├── VirtualC64Types.h └── Headless.h ├── .gitignore └── manifest.json /roms/readme.txt: -------------------------------------------------------------------------------- 1 | place your roms which should be embedded here 2 | -------------------------------------------------------------------------------- /img/mega.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/mega.png -------------------------------------------------------------------------------- /img/rom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/rom.png -------------------------------------------------------------------------------- /img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/favicon.ico -------------------------------------------------------------------------------- /img/vc64web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/vc64web.png -------------------------------------------------------------------------------- /sounds/step.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/sounds/step.mp3 -------------------------------------------------------------------------------- /img/icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/icon-72x72.png -------------------------------------------------------------------------------- /img/icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/icon-96x96.png -------------------------------------------------------------------------------- /img/rom_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/rom_empty.png -------------------------------------------------------------------------------- /img/rom_mega65.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/rom_mega65.png -------------------------------------------------------------------------------- /sounds/eject.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/sounds/eject.mp3 -------------------------------------------------------------------------------- /sounds/insert.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/sounds/insert.mp3 -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [vc64web] 4 | -------------------------------------------------------------------------------- /img/icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/icon-128x128.png -------------------------------------------------------------------------------- /img/icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/icon-144x144.png -------------------------------------------------------------------------------- /img/icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/icon-152x152.png -------------------------------------------------------------------------------- /img/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/icon-192x192.png -------------------------------------------------------------------------------- /img/icon-384x384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/icon-384x384.png -------------------------------------------------------------------------------- /img/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/icon-512x512.png -------------------------------------------------------------------------------- /img/rom_patched.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/img/rom_patched.png -------------------------------------------------------------------------------- /sounds/key_space.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/sounds/key_space.mp3 -------------------------------------------------------------------------------- /roms/basic_generic.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/roms/basic_generic.rom -------------------------------------------------------------------------------- /roms/kernal_generic.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/roms/kernal_generic.rom -------------------------------------------------------------------------------- /sounds/key_standard.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/sounds/key_standard.mp3 -------------------------------------------------------------------------------- /roms/chargen_openroms.rom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/roms/chargen_openroms.rom -------------------------------------------------------------------------------- /sounds/key_backspace.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/sounds/key_backspace.mp3 -------------------------------------------------------------------------------- /css/C64_Pro_Mono-STYLE.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vc64web/virtualc64web/HEAD/css/C64_Pro_Mono-STYLE.ttf -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #python -m SimpleHTTPServer 8080 2 | 3 | #python3 use this 4 | python3 -m http.server 8080 5 | 6 | -------------------------------------------------------------------------------- /mainsdl.h: -------------------------------------------------------------------------------- 1 | #include "C64.h" 2 | 3 | /* emulation of macos mach_absolute_time() function. */ 4 | extern uint64_t mach_absolute_time(); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | -------------------------------------------------------------------------------- /js/cm/addon/display/fullscreen.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-fullscreen { 2 | position: fixed; 3 | top: 0; left: 0; right: 0; bottom: 0; 4 | height: auto; 5 | z-index: 9; 6 | } 7 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Network/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | RS232.cpp 6 | RS232Base.cpp 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Monitor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Monitor.cpp 6 | MonitorBase.cpp 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Paddle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Paddle.cpp 6 | PaddleBase.cpp 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Datasette/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Datasette.cpp 6 | DatasetteBase.cpp 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Joystick/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Joystick.cpp 6 | JoystickBase.cpp 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /Emulator/Misc/RegressionTester/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | RegressionTester.cpp 6 | RegressionTesterBase.cpp 7 | 8 | ) 9 | -------------------------------------------------------------------------------- /Emulator/Base/HostTypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // HostTypes.h 3 | // VirtualC64 4 | // 5 | // Created by Dirk Hoffmann on 21.06.24. 6 | // 7 | 8 | #ifndef HostTypes_h 9 | #define HostTypes_h 10 | 11 | 12 | #endif /* HostTypes_h */ 13 | -------------------------------------------------------------------------------- /Emulator/Misc/Recorder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | FFmpeg.cpp 6 | NamedPipe.cpp 7 | Recorder.cpp 8 | 9 | ) 10 | 11 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Keyboard/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | C64Key.cpp 6 | Keyboard.cpp 7 | KeyboardBase.cpp 8 | 9 | ) 10 | -------------------------------------------------------------------------------- /Emulator/Components/CPU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | CPU.cpp 6 | CPUBase.cpp 7 | 8 | ) 9 | 10 | add_subdirectory(Peddle) 11 | -------------------------------------------------------------------------------- /Emulator/Misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | add_subdirectory(RemoteServers) 4 | add_subdirectory(RegressionTester) 5 | add_subdirectory(RetroShell) 6 | add_subdirectory(Recorder) 7 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Mouse/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Mouse.cpp 6 | Mouse1350.cpp 7 | Mouse1351.cpp 8 | NeosMouse.cpp 9 | 10 | ) 11 | -------------------------------------------------------------------------------- /Emulator/Components/CIA/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | CIA.cpp 6 | CIABase.cpp 7 | CIARegs.cpp 8 | TOD.cpp 9 | TODBase.cpp 10 | 11 | ) 12 | -------------------------------------------------------------------------------- /Emulator/Components/Memory/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Memory.cpp 6 | MemoryBase.cpp 7 | MemoryDebugger.cpp 8 | Heatmap.cpp 9 | 10 | ) 11 | -------------------------------------------------------------------------------- /Emulator/FileSystems/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | FSDescriptors.cpp 6 | FileSystem.cpp 7 | FSBlock.cpp 8 | FSDirEntry.cpp 9 | 10 | ) 11 | -------------------------------------------------------------------------------- /Emulator/Misc/RemoteServers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | RemoteManager.cpp 6 | RemoteServer.cpp 7 | RshServer.cpp 8 | Socket.cpp 9 | 10 | ) 11 | -------------------------------------------------------------------------------- /js/cm/addon/search/matchesonscrollbar.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-search-match { 2 | background: gold; 3 | border-top: 1px solid orange; 4 | border-bottom: 1px solid orange; 5 | -moz-box-sizing: border-box; 6 | box-sizing: border-box; 7 | opacity: .5; 8 | } 9 | -------------------------------------------------------------------------------- /Emulator/Components/CPU/Peddle/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Peddle.cpp 6 | PeddleDebugger.cpp 7 | PeddleDisassembler.cpp 8 | StrWriter.cpp 9 | 10 | ) 11 | -------------------------------------------------------------------------------- /Emulator/Components/SID/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | ReSID.cpp 6 | SID.cpp 7 | SIDBase.cpp 8 | SIDBridge.cpp 9 | 10 | ) 11 | 12 | add_subdirectory(resid) 13 | -------------------------------------------------------------------------------- /Emulator/Misc/RetroShell/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Command.cpp 6 | Console.cpp 7 | CommandConsole.cpp 8 | DebugConsole.cpp 9 | RetroShell.cpp 10 | TextStorage.cpp 11 | 12 | ) 13 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Cartridge.cpp 6 | CartridgeBase.cpp 7 | CartridgeRom.cpp 8 | FlashRom.cpp 9 | 10 | ) 11 | 12 | add_subdirectory(CustomCartridges) 13 | -------------------------------------------------------------------------------- /Emulator/Utilities/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Buffer.cpp 6 | Chrono.cpp 7 | Concurrency.cpp 8 | MemUtils.cpp 9 | Checksum.cpp 10 | StringUtils.cpp 11 | IOUtils.cpp 12 | Parser.cpp 13 | ) 14 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Drive/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | Drive.cpp 6 | DriveBase.cpp 7 | DriveMemory.cpp 8 | DriveMemoryBase.cpp 9 | VIA.cpp 10 | PIA.cpp 11 | ParCable.cpp 12 | Disk.cpp 13 | DiskAnalyzer.cpp 14 | 15 | ) 16 | -------------------------------------------------------------------------------- /Emulator/Components/VICII/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | VICII.cpp 6 | VICIIBase.cpp 7 | VICIIDraw.cpp 8 | VICIISprites.cpp 9 | VICIIMemory.cpp 10 | VICIICycles.cpp 11 | VICIITable.cpp 12 | DmaDebugger.cpp 13 | DmaDebuggerBase.cpp 14 | 15 | ) 16 | -------------------------------------------------------------------------------- /Emulator/Peripherals/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | ) 6 | 7 | add_subdirectory(Drive) 8 | add_subdirectory(Datasette) 9 | add_subdirectory(Joystick) 10 | add_subdirectory(Keyboard) 11 | add_subdirectory(Monitor) 12 | add_subdirectory(Mouse) 13 | add_subdirectory(Network) 14 | add_subdirectory(Paddle) 15 | -------------------------------------------------------------------------------- /Emulator/Components/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | target_sources(vc64Core PRIVATE 5 | 6 | C64.cpp 7 | C64Base.cpp 8 | Emulator.cpp 9 | EmulatorBase.cpp 10 | 11 | ) 12 | 13 | add_subdirectory(CPU) 14 | add_subdirectory(CIA) 15 | add_subdirectory(Ports) 16 | add_subdirectory(Memory) 17 | add_subdirectory(SID) 18 | add_subdirectory(VICII) 19 | -------------------------------------------------------------------------------- /Emulator/Components/CPU/Peddle/PeddleUtils.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of Peddle - A MOS 65xx CPU emulator 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // Published under the terms of the MIT License 6 | // ----------------------------------------------------------------------------- 7 | 8 | #include "Peddle.h" 9 | -------------------------------------------------------------------------------- /Emulator/Components/SID/resid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | add_library(resid 4 | 5 | envelope.cc 6 | pot.cc 7 | voice.cc 8 | sid.cc 9 | filter.cc 10 | dac.cc 11 | extfilt.cc 12 | wave.cc 13 | version.cc 14 | ) 15 | 16 | if(MSVC) 17 | target_compile_options(resid PUBLIC /wd5055) 18 | else() 19 | target_compile_options(resid PUBLIC -w) 20 | endif() 21 | -------------------------------------------------------------------------------- /Emulator/Media/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | MediaFile.cpp 6 | AnyCollection.cpp 7 | AnyFile.cpp 8 | 9 | CRTFile.cpp 10 | D64File.cpp 11 | Folder.cpp 12 | G64File.cpp 13 | PRGFile.cpp 14 | P00File.cpp 15 | RomFile.cpp 16 | Script.cpp 17 | Snapshot.cpp 18 | TAPFile.cpp 19 | T64File.cpp 20 | 21 | ) 22 | 23 | add_subdirectory(Cartridges) 24 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | AudioPort.cpp 6 | AudioPortBase.cpp 7 | ControlPort.cpp 8 | ControlPortBase.cpp 9 | ExpansionPort.cpp 10 | ExpansionPortBase.cpp 11 | PowerPort.cpp 12 | PowerPortBase.cpp 13 | SerialPort.cpp 14 | SerialPortBase.cpp 15 | UserPort.cpp 16 | UserPortBase.cpp 17 | VideoPort.cpp 18 | VideoPortBase.cpp 19 | 20 | ) 21 | -------------------------------------------------------------------------------- /Emulator/Base/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | CmdQueue.cpp 6 | Colors.cpp 7 | Configurable.cpp 8 | CoreObject.cpp 9 | CoreComponent.cpp 10 | Defaults.cpp 11 | Dumpable.cpp 12 | Error.cpp 13 | Host.cpp 14 | Inspectable.cpp 15 | MsgQueue.cpp 16 | Option.cpp 17 | SubComponent.cpp 18 | Synchronizable.cpp 19 | Serializable.cpp 20 | Suspendable.cpp 21 | Thread.cpp 22 | Wakeable.cpp 23 | 24 | ) 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | b 2 | .DS_Store 3 | vC64.js 4 | vC64.wasm 5 | index.html 6 | 7 | #roms 8 | *.bin 9 | 10 | # Prerequisites 11 | *.d 12 | 13 | # Compiled Object files 14 | *.slo 15 | *.lo 16 | *.o 17 | *.obj 18 | 19 | # Precompiled Headers 20 | *.gch 21 | *.pch 22 | 23 | # Compiled Dynamic libraries 24 | *.so 25 | *.dylib 26 | *.dll 27 | 28 | # Fortran module files 29 | *.mod 30 | *.smod 31 | 32 | # Compiled Static libraries 33 | *.lai 34 | *.la 35 | *.a 36 | *.lib 37 | 38 | # Executables 39 | *.exe 40 | *.out 41 | *.app 42 | -------------------------------------------------------------------------------- /js/cm/addon/fold/foldgutter.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-foldmarker { 2 | color: blue; 3 | text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; 4 | font-family: arial; 5 | line-height: .3; 6 | cursor: pointer; 7 | } 8 | .CodeMirror-foldgutter { 9 | width: .7em; 10 | } 11 | .CodeMirror-foldgutter-open, 12 | .CodeMirror-foldgutter-folded { 13 | cursor: pointer; 14 | } 15 | .CodeMirror-foldgutter-open:after { 16 | content: "\25BE"; 17 | } 18 | .CodeMirror-foldgutter-folded:after { 19 | content: "\25B8"; 20 | } 21 | -------------------------------------------------------------------------------- /Emulator/Base/Suspendable.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "Suspendable.h" 15 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Keyboard/KeyboardTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "C64Key.h" 16 | -------------------------------------------------------------------------------- /Emulator/Base/Inspectable.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "Inspectable.h" 15 | 16 | namespace vc64 { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Emulator/Base/Serializable.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "Serializable.h" 15 | 16 | namespace vc64 { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Emulator/Base/Synchronizable.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "Synchronizable.h" 15 | 16 | namespace vc64 { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Emulator/Utilities/Concurrency.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "Concurrency.h" 15 | 16 | namespace vc64::util { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /js/cm/addon/dialog/dialog.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-dialog { 2 | position: absolute; 3 | left: 0; right: 0; 4 | background: inherit; 5 | z-index: 15; 6 | padding: .1em .8em; 7 | overflow: hidden; 8 | color: inherit; 9 | } 10 | 11 | .CodeMirror-dialog-top { 12 | border-bottom: 1px solid #eee; 13 | top: 0; 14 | } 15 | 16 | .CodeMirror-dialog-bottom { 17 | border-top: 1px solid #eee; 18 | bottom: 0; 19 | } 20 | 21 | .CodeMirror-dialog input { 22 | border: none; 23 | outline: none; 24 | background: transparent; 25 | width: 20em; 26 | color: inherit; 27 | font-family: monospace; 28 | } 29 | 30 | .CodeMirror-dialog button { 31 | font-size: 70%; 32 | } 33 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_include_directories(vc64Core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | target_sources(vc64Core PRIVATE 4 | 5 | ActionReplay.cpp 6 | Comal80.cpp 7 | Dinamic.cpp 8 | EasyFlash.cpp 9 | Epyx.cpp 10 | Expert.cpp 11 | FinalIII.cpp 12 | FreezeFrame.cpp 13 | Funplay.cpp 14 | GameKiller.cpp 15 | GeoRam.cpp 16 | Gmod2.cpp 17 | Isepic.cpp 18 | Kcs.cpp 19 | Kingsoft.cpp 20 | Mach5.cpp 21 | MagicDesk.cpp 22 | MikroAss.cpp 23 | Ocean.cpp 24 | PageFox.cpp 25 | Reu.cpp 26 | Rex.cpp 27 | SimonsBasic.cpp 28 | StarDos.cpp 29 | StructuredBasic.cpp 30 | SuperGames.cpp 31 | WarpSpeed.cpp 32 | Westermann.cpp 33 | Zaxxon.cpp 34 | 35 | ) 36 | -------------------------------------------------------------------------------- /Emulator/Components/VICII/VICIIInfo.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "VICII.h" 15 | #include "C64.h" 16 | 17 | namespace vc64 { 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/SerialPortTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | typedef struct 21 | { 22 | // Bus idle time measured in frames 23 | i64 idle; 24 | } 25 | SerialPortStats; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /css/cm/show-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-hints { 2 | position: absolute; 3 | z-index: 2000; 4 | overflow: hidden; 5 | list-style: none; 6 | 7 | margin: 0; 8 | padding: 2px; 9 | 10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 13 | border-radius: 3px; 14 | border: 1px solid silver; 15 | 16 | background: white; 17 | font-size: 90%; 18 | font-family: monospace; 19 | 20 | max-height: 20em; 21 | overflow-y: auto; 22 | } 23 | 24 | .CodeMirror-hint { 25 | margin: 0; 26 | padding: 0 4px; 27 | border-radius: 2px; 28 | white-space: pre; 29 | color: black; 30 | cursor: pointer; 31 | } 32 | 33 | li.CodeMirror-hint-active { 34 | background: #08f; 35 | color: white; 36 | } 37 | -------------------------------------------------------------------------------- /js/cm/addon/hint/show-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-hints { 2 | position: absolute; 3 | z-index: 10; 4 | overflow: hidden; 5 | list-style: none; 6 | 7 | margin: 0; 8 | padding: 2px; 9 | 10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 13 | border-radius: 3px; 14 | border: 1px solid silver; 15 | 16 | background: white; 17 | font-size: 90%; 18 | font-family: monospace; 19 | 20 | max-height: 20em; 21 | overflow-y: auto; 22 | } 23 | 24 | .CodeMirror-hint { 25 | margin: 0; 26 | padding: 0 4px; 27 | border-radius: 2px; 28 | white-space: pre; 29 | color: black; 30 | cursor: pointer; 31 | } 32 | 33 | li.CodeMirror-hint-active { 34 | background: #08f; 35 | color: white; 36 | } 37 | -------------------------------------------------------------------------------- /Emulator/Misc/RegressionTester/RegressionTesterTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | 21 | // 22 | // Structures 23 | // 24 | 25 | typedef struct 26 | { 27 | bool debugcart; 28 | i64 watchdog; 29 | } 30 | RegressionTesterConfig; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/VideoPortTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "BasicTypes.h" 16 | 17 | namespace vc64 { 18 | 19 | // 20 | // Structures 21 | // 22 | 23 | typedef struct 24 | { 25 | bool whiteNoise; 26 | } 27 | 28 | VideoPortConfig; 29 | 30 | typedef struct 31 | { 32 | 33 | } 34 | VideoPortInfo; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Emulator/Base/Dumpable.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "Dumpable.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | Dumpable::dump(Category category, std::ostream& ss) const 20 | { 21 | _dump(category, ss); 22 | } 23 | 24 | void 25 | Dumpable::dump(Category category) const 26 | { 27 | dump(category, std::cout); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Dinamic.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | u8 19 | Dinamic::peekIO1(u16 addr) 20 | { 21 | if (addr <= 0xDE0F) bankIn(addr & 0xF); 22 | return 0; 23 | } 24 | 25 | u8 26 | Dinamic::spypeekIO1(u16 addr) const 27 | { 28 | return 0; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Emulator/Misc/Recorder/NamedPipe.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "BasicTypes.h" 16 | 17 | namespace vc64 { 18 | 19 | class NamedPipe final { 20 | 21 | int pipe = -1; 22 | string name; 23 | 24 | public: 25 | 26 | bool create(const string &name); 27 | bool open(); 28 | bool isOpen(); 29 | bool close(); 30 | isize write(u8 *buffer, isize length); 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Westermann.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | u8 19 | Westermann::peekIO2(u16 addr) 20 | { 21 | // Reading from I/O 2 switched the cartridge on 22 | expansionPort.setCartridgeMode(CRTMODE_8K); 23 | return 0; 24 | } 25 | 26 | u8 27 | Westermann::spypeekIO2(u16 addr) const 28 | { 29 | return 0; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Emulator/Base/Wakeable.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Concurrency.h" 16 | 17 | namespace vc64 { 18 | 19 | class Wakeable 20 | { 21 | static constexpr auto timeout = std::chrono::milliseconds(100); 22 | 23 | std::mutex condMutex; 24 | std::condition_variable condVar; 25 | bool ready = false; 26 | 27 | public: 28 | 29 | void waitForWakeUp(util::Time timeout); 30 | void wakeUp(); 31 | }; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Emulator/Components/CIA/TODTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "BasicTypes.h" 16 | 17 | // 18 | // Structures 19 | // 20 | 21 | typedef union 22 | { 23 | struct { 24 | u8 tenth; 25 | u8 sec; 26 | u8 min; 27 | u8 hour; 28 | }; 29 | u32 value; 30 | } 31 | TimeOfDay; 32 | 33 | typedef struct 34 | { 35 | TimeOfDay time; 36 | TimeOfDay latch; 37 | TimeOfDay alarm; 38 | } 39 | TODInfo; 40 | -------------------------------------------------------------------------------- /js/cm/addon/mode/multiplex_test.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function() { 5 | CodeMirror.defineMode("markdown_with_stex", function(){ 6 | var inner = CodeMirror.getMode({}, "stex"); 7 | var outer = CodeMirror.getMode({}, "markdown"); 8 | 9 | var innerOptions = { 10 | open: '$', 11 | close: '$', 12 | mode: inner, 13 | delimStyle: 'delim', 14 | innerStyle: 'inner' 15 | }; 16 | 17 | return CodeMirror.multiplexingMode(outer, innerOptions); 18 | }); 19 | 20 | var mode = CodeMirror.getMode({}, "markdown_with_stex"); 21 | 22 | function MT(name) { 23 | test.mode( 24 | name, 25 | mode, 26 | Array.prototype.slice.call(arguments, 1), 27 | 'multiplexing'); 28 | } 29 | 30 | MT( 31 | "stexInsideMarkdown", 32 | "[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]"); 33 | })(); 34 | -------------------------------------------------------------------------------- /Emulator/Base/CoreObject.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "CoreObject.h" 15 | #include 16 | 17 | namespace vc64 { 18 | 19 | isize 20 | CoreObject::verbosity = 2; 21 | 22 | void 23 | CoreObject::prefix(isize level, const char *component, isize line) const 24 | { 25 | if (level == 1) { 26 | fprintf(stderr, "%s: ", objectName()); 27 | } 28 | if (level >= 2) { 29 | fprintf(stderr, "%s:%ld ", objectName(), line); 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Emulator/Components/CPU/Peddle/PeddleDebuggerTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of Peddle - A MOS 65xx CPU emulator 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // Published under the terms of the MIT License 6 | // ----------------------------------------------------------------------------- 7 | 8 | #pragma once 9 | 10 | #include "BasicTypes.h" 11 | 12 | namespace vc64::peddle { 13 | 14 | // Base structure for a single breakpoint or watchpoint 15 | struct Guard { 16 | 17 | // The observed address 18 | u32 addr; 19 | 20 | // Disabled guards never trigger 21 | bool enabled; 22 | 23 | // Counts the number of hits 24 | long hits; 25 | 26 | // Ignore counter 27 | long ignore; 28 | 29 | public: 30 | 31 | // Returns true if the guard hits 32 | bool eval(u32 addr); 33 | 34 | // Replaces the address by another 35 | void moveTo(u32 newAddr); 36 | }; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Emulator/Components/CPU/Peddle/PeddleUtils.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of Peddle - A MOS 65xx CPU emulator 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // Published under the terms of the MIT License 6 | // ----------------------------------------------------------------------------- 7 | 8 | #pragma once 9 | 10 | #include 11 | 12 | #define LO_BYTE(x) (u8)((x) & 0xFF) 13 | #define HI_BYTE(x) (u8)((x) >> 8) 14 | 15 | #define LO_HI(x,y) (u16)((y) << 8 | (x)) 16 | #define HI_LO(x,y) (u16)((x) << 8 | (y)) 17 | 18 | #ifdef _MSC_VER 19 | 20 | #define unreachable __assume(false) 21 | #define likely(x) (x) 22 | #define unlikely(x) (x) 23 | 24 | #else 25 | 26 | #define unreachable __builtin_unreachable() 27 | #define likely(x) __builtin_expect(!!(x), 1) 28 | #define unlikely(x) __builtin_expect(!!(x), 0) 29 | 30 | #endif 31 | 32 | #define fatalError assert(false); unreachable 33 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Drive/DiskAnalyzerTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "DiskTypes.h" 16 | 17 | namespace vc64 { 18 | 19 | typedef struct 20 | { 21 | isize headerBegin; 22 | isize headerEnd; 23 | isize dataBegin; 24 | isize dataEnd; 25 | } 26 | SectorInfo; 27 | 28 | typedef struct 29 | { 30 | isize length; 31 | SectorInfo sectorInfo[22]; 32 | } 33 | TrackInfo; 34 | 35 | typedef struct 36 | { 37 | TrackInfo trackInfo[85]; 38 | } 39 | DiskInfo; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Gmod2.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | u8 19 | Gmod2::peekIO1(u16 addr) 20 | { 21 | return 0; 22 | } 23 | 24 | void 25 | Gmod2::pokeIO1(u16 addr, u8 value) 26 | { 27 | trace(CRT_DEBUG, "pokeIO1(%x, %x)\n", addr, value); 28 | 29 | control = value; 30 | 31 | // Update external lines 32 | expansionPort.setExromLine(exrom()); 33 | 34 | // Switch memory bank 35 | bankIn(value & 0x3F); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Dinamic.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Dinamic final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_DINAMIC, 24 | .title = "Dinamic", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | u8 peekIO1(u16 addr) override; 34 | u8 spypeekIO1(u16 addr) const override; 35 | }; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Emulator/Media/Script.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "Script.h" 15 | #include "VirtualC64.h" 16 | #include "IOUtils.h" 17 | 18 | #include 19 | 20 | namespace vc64 { 21 | 22 | bool 23 | Script::isCompatible(const fs::path &path) 24 | { 25 | auto s = util::uppercased(path.extension().string()); 26 | return s == ".INI"; 27 | } 28 | 29 | bool 30 | Script::isCompatible(const u8 *buf, isize len) 31 | { 32 | return true; 33 | } 34 | 35 | bool 36 | Script::isCompatible(const Buffer &buf) 37 | { 38 | return isCompatible(buf.ptr, buf.size); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/MikroAss.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | u8 19 | MikroAss::peekIO1(u16 addr) 20 | { 21 | return peekRomL(0x1E00 | LO_BYTE(addr)); 22 | } 23 | 24 | u8 25 | MikroAss::spypeekIO1(u16 addr) const 26 | { 27 | return spypeekRomL(0x1E00 | LO_BYTE(addr)); 28 | } 29 | 30 | u8 31 | MikroAss::peekIO2(u16 addr) 32 | { 33 | return peekRomL(0x1F00 | LO_BYTE(addr)); 34 | } 35 | 36 | u8 37 | MikroAss::spypeekIO2(u16 addr) const 38 | { 39 | return spypeekRomL(0x1F00 | LO_BYTE(addr)); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /js/cm/addon/edit/trailingspace.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) { 13 | if (prev == CodeMirror.Init) prev = false; 14 | if (prev && !val) 15 | cm.removeOverlay("trailingspace"); 16 | else if (!prev && val) 17 | cm.addOverlay({ 18 | token: function(stream) { 19 | for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {} 20 | if (i > stream.pos) { stream.pos = i; return null; } 21 | stream.pos = l; 22 | return "trailingspace"; 23 | }, 24 | name: "trailingspace" 25 | }); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/UserPort.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "UserPort.h" 15 | 16 | namespace vc64 { 17 | 18 | u8 19 | UserPort::getPB() const 20 | { 21 | switch (config.device) { 22 | 23 | case USR_RS232: 24 | return rs232.getPB(); 25 | 26 | default: 27 | return 0xFF; 28 | } 29 | } 30 | 31 | void 32 | UserPort::setPA2(bool value) 33 | { 34 | switch (config.device) { 35 | 36 | case USR_RS232: 37 | 38 | rs232.setPA2(value); 39 | break; 40 | 41 | default: 42 | break; 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Emulator/Components/SID/resid/version.cc: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // This file is part of reSID, a MOS6581 SID emulator engine. 3 | // Copyright (C) 2010 Dag Lem 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // --------------------------------------------------------------------------- 19 | 20 | #define RESID_VERSION_CC 21 | 22 | #include "resid-config.h" 23 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Funplay.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Funplay final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_FUNPLAY, 24 | .title = "Fun Play", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | 34 | // 35 | // Accessing cartridge memory 36 | // 37 | 38 | public: 39 | 40 | void pokeIO1(u16 addr, u8 value) override; 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/SerialPortBase.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "SerialPort.h" 15 | #include "Drive.h" 16 | 17 | namespace vc64 { 18 | 19 | void 20 | SerialPort::_dump(Category category, std::ostream& os) const 21 | { 22 | using namespace util; 23 | 24 | if (category == Category::State) { 25 | 26 | os << tab("VIA1::DDRB (Drive8)"); 27 | os << hex(drive8.via1.getDDRB()) << std::endl; 28 | os << tab("VIA1::DDRB (Drive9)"); 29 | os << hex(drive9.via1.getDDRB()) << std::endl; 30 | os << tab("Idle"); 31 | os << dec(stats.idle) << " frames" << std::endl; 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Emulator/Base/Wakeable.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "Wakeable.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | Wakeable::waitForWakeUp(util::Time timeout) 20 | { 21 | auto now = std::chrono::system_clock::now(); 22 | auto delay = std::chrono::nanoseconds(timeout.asNanoseconds()); 23 | 24 | std::unique_lock lock(condMutex); 25 | condVar.wait_until(lock, now + delay, [this]{ return ready; }); 26 | ready = false; 27 | } 28 | 29 | void 30 | Wakeable::wakeUp() 31 | { 32 | { 33 | std::lock_guard lock(condMutex); 34 | ready = true; 35 | } 36 | condVar.notify_one(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Ocean.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Ocean final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_OCEAN, 24 | .title = "Ocean", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | void bankIn(isize nr) override; 34 | u8 peekIO1(u16 addr) override; 35 | u8 peekIO2(u16 addr) override; 36 | void pokeIO1(u16 addr, u8 value) override; 37 | }; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Rex.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Rex final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_REX, 24 | .title = "REX", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | 34 | // 35 | // Accessing cartridge memory 36 | // 37 | 38 | public: 39 | 40 | u8 peekIO2(u16 addr) override; 41 | u8 spypeekIO2(u16 addr) const override; 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Emulator/Base/Suspendable.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include 16 | 17 | namespace vc64 { 18 | 19 | /** Suspend-resume mechanism */ 20 | class Suspendable { 21 | 22 | public: 23 | 24 | Suspendable() { } 25 | virtual ~Suspendable() = default; 26 | 27 | /** @brief Suspends the thread */ 28 | virtual void suspend() = 0; 29 | 30 | /** @brief Resumes the thread */ 31 | virtual void resume() = 0; 32 | }; 33 | 34 | struct AutoResume { 35 | 36 | Suspendable *s; 37 | AutoResume(Suspendable *s) : s(s) { s->suspend(); } 38 | ~AutoResume() { s->resume(); } 39 | }; 40 | 41 | #define SUSPENDED AutoResume _ar(this); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Emulator/Components/Memory/Heatmap.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "MemoryTypes.h" 16 | 17 | namespace vc64 { 18 | 19 | class Heatmap final { 20 | 21 | public: 22 | 23 | // Heapmap data 24 | float heatmap[256][256] = { }; 25 | 26 | // Cached accesses 27 | isize history[65536] = { }; 28 | 29 | // Color palette 30 | u32 palette[256]; 31 | 32 | 33 | // 34 | // Methods 35 | // 36 | 37 | public: 38 | 39 | Heatmap(); 40 | 41 | // Updates heatmap data 42 | void update(const class Memory &mem); 43 | 44 | // Draws a heatmap 45 | void draw(u32 *buffer, isize width, isize height) const; 46 | }; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Rex.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | u8 19 | Rex::peekIO2(u16 addr) 20 | { 21 | // Any read access to $DF00 - $DFBF disables the ROM 22 | if (addr >= 0xDF00 && addr <= 0xDFBF) { 23 | expansionPort.setCartridgeMode(CRTMODE_OFF); 24 | } 25 | 26 | // Any read access to $DFC0 - $DFFF switches to 8KB configuration 27 | if (addr >= 0xDFC0 && addr <= 0xDFFF) { 28 | expansionPort.setCartridgeMode(CRTMODE_8K); 29 | } 30 | 31 | return 0; 32 | } 33 | 34 | u8 35 | Rex::spypeekIO2(u16 addr) const 36 | { 37 | return 0; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /Emulator/Components/SID/resid/resid-config.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // This file is part of reSID, a MOS6581 SID emulator engine. 3 | // Copyright (C) 2010 Dag Lem 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // --------------------------------------------------------------------------- 19 | 20 | #ifndef RESID_CONFIG_H 21 | #define RESID_CONFIG_H 22 | 23 | #include "siddefs.h" 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/MikroAss.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class MikroAss final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_MIKRO_ASSEMBLER, 24 | .title = "Mikro Assembler", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | u8 peekIO1(u16 addr) override; 34 | u8 spypeekIO1(u16 addr) const override; 35 | u8 peekIO2(u16 addr) override; 36 | u8 spypeekIO2(u16 addr) const override; 37 | }; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Westermann.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Westermann final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_WESTERMANN, 24 | .title = "Westermann", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | 34 | // 35 | // Accessing cartridge memory 36 | // 37 | 38 | public: 39 | 40 | u8 peekIO2(u16 addr) override; 41 | u8 spypeekIO2(u16 addr) const override; 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/StructuredBasic.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class StructuredBasic final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_STRUCTURED_BASIC, 24 | .title = "Structured Basic", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | void resetCartConfig() override; 34 | u8 peekIO1(u16 addr) override; 35 | u8 spypeekIO1(u16 addr) const override; 36 | void pokeIO1(u16 addr, u8 value) override; 37 | }; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Emulator/Base/Error.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "ErrorTypes.h" 17 | #include "Exception.h" 18 | #include 19 | 20 | namespace vc64 { 21 | 22 | /// Emulator exception 23 | struct Error : public util::Exception 24 | { 25 | Error(ErrorCode code, const string &s); 26 | Error(ErrorCode code, const char *s) : Error(code, string(s)) { }; 27 | Error(ErrorCode code, const std::filesystem::path &path) : Error(code, path.string()) { }; 28 | Error(ErrorCode code, long v) : Error(code, std::to_string(v)) { }; 29 | Error(ErrorCode code) : Error(code, "") { } 30 | 31 | /// Returns a textual description of this error 32 | const char *what() const throw() override; 33 | }; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/SimonsBasic.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | SimonsBasic::_didReset(bool hard) 20 | { 21 | bankIn(0); 22 | bankIn(1); 23 | } 24 | 25 | u8 26 | SimonsBasic::peekIO1(u16 addr) 27 | { 28 | if (addr == 0xDE00) { 29 | expansionPort.setCartridgeMode(CRTMODE_8K); 30 | } 31 | return Cartridge::peekIO1(addr); 32 | } 33 | 34 | u8 35 | SimonsBasic::spypeekIO1(u16 addr) const 36 | { 37 | return Cartridge::spypeekIO1(addr); 38 | } 39 | 40 | void 41 | SimonsBasic::pokeIO1(u16 addr, u8 value) 42 | { 43 | if (addr == 0xDE00) { 44 | expansionPort.setCartridgeMode(CRTMODE_16K); 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Emulator/Media/AnyCollection.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "AnyCollection.h" 15 | #include "Macros.h" 16 | 17 | namespace vc64 { 18 | 19 | u16 20 | AnyCollection::readWordBE(isize nr, isize pos) const 21 | { 22 | return HI_LO(readByte(nr, pos), readByte(nr, pos + 1)); 23 | } 24 | 25 | u16 26 | AnyCollection::readWordLE(isize nr, isize pos) const 27 | { 28 | return LO_HI(readByte(nr, pos), readByte(nr, pos + 1)); 29 | } 30 | 31 | u16 32 | AnyCollection::itemLoadAddr(isize nr) const 33 | { 34 | return readWordLE(nr, 0); 35 | } 36 | 37 | void 38 | AnyCollection::copyItem(isize nr, u8 *buf, isize len, isize offset) const 39 | { 40 | for (isize i = 0; i < len; i++) buf[i] = readByte(nr, i + offset); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Funplay.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | Funplay::pokeIO1(u16 addr, u8 value) 20 | { 21 | /* 22 | * Bank switching is done by writing to $DE00. 23 | * 24 | * Bit in DE00 -> 76543210 25 | * xx210xx3 <- Bit in selected bank number 26 | * 27 | * A value of $86 is written to disable the cartridge. 28 | */ 29 | 30 | if (addr == 0xDE00) { 31 | 32 | if (value == 0x86) { 33 | 34 | expansionPort.setCartridgeMode(CRTMODE_OFF); 35 | return; 36 | } 37 | 38 | bankIn(((value >> 3) & 0x07) | ((value << 3) & 0x08)); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Zaxxon.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Zaxxon final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_ZAXXON, 24 | .title = "Zaxxon", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | private: 34 | 35 | void _didReset(bool hard) override; 36 | 37 | 38 | // 39 | // Accessing cartridge memory 40 | // 41 | 42 | public: 43 | 44 | u8 peekRomL(u16 addr) override; 45 | u8 spypeekRomL(u16 addr) const override; 46 | }; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Emulator/Components/SID/resid/pot.cc: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // This file is part of reSID, a MOS6581 SID emulator engine. 3 | // Copyright (C) 2010 Dag Lem 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // --------------------------------------------------------------------------- 19 | 20 | #include "pot.h" 21 | 22 | namespace reSID 23 | { 24 | 25 | reg8 Potentiometer::readPOT() 26 | { 27 | // NB! Not modeled. 28 | return 0xff; 29 | } 30 | 31 | } // namespace reSID 32 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Virtual C64 web", 3 | "short_name": "vc64web", 4 | "start_url": "/", 5 | "scope": ".", 6 | "display": "fullscreen", 7 | "background_color": "#000000", 8 | "theme_color": "#000000", 9 | "icons": [ 10 | { 11 | "src": "img/icon-72x72.png", 12 | "type": "image/png", 13 | "sizes": "72x72" 14 | }, 15 | { 16 | "src": "img/icon-96x96.png", 17 | "type": "image/png", 18 | "sizes": "96x96" 19 | }, 20 | { 21 | "src": "img/icon-128x128.png", 22 | "type": "image/png", 23 | "sizes": "128x128" 24 | }, 25 | { 26 | "src": "img/icon-144x144.png", 27 | "type": "image/png", 28 | "sizes": "144x144" 29 | }, 30 | { 31 | "src": "img/icon-152x152.png", 32 | "type": "image/png", 33 | "sizes": "152x152" 34 | }, 35 | { 36 | "src": "img/icon-192x192.png", 37 | "type": "image/png", 38 | "sizes": "192x192" 39 | }, 40 | { 41 | "src": "img/icon-384x384.png", 42 | "type": "image/png", 43 | "sizes": "384x384" 44 | }, 45 | { 46 | "src": "img/icon-512x512.png", 47 | "type": "image/png", 48 | "sizes": "512x512" 49 | } 50 | ], 51 | "description": "Commodore C64 Emulator" 52 | } 53 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Gmod2.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Gmod2 final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_GMOD2, 24 | .title = "Gmod2", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | u8 peekIO1(u16 addr) override; 34 | void pokeIO1(u16 addr, u8 value) override; 35 | 36 | private: 37 | 38 | bool exrom() const { return control & 0x40; } 39 | u8 mode() const { return control >> 6; } 40 | u8 bank() const { return control & 0x3F; } 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Emulator/Base/Dumpable.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include 16 | 17 | namespace vc64 { 18 | 19 | enum class Category 20 | { 21 | BankMap, 22 | Breakpoints, 23 | Checksums, 24 | Config, 25 | Current, 26 | Debug, 27 | Defaults, 28 | Disk, 29 | Dma, 30 | Layout, 31 | Properties, 32 | Registers, 33 | RunAhead, 34 | Slots, 35 | State, 36 | Stats, 37 | Summary, 38 | Tod, 39 | Watchpoints 40 | }; 41 | 42 | class Dumpable { 43 | 44 | public: 45 | 46 | virtual ~Dumpable() = default; 47 | virtual void _dump(Category category, std::ostream& ss) const { } 48 | 49 | void dump(Category category, std::ostream& ss) const; 50 | void dump(Category category) const; 51 | }; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Emulator/Utilities/Concurrency.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Chrono.h" 16 | #include 17 | #include 18 | 19 | namespace vc64::util { 20 | 21 | class Mutex 22 | { 23 | std::mutex mutex; 24 | 25 | public: 26 | 27 | void lock() { mutex.lock(); } 28 | void unlock() { mutex.unlock(); } 29 | }; 30 | 31 | class ReentrantMutex 32 | { 33 | std::recursive_mutex mutex; 34 | 35 | public: 36 | 37 | void lock() { mutex.lock(); } 38 | void unlock() { mutex.unlock(); } 39 | }; 40 | 41 | class AutoMutex 42 | { 43 | ReentrantMutex &mutex; 44 | 45 | public: 46 | 47 | bool active = true; 48 | 49 | AutoMutex(ReentrantMutex &ref) : mutex(ref) { mutex.lock(); } 50 | ~AutoMutex() { mutex.unlock(); } 51 | }; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Emulator/Base/CmdQueue.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "CmdQueue.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | CmdQueue::put(const Cmd &cmd) 20 | { 21 | { SYNCHRONIZED 22 | 23 | debug(CMD_DEBUG, "%s [%llx]\n", CmdTypeEnum::key(cmd.type), cmd.value); 24 | 25 | if (!queue.isFull()) { 26 | queue.write(cmd); 27 | } else { 28 | warn("Command lost: %s [%llx]\n", CmdTypeEnum::key(cmd.type), cmd.value); 29 | } 30 | 31 | empty = false; 32 | } 33 | } 34 | 35 | bool 36 | CmdQueue::poll(Cmd &cmd) 37 | { 38 | if (empty) return false; 39 | 40 | { SYNCHRONIZED 41 | 42 | cmd = queue.read(); 43 | empty = queue.isEmpty(); 44 | 45 | return true; 46 | } 47 | } 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Emulator/Components/SID/resid/dac.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // This file is part of reSID, a MOS6581 SID emulator engine. 3 | // Copyright (C) 2010 Dag Lem 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // --------------------------------------------------------------------------- 19 | 20 | #ifndef RESID_DAC_H 21 | #define RESID_DAC_H 22 | 23 | namespace reSID 24 | { 25 | 26 | void build_dac_table(unsigned short* dac, int bits, double _2R_div_R, bool term); 27 | 28 | } // namespace reSID 29 | 30 | #endif // not RESID_DAC_H 31 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Ocean.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | Ocean::bankIn(isize nr) 20 | { 21 | // The same 8KB page is banked into both ROML and ROMH 22 | bankInROML(nr, 0x2000, 0); 23 | bankInROMH(nr, 0x2000, 0); 24 | } 25 | 26 | u8 27 | Ocean::peekIO1(u16 addr) 28 | { 29 | // When read, we get the same values as if no cartridge is attached 30 | return vic.getDataBusPhi1(); 31 | } 32 | 33 | u8 34 | Ocean::peekIO2(u16 addr) 35 | { 36 | // When read, we get the same values as if no cartridge is attached 37 | return vic.getDataBusPhi1(); 38 | } 39 | 40 | void 41 | Ocean::pokeIO1(u16 addr, u8 value) 42 | { 43 | // Cartridges use $DE00 to switch banks 44 | bankIn(value & 0x3F); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /Emulator/Components/SID/resid/pot.h: -------------------------------------------------------------------------------- 1 | // --------------------------------------------------------------------------- 2 | // This file is part of reSID, a MOS6581 SID emulator engine. 3 | // Copyright (C) 2010 Dag Lem 4 | // 5 | // This program is free software; you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation; either version 2 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | // --------------------------------------------------------------------------- 19 | 20 | #ifndef RESID_POT_H 21 | #define RESID_POT_H 22 | 23 | #include "resid-config.h" 24 | 25 | namespace reSID 26 | { 27 | 28 | class Potentiometer 29 | { 30 | public: 31 | reg8 readPOT(); 32 | }; 33 | 34 | } // namespace reSID 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/SimonsBasic.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class SimonsBasic final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_SIMONS_BASIC, 24 | .title = "Simons Basic", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | private: 34 | 35 | void _didReset(bool hard) override; 36 | 37 | 38 | // 39 | // Accessing cartridge memory 40 | // 41 | 42 | public: 43 | 44 | u8 peekIO1(u16 addr) override; 45 | u8 spypeekIO1(u16 addr) const override; 46 | void pokeIO1(u16 addr, u8 value) override; 47 | }; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/AudioPortTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "BasicTypes.h" 17 | 18 | namespace vc64 { 19 | 20 | // 21 | // Structures 22 | // 23 | 24 | typedef struct 25 | { 26 | // Channel volumes 27 | i64 vol[4]; 28 | 29 | // Channel pan factors 30 | i64 pan[4]; 31 | 32 | // Master volume (left and right channel) 33 | i64 volL; 34 | i64 volR; 35 | } 36 | 37 | AudioPortConfig; 38 | 39 | typedef struct 40 | { 41 | 42 | } 43 | AudioPortInfo; 44 | 45 | typedef struct 46 | { 47 | // Current ring buffer fill level 48 | double fillLevel; 49 | 50 | // Number of buffer underflows since power up 51 | u64 bufferUnderflows; 52 | 53 | // Number of buffer overflows since power up 54 | u64 bufferOverflows; 55 | } 56 | AudioPortStats; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/ControlPortBase.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "ControlPort.h" 15 | #include "IOUtils.h" 16 | 17 | namespace vc64 { 18 | 19 | ControlPort::ControlPort(C64 &ref, isize id) : SubComponent(ref, id) 20 | { 21 | assert(id == PORT_1 || id == PORT_2); 22 | 23 | subComponents = std::vector { 24 | 25 | &mouse, 26 | &joystick, 27 | &paddle 28 | }; 29 | } 30 | 31 | void 32 | ControlPort::_dump(Category category, std::ostream& os) const 33 | { 34 | using namespace util; 35 | 36 | if (category == Category::State) { 37 | 38 | os << tab("Port Nr"); 39 | os << dec(objid) << std::endl; 40 | os << tab("Detetected device"); 41 | os << ControlPortDeviceEnum::key(device) << std::endl; 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Comal80.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Comal80 final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_COMAL80, 24 | .title = "Comal 80", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | 34 | void operator << (SerResetter &worker) override; 35 | 36 | u8 peekIO1(u16 addr) override { return control; } 37 | u8 spypeekIO1(u16 addr) const override { return control; } 38 | u8 peekIO2(u16 addr) override { return 0; } 39 | u8 spypeekIO2(u16 addr) const override { return 0; } 40 | void pokeIO1(u16 addr, u8 value) override; 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Mach5.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Mach5 final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_MACH5, 24 | .title = "Mach5", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | 34 | // 35 | // Accessing cartridge memory 36 | // 37 | 38 | public: 39 | 40 | u8 peekIO1(u16 addr) override; 41 | u8 spypeekIO1(u16 addr) const override; 42 | u8 peekIO2(u16 addr) override; 43 | u8 spypeekIO2(u16 addr) const override; 44 | void pokeIO1(u16 addr, u8 value) override; 45 | void pokeIO2(u16 addr, u8 value) override; 46 | }; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/CustomCartridges.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | #include "ActionReplay.h" 17 | #include "Comal80.h" 18 | #include "Dinamic.h" 19 | #include "EasyFlash.h" 20 | #include "Epyx.h" 21 | #include "Expert.h" 22 | #include "FinalIII.h" 23 | #include "FreezeFrame.h" 24 | #include "Funplay.h" 25 | #include "GameKiller.h" 26 | #include "GeoRam.h" 27 | #include "Gmod2.h" 28 | #include "Isepic.h" 29 | #include "Kcs.h" 30 | #include "Kingsoft.h" 31 | #include "Mach5.h" 32 | #include "MagicDesk.h" 33 | #include "MikroAss.h" 34 | #include "Ocean.h" 35 | #include "PageFox.h" 36 | #include "Reu.h" 37 | #include "Rex.h" 38 | #include "SimonsBasic.h" 39 | #include "StarDos.h" 40 | #include "StructuredBasic.h" 41 | #include "SuperGames.h" 42 | #include "WarpSpeed.h" 43 | #include "Westermann.h" 44 | #include "Zaxxon.h" 45 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/MagicDesk.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class MagicDesk final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_MAGIC_DESK, 24 | .title = "Magic Desk", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | 33 | void resetCartConfig() override; 34 | 35 | u8 peekIO1(u16 addr) override; 36 | u8 spypeekIO1(u16 addr) const override; 37 | void pokeIO1(u16 addr, u8 value) override; 38 | u8 peekIO2(u16 addr) override; 39 | u8 spypeekIO2(u16 addr) const override; 40 | 41 | private: 42 | 43 | bool disabled() const { return control & 0x80; } 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Emulator/Utilities/Checksum.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "BasicTypes.h" 16 | 17 | namespace vc64::util { 18 | 19 | // Returns the FNV-1a seed value 20 | inline u32 fnvInit32() { return 0x811c9dc5; } 21 | inline u64 fnvInit64() { return 0xcbf29ce484222325; } 22 | 23 | // Performs a single iteration of the FNV-1a hash algorithm 24 | u32 fnvIt32(u32 prv, u32 val); 25 | u64 fnvIt64(u64 prv, u64 val); 26 | 27 | // Computes a FNV-1a checksum for a given buffer 28 | u32 fnv32(const u8 *addr, isize size); 29 | u64 fnv64(const u8 *addr, isize size); 30 | 31 | // Computes a CRC checksum for a given buffer 32 | u16 crc16(const u8 *addr, isize size); 33 | u32 crc32(const u8 *addr, isize size); 34 | 35 | // Computes a MD5 hash for a given buffer 36 | string md5(const u8 *addr, size_t size); 37 | string md5(const string& str); 38 | 39 | string _md5(const u8 *addr, isize size); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /js/cm/addon/tern/worker.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // declare global: tern, server 5 | 6 | var server; 7 | 8 | this.onmessage = function(e) { 9 | var data = e.data; 10 | switch (data.type) { 11 | case "init": return startServer(data.defs, data.plugins, data.scripts); 12 | case "add": return server.addFile(data.name, data.text); 13 | case "del": return server.delFile(data.name); 14 | case "req": return server.request(data.body, function(err, reqData) { 15 | postMessage({id: data.id, body: reqData, err: err && String(err)}); 16 | }); 17 | case "getFile": 18 | var c = pending[data.id]; 19 | delete pending[data.id]; 20 | return c(data.err, data.text); 21 | default: throw new Error("Unknown message type: " + data.type); 22 | } 23 | }; 24 | 25 | var nextId = 0, pending = {}; 26 | function getFile(file, c) { 27 | postMessage({type: "getFile", name: file, id: ++nextId}); 28 | pending[nextId] = c; 29 | } 30 | 31 | function startServer(defs, plugins, scripts) { 32 | if (scripts) importScripts.apply(null, scripts); 33 | 34 | server = new tern.Server({ 35 | getFile: getFile, 36 | async: true, 37 | defs: defs, 38 | plugins: plugins 39 | }); 40 | } 41 | 42 | this.console = { 43 | log: function(v) { postMessage({type: "debug", message: v}); } 44 | }; 45 | -------------------------------------------------------------------------------- /Emulator/Misc/RemoteServers/RshServer.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "RemoteServer.h" 16 | 17 | namespace vc64 { 18 | 19 | class RshServer : public RemoteServer { 20 | 21 | public: 22 | 23 | using RemoteServer::RemoteServer; 24 | 25 | RshServer& operator= (const RshServer& other) { 26 | 27 | RemoteServer::operator = (other); 28 | return *this; 29 | } 30 | 31 | 32 | // 33 | // Methods from CoreObject 34 | // 35 | 36 | private: 37 | 38 | void _dump(Category category, std::ostream& os) const override; 39 | 40 | 41 | // 42 | // Methods from RemoteServer 43 | // 44 | 45 | string doReceive() throws override; 46 | void doProcess(const string &packet) throws override; 47 | void doSend(const string &packet)throws override; 48 | void didStart() override; 49 | void didConnect() override; 50 | }; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /Emulator/Base/Synchronizable.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Concurrency.h" 16 | 17 | namespace vc64 { 18 | 19 | class Synchronizable { 20 | 21 | public: 22 | 23 | /* Mutex for implementing the 'synchronized' macro. The macro can be used 24 | * to prevent multiple threads to enter the same code block. It mimics the 25 | * behaviour of the well known Java construct 'synchronized(this) { }'. 26 | */ 27 | mutable util::ReentrantMutex mutex; 28 | 29 | }; 30 | 31 | /* The following macro can be utilized to prevent multiple threads to enter the 32 | * same code block. It mimics the behaviour of the Java construct 33 | * 'synchronized(this) { }'. To secure a code-block, use the following syntax: 34 | * 35 | * { SYNCHRONIZED 36 | * 37 | * 38 | * ... 39 | * } 40 | */ 41 | #define SYNCHRONIZED util::AutoMutex _am(mutex); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Kingsoft.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class Kingsoft final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_KINGSOFT, 24 | .title = "Kingsoft", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | void resetCartConfig() override; 33 | 34 | 35 | // 36 | // Accessing cartridge memory 37 | // 38 | 39 | public: 40 | 41 | u8 peekIO1(u16 addr) override; 42 | u8 spypeekIO1(u16 addr) const override; 43 | void pokeIO1(u16 addr, u8 value) override; 44 | 45 | 46 | // 47 | // Handling delegation calls 48 | // 49 | 50 | public: 51 | 52 | void updatePeekPokeLookupTables() override; 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /js/cm/addon/lint/yaml-lint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | // Depends on js-yaml.js from https://github.com/nodeca/js-yaml 15 | 16 | // declare global: jsyaml 17 | 18 | CodeMirror.registerHelper("lint", "yaml", function(text) { 19 | var found = []; 20 | if (!window.jsyaml) { 21 | if (window.console) { 22 | window.console.error("Error: window.jsyaml not defined, CodeMirror YAML linting cannot run."); 23 | } 24 | return found; 25 | } 26 | try { jsyaml.loadAll(text); } 27 | catch(e) { 28 | var loc = e.mark, 29 | // js-yaml YAMLException doesn't always provide an accurate lineno 30 | // e.g., when there are multiple yaml docs 31 | // --- 32 | // --- 33 | // foo:bar 34 | from = loc ? CodeMirror.Pos(loc.line, loc.column) : CodeMirror.Pos(0, 0), 35 | to = from; 36 | found.push({ from: from, to: to, message: e.message }); 37 | } 38 | return found; 39 | }); 40 | 41 | }); 42 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/SuperGames.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | SuperGames::_dump(Category category, std::ostream& os) const 20 | { 21 | using namespace util; 22 | 23 | Cartridge::_dump(category, os); 24 | 25 | if (category == Category::State) { 26 | 27 | os << std::endl; 28 | 29 | os << tab("Write Protection Latch"); 30 | os << bol(protect); 31 | } 32 | } 33 | 34 | void 35 | SuperGames::pokeIO2(u16 addr, u8 value) 36 | { 37 | if (addr == 0xDF00 && protect == false) { 38 | 39 | // Bit 3: Write protection latch 40 | protect = value & 0b1000; 41 | 42 | // Bit 2: Exrom / Game control 43 | expansionPort.setCartridgeMode(value & 0b100 ? CRTMODE_OFF : CRTMODE_16K); 44 | 45 | // Bit 0 and 1: Bank select 46 | bankIn(value & 0b11); 47 | } 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Mach5.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | u8 19 | Mach5::peekIO1(u16 addr) 20 | { 21 | return peekRomL(0x1E00 | LO_BYTE(addr)); 22 | } 23 | 24 | u8 25 | Mach5::spypeekIO1(u16 addr) const 26 | { 27 | return spypeekRomL(0x1E00 | LO_BYTE(addr)); 28 | } 29 | 30 | u8 31 | Mach5::peekIO2(u16 addr) 32 | { 33 | return peekRomL(0x1F00 | LO_BYTE(addr)); 34 | } 35 | 36 | u8 37 | Mach5::spypeekIO2(u16 addr) const 38 | { 39 | return spypeekRomL(0x1F00 | LO_BYTE(addr)); 40 | } 41 | 42 | void 43 | Mach5::pokeIO1(u16 addr, u8 value) 44 | { 45 | trace(CRT_DEBUG, "Enabling Mach5 in 8K game mode\n"); 46 | expansionPort.setCartridgeMode(CRTMODE_8K); 47 | } 48 | 49 | void 50 | Mach5::pokeIO2(u16 addr, u8 value) 51 | { 52 | trace(CRT_DEBUG, "Switching Mach5 off\n"); 53 | expansionPort.setCartridgeMode(CRTMODE_OFF); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Emulator/Base/CoreComponentTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "BasicTypes.h" 16 | 17 | 18 | // 19 | // Enumerations 20 | // 21 | 22 | enum_long(COMP_TYPE) 23 | { 24 | GenericClass, 25 | 26 | // Components 27 | C64Class, 28 | CPUClass, 29 | CIAClass, 30 | HostClass, 31 | MemoryClass, 32 | PIAClass, 33 | SIDClass, 34 | SIDBridgeClass, 35 | TODClass, 36 | VIAClass, 37 | VICIIClass, 38 | 39 | // Ports 40 | AudioPortClass, 41 | ControlPortClass, 42 | ExpansionPortClass, 43 | PowerPortClass, 44 | RS232Class, 45 | SerialPortClass, 46 | UserPortClass, 47 | VideoPortClass, 48 | 49 | // Peripherals 50 | CartridgeClass, 51 | DatasetteClass, 52 | DriveClass, 53 | DriveMemoryClass, 54 | JoystickClass, 55 | KeyboardClass, 56 | MonitorClass, 57 | MouseClass, 58 | PaddleClass, 59 | ParCableClass 60 | }; 61 | typedef COMP_TYPE CType; 62 | -------------------------------------------------------------------------------- /Emulator/Base/CmdQueue.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "CmdQueueTypes.h" 17 | #include "CoreObject.h" 18 | #include "Synchronizable.h" 19 | #include "RingBuffer.h" 20 | #include 21 | 22 | namespace vc64 { 23 | 24 | /// Command queue 25 | class CmdQueue final : CoreObject, Synchronizable { 26 | 27 | /// Ring buffer storing all pending commands 28 | util::RingBuffer queue; 29 | 30 | public: 31 | 32 | /// Indicates if the queue is empty 33 | std::atomic empty = true; 34 | 35 | // 36 | // Methods 37 | // 38 | 39 | private: 40 | 41 | const char *objectName() const override { return "CmdQueue"; } 42 | 43 | 44 | // 45 | // Managing the queue 46 | // 47 | 48 | public: 49 | 50 | // Sends a command 51 | void put(const Cmd &cmd); 52 | // void put(CmdType type, KeyCmd payload); 53 | 54 | // Polls a command 55 | bool poll(Cmd &cmd); 56 | }; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Comal80.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | Comal80::operator << (SerResetter &worker) 20 | { 21 | Cartridge::operator << (worker); 22 | expansionPort.setCartridgeMode(CRTMODE_16K); 23 | bankIn(0); 24 | } 25 | 26 | void 27 | Comal80::pokeIO1(u16 addr, u8 value) 28 | { 29 | if (addr >= 0xDE00 && addr <= 0xDEFF) { 30 | 31 | control = value & 0xC7; 32 | bankIn(value & 0x07); 33 | 34 | switch (value & 0xE0) { 35 | 36 | case 0xe0: 37 | expansionPort.setCartridgeMode(CRTMODE_OFF); 38 | break; 39 | 40 | case 0x40: 41 | expansionPort.setCartridgeMode(CRTMODE_8K); 42 | break; 43 | 44 | default: 45 | expansionPort.setCartridgeMode(CRTMODE_16K); 46 | break; 47 | } 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /js/cm/addon/runmode/colorize.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("./runmode")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "./runmode"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/; 15 | 16 | function textContent(node, out) { 17 | if (node.nodeType == 3) return out.push(node.nodeValue); 18 | for (var ch = node.firstChild; ch; ch = ch.nextSibling) { 19 | textContent(ch, out); 20 | if (isBlock.test(node.nodeType)) out.push("\n"); 21 | } 22 | } 23 | 24 | CodeMirror.colorize = function(collection, defaultMode) { 25 | if (!collection) collection = document.body.getElementsByTagName("pre"); 26 | 27 | for (var i = 0; i < collection.length; ++i) { 28 | var node = collection[i]; 29 | var mode = node.getAttribute("data-lang") || defaultMode; 30 | if (!mode) continue; 31 | 32 | var text = []; 33 | textContent(node, text); 34 | node.innerHTML = ""; 35 | CodeMirror.runMode(text.join(""), mode, node); 36 | 37 | node.className += " cm-s-default"; 38 | } 39 | }; 40 | }); 41 | -------------------------------------------------------------------------------- /js/cm/addon/lint/css-lint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Depends on csslint.js from https://github.com/stubbornella/csslint 5 | 6 | // declare global: CSSLint 7 | 8 | (function(mod) { 9 | if (typeof exports == "object" && typeof module == "object") // CommonJS 10 | mod(require("../../lib/codemirror")); 11 | else if (typeof define == "function" && define.amd) // AMD 12 | define(["../../lib/codemirror"], mod); 13 | else // Plain browser env 14 | mod(CodeMirror); 15 | })(function(CodeMirror) { 16 | "use strict"; 17 | 18 | CodeMirror.registerHelper("lint", "css", function(text, options) { 19 | var found = []; 20 | if (!window.CSSLint) { 21 | if (window.console) { 22 | window.console.error("Error: window.CSSLint not defined, CodeMirror CSS linting cannot run."); 23 | } 24 | return found; 25 | } 26 | var results = CSSLint.verify(text, options), messages = results.messages, message = null; 27 | for ( var i = 0; i < messages.length; i++) { 28 | message = messages[i]; 29 | var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col; 30 | found.push({ 31 | from: CodeMirror.Pos(startLine, startCol), 32 | to: CodeMirror.Pos(endLine, endCol), 33 | message: message.message, 34 | severity : message.type 35 | }); 36 | } 37 | return found; 38 | }); 39 | 40 | }); 41 | -------------------------------------------------------------------------------- /Emulator/Misc/RemoteServers/RemoteManagerTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Reflection.h" 16 | 17 | namespace vc64 { 18 | 19 | // 20 | // Enumerations 21 | // 22 | 23 | enum_long(SERVER_TYPE) 24 | { 25 | SERVER_RSH 26 | }; 27 | typedef SERVER_TYPE ServerType; 28 | 29 | #ifdef __cplusplus 30 | struct ServerTypeEnum : util::Reflection 31 | { 32 | static constexpr long minVal = 0; 33 | static constexpr long maxVal = SERVER_RSH; 34 | 35 | static const char *prefix() { return "SERVER"; } 36 | static const char *_key(long value) 37 | { 38 | switch (value) { 39 | 40 | case SERVER_RSH: return "RSH"; 41 | } 42 | return "???"; 43 | } 44 | }; 45 | #endif 46 | 47 | 48 | // 49 | // Structures 50 | // 51 | 52 | typedef struct 53 | { 54 | isize numLaunching; 55 | isize numListening; 56 | isize numConnected; 57 | isize numErroneous; 58 | } 59 | RemoteManagerInfo; 60 | 61 | } 62 | -------------------------------------------------------------------------------- /js/cm/addon/lint/json-lint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Depends on jsonlint.js from https://github.com/zaach/jsonlint 5 | 6 | // declare global: jsonlint 7 | 8 | (function(mod) { 9 | if (typeof exports == "object" && typeof module == "object") // CommonJS 10 | mod(require("../../lib/codemirror")); 11 | else if (typeof define == "function" && define.amd) // AMD 12 | define(["../../lib/codemirror"], mod); 13 | else // Plain browser env 14 | mod(CodeMirror); 15 | })(function(CodeMirror) { 16 | "use strict"; 17 | 18 | CodeMirror.registerHelper("lint", "json", function(text) { 19 | var found = []; 20 | if (!window.jsonlint) { 21 | if (window.console) { 22 | window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run."); 23 | } 24 | return found; 25 | } 26 | // for jsonlint's web dist jsonlint is exported as an object with a single property parser, of which parseError 27 | // is a subproperty 28 | var jsonlint = window.jsonlint.parser || window.jsonlint 29 | jsonlint.parseError = function(str, hash) { 30 | var loc = hash.loc; 31 | found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column), 32 | to: CodeMirror.Pos(loc.last_line - 1, loc.last_column), 33 | message: str}); 34 | }; 35 | try { jsonlint.parse(text); } 36 | catch(e) {} 37 | return found; 38 | }); 39 | 40 | }); 41 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Drive/ParCableTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | // 21 | // Enumerations 22 | // 23 | 24 | /// Parallel cable type 25 | enum_long(PAR_CABLE_TYPE) 26 | { 27 | PAR_CABLE_NONE, ///< No parallel cable attached 28 | PAR_CABLE_STANDARD, ///< Standard parallel cable 29 | PAR_CABLE_DOLPHIN3 ///< DolphinDOS cable 30 | }; 31 | typedef PAR_CABLE_TYPE ParCableType; 32 | 33 | struct ParCableTypeEnum : util::Reflection { 34 | 35 | static constexpr long minVal = 0; 36 | static constexpr long maxVal = PAR_CABLE_DOLPHIN3; 37 | 38 | static const char *prefix() { return "PAR_CABLE"; } 39 | static const char *_key(long value) 40 | { 41 | switch (value) { 42 | 43 | case PAR_CABLE_NONE: return "PAR_CABLE_NONE"; 44 | case PAR_CABLE_STANDARD: return "PAR_CABLE_STANDARD"; 45 | case PAR_CABLE_DOLPHIN3: return "PAR_CABLE_DOLPHIN3"; 46 | } 47 | return "???"; 48 | } 49 | }; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/StructuredBasic.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | StructuredBasic::resetCartConfig() 20 | { 21 | expansionPort.setCartridgeMode(CRTMODE_8K); 22 | } 23 | 24 | u8 25 | StructuredBasic::peekIO1(u16 addr) 26 | { 27 | trace(CRT_DEBUG, "peekIO1(%x)\n", addr); 28 | 29 | switch (addr & 0b11) { 30 | 31 | case 0: 32 | case 1: 33 | expansionPort.setCartridgeMode(CRTMODE_8K); 34 | bankIn(0); 35 | break; 36 | 37 | case 2: 38 | expansionPort.setCartridgeMode(CRTMODE_8K); 39 | bankIn(1); 40 | break; 41 | 42 | case 3: 43 | expansionPort.setCartridgeMode(CRTMODE_OFF); 44 | break; 45 | } 46 | return 0; 47 | } 48 | 49 | u8 50 | StructuredBasic::spypeekIO1(u16 addr) const 51 | { 52 | return 0; 53 | } 54 | 55 | void 56 | StructuredBasic::pokeIO1(u16 addr, u8 value) 57 | { 58 | trace(CRT_DEBUG, "pokeIO1(%x,%x)\n", addr, value); 59 | 60 | peekIO1(addr); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /js/cm/addon/scroll/simplescrollbars.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div { 2 | position: absolute; 3 | background: #ccc; 4 | -moz-box-sizing: border-box; 5 | box-sizing: border-box; 6 | border: 1px solid #bbb; 7 | border-radius: 2px; 8 | } 9 | 10 | .CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical { 11 | position: absolute; 12 | z-index: 6; 13 | background: #eee; 14 | } 15 | 16 | .CodeMirror-simplescroll-horizontal { 17 | bottom: 0; left: 0; 18 | height: 8px; 19 | } 20 | .CodeMirror-simplescroll-horizontal div { 21 | bottom: 0; 22 | height: 100%; 23 | } 24 | 25 | .CodeMirror-simplescroll-vertical { 26 | right: 0; top: 0; 27 | width: 8px; 28 | } 29 | .CodeMirror-simplescroll-vertical div { 30 | right: 0; 31 | width: 100%; 32 | } 33 | 34 | 35 | .CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler { 36 | display: none; 37 | } 38 | 39 | .CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div { 40 | position: absolute; 41 | background: #bcd; 42 | border-radius: 3px; 43 | } 44 | 45 | .CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical { 46 | position: absolute; 47 | z-index: 6; 48 | } 49 | 50 | .CodeMirror-overlayscroll-horizontal { 51 | bottom: 0; left: 0; 52 | height: 6px; 53 | } 54 | .CodeMirror-overlayscroll-horizontal div { 55 | bottom: 0; 56 | height: 100%; 57 | } 58 | 59 | .CodeMirror-overlayscroll-vertical { 60 | right: 0; top: 0; 61 | width: 6px; 62 | } 63 | .CodeMirror-overlayscroll-vertical div { 64 | right: 0; 65 | width: 100%; 66 | } 67 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/ControlPortTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | // 21 | // Constants 22 | // 23 | 24 | static constexpr auto PORT_1 = 0; 25 | static constexpr auto PORT_2 = 1; 26 | 27 | 28 | // 29 | // Enumerations 30 | // 31 | 32 | /// Control port device 33 | enum_long(CPDEVICE) 34 | { 35 | CPDEVICE_NONE, ///< No device 36 | CPDEVICE_MOUSE, ///< Mouse 37 | CPDEVICE_JOYSTICK ///< Joystick 38 | }; 39 | typedef CPDEVICE ControlPortDevice; 40 | 41 | struct ControlPortDeviceEnum : util::Reflection { 42 | 43 | static constexpr long minVal = 0; 44 | static constexpr long maxVal = CPDEVICE_JOYSTICK; 45 | 46 | static const char *prefix() { return "CPDEVICE"; } 47 | static const char *_key(long value) 48 | { 49 | switch (value) { 50 | 51 | case CPDEVICE_NONE: return "NONE"; 52 | case CPDEVICE_MOUSE: return "MOUSE"; 53 | case CPDEVICE_JOYSTICK: return "JOYSTICK"; 54 | } 55 | return "???"; 56 | } 57 | }; 58 | 59 | } 60 | -------------------------------------------------------------------------------- /js/cm/addon/display/fullscreen.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineOption("fullScreen", false, function(cm, val, old) { 15 | if (old == CodeMirror.Init) old = false; 16 | if (!old == !val) return; 17 | if (val) setFullscreen(cm); 18 | else setNormal(cm); 19 | }); 20 | 21 | function setFullscreen(cm) { 22 | var wrap = cm.getWrapperElement(); 23 | cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, 24 | width: wrap.style.width, height: wrap.style.height}; 25 | wrap.style.width = ""; 26 | wrap.style.height = "auto"; 27 | wrap.className += " CodeMirror-fullscreen"; 28 | document.documentElement.style.overflow = "hidden"; 29 | cm.refresh(); 30 | } 31 | 32 | function setNormal(cm) { 33 | var wrap = cm.getWrapperElement(); 34 | wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, ""); 35 | document.documentElement.style.overflow = ""; 36 | var info = cm.state.fullScreenRestore; 37 | wrap.style.width = info.width; wrap.style.height = info.height; 38 | window.scrollTo(info.scrollLeft, info.scrollTop); 39 | cm.refresh(); 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /js/cm/addon/lint/coffeescript-lint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js 5 | 6 | // declare global: coffeelint 7 | 8 | (function(mod) { 9 | if (typeof exports == "object" && typeof module == "object") // CommonJS 10 | mod(require("../../lib/codemirror")); 11 | else if (typeof define == "function" && define.amd) // AMD 12 | define(["../../lib/codemirror"], mod); 13 | else // Plain browser env 14 | mod(CodeMirror); 15 | })(function(CodeMirror) { 16 | "use strict"; 17 | 18 | CodeMirror.registerHelper("lint", "coffeescript", function(text) { 19 | var found = []; 20 | if (!window.coffeelint) { 21 | if (window.console) { 22 | window.console.error("Error: window.coffeelint not defined, CodeMirror CoffeeScript linting cannot run."); 23 | } 24 | return found; 25 | } 26 | var parseError = function(err) { 27 | var loc = err.lineNumber; 28 | found.push({from: CodeMirror.Pos(loc-1, 0), 29 | to: CodeMirror.Pos(loc, 0), 30 | severity: err.level, 31 | message: err.message}); 32 | }; 33 | try { 34 | var res = coffeelint.lint(text); 35 | for(var i = 0; i < res.length; i++) { 36 | parseError(res[i]); 37 | } 38 | } catch(e) { 39 | found.push({from: CodeMirror.Pos(e.location.first_line, 0), 40 | to: CodeMirror.Pos(e.location.last_line, e.location.last_column), 41 | severity: 'error', 42 | message: e.message}); 43 | } 44 | return found; 45 | }); 46 | 47 | }); 48 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Zaxxon.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | Zaxxon::_didReset(bool hard) 20 | { 21 | // Make sure peekRomL() is called for the whole 8KB ROML range. 22 | mappedBytesL = 0x2000; 23 | } 24 | 25 | u8 26 | Zaxxon::peekRomL(u16 addr) 27 | { 28 | /* "The (Super) Zaxxon carts use a 4Kb ($1000) ROM at $8000-$8FFF (mirrored 29 | * in $9000-$9FFF) along with two 8Kb ($2000) cartridge banks located at 30 | * $A000-$BFFF. One of the two banks is selected by doing a read access to 31 | * either the $8000-$8FFF area (bank 0 is selected) or to $9000-$9FFF area 32 | * (bank 1 is selected)." 33 | */ 34 | if (addr < 0x1000) { 35 | bankIn(1); 36 | return Cartridge::peekRomL(addr); 37 | } else { 38 | bankIn(2); 39 | return Cartridge::peekRomL(addr - 0x1000); 40 | } 41 | } 42 | 43 | u8 44 | Zaxxon::spypeekRomL(u16 addr) const 45 | { 46 | if (addr < 0x1000) { 47 | return Cartridge::spypeekRomL(addr); 48 | } else { 49 | return Cartridge::spypeekRomL(addr - 0x1000); 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Emulator/VirtualC64Types.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "AudioPortTypes.h" 17 | #include "C64Types.h" 18 | #include "CartridgeTypes.h" 19 | #include "CIATypes.h" 20 | #include "CmdQueueTypes.h" 21 | #include "ControlPortTypes.h" 22 | #include "CoreComponentTypes.h" 23 | #include "CPUTypes.h" 24 | #include "DatasetteTypes.h" 25 | #include "DiskTypes.h" 26 | #include "DiskAnalyzerTypes.h" 27 | #include "DriveTypes.h" 28 | #include "EmulatorTypes.h" 29 | #include "ErrorTypes.h" 30 | #include "ExpansionPortTypes.h" 31 | #include "FSTypes.h" 32 | #include "JoystickTypes.h" 33 | #include "KeyboardTypes.h" 34 | #include "MediaFileTypes.h" 35 | #include "MemoryTypes.h" 36 | #include "MonitorTypes.h" 37 | #include "MouseTypes.h" 38 | #include "MsgQueueTypes.h" 39 | #include "OptionTypes.h" 40 | #include "PaddleTypes.h" 41 | #include "ParCableTypes.h" 42 | #include "PowerPortTypes.h" 43 | #include "RecorderTypes.h" 44 | #include "RemoteManagerTypes.h" 45 | #include "RemoteServerTypes.h" 46 | #include "RetroShellTypes.h" 47 | #include "SIDTypes.h" 48 | #include "ThreadTypes.h" 49 | #include "UserPortTypes.h" 50 | #include "VICIITypes.h" 51 | 52 | #include "Constants.h" 53 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/WarpSpeed.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class WarpSpeed final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_WARPSPEED, 24 | .title = "WarpSpeed", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | public: 30 | 31 | using Cartridge::Cartridge; 32 | void resetCartConfig() override; 33 | 34 | 35 | // 36 | // Accessing cartridge memory 37 | // 38 | 39 | public: 40 | 41 | u8 peekIO1(u16 addr) override; 42 | u8 spypeekIO1(u16 addr) const override; 43 | u8 peekIO2(u16 addr) override; 44 | u8 spypeekIO2(u16 addr) const override; 45 | void pokeIO1(u16 addr, u8 value) override; 46 | void pokeIO2(u16 addr, u8 value) override; 47 | 48 | 49 | // 50 | // Operating buttons 51 | // 52 | 53 | public: 54 | 55 | isize numButtons() const override { return 1; } 56 | const char *getButtonTitle(isize nr) const override; 57 | void pressButton(isize nr) override; 58 | }; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/ExpansionPortTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | // 21 | // Enumerations 22 | // 23 | 24 | /// Cartridge mode 25 | enum_long(CRTMODE) 26 | { 27 | CRTMODE_16K, //! 16KB cartridge 28 | CRTMODE_8K, //! 8KB cartridge 29 | CRTMODE_ULTIMAX, //! Ultimax cartridge 30 | CRTMODE_OFF //! No cartridge 31 | }; 32 | typedef CRTMODE CRTMode; 33 | 34 | struct CRTModeEnum : util::Reflection { 35 | 36 | static constexpr long minVal = 0; 37 | static constexpr long maxVal = CRTMODE_OFF; 38 | 39 | static const char *prefix() { return "CRTMODE"; } 40 | static const char *_key(long value) 41 | { 42 | switch (value) { 43 | 44 | case CRTMODE_16K: return "16K"; 45 | case CRTMODE_8K: return "8K"; 46 | case CRTMODE_ULTIMAX: return "ULTIMAX"; 47 | case CRTMODE_OFF: return "OFF"; 48 | } 49 | return "???"; 50 | } 51 | }; 52 | 53 | // 54 | // Structures 55 | // 56 | 57 | typedef struct 58 | { 59 | isize reuSpeed; 60 | } 61 | ExpansionPortConfig; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/FreezeFrame.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class FreezeFrame final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_FREEZE_FRAME, 24 | .title = "Freeze Frame", 25 | 26 | .buttons = 1, 27 | .button1 = "Freeze" 28 | }; 29 | 30 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 31 | 32 | public: 33 | 34 | using Cartridge::Cartridge; 35 | 36 | private: 37 | 38 | 39 | void _didReset(bool hard) override; 40 | 41 | 42 | // 43 | // Accessing cartridge memory 44 | // 45 | 46 | public: 47 | 48 | u8 peekIO1(u16 addr) override; 49 | u8 spypeekIO1(u16 addr) const override; 50 | u8 peekIO2(u16 addr) override; 51 | u8 spypeekIO2(u16 addr) const override; 52 | 53 | 54 | // 55 | // Operating buttons 56 | // 57 | 58 | isize numButtons() const override { return 1; } 59 | const char *getButtonTitle(isize nr) const override; 60 | void pressButton(isize nr) override; 61 | void releaseButton(isize nr) override; 62 | }; 63 | 64 | } 65 | -------------------------------------------------------------------------------- /Emulator/Media/Script.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "AnyFile.h" 16 | 17 | namespace vc64 { 18 | 19 | class VirtualC64; 20 | 21 | class Script : public AnyFile { 22 | 23 | public: 24 | 25 | // 26 | // Class methods 27 | // 28 | 29 | static bool isCompatible(const fs::path &path); 30 | static bool isCompatible(const u8 *buf, isize len); 31 | static bool isCompatible(const Buffer &buffer); 32 | 33 | 34 | // 35 | // Initializing 36 | // 37 | 38 | public: 39 | 40 | // Script(); 41 | Script(const fs::path &path) throws { init(path); } 42 | Script(const u8 *buf, isize len) throws { init(buf, len); } 43 | 44 | 45 | // 46 | // Methods from CoreObject 47 | // 48 | 49 | const char *objectName() const override { return "Script"; } 50 | 51 | 52 | // 53 | // Methods from AnyFile 54 | // 55 | 56 | public: 57 | 58 | bool isCompatiblePath(const fs::path &path) override { return isCompatible(path); } 59 | bool isCompatibleBuffer(const u8 *buf, isize len) override { return isCompatible(buf, len); } 60 | FileType type() const override { return FILETYPE_SCRIPT; } 61 | }; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/UserPortTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "RS232Types.h" 16 | 17 | namespace vc64 { 18 | 19 | // 20 | // Enumerations 21 | // 22 | 23 | enum_long(USR) 24 | { 25 | USR_NONE, 26 | USR_PARCABLE, 27 | USR_PARCABLE_DOLPHIN, 28 | USR_RS232 29 | }; 30 | typedef USR UserPortDevice; 31 | 32 | #ifdef __cplusplus 33 | struct UserPortDeviceEnum : util::Reflection 34 | { 35 | static constexpr long minVal = 0; 36 | static constexpr long maxVal = USR_RS232; 37 | 38 | static const char *prefix() { return "USR"; } 39 | static const char *_key(long value) 40 | { 41 | switch (value) { 42 | 43 | case USR_NONE: return "NONE"; 44 | case USR_PARCABLE: return "PARCABLE"; 45 | case USR_PARCABLE_DOLPHIN: return "PARCABLE_DOLPHIN"; 46 | case USR_RS232: return "RS232"; 47 | } 48 | return "???"; 49 | } 50 | }; 51 | #endif 52 | 53 | 54 | // 55 | // Structures 56 | // 57 | 58 | typedef struct 59 | { 60 | UserPortDevice device; 61 | } 62 | UserPortConfig; 63 | 64 | typedef struct 65 | { 66 | 67 | } 68 | UserPortInfo; 69 | 70 | } 71 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Network/RS232Types.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | // 21 | // Enumerations 22 | // 23 | 24 | enum_long(COMDEV) 25 | { 26 | COMDEV_NONE, 27 | COMDEV_LOOPBACK, 28 | COMDEV_RETROSHELL, 29 | COMDEV_COMMANDER 30 | }; 31 | typedef COMDEV CommunicationDevice; 32 | 33 | #ifdef __cplusplus 34 | struct CommunicationDeviceEnum : util::Reflection 35 | { 36 | static constexpr long minVal = 0; 37 | static constexpr long maxVal = COMDEV_COMMANDER; 38 | 39 | static const char *prefix() { return "COMDEV"; } 40 | static const char *_key(long value) 41 | { 42 | switch (value) { 43 | 44 | case COMDEV_NONE: return "NONE"; 45 | case COMDEV_LOOPBACK: return "LOOPBACK"; 46 | case COMDEV_RETROSHELL: return "RETROSHELL"; 47 | case COMDEV_COMMANDER: return "COMMANDER"; 48 | } 49 | return "???"; 50 | } 51 | }; 52 | #endif 53 | 54 | 55 | // 56 | // Structures 57 | // 58 | 59 | typedef struct 60 | { 61 | CommunicationDevice device; 62 | isize baud; 63 | } 64 | RS232Config; 65 | 66 | } 67 | -------------------------------------------------------------------------------- /Emulator/Components/CIA/TODBase.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "TOD.h" 15 | #include "IOUtils.h" 16 | 17 | namespace vc64 { 18 | 19 | void 20 | TOD::_dump(Category category, std::ostream& os) const 21 | { 22 | using namespace util; 23 | 24 | if (category == Category::State) { 25 | 26 | os << tab("Time of Day"); 27 | os << hex(tod.hour) << ":" << hex(tod.min) << ":"; 28 | os << hex(tod.sec) << ":" << hex(tod.tenth) << std::endl; 29 | 30 | os << tab("Alarm"); 31 | os << hex(alarm.hour) << ":" << hex(alarm.min) << ":"; 32 | os << hex(alarm.sec) << ":" << hex(alarm.tenth) << std::endl; 33 | 34 | os << tab("Latch"); 35 | os << hex(latch.hour) << ":" << hex(latch.min) << ":"; 36 | os << hex(latch.sec) << ":" << hex(latch.tenth) << std::endl; 37 | 38 | os << tab("Frozen"); 39 | os << bol(frozen) << std::endl; 40 | os << tab("Stopped"); 41 | os << bol(stopped) << std::endl; 42 | } 43 | } 44 | 45 | void 46 | TOD::cacheInfo(TODInfo &info) const 47 | { 48 | { SYNCHRONIZED 49 | 50 | info.time = tod; 51 | info.latch = latch; 52 | info.alarm = alarm; 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /js/cm/addon/display/autorefresh.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")) 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod) 9 | else // Plain browser env 10 | mod(CodeMirror) 11 | })(function(CodeMirror) { 12 | "use strict" 13 | 14 | CodeMirror.defineOption("autoRefresh", false, function(cm, val) { 15 | if (cm.state.autoRefresh) { 16 | stopListening(cm, cm.state.autoRefresh) 17 | cm.state.autoRefresh = null 18 | } 19 | if (val && cm.display.wrapper.offsetHeight == 0) 20 | startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250}) 21 | }) 22 | 23 | function startListening(cm, state) { 24 | function check() { 25 | if (cm.display.wrapper.offsetHeight) { 26 | stopListening(cm, state) 27 | if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight) 28 | cm.refresh() 29 | } else { 30 | state.timeout = setTimeout(check, state.delay) 31 | } 32 | } 33 | state.timeout = setTimeout(check, state.delay) 34 | state.hurry = function() { 35 | clearTimeout(state.timeout) 36 | state.timeout = setTimeout(check, 50) 37 | } 38 | CodeMirror.on(window, "mouseup", state.hurry) 39 | CodeMirror.on(window, "keyup", state.hurry) 40 | } 41 | 42 | function stopListening(_cm, state) { 43 | clearTimeout(state.timeout) 44 | CodeMirror.off(window, "mouseup", state.hurry) 45 | CodeMirror.off(window, "keyup", state.hurry) 46 | } 47 | }); 48 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/VideoPortBase.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "VideoPort.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | VideoPort::_dump(Category category, std::ostream& os) const 20 | { 21 | using namespace util; 22 | 23 | if (category == Category::Config) { 24 | 25 | dumpConfig(os); 26 | } 27 | 28 | if (category == Category::State) { 29 | 30 | } 31 | } 32 | 33 | i64 34 | VideoPort::getOption(Option option) const 35 | { 36 | switch (option) { 37 | 38 | case OPT_VID_WHITE_NOISE: return config.whiteNoise; 39 | 40 | default: 41 | fatalError; 42 | } 43 | } 44 | 45 | void 46 | VideoPort::checkOption(Option opt, i64 value) 47 | { 48 | switch (opt) { 49 | 50 | case OPT_VID_WHITE_NOISE: 51 | 52 | return; 53 | 54 | default: 55 | throw Error(VC64ERROR_OPT_UNSUPPORTED); 56 | } 57 | } 58 | 59 | void 60 | VideoPort::setOption(Option opt, i64 value) 61 | { 62 | checkOption(opt, value); 63 | 64 | switch (opt) { 65 | 66 | case OPT_VID_WHITE_NOISE: 67 | 68 | config.whiteNoise = (bool)value; 69 | return; 70 | 71 | default: 72 | fatalError; 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /Emulator/Components/VICII/BusTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | enum_long(MEMACCESS) 21 | { 22 | MEMACCESS_R, // Memory Refresh 23 | MEMACCESS_I, // Idle read 24 | MEMACCESS_C, // Character access 25 | MEMACCESS_G, // Graphics access 26 | MEMACCESS_P, // Sprite pointer access 27 | MEMACCESS_S, // Sprite data access 28 | MEMACCESS_COUNT 29 | }; 30 | typedef MEMACCESS MemAccess; 31 | 32 | struct MemAccessEnum : util::Reflection { 33 | 34 | static constexpr long minVal = 0; 35 | static constexpr long maxVal = MEMACCESS_S; 36 | 37 | static const char *prefix() { return "MEMACCESS"; } 38 | static const char *_key(long value) 39 | { 40 | switch (value) { 41 | 42 | case MEMACCESS_R: return "R"; 43 | case MEMACCESS_I: return "I"; 44 | case MEMACCESS_C: return "C"; 45 | case MEMACCESS_G: return "G"; 46 | case MEMACCESS_P: return "P"; 47 | case MEMACCESS_S: return "S"; 48 | case MEMACCESS_COUNT: return "???"; 49 | } 50 | return "???"; 51 | } 52 | }; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/PowerPortTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | // 21 | // Enumerations 22 | // 23 | 24 | /// Power grip characteristics 25 | enum_long(GRID) 26 | { 27 | GRID_STABLE_50HZ, ///< 50Hz constant 28 | GRID_UNSTABLE_50HZ, ///< 50Hz with jitter 29 | GRID_STABLE_60HZ, ///< 60Hz constant 30 | GRID_UNSTABLE_60HZ ///< 60Hz with jitter 31 | }; 32 | typedef GRID PowerGrid; 33 | 34 | struct PowerGridEnum : util::Reflection { 35 | 36 | static constexpr long minVal = 0; 37 | static constexpr long maxVal = GRID_UNSTABLE_60HZ; 38 | 39 | static const char *prefix() { return "GRID"; } 40 | static const char *_key(long value) 41 | { 42 | switch (value) { 43 | 44 | case GRID_STABLE_50HZ: return "STABLE_50HZ"; 45 | case GRID_UNSTABLE_50HZ: return "UNSTABLE_50HZ"; 46 | case GRID_STABLE_60HZ: return "STABLE_60HZ"; 47 | case GRID_UNSTABLE_60HZ: return "UNSTABLE_60HZ"; 48 | } 49 | return "???"; 50 | } 51 | }; 52 | 53 | // 54 | // Structures 55 | // 56 | 57 | typedef struct 58 | { 59 | PowerGrid powerGrid; 60 | } 61 | PowerPortConfig; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/WarpSpeed.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | WarpSpeed::resetCartConfig() 20 | { 21 | expansionPort.setCartridgeMode(CRTMODE_16K); 22 | } 23 | 24 | u8 25 | WarpSpeed::peekIO1(u16 addr) 26 | { 27 | return Cartridge::peekRomL(0x1E00 | (addr & 0xFF)); 28 | } 29 | 30 | u8 31 | WarpSpeed::spypeekIO1(u16 addr) const 32 | { 33 | return Cartridge::spypeekRomL(0x1E00 | (addr & 0xFF)); 34 | } 35 | 36 | u8 37 | WarpSpeed::peekIO2(u16 addr) 38 | { 39 | return Cartridge::peekRomL(0x1F00 | (addr & 0xFF)); 40 | } 41 | 42 | u8 43 | WarpSpeed::spypeekIO2(u16 addr) const 44 | { 45 | return Cartridge::spypeekRomL(0x1F00 | (addr & 0xFF)); 46 | } 47 | 48 | void 49 | WarpSpeed::pokeIO1(u16 addr, u8 value) 50 | { 51 | expansionPort.setCartridgeMode(CRTMODE_16K); 52 | } 53 | 54 | void 55 | WarpSpeed::pokeIO2(u16 addr, u8 value) 56 | { 57 | expansionPort.setCartridgeMode(CRTMODE_OFF); 58 | } 59 | 60 | const char * 61 | WarpSpeed::getButtonTitle(isize nr) const 62 | { 63 | return nr == 1 ? "Reset" : ""; 64 | } 65 | 66 | void 67 | WarpSpeed::pressButton(isize nr) 68 | { 69 | assert(nr <= numButtons()); 70 | 71 | c64.softReset(); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /js/cm/addon/scroll/scrollpastend.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) { 15 | if (old && old != CodeMirror.Init) { 16 | cm.off("change", onChange); 17 | cm.off("refresh", updateBottomMargin); 18 | cm.display.lineSpace.parentNode.style.paddingBottom = ""; 19 | cm.state.scrollPastEndPadding = null; 20 | } 21 | if (val) { 22 | cm.on("change", onChange); 23 | cm.on("refresh", updateBottomMargin); 24 | updateBottomMargin(cm); 25 | } 26 | }); 27 | 28 | function onChange(cm, change) { 29 | if (CodeMirror.changeEnd(change).line == cm.lastLine()) 30 | updateBottomMargin(cm); 31 | } 32 | 33 | function updateBottomMargin(cm) { 34 | var padding = ""; 35 | if (cm.lineCount() > 1) { 36 | var totalH = cm.display.scroller.clientHeight - 30, 37 | lastLineH = cm.getLineHandle(cm.lastLine()).height; 38 | padding = (totalH - lastLineH) + "px"; 39 | } 40 | if (cm.state.scrollPastEndPadding != padding) { 41 | cm.state.scrollPastEndPadding = padding; 42 | cm.display.lineSpace.parentNode.style.paddingBottom = padding; 43 | cm.off("refresh", updateBottomMargin); 44 | cm.setSize(); 45 | cm.on("refresh", updateBottomMargin); 46 | } 47 | } 48 | }); 49 | -------------------------------------------------------------------------------- /Emulator/Misc/Recorder/FFmpeg.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "BasicTypes.h" 16 | #include 17 | #include 18 | 19 | namespace vc64 { 20 | 21 | namespace fs = ::std::filesystem; 22 | 23 | class FFmpeg final { 24 | 25 | public: 26 | 27 | // A list of available FFmpeg executables (setup in init() ) 28 | static std::vector paths; 29 | 30 | // Path to the selected FFmpeg executable 31 | static std::filesystem::path exec; 32 | 33 | #ifdef _MSC_VER 34 | 35 | #else 36 | FILE *handle = nullptr; 37 | #endif 38 | 39 | // 40 | // Locating FFmpeg 41 | // 42 | 43 | // Sets up the 'path' vector 44 | static void init(); 45 | 46 | // Getter and setter for the FFmpeg executable path 47 | static const fs::path getExecPath(); 48 | static void setExecPath(const fs::path &path); 49 | 50 | // Checks whether FFmeg is available 51 | static bool available(); 52 | 53 | 54 | // 55 | // Running FFmpeg 56 | // 57 | 58 | // Launches the FFmpeg instance 59 | bool launch(const string &args); 60 | 61 | // Returns true if the FFmpeg instance is currently running 62 | bool isRunning(); 63 | 64 | // Waits until the FFmpeg instance has terminated 65 | void join(); 66 | }; 67 | 68 | } 69 | -------------------------------------------------------------------------------- /Emulator/Base/ThreadTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | /// Execution state 21 | enum_long(EXEC_STATE) 22 | { 23 | STATE_UNINIT, ///< Not yet initialized 24 | STATE_OFF, ///< Powered off 25 | STATE_PAUSED, ///< Powered on, but currently paused 26 | STATE_RUNNING, ///< Up and running 27 | STATE_SUSPENDED, ///< Shortly paused for an internal state change 28 | STATE_HALTED ///< Shut down 29 | }; 30 | typedef EXEC_STATE ExecState; 31 | 32 | struct ExecStateEnum : util::Reflection 33 | { 34 | static constexpr long minVal = 0; 35 | static constexpr long maxVal = STATE_HALTED; 36 | 37 | static const char *prefix() { return "STATE"; } 38 | static const char *_key(long value) 39 | { 40 | switch (value) { 41 | 42 | case STATE_UNINIT: return "UNINIT"; 43 | case STATE_OFF: return "OFF"; 44 | case STATE_PAUSED: return "PAUSED"; 45 | case STATE_RUNNING: return "RUNNING"; 46 | case STATE_SUSPENDED: return "SUSPENDED"; 47 | case STATE_HALTED: return "HALTED"; 48 | } 49 | return "???"; 50 | } 51 | }; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Emulator/Headless.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "VirtualC64.h" 16 | #include "Wakeable.h" 17 | #include 18 | 19 | namespace vc64 { 20 | 21 | struct SyntaxError : public std::runtime_error { 22 | using runtime_error::runtime_error; 23 | }; 24 | 25 | // The message listener 26 | void process(const void *listener, Message msg); 27 | 28 | class Headless : Wakeable { 29 | 30 | // Parsed command line arguments 31 | std::map keys; 32 | 33 | // Return code 34 | int returnCode; 35 | 36 | 37 | // 38 | // Launching 39 | // 40 | 41 | public: 42 | 43 | // Main entry point 44 | int main(int argc, char *argv[]); 45 | 46 | private: 47 | 48 | // Parses the command line arguments 49 | void parseArguments(int argc, char *argv[]); 50 | 51 | // Checks all command line arguments for conistency 52 | void checkArguments() throws; 53 | 54 | // Runs a RetroShell script 55 | void runScript(const char **script); 56 | void runScript(const std::filesystem::path &path); 57 | 58 | 59 | // 60 | // Running 61 | // 62 | 63 | public: 64 | 65 | // Reports size information 66 | void reportSize(); 67 | 68 | // Processes an incoming message 69 | void process(Message msg); 70 | }; 71 | 72 | } 73 | -------------------------------------------------------------------------------- /js/cm/addon/fold/markdown-fold.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.registerHelper("fold", "markdown", function(cm, start) { 15 | var maxDepth = 100; 16 | 17 | function isHeader(lineNo) { 18 | var tokentype = cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0)); 19 | return tokentype && /\bheader\b/.test(tokentype); 20 | } 21 | 22 | function headerLevel(lineNo, line, nextLine) { 23 | var match = line && line.match(/^#+/); 24 | if (match && isHeader(lineNo)) return match[0].length; 25 | match = nextLine && nextLine.match(/^[=\-]+\s*$/); 26 | if (match && isHeader(lineNo + 1)) return nextLine[0] == "=" ? 1 : 2; 27 | return maxDepth; 28 | } 29 | 30 | var firstLine = cm.getLine(start.line), nextLine = cm.getLine(start.line + 1); 31 | var level = headerLevel(start.line, firstLine, nextLine); 32 | if (level === maxDepth) return undefined; 33 | 34 | var lastLineNo = cm.lastLine(); 35 | var end = start.line, nextNextLine = cm.getLine(end + 2); 36 | while (end < lastLineNo) { 37 | if (headerLevel(end + 1, nextLine, nextNextLine) <= level) break; 38 | ++end; 39 | nextLine = nextNextLine; 40 | nextNextLine = cm.getLine(end + 2); 41 | } 42 | 43 | return { 44 | from: CodeMirror.Pos(start.line, firstLine.length), 45 | to: CodeMirror.Pos(end, cm.getLine(end).length) 46 | }; 47 | }); 48 | 49 | }); 50 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/Kcs.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class KcsPower final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_KCS_POWER, 24 | .title = "KCS Power", 25 | .memory = 128, 26 | .buttons = 1, 27 | .button1 = "Freeze", 28 | }; 29 | 30 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 31 | 32 | public: 33 | 34 | using Cartridge::Cartridge; 35 | 36 | private: 37 | 38 | void _didReset(bool hard) override; 39 | 40 | 41 | // 42 | // Accessing cartridge memory 43 | // 44 | 45 | public: 46 | 47 | u8 peekIO1(u16 addr) override; 48 | u8 spypeekIO1(u16 addr) const override; 49 | u8 peekIO2(u16 addr) override; 50 | u8 spypeekIO2(u16 addr) const override; 51 | void pokeIO1(u16 addr, u8 value) override; 52 | void pokeIO2(u16 addr, u8 value) override; 53 | 54 | 55 | // 56 | // Operating buttons 57 | // 58 | 59 | isize numButtons() const override { return 1; } 60 | const char *getButtonTitle(isize nr) const override; 61 | void pressButton(isize nr) override; 62 | void releaseButton(isize nr) override; 63 | }; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Emulator/Utilities/BasicTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include 16 | #include 17 | 18 | // 19 | // Integers 20 | // 21 | 22 | // Signed integers 23 | typedef signed char i8; 24 | typedef signed short i16; 25 | typedef signed int i32; 26 | typedef signed long long i64; 27 | typedef signed long isize; 28 | 29 | // Unsigned integers 30 | typedef unsigned char u8; 31 | typedef unsigned short u16; 32 | typedef unsigned int u32; 33 | typedef unsigned long long u64; 34 | typedef unsigned long usize; 35 | 36 | 37 | // 38 | // Strings 39 | // 40 | 41 | #include 42 | #include 43 | using std::string; 44 | 45 | 46 | // 47 | // Optionals 48 | // 49 | 50 | #include 51 | using std::optional; 52 | 53 | 54 | // 55 | // Enums 56 | // 57 | 58 | #if defined(__SWIFT__) 59 | 60 | #define new_enum_generic(_name, _type) \ 61 | enum __attribute__((enum_extensibility(open))) _name : _type 62 | #define enum_long(_name) new_enum_generic(_name, long) 63 | #define enum_i8(_name) new_enum_generic(_name, i8) 64 | 65 | #else 66 | 67 | #define new_enum_generic(_name, _type) \ 68 | enum _name : _type 69 | #define enum_long(_name) new_enum_generic(_name, long) 70 | #define enum_i8(_name) new_enum_generic(_name, i8) 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/PowerPortBase.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "PowerPort.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | PowerPort::_dump(Category category, std::ostream& os) const 20 | { 21 | using namespace util; 22 | 23 | if (category == Category::Config) { 24 | 25 | dumpConfig(os); 26 | } 27 | } 28 | 29 | i64 30 | PowerPort::getOption(Option option) const 31 | { 32 | switch (option) { 33 | 34 | case OPT_POWER_GRID: return config.powerGrid; 35 | 36 | default: 37 | fatalError; 38 | } 39 | } 40 | 41 | void 42 | PowerPort::checkOption(Option opt, i64 value) 43 | { 44 | switch (opt) { 45 | 46 | case OPT_POWER_GRID: 47 | 48 | if (!PowerGridEnum::isValid(value)) { 49 | throw Error(VC64ERROR_OPT_INV_ARG, PowerGridEnum::keyList()); 50 | } 51 | return; 52 | 53 | default: 54 | throw Error(VC64ERROR_OPT_UNSUPPORTED); 55 | } 56 | } 57 | 58 | void 59 | PowerPort::setOption(Option opt, i64 value) 60 | { 61 | checkOption(opt, value); 62 | 63 | switch (opt) { 64 | 65 | case OPT_POWER_GRID: 66 | 67 | config.powerGrid = (PowerGrid)value; 68 | return; 69 | 70 | default: 71 | fatalError; 72 | } 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /Emulator/Utilities/Exception.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "BasicTypes.h" 16 | #include 17 | 18 | namespace vc64::util { 19 | 20 | /** @brief Base class for all emulator exceptions 21 | */ 22 | struct Exception : public std::exception { 23 | 24 | //! @brief Error code 25 | i64 data; 26 | 27 | //! @brief Auxiliary information about the thrown errow 28 | string description; 29 | 30 | Exception(i64 d, const string &s) : data(d), description(s) { } 31 | Exception(i64 d) : data(d), description("") { } 32 | Exception(const string &s) : data(0), description(s) { } 33 | Exception() : data(0) { } 34 | 35 | const char *what() const noexcept override { return description.c_str(); } 36 | }; 37 | 38 | // 39 | // Syntactic sugar 40 | // 41 | 42 | /** @brief Marks a function a throwing. 43 | * It is used to mark all methods that use the exception mechanism to signal 44 | * error conditions instead of returning error codes. The keyword is used for 45 | * documentary purposes only as C++ implicitly marks all functions with 46 | * noexcept(false) by default. 47 | * @note It is used in favor of classic throw lists since the latter causes 48 | * the compiler to embed unwanted runtime checks in the code. 49 | */ 50 | #define throws noexcept(false) 51 | 52 | } 53 | -------------------------------------------------------------------------------- /js/cm/addon/hint/anyword-hint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var WORD = /[\w$]+/, RANGE = 500; 15 | 16 | CodeMirror.registerHelper("hint", "anyword", function(editor, options) { 17 | var word = options && options.word || WORD; 18 | var range = options && options.range || RANGE; 19 | var cur = editor.getCursor(), curLine = editor.getLine(cur.line); 20 | var end = cur.ch, start = end; 21 | while (start && word.test(curLine.charAt(start - 1))) --start; 22 | var curWord = start != end && curLine.slice(start, end); 23 | 24 | var list = options && options.list || [], seen = {}; 25 | var re = new RegExp(word.source, "g"); 26 | for (var dir = -1; dir <= 1; dir += 2) { 27 | var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir; 28 | for (; line != endLine; line += dir) { 29 | var text = editor.getLine(line), m; 30 | while (m = re.exec(text)) { 31 | if (line == cur.line && m[0] === curWord) continue; 32 | if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) { 33 | seen[m[0]] = true; 34 | list.push(m[0]); 35 | } 36 | } 37 | } 38 | } 39 | return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)}; 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /Emulator/Media/Folder.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "Folder.h" 15 | #include "C64.h" 16 | 17 | namespace vc64 { 18 | 19 | bool 20 | Folder::isCompatible(const fs::path &path) 21 | { 22 | return util::isDirectory(path); 23 | } 24 | 25 | void 26 | Folder::init(const fs::path &path) 27 | { 28 | if (!isCompatiblePath(path)) throw Error(VC64ERROR_FILE_TYPE_MISMATCH); 29 | 30 | fs = new FileSystem(path); 31 | 32 | // REMOVE ASAP 33 | fs->scanDirectory(); 34 | fs->printDirectory(); 35 | printf("NumFiles: %ld\n", fs->numFiles()); 36 | } 37 | 38 | PETName<16> 39 | Folder::collectionName() 40 | { 41 | return fs->getName(); 42 | } 43 | 44 | isize 45 | Folder::collectionCount() const 46 | { 47 | printf("collectionCount: %ld\n", fs->numFiles()); 48 | return (isize)fs->numFiles(); 49 | } 50 | 51 | PETName<16> 52 | Folder::itemName(isize nr) const 53 | { 54 | return fs->fileName(nr); 55 | } 56 | 57 | isize 58 | Folder::itemSize(isize nr) const 59 | { 60 | return fs->fileSize(nr); 61 | } 62 | 63 | u8 64 | Folder::readByte(isize nr, isize pos) const 65 | { 66 | u8 result; 67 | fs->copyFile(nr, &result, 1, pos); 68 | return result; 69 | } 70 | 71 | void 72 | Folder::copyItem(isize nr, u8 *buf, isize len, isize offset) const 73 | { 74 | fs->copyFile(nr, buf, len, offset); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /js/cm/addon/fold/indent-fold.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | function lineIndent(cm, lineNo) { 15 | var text = cm.getLine(lineNo) 16 | var spaceTo = text.search(/\S/) 17 | if (spaceTo == -1 || /\bcomment\b/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, spaceTo + 1)))) 18 | return -1 19 | return CodeMirror.countColumn(text, null, cm.getOption("tabSize")) 20 | } 21 | 22 | CodeMirror.registerHelper("fold", "indent", function(cm, start) { 23 | var myIndent = lineIndent(cm, start.line) 24 | if (myIndent < 0) return 25 | var lastLineInFold = null 26 | 27 | // Go through lines until we find a line that definitely doesn't belong in 28 | // the block we're folding, or to the end. 29 | for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) { 30 | var indent = lineIndent(cm, i) 31 | if (indent == -1) { 32 | } else if (indent > myIndent) { 33 | // Lines with a greater indent are considered part of the block. 34 | lastLineInFold = i; 35 | } else { 36 | // If this line has non-space, non-comment content, and is 37 | // indented less or equal to the start line, it is the start of 38 | // another block. 39 | break; 40 | } 41 | } 42 | if (lastLineInFold) return { 43 | from: CodeMirror.Pos(start.line, cm.getLine(start.line).length), 44 | to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length) 45 | }; 46 | }); 47 | 48 | }); 49 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/PowerPort.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "PowerPort.h" 15 | #include "Emulator.h" 16 | 17 | namespace vc64 { 18 | 19 | PowerPort::PowerPort(C64& ref) : SubComponent(ref) 20 | { 21 | 22 | } 23 | 24 | Cycle 25 | PowerPort::todTickDelay(u8 cra) 26 | { 27 | Cycle delay, jitter; 28 | i64 frequency = vic.pal() ? PAL::CLOCK_FREQUENCY : NTSC::CLOCK_FREQUENCY; 29 | 30 | switch (config.powerGrid) { 31 | 32 | case GRID_STABLE_50HZ: 33 | 34 | delay = (cra & 0x80) ? frequency / 10 : frequency * 6/50; 35 | jitter = 0; 36 | break; 37 | 38 | case GRID_UNSTABLE_50HZ: 39 | 40 | delay = (cra & 0x80) ? frequency / 10 : frequency * 6/50; 41 | jitter = (c64.random() % 1000) - 500; 42 | break; 43 | 44 | case GRID_STABLE_60HZ: 45 | 46 | delay = (cra & 0x80) ? frequency * 5/60 : frequency / 10; 47 | jitter = 0; 48 | break; 49 | 50 | case GRID_UNSTABLE_60HZ: 51 | 52 | delay = (cra & 0x80) ? frequency * 5/60 : frequency / 10; 53 | jitter = (c64.random() % 1000) - 500; 54 | break; 55 | 56 | default: 57 | fatalError; 58 | } 59 | 60 | return delay + jitter; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /js/cm/mode/javascript/typescript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: TypeScript mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 25 | 26 |
27 |

TypeScript mode

28 | 29 | 30 |
52 | 53 | 60 | 61 |

This is a specialization of the JavaScript mode.

62 |
63 | -------------------------------------------------------------------------------- /Emulator/Components/Ports/VideoPort.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "VideoPort.h" 15 | #include "VICII.h" 16 | 17 | namespace vc64 { 18 | 19 | VideoPort::VideoPort(C64 &ref) : SubComponent(ref) 20 | { 21 | 22 | }; 23 | 24 | u32 * 25 | VideoPort::getTexture() const 26 | { 27 | if (isPoweredOff()) { 28 | return config.whiteNoise ? getNoiseTexture() : getBlankTexture(); 29 | } else { 30 | return vic.getTexture(); 31 | } 32 | } 33 | 34 | u32 * 35 | VideoPort::getDmaTexture() const 36 | { 37 | return vic.getDmaTexture(); 38 | } 39 | 40 | u32 * 41 | VideoPort::getNoiseTexture() const 42 | { 43 | static u32 *noise = nullptr; 44 | constexpr isize noiseSize = 16 * 512 * 512; 45 | 46 | if (!noise) { 47 | 48 | noise = new u32[noiseSize]; 49 | 50 | for (isize i = 0; i < noiseSize; i++) { 51 | noise[i] = rand() % 2 ? 0xFF000000 : 0xFFFFFFFF; 52 | } 53 | } 54 | 55 | int offset = rand() % (512 * 512); 56 | return noise + offset; 57 | } 58 | 59 | u32 * 60 | VideoPort::getBlankTexture() const 61 | { 62 | static u32 *blank = nullptr; 63 | 64 | if (!blank) { 65 | 66 | blank = new u32[Texture::height * Texture::width]; 67 | 68 | for (isize i = 0; i < Texture::height * Texture::width; i++) { 69 | blank[i] = 0xFF000000; 70 | } 71 | } 72 | 73 | return blank; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /Emulator/Media/AnyCollection.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "AnyFile.h" 16 | 17 | namespace vc64 { 18 | 19 | class AnyCollection : public AnyFile { 20 | 21 | public: 22 | 23 | AnyCollection() : AnyFile() { } 24 | AnyCollection(isize capacity) : AnyFile() { init(capacity); } 25 | virtual ~AnyCollection() = default; 26 | 27 | // Returns the name of this collection 28 | virtual PETName<16> collectionName() = 0; 29 | 30 | // Returns the number of items stored in this collection 31 | virtual isize collectionCount() const = 0; 32 | 33 | // Returns the name of a certain item 34 | virtual PETName<16> itemName(isize nr) const = 0; 35 | 36 | // Returns the size of a certain in bytes 37 | virtual isize itemSize(isize nr) const = 0; 38 | 39 | // Reads a byte from a certain item 40 | virtual u8 readByte(isize nr, isize pos) const = 0; 41 | 42 | 43 | // 44 | // Derived functions 45 | // 46 | 47 | // Reads a word from a certain item in little endian or big endian format 48 | u16 readWordBE(isize nr, isize pos) const; 49 | u16 readWordLE(isize nr, isize pos) const; 50 | 51 | // Return the load address of this item 52 | u16 itemLoadAddr(isize nr) const; 53 | 54 | // Copies an item into a buffer 55 | virtual void copyItem(isize nr, u8 *buf, isize len, isize offset = 0) const; 56 | }; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /Emulator/Base/SubComponent.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "SubComponent.h" 15 | #include "Emulator.h" 16 | 17 | namespace vc64 { 18 | 19 | References::References(C64& ref) : 20 | 21 | audioPort(ref.audioPort), 22 | c64(ref), 23 | cia1(ref.cia1), 24 | cia2(ref.cia2), 25 | port1(ref.port1), 26 | port2(ref.port2), 27 | cpu(ref.cpu), 28 | datasette(ref.datasette), 29 | drive8(ref.drive8), 30 | drive9(ref.drive9), 31 | expansionPort(ref.expansionport), 32 | userPort(ref.userPort), 33 | host(ref.host), 34 | serialPort(ref.iec), 35 | keyboard(ref.keyboard), 36 | mem(ref.mem), 37 | monitor(ref.monitor), 38 | msgQueue(ref.msgQueue), 39 | parCable(ref.parCable), 40 | powerSupply(ref.supply), 41 | recorder(ref.recorder), 42 | regressionTester(ref.regressionTester), 43 | remoteManager(ref.remoteManager), 44 | retroShell(ref.retroShell), 45 | sidBridge(ref.sidBridge), 46 | sid0(ref.sidBridge.sid[0]), 47 | sid1(ref.sidBridge.sid[1]), 48 | sid2(ref.sidBridge.sid[2]), 49 | sid3(ref.sidBridge.sid[3]), 50 | vic(ref.vic), 51 | videoPort(ref.videoPort) 52 | { 53 | 54 | }; 55 | 56 | SubComponent::SubComponent(C64& ref) : CoreComponent(ref.emulator), References(ref) { }; 57 | SubComponent::SubComponent(C64& ref, isize id) : CoreComponent(ref.emulator, id), References(ref) { }; 58 | 59 | void 60 | SubComponent::prefix(isize level, const char *component, isize line) const 61 | { 62 | c64.prefix(level, component, line); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /Emulator/Misc/Recorder/NamedPipe.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "NamedPipe.h" 15 | #include "IOUtils.h" 16 | #ifndef _WIN32 17 | #include 18 | #endif 19 | 20 | namespace vc64 { 21 | 22 | bool 23 | NamedPipe::create(const string &name) 24 | { 25 | this->name = name; 26 | 27 | #ifdef _WIN32 28 | 29 | return false; 30 | 31 | #else 32 | 33 | ::unlink(name.c_str()); 34 | return ::mkfifo(name.c_str(), 0666) != -1; 35 | 36 | #endif 37 | } 38 | 39 | bool 40 | NamedPipe::open() 41 | { 42 | #ifdef _WIN32 43 | 44 | return false; 45 | 46 | #else 47 | 48 | pipe = ::open(name.c_str(), O_WRONLY); 49 | return pipe != -1; 50 | 51 | #endif 52 | } 53 | 54 | bool 55 | NamedPipe::isOpen() 56 | { 57 | #ifdef _WIN32 58 | 59 | return false; 60 | 61 | #else 62 | 63 | return pipe != -1; 64 | 65 | #endif 66 | } 67 | 68 | bool 69 | NamedPipe::close() 70 | { 71 | #ifdef _WIN32 72 | 73 | return false; 74 | 75 | #else 76 | 77 | auto result = ::close(pipe); 78 | pipe = -1; 79 | return result == 0; 80 | 81 | #endif 82 | } 83 | 84 | isize 85 | NamedPipe::write(u8 *buffer, isize length) 86 | { 87 | #ifdef _WIN32 88 | 89 | return 0; 90 | 91 | #else 92 | 93 | assert(isOpen()); 94 | return ::write(pipe, (void *)buffer, (size_t)length); 95 | 96 | #endif 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /Emulator/Base/MsgQueue.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "MsgQueueTypes.h" 16 | #include "CoreObject.h" 17 | #include "Synchronizable.h" 18 | #include "RingBuffer.h" 19 | 20 | namespace vc64 { 21 | 22 | class MsgQueue final : CoreObject, Synchronizable { 23 | 24 | // Ring buffer storing all pending messages 25 | util::RingBuffer queue; 26 | 27 | // The registered listener 28 | const void *listener = nullptr; 29 | 30 | // The registered callback function 31 | Callback *callback = nullptr; 32 | 33 | // If disabled, no messages will be stored 34 | bool enabled = true; 35 | 36 | 37 | // 38 | // Methods 39 | // 40 | 41 | private: 42 | 43 | const char *objectName() const override { return "MsgQueue"; } 44 | 45 | 46 | // 47 | // Managing the queue 48 | // 49 | 50 | public: 51 | 52 | // Registers a listener together with it's callback function 53 | void setListener(const void *listener, Callback *func); 54 | 55 | // Disables the message queue 56 | void disable() { enabled = false; } 57 | 58 | // Sends a message 59 | void put(const Message &msg); 60 | void put(MsgType type, i64 payload = 0); 61 | void put(MsgType type, CpuMsg payload); 62 | void put(MsgType type, DriveMsg payload); 63 | void put(MsgType type, ScriptMsg payload); 64 | 65 | // Reads a message 66 | bool get(Message &msg); 67 | }; 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/SuperGames.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "Cartridge.h" 16 | 17 | namespace vc64 { 18 | 19 | class SuperGames final : public Cartridge { 20 | 21 | CartridgeTraits traits = { 22 | 23 | .type = CRT_SUPER_GAMES, 24 | .title = "Super Games", 25 | }; 26 | 27 | virtual const CartridgeTraits &getCartridgeTraits() const override { return traits; } 28 | 29 | // Write protection latch 30 | bool protect = false; 31 | 32 | public: 33 | 34 | SuperGames(C64 &ref) : Cartridge(ref) { }; 35 | 36 | 37 | // 38 | // Methods from CoreObject 39 | // 40 | 41 | private: 42 | 43 | void _dump(Category category, std::ostream& os) const override; 44 | 45 | 46 | // 47 | // Methods from CoreComponent 48 | // 49 | 50 | public: 51 | 52 | SuperGames& operator= (const SuperGames& other) { 53 | 54 | Cartridge::operator=(other); 55 | 56 | CLONE(protect) 57 | 58 | return *this; 59 | } 60 | virtual void clone(const Cartridge &other) override { *this = (const SuperGames &)other; } 61 | 62 | template 63 | void serialize(T& worker) 64 | { 65 | worker 66 | 67 | << protect; 68 | 69 | } CARTRIDGE_SERIALIZERS(serialize) 70 | 71 | 72 | // 73 | // Accessing cartridge memory 74 | // 75 | 76 | public: 77 | 78 | void pokeIO2(u16 addr, u8 value) override; 79 | }; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/MagicDesk.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | MagicDesk::resetCartConfig() 20 | { 21 | trace(CRT_DEBUG, "Starting cartridge in 8K game mode\n"); 22 | expansionPort.setCartridgeMode(CRTMODE_8K); 23 | } 24 | 25 | u8 26 | MagicDesk::peekIO1(u16 addr) 27 | { 28 | return spypeekIO1(addr); 29 | } 30 | 31 | u8 32 | MagicDesk::spypeekIO1(u16 addr) const 33 | { 34 | return disabled() ? vic.getDataBusPhi1() : control; 35 | } 36 | 37 | void 38 | MagicDesk::pokeIO1(u16 addr, u8 value) 39 | { 40 | control = value & 0x8F; 41 | 42 | // printf("%x control = %x\n", addr, control); 43 | 44 | /* This cartridge type is very similar to the OCEAN cart type: ROM memory 45 | * is organized in 8Kb ($2000) banks located at $8000-$9FFF. Bank 46 | * switching is done by writing the bank number to $DE00. Deviant from the 47 | * Ocean type, bit 8 is cleared for selecting one of the ROM banks. If bit 48 | * 8 is set ($DE00 = $80), the GAME/EXROM lines are disabled, turning on 49 | * RAM at $8000-$9FFF instead of ROM. 50 | */ 51 | 52 | expansionPort.setExromLine(disabled()); 53 | bankIn(value & 0x0F); 54 | } 55 | 56 | u8 57 | MagicDesk::peekIO2(u16 addr) 58 | { 59 | return spypeekIO2(addr); 60 | } 61 | 62 | u8 63 | MagicDesk::spypeekIO2(u16 addr) const 64 | { 65 | return vic.getDataBusPhi1(); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Paddle/PaddleTypes.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | /// @file 13 | 14 | #pragma once 15 | 16 | #include "Reflection.h" 17 | 18 | namespace vc64 { 19 | 20 | // 21 | // Enumerations 22 | // 23 | 24 | /// Value mapping scheme 25 | enum_long(PADDLE_ORIENTATION) 26 | { 27 | PADDLE_HORIZONTAL, ///< Horizontal 28 | PADDLE_HORIZONTAL_FLIPPED, ///< Horizontal, reverse direction 29 | PADDLE_VERTICAL, ///< Vertical 30 | PADDLE_VERTICAL_FLIPPED ///< Vertical, reverse direction 31 | }; 32 | typedef PADDLE_ORIENTATION PaddleOrientation; 33 | 34 | struct PaddleOrientationEnum : util::Reflection { 35 | 36 | static constexpr long minVal = 0; 37 | static constexpr long maxVal = PADDLE_VERTICAL_FLIPPED; 38 | 39 | static const char *prefix() { return nullptr; } 40 | static const char *_key(long value) 41 | { 42 | switch (value) { 43 | 44 | case PADDLE_HORIZONTAL: return "HORIZONTAL"; 45 | case PADDLE_HORIZONTAL_FLIPPED: return "HORIZONTAL_FLIPPED"; 46 | case PADDLE_VERTICAL: return "VERTICAL"; 47 | case PADDLE_VERTICAL_FLIPPED: return "VERTICAL_FLIPPED"; 48 | } 49 | return "???"; 50 | } 51 | }; 52 | 53 | // 54 | // Structures 55 | // 56 | 57 | typedef struct 58 | { 59 | PaddleOrientation orientation; 60 | } 61 | PaddleConfig; 62 | 63 | typedef struct 64 | { 65 | 66 | } 67 | PaddleInfo; 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Emulator/Media/Cartridges/CustomCartridges/FreezeFrame.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "C64.h" 15 | 16 | namespace vc64 { 17 | 18 | void 19 | FreezeFrame::_didReset(bool hard) 20 | { 21 | // In Ultimax mode, the same ROM chip that appears in ROML also appears 22 | // in ROMH. By default, it it appears in ROML only, so let's bank it in 23 | // ROMH manually. 24 | bankInROMH(0, 0x2000, 0); 25 | } 26 | 27 | u8 28 | FreezeFrame::peekIO1(u16 addr) 29 | { 30 | // Reading from IO1 switched to 8K game mode 31 | expansionPort.setCartridgeMode(CRTMODE_8K); 32 | return 0; 33 | } 34 | 35 | u8 36 | FreezeFrame::spypeekIO1(u16 addr) const 37 | { 38 | return 0; 39 | } 40 | 41 | u8 42 | FreezeFrame::peekIO2(u16 addr) 43 | { 44 | // Reading from IO2 disables the cartridge 45 | expansionPort.setCartridgeMode(CRTMODE_OFF); 46 | return 0; 47 | } 48 | 49 | u8 50 | FreezeFrame::spypeekIO2(u16 addr) const 51 | { 52 | return 0; 53 | } 54 | 55 | const char * 56 | FreezeFrame::getButtonTitle(isize nr) const 57 | { 58 | return nr == 1 ? "Freeze" : ""; 59 | } 60 | 61 | void 62 | FreezeFrame::pressButton(isize nr) 63 | { 64 | if (nr == 1) { 65 | 66 | expansionPort.setCartridgeMode(CRTMODE_ULTIMAX); 67 | cpu.pullDownNmiLine(INTSRC_EXP); 68 | } 69 | } 70 | 71 | void 72 | FreezeFrame::releaseButton(isize nr) 73 | { 74 | if (nr == 1) { 75 | 76 | cpu.releaseNmiLine(INTSRC_EXP); 77 | } 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /Emulator/Peripherals/Drive/DriveMemoryBase.cpp: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #include "config.h" 14 | #include "DriveMemory.h" 15 | #include "IOUtils.h" 16 | 17 | namespace vc64 { 18 | 19 | void 20 | DriveMemory::_didReset(bool hard) 21 | { 22 | // Initialize RAM with the power-up pattern (pattern from Hoxs64) 23 | for (isize i = 0; i < isizeof(ram); i++) { 24 | ram[i] = (i & 64) ? 0xFF : 0x00; 25 | } 26 | } 27 | 28 | void 29 | DriveMemory::operator << (SerCounter &worker) 30 | { 31 | serialize(worker); 32 | } 33 | 34 | void 35 | DriveMemory::operator << (SerReader &worker) 36 | { 37 | serialize(worker); 38 | } 39 | 40 | void 41 | DriveMemory::operator << (SerWriter &worker) 42 | { 43 | serialize(worker); 44 | } 45 | 46 | void 47 | DriveMemory::_dump(Category category, std::ostream& os) const 48 | { 49 | using namespace util; 50 | 51 | if (category == Category::BankMap) { 52 | 53 | DrvMemType oldsrc = usage[0]; 54 | isize oldi = 0; 55 | 56 | for (isize i = 0; i <= 64; i++) { 57 | DrvMemType newsrc = i < 64 ? usage[i] : (DrvMemType)-1; 58 | if (oldsrc != newsrc) { 59 | os << " "; 60 | os << util::hex((u16)(oldi << 10)) << " - "; 61 | os << util::hex((u16)((i << 10) - 1)) << " : "; 62 | os << DrvMemTypeEnum::key(oldsrc) << std::endl; 63 | oldsrc = newsrc; oldi = i; 64 | } 65 | } 66 | } 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /Emulator/Base/Configurable.h: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // This file is part of VirtualC64 3 | // 4 | // Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de 5 | // This FILE is dual-licensed. You are free to choose between: 6 | // 7 | // - The GNU General Public License v3 (or any later version) 8 | // - The Mozilla Public License v2 9 | // 10 | // SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0 11 | // ----------------------------------------------------------------------------- 12 | 13 | #pragma once 14 | 15 | #include "OptionTypes.h" 16 | #include "Reflection.h" 17 | #include "Defaults.h" 18 | #include 19 | 20 | namespace vc64 { 21 | 22 | typedef std::vector