├── .github └── workflows │ └── build.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── assemble.sh ├── assembler.py ├── docs ├── ARCHITECTURE.md ├── ASSEMBLER.md ├── ATTRIBUTIONS.md ├── BOOTLOADER.md ├── COMPILER.md ├── EMULATOR.md ├── FPGA.md ├── HARDWARE.md ├── LIBRARIES.md ├── PLUGIN.md ├── PROGRAMMING.md ├── README.md ├── SIMULATION.md └── media │ ├── debugger.png │ ├── ide.png │ ├── simulation.png │ ├── snake_game.png │ └── snake_title.png ├── emulator ├── CMakeLists.txt ├── Disassembler.cpp ├── Disassembler.h ├── Emscripten │ ├── Makefile │ └── shell_minimal.html ├── Emulator.cpp ├── Emulator.h ├── ImGuiFileDialog.cpp ├── ImGuiFileDialog.h ├── StringFormat.h ├── Windows │ ├── GLEW │ │ ├── LICENSE.txt │ │ ├── Makefile.txt │ │ ├── bin │ │ │ └── Release │ │ │ │ ├── Win32 │ │ │ │ ├── glew32.dll │ │ │ │ ├── glewinfo.exe │ │ │ │ └── visualinfo.exe │ │ │ │ └── x64 │ │ │ │ ├── glew32.dll │ │ │ │ ├── glewinfo.exe │ │ │ │ └── visualinfo.exe │ │ ├── doc │ │ │ ├── advanced.html │ │ │ ├── basic.html │ │ │ ├── build.html │ │ │ ├── credits.html │ │ │ ├── github.png │ │ │ ├── glew.css │ │ │ ├── glew.html │ │ │ ├── glew.png │ │ │ ├── glew.txt │ │ │ ├── glxew.html │ │ │ ├── gpl.txt │ │ │ ├── index.html │ │ │ ├── install.html │ │ │ ├── khronos.txt │ │ │ ├── log.html │ │ │ ├── mesa.txt │ │ │ ├── new.png │ │ │ ├── ogl_sm.jpg │ │ │ ├── travis.png │ │ │ └── wglew.html │ │ ├── include │ │ │ └── GL │ │ │ │ ├── eglew.h │ │ │ │ ├── glew.h │ │ │ │ ├── glxew.h │ │ │ │ └── wglew.h │ │ └── lib │ │ │ └── Release │ │ │ ├── Win32 │ │ │ ├── glew32.lib │ │ │ └── glew32s.lib │ │ │ └── x64 │ │ │ ├── glew32.lib │ │ │ └── glew32s.lib │ ├── SDL2 │ │ ├── BUGS.txt │ │ ├── COPYING.txt │ │ ├── CREDITS.txt │ │ ├── INSTALL.txt │ │ ├── Makefile │ │ ├── README-SDL.txt │ │ ├── README.txt │ │ ├── WhatsNew.txt │ │ ├── docs │ │ │ ├── README-android.md │ │ │ ├── README-cmake.md │ │ │ ├── README-directfb.md │ │ │ ├── README-dynapi.md │ │ │ ├── README-emscripten.md │ │ │ ├── README-gesture.md │ │ │ ├── README-hg.md │ │ │ ├── README-ios.md │ │ │ ├── README-linux.md │ │ │ ├── README-macosx.md │ │ │ ├── README-nacl.md │ │ │ ├── README-os2.md │ │ │ ├── README-pandora.md │ │ │ ├── README-platforms.md │ │ │ ├── README-porting.md │ │ │ ├── README-psp.md │ │ │ ├── README-raspberrypi.md │ │ │ ├── README-touch.md │ │ │ ├── README-wince.md │ │ │ ├── README-windows.md │ │ │ ├── README-winrt.md │ │ │ ├── README.md │ │ │ └── doxyfile │ │ ├── i686-w64-mingw32 │ │ │ ├── bin │ │ │ │ ├── SDL2.dll │ │ │ │ └── sdl2-config │ │ │ ├── include │ │ │ │ └── SDL2 │ │ │ │ │ ├── SDL.h │ │ │ │ │ ├── SDL_assert.h │ │ │ │ │ ├── SDL_atomic.h │ │ │ │ │ ├── SDL_audio.h │ │ │ │ │ ├── SDL_bits.h │ │ │ │ │ ├── SDL_blendmode.h │ │ │ │ │ ├── SDL_clipboard.h │ │ │ │ │ ├── SDL_config.h │ │ │ │ │ ├── SDL_cpuinfo.h │ │ │ │ │ ├── SDL_egl.h │ │ │ │ │ ├── SDL_endian.h │ │ │ │ │ ├── SDL_error.h │ │ │ │ │ ├── SDL_events.h │ │ │ │ │ ├── SDL_filesystem.h │ │ │ │ │ ├── SDL_gamecontroller.h │ │ │ │ │ ├── SDL_gesture.h │ │ │ │ │ ├── SDL_haptic.h │ │ │ │ │ ├── SDL_hints.h │ │ │ │ │ ├── SDL_joystick.h │ │ │ │ │ ├── SDL_keyboard.h │ │ │ │ │ ├── SDL_keycode.h │ │ │ │ │ ├── SDL_loadso.h │ │ │ │ │ ├── SDL_locale.h │ │ │ │ │ ├── SDL_log.h │ │ │ │ │ ├── SDL_main.h │ │ │ │ │ ├── SDL_messagebox.h │ │ │ │ │ ├── SDL_metal.h │ │ │ │ │ ├── SDL_misc.h │ │ │ │ │ ├── SDL_mouse.h │ │ │ │ │ ├── SDL_mutex.h │ │ │ │ │ ├── SDL_name.h │ │ │ │ │ ├── SDL_opengl.h │ │ │ │ │ ├── SDL_opengl_glext.h │ │ │ │ │ ├── SDL_opengles.h │ │ │ │ │ ├── SDL_opengles2.h │ │ │ │ │ ├── SDL_opengles2_gl2.h │ │ │ │ │ ├── SDL_opengles2_gl2ext.h │ │ │ │ │ ├── SDL_opengles2_gl2platform.h │ │ │ │ │ ├── SDL_opengles2_khrplatform.h │ │ │ │ │ ├── SDL_pixels.h │ │ │ │ │ ├── SDL_platform.h │ │ │ │ │ ├── SDL_power.h │ │ │ │ │ ├── SDL_quit.h │ │ │ │ │ ├── SDL_rect.h │ │ │ │ │ ├── SDL_render.h │ │ │ │ │ ├── SDL_revision.h │ │ │ │ │ ├── SDL_rwops.h │ │ │ │ │ ├── SDL_scancode.h │ │ │ │ │ ├── SDL_sensor.h │ │ │ │ │ ├── SDL_shape.h │ │ │ │ │ ├── SDL_stdinc.h │ │ │ │ │ ├── SDL_surface.h │ │ │ │ │ ├── SDL_system.h │ │ │ │ │ ├── SDL_syswm.h │ │ │ │ │ ├── SDL_test.h │ │ │ │ │ ├── SDL_test_assert.h │ │ │ │ │ ├── SDL_test_common.h │ │ │ │ │ ├── SDL_test_compare.h │ │ │ │ │ ├── SDL_test_crc32.h │ │ │ │ │ ├── SDL_test_font.h │ │ │ │ │ ├── SDL_test_fuzzer.h │ │ │ │ │ ├── SDL_test_harness.h │ │ │ │ │ ├── SDL_test_images.h │ │ │ │ │ ├── SDL_test_log.h │ │ │ │ │ ├── SDL_test_md5.h │ │ │ │ │ ├── SDL_test_memory.h │ │ │ │ │ ├── SDL_test_random.h │ │ │ │ │ ├── SDL_thread.h │ │ │ │ │ ├── SDL_timer.h │ │ │ │ │ ├── SDL_touch.h │ │ │ │ │ ├── SDL_types.h │ │ │ │ │ ├── SDL_version.h │ │ │ │ │ ├── SDL_video.h │ │ │ │ │ ├── SDL_vulkan.h │ │ │ │ │ ├── begin_code.h │ │ │ │ │ └── close_code.h │ │ │ ├── lib │ │ │ │ ├── cmake │ │ │ │ │ └── SDL2 │ │ │ │ │ │ ├── sdl2-config-version.cmake │ │ │ │ │ │ └── sdl2-config.cmake │ │ │ │ ├── libSDL2.a │ │ │ │ ├── libSDL2.dll.a │ │ │ │ ├── libSDL2.la │ │ │ │ ├── libSDL2_test.a │ │ │ │ ├── libSDL2_test.la │ │ │ │ ├── libSDL2main.a │ │ │ │ ├── libSDL2main.la │ │ │ │ └── pkgconfig │ │ │ │ │ └── sdl2.pc │ │ │ └── share │ │ │ │ └── aclocal │ │ │ │ └── sdl2.m4 │ │ ├── test │ │ │ ├── CMakeLists.txt │ │ │ ├── COPYING │ │ │ ├── Makefile.in │ │ │ ├── Makefile.os2 │ │ │ ├── README │ │ │ ├── acinclude.m4 │ │ │ ├── autogen.sh │ │ │ ├── axis.bmp │ │ │ ├── button.bmp │ │ │ ├── checkkeys.c │ │ │ ├── configure │ │ │ ├── configure.ac │ │ │ ├── controllermap.bmp │ │ │ ├── controllermap.c │ │ │ ├── controllermap_back.bmp │ │ │ ├── emscripten │ │ │ │ └── joystick-pre.js │ │ │ ├── gcc-fat.sh │ │ │ ├── icon.bmp │ │ │ ├── loopwave.c │ │ │ ├── loopwavequeue.c │ │ │ ├── moose.dat │ │ │ ├── nacl │ │ │ │ ├── Makefile │ │ │ │ ├── background.js │ │ │ │ ├── common.js │ │ │ │ ├── index.html │ │ │ │ └── manifest.json │ │ │ ├── picture.xbm │ │ │ ├── relative_mode.markdown │ │ │ ├── sample.bmp │ │ │ ├── sample.wav │ │ │ ├── shapes │ │ │ │ ├── p01_shape24.bmp │ │ │ │ ├── p01_shape32alpha.bmp │ │ │ │ ├── p01_shape8.bmp │ │ │ │ ├── p02_shape24.bmp │ │ │ │ ├── p02_shape32alpha.bmp │ │ │ │ ├── p02_shape8.bmp │ │ │ │ ├── p03_shape24.bmp │ │ │ │ ├── p03_shape8.bmp │ │ │ │ ├── p04_shape1.bmp │ │ │ │ ├── p04_shape24.bmp │ │ │ │ ├── p04_shape32alpha.bmp │ │ │ │ ├── p04_shape8.bmp │ │ │ │ ├── p05_shape8.bmp │ │ │ │ ├── p06_shape1alpha.bmp │ │ │ │ ├── p06_shape24.bmp │ │ │ │ ├── p06_shape32alpha.bmp │ │ │ │ ├── p06_shape8.bmp │ │ │ │ ├── p07_shape24.bmp │ │ │ │ ├── p07_shape32alpha.bmp │ │ │ │ ├── p07_shape8.bmp │ │ │ │ ├── p08_shape24.bmp │ │ │ │ ├── p08_shape32alpha.bmp │ │ │ │ ├── p08_shape8.bmp │ │ │ │ ├── p09_shape24.bmp │ │ │ │ ├── p09_shape32alpha.bmp │ │ │ │ ├── p09_shape8.bmp │ │ │ │ ├── p10_shape1.bmp │ │ │ │ ├── p10_shape24.bmp │ │ │ │ ├── p10_shape32alpha.bmp │ │ │ │ ├── p10_shape8.bmp │ │ │ │ ├── p11_shape24.bmp │ │ │ │ ├── p11_shape32alpha.bmp │ │ │ │ ├── p11_shape8.bmp │ │ │ │ ├── p12_shape24.bmp │ │ │ │ ├── p12_shape8.bmp │ │ │ │ ├── p13_shape24.bmp │ │ │ │ ├── p13_shape32alpha.bmp │ │ │ │ ├── p13_shape8.bmp │ │ │ │ ├── p14_shape24.bmp │ │ │ │ ├── p14_shape8.bmp │ │ │ │ ├── p15_shape24.bmp │ │ │ │ ├── p15_shape32alpha.bmp │ │ │ │ ├── p15_shape8.bmp │ │ │ │ ├── p16_shape1.bmp │ │ │ │ ├── p16_shape24.bmp │ │ │ │ ├── p16_shape8.bmp │ │ │ │ ├── trollface_24.bmp │ │ │ │ └── trollface_32alpha.bmp │ │ │ ├── testatomic.c │ │ │ ├── testaudiocapture.c │ │ │ ├── testaudiohotplug.c │ │ │ ├── testaudioinfo.c │ │ │ ├── testautomation.c │ │ │ ├── testautomation_audio.c │ │ │ ├── testautomation_clipboard.c │ │ │ ├── testautomation_events.c │ │ │ ├── testautomation_hints.c │ │ │ ├── testautomation_keyboard.c │ │ │ ├── testautomation_main.c │ │ │ ├── testautomation_mouse.c │ │ │ ├── testautomation_pixels.c │ │ │ ├── testautomation_platform.c │ │ │ ├── testautomation_rect.c │ │ │ ├── testautomation_render.c │ │ │ ├── testautomation_rwops.c │ │ │ ├── testautomation_sdltest.c │ │ │ ├── testautomation_stdlib.c │ │ │ ├── testautomation_suites.h │ │ │ ├── testautomation_surface.c │ │ │ ├── testautomation_syswm.c │ │ │ ├── testautomation_timer.c │ │ │ ├── testautomation_video.c │ │ │ ├── testbounds.c │ │ │ ├── testcustomcursor.c │ │ │ ├── testdisplayinfo.c │ │ │ ├── testdraw2.c │ │ │ ├── testdrawchessboard.c │ │ │ ├── testdropfile.c │ │ │ ├── testerror.c │ │ │ ├── testevdev.c │ │ │ ├── testfile.c │ │ │ ├── testfilesystem.c │ │ │ ├── testgamecontroller.c │ │ │ ├── testgesture.c │ │ │ ├── testgl2.c │ │ │ ├── testgles.c │ │ │ ├── testgles2.c │ │ │ ├── testhaptic.c │ │ │ ├── testhittesting.c │ │ │ ├── testhotplug.c │ │ │ ├── testiconv.c │ │ │ ├── testime.c │ │ │ ├── testintersections.c │ │ │ ├── testjoystick.c │ │ │ ├── testkeys.c │ │ │ ├── testloadso.c │ │ │ ├── testlocale.c │ │ │ ├── testlock.c │ │ │ ├── testmessage.c │ │ │ ├── testmultiaudio.c │ │ │ ├── testnative.c │ │ │ ├── testnative.h │ │ │ ├── testnativecocoa.m │ │ │ ├── testnativeos2.c │ │ │ ├── testnativew32.c │ │ │ ├── testnativex11.c │ │ │ ├── testoffscreen.c │ │ │ ├── testoverlay2.c │ │ │ ├── testplatform.c │ │ │ ├── testpower.c │ │ │ ├── testqsort.c │ │ │ ├── testrelative.c │ │ │ ├── testrendercopyex.c │ │ │ ├── testrendertarget.c │ │ │ ├── testresample.c │ │ │ ├── testrumble.c │ │ │ ├── testscale.c │ │ │ ├── testsem.c │ │ │ ├── testsensor.c │ │ │ ├── testshader.c │ │ │ ├── testshape.c │ │ │ ├── testsprite2.c │ │ │ ├── testspriteminimal.c │ │ │ ├── teststreaming.c │ │ │ ├── testthread.c │ │ │ ├── testtimer.c │ │ │ ├── testurl.c │ │ │ ├── testver.c │ │ │ ├── testviewport.c │ │ │ ├── testvulkan.c │ │ │ ├── testwm2.c │ │ │ ├── testyuv.bmp │ │ │ ├── testyuv.c │ │ │ ├── testyuv_cvt.c │ │ │ ├── testyuv_cvt.h │ │ │ ├── torturethread.c │ │ │ └── utf8.txt │ │ └── x86_64-w64-mingw32 │ │ │ ├── bin │ │ │ ├── SDL2.dll │ │ │ └── sdl2-config │ │ │ ├── include │ │ │ └── SDL2 │ │ │ │ ├── SDL.h │ │ │ │ ├── SDL_assert.h │ │ │ │ ├── SDL_atomic.h │ │ │ │ ├── SDL_audio.h │ │ │ │ ├── SDL_bits.h │ │ │ │ ├── SDL_blendmode.h │ │ │ │ ├── SDL_clipboard.h │ │ │ │ ├── SDL_config.h │ │ │ │ ├── SDL_cpuinfo.h │ │ │ │ ├── SDL_egl.h │ │ │ │ ├── SDL_endian.h │ │ │ │ ├── SDL_error.h │ │ │ │ ├── SDL_events.h │ │ │ │ ├── SDL_filesystem.h │ │ │ │ ├── SDL_gamecontroller.h │ │ │ │ ├── SDL_gesture.h │ │ │ │ ├── SDL_haptic.h │ │ │ │ ├── SDL_hints.h │ │ │ │ ├── SDL_joystick.h │ │ │ │ ├── SDL_keyboard.h │ │ │ │ ├── SDL_keycode.h │ │ │ │ ├── SDL_loadso.h │ │ │ │ ├── SDL_locale.h │ │ │ │ ├── SDL_log.h │ │ │ │ ├── SDL_main.h │ │ │ │ ├── SDL_messagebox.h │ │ │ │ ├── SDL_metal.h │ │ │ │ ├── SDL_misc.h │ │ │ │ ├── SDL_mouse.h │ │ │ │ ├── SDL_mutex.h │ │ │ │ ├── SDL_name.h │ │ │ │ ├── SDL_opengl.h │ │ │ │ ├── SDL_opengl_glext.h │ │ │ │ ├── SDL_opengles.h │ │ │ │ ├── SDL_opengles2.h │ │ │ │ ├── SDL_opengles2_gl2.h │ │ │ │ ├── SDL_opengles2_gl2ext.h │ │ │ │ ├── SDL_opengles2_gl2platform.h │ │ │ │ ├── SDL_opengles2_khrplatform.h │ │ │ │ ├── SDL_pixels.h │ │ │ │ ├── SDL_platform.h │ │ │ │ ├── SDL_power.h │ │ │ │ ├── SDL_quit.h │ │ │ │ ├── SDL_rect.h │ │ │ │ ├── SDL_render.h │ │ │ │ ├── SDL_revision.h │ │ │ │ ├── SDL_rwops.h │ │ │ │ ├── SDL_scancode.h │ │ │ │ ├── SDL_sensor.h │ │ │ │ ├── SDL_shape.h │ │ │ │ ├── SDL_stdinc.h │ │ │ │ ├── SDL_surface.h │ │ │ │ ├── SDL_system.h │ │ │ │ ├── SDL_syswm.h │ │ │ │ ├── SDL_test.h │ │ │ │ ├── SDL_test_assert.h │ │ │ │ ├── SDL_test_common.h │ │ │ │ ├── SDL_test_compare.h │ │ │ │ ├── SDL_test_crc32.h │ │ │ │ ├── SDL_test_font.h │ │ │ │ ├── SDL_test_fuzzer.h │ │ │ │ ├── SDL_test_harness.h │ │ │ │ ├── SDL_test_images.h │ │ │ │ ├── SDL_test_log.h │ │ │ │ ├── SDL_test_md5.h │ │ │ │ ├── SDL_test_memory.h │ │ │ │ ├── SDL_test_random.h │ │ │ │ ├── SDL_thread.h │ │ │ │ ├── SDL_timer.h │ │ │ │ ├── SDL_touch.h │ │ │ │ ├── SDL_types.h │ │ │ │ ├── SDL_version.h │ │ │ │ ├── SDL_video.h │ │ │ │ ├── SDL_vulkan.h │ │ │ │ ├── begin_code.h │ │ │ │ └── close_code.h │ │ │ ├── lib │ │ │ ├── cmake │ │ │ │ └── SDL2 │ │ │ │ │ ├── sdl2-config-version.cmake │ │ │ │ │ └── sdl2-config.cmake │ │ │ ├── libSDL2.a │ │ │ ├── libSDL2.dll.a │ │ │ ├── libSDL2.la │ │ │ ├── libSDL2_test.a │ │ │ ├── libSDL2_test.la │ │ │ ├── libSDL2main.a │ │ │ ├── libSDL2main.la │ │ │ └── pkgconfig │ │ │ │ └── sdl2.pc │ │ │ └── share │ │ │ └── aclocal │ │ │ └── sdl2.m4 │ └── dirent │ │ ├── ChangeLog │ │ ├── LICENSE │ │ ├── README.md │ │ └── dirent.h ├── cmake │ └── FindSDL2.cmake ├── imgui_memory_editor.h ├── imgui_toggle_button.h └── main.cpp ├── fetch_songs.sh ├── fpga ├── .gitignore ├── adc.qsys ├── adc_driver.vhd ├── alu.vhd ├── computer.vhd ├── cpu.vhd ├── cpu_test.vhd ├── debug.stp ├── fpga.qpf ├── fpga.qsf ├── fpga.sdc ├── fpga.sld ├── gpu.vhd ├── memory.vhd ├── microcode.vhd ├── peripherals.vhd ├── peripherals_test.vhd ├── power_on_reset.vhd ├── pwm_driver.vhd ├── random.vhd ├── seg7.vhd ├── timer.vhd ├── timer_test.vhd ├── uart.qsys ├── uart_controller.vhd └── vga_driver.vhd ├── image_convert.py ├── jetbrains-assembly-plugin ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ └── main │ ├── gen │ └── com │ │ └── thelogicmaster │ │ └── custom_assembly_plugin │ │ ├── AssemblyLexer.java │ │ ├── AssemblyParser.java │ │ └── psi │ │ ├── AssemblyInstruction.java │ │ ├── AssemblyLabelDefinition.java │ │ ├── AssemblyTypes.java │ │ ├── AssemblyVisitor.java │ │ └── impl │ │ ├── AssemblyInstructionImpl.java │ │ └── AssemblyLabelDefinitionImpl.java │ ├── java │ └── com │ │ └── thelogicmaster │ │ └── custom_assembly_plugin │ │ ├── Assembly.bnf │ │ ├── Assembly.flex │ │ ├── AssemblyAnnotator.java │ │ ├── AssemblyBlock.java │ │ ├── AssemblyColorSettingsPage.java │ │ ├── AssemblyCommenter.java │ │ ├── AssemblyCompletionContributor.java │ │ ├── AssemblyConfigurationFactory.java │ │ ├── AssemblyDocumentationProvider.java │ │ ├── AssemblyFileCreateAction.java │ │ ├── AssemblyFileType.java │ │ ├── AssemblyFindUsagesProvider.java │ │ ├── AssemblyFormattingModelBuilder.java │ │ ├── AssemblyIcons.java │ │ ├── AssemblyLanguage.java │ │ ├── AssemblyLexerAdaptor.java │ │ ├── AssemblyNotificationProvider.java │ │ ├── AssemblyParserDefinition.java │ │ ├── AssemblyRefactoringSupportProvider.java │ │ ├── AssemblyReference.java │ │ ├── AssemblyReferenceContributor.java │ │ ├── AssemblyRunConfigurationProducer.java │ │ ├── AssemblyRunLineMarkerContributor.java │ │ ├── AssemblySettingsComponent.java │ │ ├── AssemblySettingsConfigurable.java │ │ ├── AssemblySettingsState.java │ │ ├── AssemblyStructureViewElement.java │ │ ├── AssemblyStructureViewFactory.java │ │ ├── AssemblyStructureViewModel.java │ │ ├── AssemblySyntaxHighlighter.java │ │ ├── AssemblySyntaxHighlighterFactory.java │ │ └── psi │ │ ├── AssemblyDocumentationElement.java │ │ ├── AssemblyElementFactory.java │ │ ├── AssemblyElementType.java │ │ ├── AssemblyFile.java │ │ ├── AssemblyInstructionElement.java │ │ ├── AssemblyLabelElement.java │ │ ├── AssemblyTokenType.java │ │ └── impl │ │ ├── AssemblyInstructionElementImpl.java │ │ ├── AssemblyLabelElementImpl.java │ │ └── AssemblyPsiImplUtil.java │ └── resources │ ├── META-INF │ ├── plugin.xml │ └── pluginIcon.svg │ ├── fileTemplates │ └── Assembly Program.asm.ft │ └── icons │ ├── constant.svg │ ├── label.svg │ ├── logo_16.svg │ └── variable.svg ├── microcode-LE.bin ├── microcode.bin ├── microcode.py ├── programs ├── All Instructions.asm ├── Blink.asm ├── Bootloader.asm ├── Disassembler Test.asm ├── Emulator Bootloader.asm ├── Hello From C.c ├── Hello World.asm ├── IO Panel.asm ├── IO Test.asm ├── Instruction Test.asm ├── LCD Hello.asm ├── LED Dimmer.asm ├── Music.asm ├── OLED Display Demo.asm ├── RC Car.asm ├── Rotary Encoder.asm ├── Serial Parot in C.c ├── Serial Parot.asm ├── Servo Wave.asm ├── Servo.asm ├── Simulator Test.asm ├── Snake in C.c ├── Snake.asm ├── Telnet Display.asm ├── Ultrasonic.asm ├── images │ ├── lm8.bin │ └── lm8.png ├── libraries │ ├── Graphics.asm │ ├── I2C.asm │ ├── LCD.asm │ ├── Math.asm │ ├── Modem.asm │ ├── Nunchuk.asm │ ├── PCA9685.asm │ ├── SD.asm │ ├── SPI.asm │ ├── SSD1306.asm │ ├── Serial.asm │ └── Utilities.asm └── sprites │ ├── apple.bin │ ├── apple.png │ ├── face.bin │ ├── face.png │ ├── snake_body.bin │ ├── snake_body.png │ ├── snake_head.bin │ └── snake_head.png ├── simulation ├── .gitignore ├── DE10-LITE.xml ├── adc.qsys ├── adc_controller.vhd ├── compile.sh ├── compile_and_flash.sh ├── debug.sh ├── debug.stp ├── env.sh ├── flash.sh ├── incremental_flash.sh ├── lm8.dig ├── patch_microcode.sh ├── patch_rom.sh ├── persistent_flash.sh ├── rom.vhd ├── rom_to_mif.py ├── rom_to_vhdl.py ├── simulation.circ ├── synthesize.sh ├── synthesize_and_flash.sh ├── timer.dig ├── uart.qsys └── uart_controller.vhd ├── song_converter.py └── vbcc └── machines └── lm8 ├── machine.c ├── machine.dt └── machine.h /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | emulator/cmake-build-debug/ 3 | 4 | emulator/.idea/ 5 | 6 | .idea/ 7 | 8 | jetbrains-assembly-plugin/.gradle/ 9 | 10 | jetbrains-assembly-plugin/build/ 11 | 12 | emulator/build/ 13 | 14 | programs/songs 15 | programs/build -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "emulator/imgui"] 2 | path = emulator/imgui 3 | url = https://github.com/ocornut/imgui.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Justin Marentette 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /assemble.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Assemble all programs in programs directory 4 | 5 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 6 | 7 | ( 8 | cd "${SCRIPT_DIR}/programs" || exit -1 9 | 10 | for f in ./*.asm 11 | do 12 | echo "Assembling: $f" 13 | python ../assembler.py "$f" 14 | done 15 | ) 16 | -------------------------------------------------------------------------------- /docs/ATTRIBUTIONS.md: -------------------------------------------------------------------------------- 1 | # LM-8 Attributions 2 | ## Project 3 | - [jdh-8](https://github.com/jdah/jdh-8) (The inspiration for this project) 4 | - [Logisim-evolution](https://github.com/logisim-evolution/logisim-evolution) 5 | (Computer simulation and circuit design) 6 | - [Digital](https://github.com/hneemann/Digital) (Simulation software) 7 | - [VBCC](http://www.compilers.de/vbcc.html) (Retargetable C compiler) 8 | - [Jetbrains IDEs](https://www.jetbrains.com/) (IDEs for assembly program development) 9 | - [Quartus Prime](https://www.intel.com/content/www/us/en/software/programmable/quartus-prime/overview.html) 10 | (FPGA development IDE) 11 | - [Git](https://git-scm.com/) (Project version control) 12 | - [Patorjk ascii art generator](https://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=LM-8) 13 | (README logo art) 14 | ## Scripting 15 | - [Bash](https://www.gnu.org/software/bash/) (FPGA patching related scripting) 16 | - [Python](https://www.python.org/downloads/) (Assembler and assembly program related scripting) 17 | - [Perl](https://www.perl.org/) (Patching generated code with regex substitutions) 18 | - [Ubuntu WSL](https://ubuntu.com/wsl) (Windows FPGA patching support) 19 | ## Emulator 20 | - [ImGui](https://github.com/ocornut/imgui) (UI framework) 21 | - [ImGuiFileDialog](https://github.com/aiekick/ImGuiFileDialog) (File dialogs) 22 | - [imgui_memory_editor](https://github.com/ocornut/imgui_club/tree/master/imgui_memory_editor) 23 | (ImGUI memory inspectors for RAM/ROM) 24 | - [C++ 11 string_format](https://stackoverflow.com/a/26221725) (String formatting function for C++ 11) 25 | - [Emscripten](https://emscripten.org/) (Web support) 26 | - [Dirent](https://github.com/tronkko/dirent) (Windows filesystem support) 27 | - [GLEW](http://glew.sourceforge.net/) (OpenGL extension manager) 28 | - [SDL2](https://www.libsdl.org/) (ImGUI backend) 29 | - [CMake](https://cmake.org/) (C++ build system) 30 | ## Assembly Programs 31 | - [arduino-songs](https://github.com/robsoncouto/arduino-songs) (Source of buzzer music) 32 | - [Adafruit](https://github.com/adafruit) (Reference material for library implementation) 33 | -------------------------------------------------------------------------------- /docs/BOOTLOADER.md: -------------------------------------------------------------------------------- 1 | # LM-8 Bootloader 2 | The bootloader is an assembly program that can load other programs from an SD card when flashed to 3 | the dev board. 4 | 5 | ## Usage 6 | 1. Connect an SD card module to GPIO pins 4-7 for `CLK`, `MISO`, `MOSI`, and `CS`, resepectively. 7 | 2. Assemble a program with the `memory` flag to generate a compatible SD card image. 8 | 3. Use a program like [Etcher](https://www.balena.io/etcher/) to flash the SD card with the 9 | resulting image file. 10 | 4. Flash the bootloader program to the dev board. (Flash it persistently with the script for the 11 | best experience) 12 | 5. To update or change the program, simply power off the board and flash a new image to the SD 13 | card. 14 | 15 | ## Behind the Scenes 16 | Normally, an LM-8 program runs directly in ROM and isn't modifiable at runtime except for the RAM 17 | area of the address space. The bootloader connects to an unformatted SD card over SPI and directly 18 | copies the first 16 KB into memory and executes the program in RAM. Since the space that would 19 | normally be reserved for variables is being used to store the program, as well, the RAM address 20 | space is split into two with half of it being allocated to the program and half to its variables. 21 | A flag is available in the Assembler CLI to enable generating a flashable image. To allow labels 22 | to work normally despite the addresses being shifted by 0x8000 bytes, the Assembler will modify 23 | the variable and program label addresses to accommodate this. This means that any addresses that 24 | aren't specified by labels won't be affected and will still point to their original locations. An 25 | SDHC or SDXC SD card is required due to the block addressing format being simpler to use. 26 | -------------------------------------------------------------------------------- /docs/COMPILER.md: -------------------------------------------------------------------------------- 1 | # LM-8 C Compiler 2 | 3 | ## Background 4 | C compiler support is provided by a custom backend written for the VBCC compiler. This is only intended 5 | to be used as a proof-of-concept, as the LM-8 architecture is not well suited for supporting C and the 6 | generated assembly code is huge, easily ten times as much as would be expected due to the challenge of 7 | performing 16-bit operations using only four registers. 8 | 9 | ## Usage 10 | - The [VBCC](http://www.compilers.de/vbcc.html) compiler source are required to be extracted to the `vbcc` 11 | directory. 12 | - Build the compiler from the `vbcc` directory: `make TARGET=lm8 bin/vbcclm8` 13 | - Compile a C program from the `programs` directory: `../vbcc/bin/vbcclm8 .c` 14 | - Assemble the produced assembly file per usual. 15 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | __ __ __ ______ 3 | / | / \ / | / \ 4 | $$ | $$ \ /$$ | /$$$$$$ | 5 | $$ | $$$ \ /$$$ | ______ $$ \__$$ | 6 | $$ | $$$$ /$$$$ |/ |$$ $$< 7 | $$ | $$ $$ $$/$$ |$$$$$$/ $$$$$$ | 8 | $$ |_____ $$ |$$$/ $$ | $$ \__$$ | 9 | $$ |$$ | $/ $$ | $$ $$/ 10 | $$$$$$$$/ $$/ $$/ $$$$$$/ 11 | ``` 12 | 13 | # LM-8 14 | This project is a custom 8-bit computer architecture comprised of an Assembler, an Emulator, a C compiler, 15 | a Jetbrains IDE language support plugin, a Logisim-Evolution simulation, a Digital simulation, and a 16 | VHDL FPGA implementation. 17 | 18 | ![Snake Title Screen](media/snake_title.png) 19 | ![Snake Game](media/snake_game.png) 20 | ![Debugger](media/debugger.png) 21 | ![IDE](media/ide.png) 22 | ![Simulation](media/simulation.png) 23 | 24 | ## Web Demo 25 | [Online Demo](https://thelogicmaster.github.io/lm8/) hosted on GitHub Pages. 26 | 27 | ## Documentation 28 | - [Architecture](ARCHITECTURE.md) 29 | - [Assembler](ASSEMBLER.md) 30 | - [Assembly Programming](PROGRAMMING.md) 31 | - [Emulator](EMULATOR.md) 32 | - [Hardware Interfaces](HARDWARE.md) 33 | - [Simulation](SIMULATION.md) 34 | - [FPGA](FPGA.md) 35 | - [Computer Bootloader](BOOTLOADER.md) 36 | - [Jetbrains Plugin](PLUGIN.md) 37 | - [Assembly Libraries](LIBRARIES.md) 38 | - [C Compiler](COMPILER.md) 39 | 40 | ## Attributions 41 | See [Attributions](ATTRIBUTIONS.md) for the libraries and software used by the project. 42 | -------------------------------------------------------------------------------- /docs/media/debugger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/docs/media/debugger.png -------------------------------------------------------------------------------- /docs/media/ide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/docs/media/ide.png -------------------------------------------------------------------------------- /docs/media/simulation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/docs/media/simulation.png -------------------------------------------------------------------------------- /docs/media/snake_game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/docs/media/snake_game.png -------------------------------------------------------------------------------- /docs/media/snake_title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/docs/media/snake_title.png -------------------------------------------------------------------------------- /emulator/StringFormat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a CC0 1.0 licensed C++11 std::string formatting utility function to get C++20 std::format functionality 3 | */ 4 | 5 | #ifndef EMULATOR_STRINGFORMAT_H 6 | #define EMULATOR_STRINGFORMAT_H 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | template 13 | inline std::string stringFormat(const std::string &format, Args ... args) { 14 | int size_s = std::snprintf(nullptr, 0, format.c_str(), args ...) + 1; // Extra space for '\0' 15 | if (size_s <= 0) 16 | throw std::runtime_error("Error during formatting."); 17 | auto size = static_cast(size_s); 18 | auto buf = std::make_unique(size); 19 | std::snprintf(buf.get(), size, format.c_str(), args ...); 20 | return std::string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside 21 | } 22 | 23 | #endif //EMULATOR_STRINGFORMAT_H 24 | -------------------------------------------------------------------------------- /emulator/Windows/GLEW/bin/Release/Win32/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/bin/Release/Win32/glew32.dll -------------------------------------------------------------------------------- /emulator/Windows/GLEW/bin/Release/Win32/glewinfo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/bin/Release/Win32/glewinfo.exe -------------------------------------------------------------------------------- /emulator/Windows/GLEW/bin/Release/Win32/visualinfo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/bin/Release/Win32/visualinfo.exe -------------------------------------------------------------------------------- /emulator/Windows/GLEW/bin/Release/x64/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/bin/Release/x64/glew32.dll -------------------------------------------------------------------------------- /emulator/Windows/GLEW/bin/Release/x64/glewinfo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/bin/Release/x64/glewinfo.exe -------------------------------------------------------------------------------- /emulator/Windows/GLEW/bin/Release/x64/visualinfo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/bin/Release/x64/visualinfo.exe -------------------------------------------------------------------------------- /emulator/Windows/GLEW/doc/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/doc/github.png -------------------------------------------------------------------------------- /emulator/Windows/GLEW/doc/glew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/doc/glew.png -------------------------------------------------------------------------------- /emulator/Windows/GLEW/doc/glew.txt: -------------------------------------------------------------------------------- 1 | The OpenGL Extension Wrangler Library 2 | Copyright (C) 2008-2016, Nigel Stewart 3 | Copyright (C) 2002-2008, Milan Ikits 4 | Copyright (C) 2002-2008, Marcelo E. Magallon 5 | Copyright (C) 2002, Lev Povalahev 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * The name of the author may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 29 | THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /emulator/Windows/GLEW/doc/khronos.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 The Khronos Group Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and/or associated documentation files (the 5 | "Materials"), to deal in the Materials without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Materials, and to 8 | permit persons to whom the Materials are furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Materials. 13 | 14 | THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 21 | -------------------------------------------------------------------------------- /emulator/Windows/GLEW/doc/mesa.txt: -------------------------------------------------------------------------------- 1 | Mesa 3-D graphics library 2 | Version: 7.0 3 | 4 | Copyright (C) 1999-2007 Brian Paul All Rights Reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a 7 | copy of this software and associated documentation files (the "Software"), 8 | to deal in the Software without restriction, including without limitation 9 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | and/or sell copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 20 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /emulator/Windows/GLEW/doc/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/doc/new.png -------------------------------------------------------------------------------- /emulator/Windows/GLEW/doc/ogl_sm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/doc/ogl_sm.jpg -------------------------------------------------------------------------------- /emulator/Windows/GLEW/doc/travis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/doc/travis.png -------------------------------------------------------------------------------- /emulator/Windows/GLEW/lib/Release/Win32/glew32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/lib/Release/Win32/glew32.lib -------------------------------------------------------------------------------- /emulator/Windows/GLEW/lib/Release/Win32/glew32s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/lib/Release/Win32/glew32s.lib -------------------------------------------------------------------------------- /emulator/Windows/GLEW/lib/Release/x64/glew32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/lib/Release/x64/glew32.lib -------------------------------------------------------------------------------- /emulator/Windows/GLEW/lib/Release/x64/glew32s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/GLEW/lib/Release/x64/glew32s.lib -------------------------------------------------------------------------------- /emulator/Windows/SDL2/BUGS.txt: -------------------------------------------------------------------------------- 1 | 2 | Bugs are now managed in the SDL bug tracker, here: 3 | 4 | https://bugzilla.libsdl.org/ 5 | 6 | You may report bugs there, and search to see if a given issue has already 7 | been reported, discussed, and maybe even fixed. 8 | 9 | 10 | You may also find help at the SDL forums/mailing list: 11 | 12 | https://discourse.libsdl.org/ 13 | 14 | Bug reports are welcome here, but we really appreciate if you use Bugzilla, as 15 | bugs discussed on the mailing list may be forgotten or missed. 16 | 17 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/COPYING.txt: -------------------------------------------------------------------------------- 1 | 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/CREDITS.txt: -------------------------------------------------------------------------------- 1 | 2 | Simple DirectMedia Layer CREDITS 3 | Thanks to everyone who made this possible, including: 4 | 5 | * Cliff Matthews, for giving me a reason to start this project. :) 6 | -- Executor rocks! *grin* 7 | 8 | * Ryan Gordon for helping everybody out and keeping the dream alive. :) 9 | 10 | * Gabriel Jacobo for his work on the Android port and generally helping out all around. 11 | 12 | * Philipp Wiesemann for his attention to detail reviewing the entire SDL code base and proposes patches. 13 | 14 | * Andreas Schiffler for his dedication to unit tests, Visual Studio projects, and managing the Google Summer of Code. 15 | 16 | * Mike Sartain for incorporating SDL into Team Fortress 2 and cheering me on at Valve. 17 | 18 | * Alfred Reynolds for the game controller API and general (in)sanity 19 | 20 | * Jørgen Tjernø for numerous magical Mac OS X fixes. 21 | 22 | * Pierre-Loup Griffais for his deep knowledge of OpenGL drivers. 23 | 24 | * Julian Winter for the SDL 2.0 website. 25 | 26 | * Sheena Smith for many months of great work on the SDL wiki creating the API documentation and style guides. 27 | 28 | * Paul Hunkin for his port of SDL to Android during the Google Summer of Code 2010. 29 | 30 | * Eli Gottlieb for his work on shaped windows during the Google Summer of Code 2010. 31 | 32 | * Jim Grandpre for his work on multi-touch and gesture recognition during 33 | the Google Summer of Code 2010. 34 | 35 | * Edgar "bobbens" Simo for his force feedback API development during the 36 | Google Summer of Code 2008. 37 | 38 | * Aaron Wishnick for his work on audio resampling and pitch shifting during 39 | the Google Summer of Code 2008. 40 | 41 | * Holmes Futrell for his port of SDL to the iPhone and iPod Touch during the 42 | Google Summer of Code 2008. 43 | 44 | * Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation. 45 | 46 | * Everybody at Loki Software, Inc. for their great contributions! 47 | 48 | And a big hand to everyone else who has contributed over the years. 49 | 50 | THANKS! :) 51 | 52 | -- Sam Lantinga 53 | 54 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/INSTALL.txt: -------------------------------------------------------------------------------- 1 | 2 | The 32-bit files are in i686-w64-mingw32 3 | The 64-bit files are in x86_64-w64-mingw32 4 | 5 | To install SDL for native development: 6 | make native 7 | 8 | To install SDL for cross-compiling development: 9 | make cross 10 | 11 | Look at the example programs in ./test, and check out online documentation: 12 | http://wiki.libsdl.org/ 13 | 14 | Join the SDL developer mailing list if you want to join the community: 15 | http://www.libsdl.org/mailing-list.php 16 | 17 | That's it! 18 | Sam Lantinga 19 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for installing the mingw32 version of the SDL library 3 | 4 | CROSS_PATH := /usr/local 5 | ARCHITECTURES := i686-w64-mingw32 x86_64-w64-mingw32 6 | 7 | all install: 8 | @echo "Type \"make native\" to install 32-bit to /usr" 9 | @echo "Type \"make cross\" to install 32-bit and 64-bit to $(CROSS_PATH)" 10 | 11 | native: 12 | make install-package arch=i686-w64-mingw32 prefix=/usr 13 | 14 | cross: 15 | for arch in $(ARCHITECTURES); do \ 16 | make install-package arch=$$arch prefix=$(CROSS_PATH)/$$arch; \ 17 | done 18 | 19 | install-package: 20 | @if test -d $(arch) && test -d $(prefix); then \ 21 | (cd $(arch) && cp -rv bin include lib share $(prefix)/); \ 22 | sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/bin/sdl2-config >$(prefix)/bin/sdl2-config; \ 23 | chmod 755 $(prefix)/bin/sdl2-config; \ 24 | sed "s|^libdir=.*|libdir=\'$(prefix)/lib\'|" <$(arch)/lib/libSDL2.la >$(prefix)/lib/libSDL2.la; \ 25 | sed "s|^libdir=.*|libdir=\'$(prefix)/lib\'|" <$(arch)/lib/libSDL2main.la >$(prefix)/lib/libSDL2main.la; \ 26 | sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/lib/pkgconfig/sdl2.pc >$(prefix)/lib/pkgconfig/sdl2.pc; \ 27 | else \ 28 | echo "*** ERROR: $(arch) or $(prefix) does not exist!"; \ 29 | exit 1; \ 30 | fi 31 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/README-SDL.txt: -------------------------------------------------------------------------------- 1 | 2 | Please distribute this file with the SDL runtime environment: 3 | 4 | The Simple DirectMedia Layer (SDL for short) is a cross-platform library 5 | designed to make it easy to write multi-media software, such as games 6 | and emulators. 7 | 8 | The Simple DirectMedia Layer library source code is available from: 9 | https://www.libsdl.org/ 10 | 11 | This library is distributed under the terms of the zlib license: 12 | http://www.zlib.net/zlib_license.html 13 | 14 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Simple DirectMedia Layer 3 | 4 | (SDL) 5 | 6 | Version 2.0 7 | 8 | --- 9 | https://www.libsdl.org/ 10 | 11 | Simple DirectMedia Layer is a cross-platform development library designed 12 | to provide low level access to audio, keyboard, mouse, joystick, and graphics 13 | hardware via OpenGL and Direct3D. It is used by video playback software, 14 | emulators, and popular games including Valve's award winning catalog 15 | and many Humble Bundle games. 16 | 17 | More extensive documentation is available in the docs directory, starting 18 | with README.md 19 | 20 | Enjoy! 21 | Sam Lantinga (slouken@libsdl.org) 22 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/docs/README-emscripten.md: -------------------------------------------------------------------------------- 1 | Emscripten 2 | ================================================================================ 3 | 4 | Build: 5 | 6 | $ mkdir build 7 | $ cd build 8 | $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2" 9 | $ emmake make 10 | 11 | Or with cmake: 12 | 13 | $ mkdir build 14 | $ cd build 15 | $ emcmake cmake .. 16 | $ emmake make 17 | 18 | To build one of the tests: 19 | 20 | $ cd test/ 21 | $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html 22 | 23 | Uses GLES2 renderer or software 24 | 25 | Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere): 26 | 27 | SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/): 28 | 29 | $ EMCONFIGURE_JS=1 emconfigure ../configure 30 | build as usual... 31 | 32 | SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx): 33 | 34 | $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx 35 | build as usual... 36 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/docs/README-hg.md: -------------------------------------------------------------------------------- 1 | Mercurial 2 | ========= 3 | 4 | The latest development version of SDL is available via Mercurial. 5 | Mercurial allows you to get up-to-the-minute fixes and enhancements; 6 | as a developer works on a source tree, you can use "hg" to mirror that 7 | source tree instead of waiting for an official release. Please look 8 | at the Mercurial website ( https://www.mercurial-scm.org/ ) for more 9 | information on using hg, where you can also download software for 10 | Mac OS X, Windows, and Unix systems. 11 | 12 | hg clone http://hg.libsdl.org/SDL 13 | 14 | If you are building SDL via configure, you will need to run autogen.sh 15 | before running configure. 16 | 17 | There is a web interface to the subversion repository at: 18 | http://hg.libsdl.org/SDL/ 19 | 20 | There is an RSS feed available at that URL, for those that want to 21 | track commits in real time. 22 | 23 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/docs/README-os2.md: -------------------------------------------------------------------------------- 1 | Simple DirectMedia Layer 2 for OS/2 & eComStation 2 | ================================================================================ 3 | SDL port for OS/2, authored by Andrey Vasilkin , 2016 4 | 5 | 6 | OpenGL, joystick and audio capture not supported by this port. 7 | 8 | Additional environment variables (optional) for OS/2 version: 9 | 10 | SDL_AUDIO_SHARE 11 | Values: 0 or 1, default is 0 12 | Initializes the device as shareable or exclusively acquired. 13 | 14 | SDL_VIDEODRIVER 15 | Values: DIVE or VMAN, default is DIVE 16 | Use video subsystem: Direct interface video extensions (DIVE) or 17 | Video Manager (VMAN). 18 | 19 | You may significantly increase video output speed with OS4 kernel and patched 20 | files vman.dll and dive.dll or with latest versions of ACPI support and video 21 | driver Panorama. 22 | 23 | Latest versions of OS/4 kernel: 24 | http://gus.biysk.ru/os4/ 25 | (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4) 26 | 27 | Patched files vman.dll and dive.dll: 28 | http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR 29 | 30 | 31 | Compiling: 32 | ---------- 33 | 34 | Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see: 35 | https://github.com/open-watcom/ and https://open-watcom.github.io 36 | WATCOM ervironment variable must to be set to the Open Watcom install 37 | directory. To compile, run: wmake -f Makefile.os2 38 | 39 | 40 | Installing: 41 | ----------- 42 | 43 | - eComStation: 44 | 45 | If you have previously installed SDL2, make a Backup copy of SDL2.dll 46 | located in D:\ecs\dll (where D: is disk on which installed eComStation). 47 | Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll 48 | 49 | - OS/2: 50 | 51 | Copy SDL2.dll to any directory on your LIBPATH. If you have a previous 52 | version installed, close all SDL2 applications before replacing the old 53 | copy. Also make sure that any other older versions of DLLs are removed 54 | from your system. 55 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/docs/README-pandora.md: -------------------------------------------------------------------------------- 1 | Pandora 2 | ===================================================================== 3 | 4 | ( http://openpandora.org/ ) 5 | - A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES 6 | support to work on the pandora under the framebuffer. This driver do not have 7 | input support for now, so if you use it you will have to add your own control code. 8 | The video driver name is "pandora" so if you have problem running it from 9 | the framebuffer, try to set the following variable before starting your application : 10 | "export SDL_VIDEODRIVER=pandora" 11 | 12 | - OpenGL ES support was added to the x11 driver, so it's working like the normal 13 | x11 driver one with OpenGLX support, with SDL input event's etc.. 14 | 15 | 16 | David Carré (Cpasjuste) 17 | cpasjuste@gmail.com 18 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/docs/README-platforms.md: -------------------------------------------------------------------------------- 1 | Platforms 2 | ========= 3 | 4 | We maintain the list of supported platforms on our wiki now, and how to 5 | build and install SDL for those platforms: 6 | 7 | https://wiki.libsdl.org/Installation 8 | 9 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/docs/README-psp.md: -------------------------------------------------------------------------------- 1 | PSP 2 | ====== 3 | SDL port for the Sony PSP contributed by 4 | Captian Lex 5 | 6 | Credit to 7 | Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP 8 | Geecko for his PSP GU lib "Glib2d" 9 | 10 | Building 11 | -------- 12 | To build for the PSP, make sure psp-config is in the path and run: 13 | make -f Makefile.psp 14 | 15 | 16 | 17 | To Do 18 | ------ 19 | PSP Screen Keyboard 20 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/docs/README-wince.md: -------------------------------------------------------------------------------- 1 | WinCE 2 | ===== 3 | 4 | Windows CE is no longer supported by SDL. 5 | 6 | We have left the CE support in SDL 1.2 for those that must have it, and we 7 | have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3. 8 | 9 | --ryan. 10 | 11 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/bin/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/i686-w64-mingw32/bin/SDL2.dll -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/bin/sdl2-config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=/opt/local/i686-w64-mingw32 4 | exec_prefix=${prefix} 5 | exec_prefix_set=no 6 | libdir=${exec_prefix}/lib 7 | 8 | #usage="\ 9 | #Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]" 10 | usage="\ 11 | Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]" 12 | 13 | if test $# -eq 0; then 14 | echo "${usage}" 1>&2 15 | exit 1 16 | fi 17 | 18 | while test $# -gt 0; do 19 | case "$1" in 20 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 21 | *) optarg= ;; 22 | esac 23 | 24 | case $1 in 25 | --prefix=*) 26 | prefix=$optarg 27 | if test $exec_prefix_set = no ; then 28 | exec_prefix=$optarg 29 | fi 30 | ;; 31 | --prefix) 32 | echo $prefix 33 | ;; 34 | --exec-prefix=*) 35 | exec_prefix=$optarg 36 | exec_prefix_set=yes 37 | ;; 38 | --exec-prefix) 39 | echo $exec_prefix 40 | ;; 41 | --version) 42 | echo 2.0.14 43 | ;; 44 | --cflags) 45 | echo -I${prefix}/include/SDL2 -Dmain=SDL_main 46 | ;; 47 | --libs) 48 | echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows 49 | ;; 50 | --static-libs) 51 | # --libs|--static-libs) 52 | echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc 53 | ;; 54 | *) 55 | echo "${usage}" 1>&2 56 | exit 1 57 | ;; 58 | esac 59 | shift 60 | done 61 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/include/SDL2/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifndef _MSC_VER 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/include/SDL2/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "hg-14525:e52d96ea04fc" 2 | #define SDL_REVISION_NUMBER 14525 3 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(void); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(void); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/include/SDL2/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/include/SDL2/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #ifndef _begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef _begin_code_h 33 | 34 | /* Reset structure packing at previous byte alignment */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #pragma pack(pop) 40 | #endif /* Compiler needs structure packing set */ 41 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "2.0.14") 2 | 3 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 4 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 5 | else() 6 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 7 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 8 | set(PACKAGE_VERSION_EXACT TRUE) 9 | endif() 10 | endif() 11 | 12 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2.a -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2.dll.a -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2.la: -------------------------------------------------------------------------------- 1 | # libSDL2.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='../bin/SDL2.dll' 9 | 10 | # Names of this library. 11 | library_names='libSDL2.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL2.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL2. 26 | current=14 27 | age=14 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/valve/release/SDL/SDL2-2.0.14/i686-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2_test.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2_test.a -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2_test.la: -------------------------------------------------------------------------------- 1 | # libSDL2_test.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='' 9 | 10 | # Names of this library. 11 | library_names='' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL2_test.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs='' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL2_test. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/valve/release/SDL/SDL2-2.0.14/i686-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2main.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2main.a -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/lib/libSDL2main.la: -------------------------------------------------------------------------------- 1 | # libSDL2main.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='' 9 | 10 | # Names of this library. 11 | library_names='' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL2main.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs='' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL2main. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/valve/release/SDL/SDL2-2.0.14/i686-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/i686-w64-mingw32/lib/pkgconfig/sdl2.pc: -------------------------------------------------------------------------------- 1 | # sdl pkg-config source file 2 | 3 | prefix=/opt/local/i686-w64-mingw32 4 | exec_prefix=${prefix} 5 | libdir=${exec_prefix}/lib 6 | includedir=${prefix}/include 7 | 8 | Name: sdl2 9 | Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. 10 | Version: 2.0.14 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows 14 | Libs.private: -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc 15 | Cflags: -I${includedir}/SDL2 -Dmain=SDL_main 16 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/COPYING: -------------------------------------------------------------------------------- 1 | 2 | The test programs in this directory tree are for demonstrating and 3 | testing the functionality of the SDL library, and are placed in the 4 | public domain. 5 | 6 | October 28, 1997 7 | -- 8 | Sam Lantinga (slouken@libsdl.org) 9 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/README: -------------------------------------------------------------------------------- 1 | 2 | These are test programs for the SDL library: 3 | 4 | checkkeys Watch the key events to check the keyboard 5 | loopwave Audio test -- loop playing a WAV file 6 | loopwavequeue Audio test -- loop playing a WAV file with SDL_QueueAudio 7 | testaudioinfo Lists audio device capabilities 8 | testerror Tests multi-threaded error handling 9 | testfile Tests RWops layer 10 | testgl2 A very simple example of using OpenGL with SDL 11 | testiconv Tests international string conversion 12 | testjoystick List joysticks and watch joystick events 13 | testkeys List the available keyboard keys 14 | testloadso Tests the loadable library layer 15 | testlocale Test Locale API 16 | testlock Hacked up test of multi-threading and locking 17 | testmultiaudio Tests using several audio devices 18 | testoverlay2 Tests the overlay flickering/scaling during playback. 19 | testplatform Tests types, endianness and cpu capabilities 20 | testsem Tests SDL's semaphore implementation 21 | testshape Tests shaped windows 22 | testsprite2 Example of fast sprite movement on the screen 23 | testthread Hacked up test of multi-threading 24 | testtimer Test the timer facilities 25 | testver Check the version and dynamic loading and endianness 26 | testwm2 Test window manager -- title, icon, events 27 | torturethread Simple test for thread creation/destruction 28 | controllermap Useful to generate Game Controller API compatible maps 29 | 30 | 31 | 32 | This directory contains sample.wav, which is a sample from Will Provost's 33 | song, The Living Proof: 34 | 35 | From the album The Living Proof 36 | Publisher: 5 Guys Named Will 37 | Copyright 1996 Will Provost 38 | 39 | You can get a copy of the full song (and album!) from iTunes... 40 | 41 | https://itunes.apple.com/us/album/the-living-proof/id4153978 42 | 43 | or Amazon... 44 | 45 | http://www.amazon.com/The-Living-Proof-Will-Provost/dp/B00004R8RH 46 | 47 | Thanks to Will for permitting us to distribute this sample with SDL! 48 | 49 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Regenerate configuration files 4 | cp acinclude.m4 aclocal.m4 5 | found=false 6 | for autoconf in autoconf autoconf259 autoconf-2.59 7 | do if which $autoconf >/dev/null 2>&1; then $autoconf && found=true; break; fi 8 | done 9 | if test x$found = xfalse; then 10 | echo "Couldn't find autoconf, aborting" 11 | exit 1 12 | fi 13 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/axis.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/axis.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/button.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/button.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/controllermap.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/controllermap.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/controllermap_back.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/controllermap_back.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/emscripten/joystick-pre.js: -------------------------------------------------------------------------------- 1 | Module['arguments'] = ['0']; 2 | //Gamepads don't appear until a button is pressed and the joystick/gamepad tests expect one to be connected 3 | Module['preRun'].push(function() 4 | { 5 | Module['print']("Waiting for gamepad..."); 6 | Module['addRunDependency']("gamepad"); 7 | window.addEventListener('gamepadconnected', function() 8 | { 9 | //OK, got one 10 | Module['removeRunDependency']("gamepad"); 11 | }, false); 12 | 13 | //chrome 14 | if(!!navigator.webkitGetGamepads) 15 | { 16 | var timeout = function() 17 | { 18 | if(navigator.webkitGetGamepads()[0] !== undefined) 19 | Module['removeRunDependency']("gamepad"); 20 | else 21 | setTimeout(timeout, 100); 22 | } 23 | setTimeout(timeout, 100); 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/icon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/icon.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/nacl/background.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | function makeURL(toolchain, config) { 6 | return 'index.html?tc=' + toolchain + '&config=' + config; 7 | } 8 | 9 | function createWindow(url) { 10 | console.log('loading ' + url); 11 | chrome.app.window.create(url, { 12 | width: 1024, 13 | height: 800, 14 | frame: 'none' 15 | }); 16 | } 17 | 18 | function onLaunched(launchData) { 19 | // Send and XHR to get the URL to load from a configuration file. 20 | // Normally you won't need to do this; just call: 21 | // 22 | // chrome.app.window.create('', {...}); 23 | // 24 | // In the SDK we want to be able to load different URLs (for different 25 | // toolchain/config combinations) from the commandline, so we to read 26 | // this information from the file "run_package_config". 27 | var xhr = new XMLHttpRequest(); 28 | xhr.open('GET', 'run_package_config', true); 29 | xhr.onload = function() { 30 | var toolchain_config = this.responseText.split(' '); 31 | createWindow(makeURL.apply(null, toolchain_config)); 32 | }; 33 | xhr.onerror = function() { 34 | // Can't find the config file, just load the default. 35 | createWindow('index.html'); 36 | }; 37 | xhr.send(); 38 | } 39 | 40 | chrome.app.runtime.onLaunched.addListener(onLaunched); 41 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/nacl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | SDL NACL Test 12 | 13 | 14 | 15 |

SDL NACL Test

16 |

Status: NO-STATUS

17 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/nacl/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SDL testgles2", 3 | "version": "33.0.1750.117", 4 | "minimum_chrome_version": "33.0.1750.117", 5 | "manifest_version": 2, 6 | "description": "testgles2", 7 | "offline_enabled": true, 8 | "icons": { 9 | "128": "icon128.png" 10 | }, 11 | "app": { 12 | "background": { 13 | "scripts": ["background.js"] 14 | } 15 | }, 16 | "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMN716Qyu0l2EHNFqIJVqVysFcTR6urqhaGGqW4UK7slBaURz9+Sb1b4Ot5P1uQNE5c+CTU5Vu61wpqmSqMMxqHLWdPPMh8uRlyctsb2cxWwG6XoGSvpX29NsQVUFXd4v2tkJm3G9t+V0X8TYskrvWQmnyOW8OEIDvrBhUEfFxWQIDAQAB", 17 | "oauth2": { 18 | "client_id": "903965034255.apps.googleusercontent.com", 19 | "scopes": ["https://www.googleapis.com/auth/drive"] 20 | }, 21 | "permissions": [] 22 | } 23 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/picture.xbm: -------------------------------------------------------------------------------- 1 | #define picture_width 32 2 | #define picture_height 32 3 | static char picture_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x80, 0x01, 0x18, 5 | 0x64, 0x6f, 0xf6, 0x26, 0x0a, 0x00, 0x00, 0x50, 0xf2, 0xff, 0xff, 0x4f, 6 | 0x14, 0x04, 0x00, 0x28, 0x14, 0x0e, 0x00, 0x28, 0x10, 0x32, 0x00, 0x08, 7 | 0x94, 0x03, 0x00, 0x08, 0xf4, 0x04, 0x00, 0x08, 0xb0, 0x08, 0x00, 0x08, 8 | 0x34, 0x01, 0x00, 0x28, 0x34, 0x01, 0x00, 0x28, 0x12, 0x00, 0x40, 0x48, 9 | 0x12, 0x20, 0xa6, 0x48, 0x14, 0x50, 0x11, 0x29, 0x14, 0x50, 0x48, 0x2a, 10 | 0x10, 0x27, 0xac, 0x0e, 0xd4, 0x71, 0xe8, 0x0a, 0x74, 0x20, 0xa8, 0x0a, 11 | 0x14, 0x20, 0x00, 0x08, 0x10, 0x50, 0x00, 0x08, 0x14, 0x00, 0x00, 0x28, 12 | 0x14, 0x00, 0x00, 0x28, 0xf2, 0xff, 0xff, 0x4f, 0x0a, 0x00, 0x00, 0x50, 13 | 0x64, 0x6f, 0xf6, 0x26, 0x18, 0x80, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, 14 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 15 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/relative_mode.markdown: -------------------------------------------------------------------------------- 1 | Relative mode testing 2 | ===================== 3 | 4 | See test program at the bottom of this file. 5 | 6 | Initial tests: 7 | 8 | - When in relative mode, the mouse shouldn't be moveable outside of the window. 9 | - When the cursor is outside the window when relative mode is enabled, mouse 10 | clicks should not go to whatever app was under the cursor previously. 11 | - When alt/cmd-tabbing between a relative mode app and another app, clicks when 12 | in the relative mode app should also not go to whatever app was under the 13 | cursor previously. 14 | 15 | 16 | Code 17 | ==== 18 | 19 | #include 20 | 21 | int PollEvents() 22 | { 23 | SDL_Event event; 24 | while (SDL_PollEvent(&event)) 25 | { 26 | switch (event.type) 27 | { 28 | case SDL_QUIT: 29 | return 1; 30 | default: 31 | break; 32 | } 33 | } 34 | 35 | return 0; 36 | } 37 | 38 | int main(int argc, char *argv[]) 39 | { 40 | SDL_Window *win; 41 | 42 | SDL_Init(SDL_INIT_VIDEO); 43 | 44 | win = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, 0); 45 | SDL_SetRelativeMouseMode(SDL_TRUE); 46 | 47 | while (1) 48 | { 49 | if (PollEvents()) 50 | break; 51 | } 52 | 53 | SDL_DestroyWindow(win); 54 | 55 | SDL_Quit(); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/sample.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/sample.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/sample.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/sample.wav -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p01_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p01_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p01_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p01_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p01_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p01_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p02_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p02_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p02_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p02_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p02_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p02_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p03_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p03_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p03_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p03_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p04_shape1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p04_shape1.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p04_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p04_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p04_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p04_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p04_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p04_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p05_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p05_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p06_shape1alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p06_shape1alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p06_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p06_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p06_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p06_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p06_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p06_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p07_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p07_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p07_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p07_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p07_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p07_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p08_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p08_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p08_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p08_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p08_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p08_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p09_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p09_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p09_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p09_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p09_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p09_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p10_shape1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p10_shape1.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p10_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p10_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p10_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p10_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p10_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p10_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p11_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p11_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p11_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p11_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p11_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p11_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p12_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p12_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p12_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p12_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p13_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p13_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p13_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p13_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p13_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p13_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p14_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p14_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p14_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p14_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p15_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p15_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p15_shape32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p15_shape32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p15_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p15_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p16_shape1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p16_shape1.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p16_shape24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p16_shape24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/p16_shape8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/p16_shape8.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/trollface_24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/trollface_24.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/shapes/trollface_32alpha.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/shapes/trollface_32alpha.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testautomation_suites.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Reference to all test suites. 3 | * 4 | */ 5 | 6 | #ifndef _testsuites_h 7 | #define _testsuites_h 8 | 9 | #include "SDL_test.h" 10 | 11 | /* Test collections */ 12 | extern SDLTest_TestSuiteReference audioTestSuite; 13 | extern SDLTest_TestSuiteReference clipboardTestSuite; 14 | extern SDLTest_TestSuiteReference eventsTestSuite; 15 | extern SDLTest_TestSuiteReference keyboardTestSuite; 16 | extern SDLTest_TestSuiteReference mainTestSuite; 17 | extern SDLTest_TestSuiteReference mouseTestSuite; 18 | extern SDLTest_TestSuiteReference pixelsTestSuite; 19 | extern SDLTest_TestSuiteReference platformTestSuite; 20 | extern SDLTest_TestSuiteReference rectTestSuite; 21 | extern SDLTest_TestSuiteReference renderTestSuite; 22 | extern SDLTest_TestSuiteReference rwopsTestSuite; 23 | extern SDLTest_TestSuiteReference sdltestTestSuite; 24 | extern SDLTest_TestSuiteReference stdlibTestSuite; 25 | extern SDLTest_TestSuiteReference surfaceTestSuite; 26 | extern SDLTest_TestSuiteReference syswmTestSuite; 27 | extern SDLTest_TestSuiteReference timerTestSuite; 28 | extern SDLTest_TestSuiteReference videoTestSuite; 29 | extern SDLTest_TestSuiteReference hintsTestSuite; 30 | 31 | /* All test suites */ 32 | SDLTest_TestSuiteReference *testSuites[] = { 33 | &audioTestSuite, 34 | &clipboardTestSuite, 35 | &eventsTestSuite, 36 | &keyboardTestSuite, 37 | &mainTestSuite, 38 | &mouseTestSuite, 39 | &pixelsTestSuite, 40 | &platformTestSuite, 41 | &rectTestSuite, 42 | &renderTestSuite, 43 | &rwopsTestSuite, 44 | &sdltestTestSuite, 45 | &stdlibTestSuite, 46 | &surfaceTestSuite, 47 | &syswmTestSuite, 48 | &timerTestSuite, 49 | &videoTestSuite, 50 | &hintsTestSuite, 51 | NULL 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testautomation_syswm.c: -------------------------------------------------------------------------------- 1 | /** 2 | * SysWM test suite 3 | */ 4 | 5 | #include 6 | 7 | #include "SDL.h" 8 | #include "SDL_syswm.h" 9 | #include "SDL_test.h" 10 | 11 | /* Test case functions */ 12 | 13 | /** 14 | * @brief Call to SDL_GetWindowWMInfo 15 | */ 16 | int 17 | syswm_getWindowWMInfo(void *arg) 18 | { 19 | SDL_bool result; 20 | SDL_Window *window; 21 | SDL_SysWMinfo info; 22 | 23 | window = SDL_CreateWindow("", 0, 0, 0, 0, SDL_WINDOW_HIDDEN); 24 | SDLTest_AssertPass("Call to SDL_CreateWindow()"); 25 | SDLTest_AssertCheck(window != NULL, "Check that value returned from SDL_CreateWindow is not NULL"); 26 | if (window == NULL) { 27 | return TEST_ABORTED; 28 | } 29 | 30 | /* Initialize info structure with SDL version info */ 31 | SDL_VERSION(&info.version); 32 | 33 | /* Make call */ 34 | result = SDL_GetWindowWMInfo(window, &info); 35 | SDLTest_AssertPass("Call to SDL_GetWindowWMInfo()"); 36 | SDLTest_Log((result == SDL_TRUE) ? "Got window information" : "Couldn't get window information"); 37 | 38 | SDL_DestroyWindow(window); 39 | SDLTest_AssertPass("Call to SDL_DestroyWindow()"); 40 | 41 | return TEST_COMPLETED; 42 | } 43 | 44 | /* ================= Test References ================== */ 45 | 46 | /* SysWM test cases */ 47 | static const SDLTest_TestCaseReference syswmTest1 = 48 | { (SDLTest_TestCaseFp)syswm_getWindowWMInfo, "syswm_getWindowWMInfo", "Call to SDL_GetWindowWMInfo", TEST_ENABLED }; 49 | 50 | /* Sequence of SysWM test cases */ 51 | static const SDLTest_TestCaseReference *syswmTests[] = { 52 | &syswmTest1, NULL 53 | }; 54 | 55 | /* SysWM test suite (global) */ 56 | SDLTest_TestSuiteReference syswmTestSuite = { 57 | "SysWM", 58 | NULL, 59 | syswmTests, 60 | NULL 61 | }; 62 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testbounds.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2020 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | 13 | #include "SDL.h" 14 | 15 | int main(int argc, char **argv) 16 | { 17 | int total, i; 18 | 19 | if (SDL_Init(SDL_INIT_VIDEO) < 0) { 20 | SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError()); 21 | return 1; 22 | } 23 | 24 | total = SDL_GetNumVideoDisplays(); 25 | for (i = 0; i < total; i++) { 26 | SDL_Rect bounds = { -1,-1,-1,-1 }, usable = { -1,-1,-1,-1 }; 27 | SDL_GetDisplayBounds(i, &bounds); 28 | SDL_GetDisplayUsableBounds(i, &usable); 29 | SDL_Log("Display #%d ('%s'): bounds={(%d,%d),%dx%d}, usable={(%d,%d),%dx%d}", 30 | i, SDL_GetDisplayName(i), 31 | bounds.x, bounds.y, bounds.w, bounds.h, 32 | usable.x, usable.y, usable.w, usable.h); 33 | } 34 | 35 | SDL_Quit(); 36 | return 0; 37 | } 38 | 39 | /* vi: set ts=4 sw=4 expandtab: */ 40 | 41 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testfilesystem.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2020 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | /* Simple test of filesystem functions. */ 13 | 14 | #include 15 | #include "SDL.h" 16 | 17 | int 18 | main(int argc, char *argv[]) 19 | { 20 | char *base_path; 21 | char *pref_path; 22 | 23 | /* Enable standard application logging */ 24 | SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); 25 | 26 | if (SDL_Init(0) == -1) { 27 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError()); 28 | return 1; 29 | } 30 | 31 | base_path = SDL_GetBasePath(); 32 | if(base_path == NULL){ 33 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n", 34 | SDL_GetError()); 35 | } else { 36 | SDL_Log("base path: '%s'\n", base_path); 37 | SDL_free(base_path); 38 | } 39 | 40 | pref_path = SDL_GetPrefPath("libsdl", "testfilesystem"); 41 | if(pref_path == NULL){ 42 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n", 43 | SDL_GetError()); 44 | } else { 45 | SDL_Log("pref path: '%s'\n", pref_path); 46 | SDL_free(pref_path); 47 | } 48 | 49 | pref_path = SDL_GetPrefPath(NULL, "testfilesystem"); 50 | if(pref_path == NULL){ 51 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n", 52 | SDL_GetError()); 53 | } else { 54 | SDL_Log("pref path: '%s'\n", pref_path); 55 | SDL_free(pref_path); 56 | } 57 | 58 | SDL_Quit(); 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testkeys.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2020 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | 13 | /* Print out all the scancodes we have, just to verify them */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "SDL.h" 21 | 22 | int 23 | main(int argc, char *argv[]) 24 | { 25 | SDL_Scancode scancode; 26 | 27 | /* Enable standard application logging */ 28 | SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); 29 | 30 | if (SDL_Init(SDL_INIT_VIDEO) < 0) { 31 | SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); 32 | exit(1); 33 | } 34 | for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) { 35 | SDL_Log("Scancode #%d, \"%s\"\n", scancode, 36 | SDL_GetScancodeName(scancode)); 37 | } 38 | SDL_Quit(); 39 | return (0); 40 | } 41 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testnative.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2020 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | 13 | /* Definitions for platform dependent windowing functions to test SDL 14 | integration with native windows 15 | */ 16 | 17 | #include "SDL.h" 18 | 19 | /* This header includes all the necessary system headers for native windows */ 20 | #include "SDL_syswm.h" 21 | 22 | typedef struct 23 | { 24 | const char *tag; 25 | void *(*CreateNativeWindow) (int w, int h); 26 | void (*DestroyNativeWindow) (void *window); 27 | } NativeWindowFactory; 28 | 29 | #ifdef SDL_VIDEO_DRIVER_WINDOWS 30 | #define TEST_NATIVE_WINDOWS 31 | extern NativeWindowFactory WindowsWindowFactory; 32 | #endif 33 | 34 | #ifdef SDL_VIDEO_DRIVER_X11 35 | #define TEST_NATIVE_X11 36 | extern NativeWindowFactory X11WindowFactory; 37 | #endif 38 | 39 | #ifdef SDL_VIDEO_DRIVER_COCOA 40 | /* Actually, we don't really do this, since it involves adding Objective C 41 | support to the build system, which is a little tricky. You can uncomment 42 | it manually though and link testnativecocoa.m into the test application. 43 | */ 44 | #define TEST_NATIVE_COCOA 45 | extern NativeWindowFactory CocoaWindowFactory; 46 | #endif 47 | 48 | #ifdef SDL_VIDEO_DRIVER_OS2 49 | #define TEST_NATIVE_OS2 50 | extern NativeWindowFactory OS2WindowFactory; 51 | #endif 52 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testnativecocoa.m: -------------------------------------------------------------------------------- 1 | 2 | #include "testnative.h" 3 | 4 | #ifdef TEST_NATIVE_COCOA 5 | 6 | #include 7 | 8 | static void *CreateWindowCocoa(int w, int h); 9 | static void DestroyWindowCocoa(void *window); 10 | 11 | NativeWindowFactory CocoaWindowFactory = { 12 | "cocoa", 13 | CreateWindowCocoa, 14 | DestroyWindowCocoa 15 | }; 16 | 17 | static void *CreateWindowCocoa(int w, int h) 18 | { 19 | NSAutoreleasePool *pool; 20 | NSWindow *nswindow; 21 | NSRect rect; 22 | unsigned int style; 23 | 24 | pool = [[NSAutoreleasePool alloc] init]; 25 | 26 | rect.origin.x = 0; 27 | rect.origin.y = 0; 28 | rect.size.width = w; 29 | rect.size.height = h; 30 | rect.origin.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - rect.origin.y - rect.size.height; 31 | 32 | style = (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask); 33 | 34 | nswindow = [[NSWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:FALSE]; 35 | [nswindow makeKeyAndOrderFront:nil]; 36 | 37 | [pool release]; 38 | 39 | return nswindow; 40 | } 41 | 42 | static void DestroyWindowCocoa(void *window) 43 | { 44 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 45 | NSWindow *nswindow = (NSWindow *)window; 46 | 47 | [nswindow close]; 48 | [pool release]; 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testnativeos2.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2020 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | 13 | #include "testnative.h" 14 | 15 | #ifdef TEST_NATIVE_OS2 16 | 17 | #define WIN_CLIENT_CLASS "SDL Test" 18 | 19 | static void *CreateWindowNative(int w, int h); 20 | static void DestroyWindowNative(void *window); 21 | 22 | NativeWindowFactory OS2WindowFactory = { 23 | "DIVE", 24 | CreateWindowNative, 25 | DestroyWindowNative 26 | }; 27 | 28 | static void *CreateWindowNative(int w, int h) 29 | { 30 | HWND hwnd; 31 | HWND hwndFrame; 32 | ULONG ulFrameFlags = FCF_TASKLIST | FCF_DLGBORDER | FCF_TITLEBAR | 33 | FCF_SYSMENU | FCF_SHELLPOSITION | 34 | FCF_SIZEBORDER | FCF_MINBUTTON | FCF_MAXBUTTON; 35 | 36 | WinRegisterClass( 0, WIN_CLIENT_CLASS, WinDefWindowProc, 37 | CS_SIZEREDRAW | CS_MOVENOTIFY, 38 | sizeof(ULONG) ); // We should have minimum 4 bytes. 39 | 40 | hwndFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulFrameFlags, 41 | WIN_CLIENT_CLASS, "SDL Test", 0, 0, 1, &hwnd ); 42 | if ( hwndFrame == NULLHANDLE ) 43 | { 44 | return 0; 45 | } 46 | 47 | WinSetWindowPos( hwndFrame, HWND_TOP, 0, 0, w, h, 48 | SWP_ZORDER | SWP_ACTIVATE | SWP_SIZE | SWP_SHOW ); 49 | 50 | return (void *)hwndFrame; // We may returns client or frame window handle 51 | // for SDL_CreateWindowFrom(). 52 | } 53 | 54 | static void DestroyWindowNative(void *window) 55 | { 56 | WinDestroyWindow( (HWND)window ); 57 | } 58 | 59 | #endif /* TEST_NATIVE_OS2 */ 60 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testnativex11.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2020 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | 13 | #include "testnative.h" 14 | 15 | #ifdef TEST_NATIVE_X11 16 | 17 | static void *CreateWindowX11(int w, int h); 18 | static void DestroyWindowX11(void *window); 19 | 20 | NativeWindowFactory X11WindowFactory = { 21 | "x11", 22 | CreateWindowX11, 23 | DestroyWindowX11 24 | }; 25 | 26 | static Display *dpy; 27 | 28 | static void * 29 | CreateWindowX11(int w, int h) 30 | { 31 | Window window = 0; 32 | 33 | dpy = XOpenDisplay(NULL); 34 | if (dpy) { 35 | window = 36 | XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, w, h, 0, 0, 37 | 0); 38 | XMapRaised(dpy, window); 39 | XSync(dpy, False); 40 | } 41 | return (void *) window; 42 | } 43 | 44 | static void 45 | DestroyWindowX11(void *window) 46 | { 47 | if (dpy) { 48 | XDestroyWindow(dpy, (Window) window); 49 | XCloseDisplay(dpy); 50 | } 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testurl.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2020 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | #include "SDL.h" 13 | 14 | int main(int argc, char **argv) 15 | { 16 | int i; 17 | if (SDL_Init(SDL_INIT_VIDEO) == -1) { 18 | SDL_Log("SDL_Init failed: %s\n", SDL_GetError()); 19 | return 1; 20 | } 21 | 22 | for (i = 1; i < argc; i++) { 23 | const char *url = argv[i]; 24 | SDL_Log("Opening '%s' ...", url); 25 | if (SDL_OpenURL(url) == 0) { 26 | SDL_Log(" success!"); 27 | } else { 28 | SDL_Log(" failed! %s", SDL_GetError()); 29 | } 30 | } 31 | 32 | SDL_Quit(); 33 | return 0; 34 | } 35 | 36 | /* vi: set ts=4 sw=4 expandtab: */ 37 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testver.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2020 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | 13 | /* Test program to compare the compile-time version of SDL with the linked 14 | version of SDL 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include "SDL.h" 21 | #include "SDL_revision.h" 22 | 23 | int 24 | main(int argc, char *argv[]) 25 | { 26 | SDL_version compiled; 27 | SDL_version linked; 28 | 29 | /* Enable standard application logging */ 30 | SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); 31 | 32 | #if SDL_VERSION_ATLEAST(2, 0, 0) 33 | SDL_Log("Compiled with SDL 2.0 or newer\n"); 34 | #else 35 | SDL_Log("Compiled with SDL older than 2.0\n"); 36 | #endif 37 | SDL_VERSION(&compiled); 38 | SDL_Log("Compiled version: %d.%d.%d.%d (%s)\n", 39 | compiled.major, compiled.minor, compiled.patch, 40 | SDL_REVISION_NUMBER, SDL_REVISION); 41 | SDL_GetVersion(&linked); 42 | SDL_Log("Linked version: %d.%d.%d.%d (%s)\n", 43 | linked.major, linked.minor, linked.patch, 44 | SDL_GetRevisionNumber(), SDL_GetRevision()); 45 | SDL_Quit(); 46 | return (0); 47 | } 48 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testyuv.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/testyuv.bmp -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/testyuv_cvt.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1997-2020 Sam Lantinga 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely. 11 | */ 12 | 13 | /* These functions are designed for testing correctness, not for speed */ 14 | 15 | extern SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance); 16 | extern int CalculateYUVPitch(Uint32 format, int width); 17 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/test/utf8.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/test/utf8.txt -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/bin/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/x86_64-w64-mingw32/bin/SDL2.dll -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/bin/sdl2-config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=/opt/local/x86_64-w64-mingw32 4 | exec_prefix=${prefix} 5 | exec_prefix_set=no 6 | libdir=${exec_prefix}/lib 7 | 8 | #usage="\ 9 | #Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]" 10 | usage="\ 11 | Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]" 12 | 13 | if test $# -eq 0; then 14 | echo "${usage}" 1>&2 15 | exit 1 16 | fi 17 | 18 | while test $# -gt 0; do 19 | case "$1" in 20 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 21 | *) optarg= ;; 22 | esac 23 | 24 | case $1 in 25 | --prefix=*) 26 | prefix=$optarg 27 | if test $exec_prefix_set = no ; then 28 | exec_prefix=$optarg 29 | fi 30 | ;; 31 | --prefix) 32 | echo $prefix 33 | ;; 34 | --exec-prefix=*) 35 | exec_prefix=$optarg 36 | exec_prefix_set=yes 37 | ;; 38 | --exec-prefix) 39 | echo $exec_prefix 40 | ;; 41 | --version) 42 | echo 2.0.14 43 | ;; 44 | --cflags) 45 | echo -I${prefix}/include/SDL2 -Dmain=SDL_main 46 | ;; 47 | --libs) 48 | echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows 49 | ;; 50 | --static-libs) 51 | # --libs|--static-libs) 52 | echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc 53 | ;; 54 | *) 55 | echo "${usage}" 1>&2 56 | exit 1 57 | ;; 58 | esac 59 | shift 60 | done 61 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | #ifndef SDLname_h_ 23 | #define SDLname_h_ 24 | 25 | #if defined(__STDC__) || defined(__cplusplus) 26 | #define NeedFunctionPrototypes 1 27 | #endif 28 | 29 | #define SDL_NAME(X) SDL_##X 30 | 31 | #endif /* SDLname_h_ */ 32 | 33 | /* vi: set ts=4 sw=4 expandtab: */ 34 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 1.X API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifdef __IPHONEOS__ 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #endif 36 | 37 | #ifndef APIENTRY 38 | #define APIENTRY 39 | #endif 40 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_opengles2.h 24 | * 25 | * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. 26 | */ 27 | #include "SDL_config.h" 28 | 29 | #ifndef _MSC_VER 30 | 31 | #ifdef __IPHONEOS__ 32 | #include 33 | #include 34 | #else 35 | #include 36 | #include 37 | #include 38 | #endif 39 | 40 | #else /* _MSC_VER */ 41 | 42 | /* OpenGL ES2 headers for Visual Studio */ 43 | #include "SDL_opengles2_khrplatform.h" 44 | #include "SDL_opengles2_gl2platform.h" 45 | #include "SDL_opengles2_gl2.h" 46 | #include "SDL_opengles2_gl2ext.h" 47 | 48 | #endif /* _MSC_VER */ 49 | 50 | #ifndef APIENTRY 51 | #define APIENTRY GL_APIENTRY 52 | #endif 53 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles2_gl2platform.h: -------------------------------------------------------------------------------- 1 | #ifndef __gl2platform_h_ 2 | #define __gl2platform_h_ 3 | 4 | /* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ 5 | 6 | /* 7 | * This document is licensed under the SGI Free Software B License Version 8 | * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . 9 | */ 10 | 11 | /* Platform-specific types and definitions for OpenGL ES 2.X gl2.h 12 | * 13 | * Adopters may modify khrplatform.h and this file to suit their platform. 14 | * You are encouraged to submit all modifications to the Khronos group so that 15 | * they can be included in future versions of this file. Please submit changes 16 | * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 17 | * by filing a bug against product "OpenGL-ES" component "Registry". 18 | */ 19 | 20 | /*#include */ 21 | 22 | #ifndef GL_APICALL 23 | #define GL_APICALL KHRONOS_APICALL 24 | #endif 25 | 26 | #ifndef GL_APIENTRY 27 | #define GL_APIENTRY KHRONOS_APIENTRY 28 | #endif 29 | 30 | #endif /* __gl2platform_h_ */ 31 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_revision.h: -------------------------------------------------------------------------------- 1 | #define SDL_REVISION "hg-14525:e52d96ea04fc" 2 | #define SDL_REVISION_NUMBER 14525 3 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_test_memory.h 24 | * 25 | * Include file for SDL test framework. 26 | * 27 | * This code is a part of the SDL2_test library, not the main SDL library. 28 | */ 29 | 30 | #ifndef SDL_test_memory_h_ 31 | #define SDL_test_memory_h_ 32 | 33 | #include "begin_code.h" 34 | /* Set up for C function definitions, even when using C++ */ 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | /** 41 | * \brief Start tracking SDL memory allocations 42 | * 43 | * \note This should be called before any other SDL functions for complete tracking coverage 44 | */ 45 | int SDLTest_TrackAllocations(void); 46 | 47 | /** 48 | * \brief Print a log of any outstanding allocations 49 | * 50 | * \note This can be called after SDL_Quit() 51 | */ 52 | void SDLTest_LogAllocations(void); 53 | 54 | 55 | /* Ends C function definitions when using C++ */ 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #include "close_code.h" 60 | 61 | #endif /* SDL_test_memory_h_ */ 62 | 63 | /* vi: set ts=4 sw=4 expandtab: */ 64 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file SDL_types.h 24 | * 25 | * \deprecated 26 | */ 27 | 28 | /* DEPRECATED */ 29 | #include "SDL_stdinc.h" 30 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/include/SDL2/close_code.h: -------------------------------------------------------------------------------- 1 | /* 2 | Simple DirectMedia Layer 3 | Copyright (C) 1997-2020 Sam Lantinga 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | */ 21 | 22 | /** 23 | * \file close_code.h 24 | * 25 | * This file reverses the effects of begin_code.h and should be included 26 | * after you finish any function and structure declarations in your headers 27 | */ 28 | 29 | #ifndef _begin_code_h 30 | #error close_code.h included without matching begin_code.h 31 | #endif 32 | #undef _begin_code_h 33 | 34 | /* Reset structure packing at previous byte alignment */ 35 | #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 36 | #ifdef __BORLANDC__ 37 | #pragma nopackwarning 38 | #endif 39 | #pragma pack(pop) 40 | #endif /* Compiler needs structure packing set */ 41 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config-version.cmake: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "2.0.14") 2 | 3 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 4 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 5 | else() 6 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 7 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 8 | set(PACKAGE_VERSION_EXACT TRUE) 9 | endif() 10 | endif() 11 | 12 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2.a -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2.dll.a -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2.la: -------------------------------------------------------------------------------- 1 | # libSDL2.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='../bin/SDL2.dll' 9 | 10 | # Names of this library. 11 | library_names='libSDL2.dll.a' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL2.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL2. 26 | current=14 27 | age=14 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/valve/release/SDL/SDL2-2.0.14/x86_64-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.a -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.la: -------------------------------------------------------------------------------- 1 | # libSDL2_test.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='' 9 | 10 | # Names of this library. 11 | library_names='' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL2_test.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs='' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL2_test. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/valve/release/SDL/SDL2-2.0.14/x86_64-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2main.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2main.a -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/lib/libSDL2main.la: -------------------------------------------------------------------------------- 1 | # libSDL2main.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.2 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='' 9 | 10 | # Names of this library. 11 | library_names='' 12 | 13 | # The name of the static archive. 14 | old_library='libSDL2main.a' 15 | 16 | # Linker flags that can not go in dependency_libs. 17 | inherited_linker_flags='' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs='' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libSDL2main. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/valve/release/SDL/SDL2-2.0.14/x86_64-w64-mingw32/lib' 42 | -------------------------------------------------------------------------------- /emulator/Windows/SDL2/x86_64-w64-mingw32/lib/pkgconfig/sdl2.pc: -------------------------------------------------------------------------------- 1 | # sdl pkg-config source file 2 | 3 | prefix=/opt/local/x86_64-w64-mingw32 4 | exec_prefix=${prefix} 5 | libdir=${exec_prefix}/lib 6 | includedir=${prefix}/include 7 | 8 | Name: sdl2 9 | Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. 10 | Version: 2.0.14 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows 14 | Libs.private: -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc 15 | Cflags: -I${includedir}/SDL2 -Dmain=SDL_main 16 | -------------------------------------------------------------------------------- /emulator/Windows/dirent/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Toni Rönkkö 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /emulator/imgui_toggle_button.h: -------------------------------------------------------------------------------- 1 | // https://github.com/ocornut/imgui/issues/1537#issuecomment-355569554 2 | #ifndef EMULATOR_IMGUI_TOGGLE_BUTTON_H 3 | #define EMULATOR_IMGUI_TOGGLE_BUTTON_H 4 | 5 | inline void ToggleButton(const char* str_id, bool* v) { 6 | ImVec2 p = ImGui::GetCursorScreenPos(); 7 | ImDrawList* draw_list = ImGui::GetWindowDrawList(); 8 | 9 | float height = ImGui::GetFrameHeight(); 10 | float width = height * 1.55f; 11 | float radius = height * 0.50f; 12 | 13 | ImGui::InvisibleButton(str_id, ImVec2(width, height)); 14 | if (ImGui::IsItemClicked()) 15 | *v = !*v; 16 | 17 | float t = *v ? 1.0f : 0.0f; 18 | 19 | ImGuiContext& g = *GImGui; 20 | float ANIM_SPEED = 0.08f; 21 | if (g.LastActiveId == g.CurrentWindow->GetID(str_id))// && g.LastActiveIdTimer < ANIM_SPEED) 22 | { 23 | float t_anim = ImSaturate(g.LastActiveIdTimer / ANIM_SPEED); 24 | t = *v ? (t_anim) : (1.0f - t_anim); 25 | } 26 | 27 | ImU32 col_bg; 28 | if (ImGui::IsItemHovered()) 29 | col_bg = ImGui::GetColorU32(ImLerp(ImVec4(0.78f, 0.78f, 0.78f, 1.0f), ImVec4(0.64f, 0.83f, 0.34f, 1.0f), t)); 30 | else 31 | col_bg = ImGui::GetColorU32(ImLerp(ImVec4(0.85f, 0.85f, 0.85f, 1.0f), ImVec4(0.56f, 0.83f, 0.26f, 1.0f), t)); 32 | 33 | draw_list->AddRectFilled(p, ImVec2(p.x + width, p.y + height), col_bg, height * 0.5f); 34 | draw_list->AddCircleFilled(ImVec2(p.x + radius + t * (width - radius * 2.0f), p.y + radius), radius - 1.5f, IM_COL32(255, 255, 255, 255)); 35 | } 36 | 37 | #endif //EMULATOR_IMGUI_TOGGLE_BUTTON_H 38 | -------------------------------------------------------------------------------- /fetch_songs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Fetches and converts all songs from https://github.com/robsoncouto/arduino-songs 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | 9 | git clone https://github.com/robsoncouto/arduino-songs 10 | 11 | mkdir -p "${SCRIPT_DIR}/programs/songs/" 12 | 13 | for f in ./arduino-songs/*/*.ino 14 | do 15 | echo "Converting: $f" 16 | filename=${f##*/} 17 | cat "$f" | python3 "${SCRIPT_DIR}/song_converter.py" "${SCRIPT_DIR}/programs/songs/${filename%.*}.bin" 18 | done 19 | 20 | rm -rf ./arduino-songs 21 | -------------------------------------------------------------------------------- /fpga/adc_driver.vhd: -------------------------------------------------------------------------------- 1 | library ieee; 2 | use ieee.std_logic_1164.all; 3 | 4 | entity adc_driver is 5 | port ( 6 | clock : in std_logic; 7 | reset : in std_logic; 8 | ch0 : out std_logic_vector(7 downto 0); 9 | ch1 : out std_logic_vector(7 downto 0); 10 | ch2 : out std_logic_vector(7 downto 0); 11 | ch3 : out std_logic_vector(7 downto 0); 12 | ch4 : out std_logic_vector(7 downto 0); 13 | ch5 : out std_logic_vector(7 downto 0) 14 | ); 15 | end adc_driver; 16 | 17 | architecture impl of adc_driver is 18 | component adc is 19 | port ( 20 | CLOCK : in std_logic := '0'; 21 | CH0 : out std_logic_vector(11 downto 0); 22 | CH1 : out std_logic_vector(11 downto 0); 23 | CH2 : out std_logic_vector(11 downto 0); 24 | CH3 : out std_logic_vector(11 downto 0); 25 | CH4 : out std_logic_vector(11 downto 0); 26 | CH5 : out std_logic_vector(11 downto 0); 27 | CH6 : out std_logic_vector(11 downto 0); 28 | CH7 : out std_logic_vector(11 downto 0); 29 | RESET : in std_logic := '0' 30 | ); 31 | end component; 32 | 33 | signal channel0, channel1, channel2, channel3, channel4, channel5 : std_logic_vector(11 downto 0); 34 | begin 35 | driver : adc 36 | port map ( 37 | CLOCK => clock, 38 | RESET => reset, 39 | CH0 => channel0, 40 | CH1 => channel1, 41 | CH2 => channel2, 42 | CH3 => channel3, 43 | CH4 => channel4, 44 | CH5 => channel5 45 | ); 46 | 47 | ch0 <= channel0(11 downto 4); 48 | ch1 <= channel1(11 downto 4); 49 | ch2 <= channel2(11 downto 4); 50 | ch3 <= channel3(11 downto 4); 51 | ch4 <= channel4(11 downto 4); 52 | ch5 <= channel5(11 downto 4); 53 | end architecture; 54 | -------------------------------------------------------------------------------- /fpga/fpga.qpf: -------------------------------------------------------------------------------- 1 | DATE = "18:31:16 July 26, 2021" 2 | QUARTUS_VERSION = "16.0.0" 3 | 4 | # Revisions 5 | 6 | PROJECT_REVISION = "fpga" 7 | -------------------------------------------------------------------------------- /fpga/fpga.sld: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /fpga/power_on_reset.vhd: -------------------------------------------------------------------------------- 1 | -- A Power-on-Reset module 2 | 3 | library ieee; 4 | use ieee.std_logic_1164.all; 5 | 6 | entity power_on_reset is 7 | port ( 8 | clock : in std_logic; 9 | reset_in : in std_logic; 10 | reset_out : out std_logic 11 | ); 12 | end entity; 13 | 14 | architecture impl of power_on_reset is 15 | constant RESET_CYCLES: integer := 5; 16 | 17 | signal state : integer range 0 to RESET_CYCLES; 18 | begin 19 | process(all) 20 | begin 21 | if reset_in='1' then 22 | state <= 0; 23 | reset_out <= '1'; 24 | elsif rising_edge(clock) then 25 | if state < RESET_CYCLES then 26 | state <= state + 1; 27 | reset_out <= '1'; 28 | else 29 | reset_out <= '0'; 30 | end if; 31 | end if; 32 | end process; 33 | end architecture; 34 | -------------------------------------------------------------------------------- /fpga/pwm_driver.vhd: -------------------------------------------------------------------------------- 1 | library ieee; 2 | use ieee.std_logic_1164.all; 3 | use ieee.numeric_std.all; 4 | 5 | entity pwm_driver is 6 | port ( 7 | clock : in std_logic; 8 | reset : in std_logic; 9 | duty_cycle : in std_logic_vector(7 downto 0); 10 | modulated : out std_logic 11 | ); 12 | end entity; 13 | 14 | architecture impl of pwm_driver is 15 | signal count : unsigned(7 downto 0); 16 | begin 17 | modulated <= '1' when duty_cycle = x"FF" or count < unsigned(duty_cycle) else '0'; 18 | 19 | process(all) 20 | begin 21 | if reset = '1' then 22 | count <= to_unsigned(0, 8); 23 | elsif rising_edge(clock) then 24 | count <= count + 1; 25 | end if; 26 | end process; 27 | end architecture; 28 | -------------------------------------------------------------------------------- /fpga/random.vhd: -------------------------------------------------------------------------------- 1 | library ieee; 2 | use ieee.std_logic_1164.all; 3 | use ieee.numeric_std.all; 4 | 5 | entity random is 6 | port ( 7 | clock : in std_logic; 8 | reset : in std_logic; 9 | seed : in std_logic_vector(7 downto 0); 10 | seed_write : in std_logic; 11 | rand : out std_logic_vector(7 downto 0) 12 | ); 13 | end entity; 14 | 15 | architecture impl of random is 16 | signal lsfr : std_logic_vector(7 downto 0); 17 | begin 18 | rand <= lsfr; 19 | 20 | process(all) 21 | begin 22 | if reset = '1' then 23 | lsfr <= x"FF"; 24 | elsif rising_edge(clock) then 25 | if seed_write = '1' then 26 | lsfr <= seed; 27 | else 28 | lsfr(7) <= lsfr(0); 29 | lsfr(6) <= lsfr(7) xor lsfr(0); 30 | lsfr(5) <= lsfr(6); 31 | lsfr(4) <= lsfr(5); 32 | lsfr(3) <= lsfr(4); 33 | lsfr(2) <= lsfr(3); 34 | lsfr(1) <= lsfr(2); 35 | lsfr(0) <= lsfr(1); 36 | end if; 37 | end if; 38 | end process; 39 | end architecture; 40 | -------------------------------------------------------------------------------- /fpga/seg7.vhd: -------------------------------------------------------------------------------- 1 | -- A seven segment display driver 2 | 3 | library ieee; 4 | use ieee.std_logic_1164.all; 5 | 6 | entity seg7 is 7 | port ( 8 | digit : in std_logic_vector(3 downto 0); 9 | segments: out std_logic_vector(7 downto 0) 10 | ); 11 | end entity; 12 | 13 | architecture impl of seg7 is 14 | begin 15 | with digit select segments <= 16 | "11000000" when x"0", 17 | "11111001" when x"1", 18 | "10100100" when x"2", 19 | "10110000" when x"3", 20 | "10011001" when x"4", 21 | "10010010" when x"5", 22 | "10000010" when x"6", 23 | "11111000" when x"7", 24 | "10000000" when x"8", 25 | "10010000" when x"9", 26 | "10001000" when x"A", 27 | "10000011" when x"B", 28 | "11000110" when x"C", 29 | "10100001" when x"D", 30 | "10000110" when x"E", 31 | "10001110" when x"F", 32 | "00000000" when others; 33 | end architecture; 34 | -------------------------------------------------------------------------------- /fpga/timer.vhd: -------------------------------------------------------------------------------- 1 | library ieee; 2 | use ieee.std_logic_1164.all; 3 | use ieee.numeric_std.all; 4 | 5 | entity timer is 6 | port ( 7 | clock : in std_logic; 8 | reset : in std_logic; 9 | clear : in std_logic; 10 | unit : in std_logic_vector(2 downto 0); 11 | multiplier : in std_logic_vector(7 downto 0); 12 | triggered : out std_logic 13 | ); 14 | end entity; 15 | 16 | architecture impl of timer is 17 | signal count : unsigned(36 downto 0); 18 | signal timer_triggered : std_logic; 19 | signal unit_counts : integer; 20 | begin 21 | with unit select 22 | unit_counts <= 23 | 50 when "000", 24 | 500 when "001", 25 | 5000 when "010", 26 | 50000 when "011", 27 | 500000 when "100", 28 | 5000000 when "101", 29 | 50000000 when "110", 30 | 500000000 when "111", 31 | 0 when others; 32 | timer_triggered <= '1' when count >= to_unsigned(unit_counts, 37) * resize(unsigned(multiplier), 37) else '0'; 33 | triggered <= timer_triggered; 34 | 35 | process(all) 36 | begin 37 | if reset = '1' then 38 | count <= to_unsigned(0, 37); 39 | elsif rising_edge(clock) then 40 | if clear = '1' then 41 | count <= to_unsigned(0, 37); 42 | elsif timer_triggered = '0' then 43 | count <= count + 1; 44 | end if; 45 | end if; 46 | end process; 47 | end architecture; 48 | -------------------------------------------------------------------------------- /fpga/timer_test.vhd: -------------------------------------------------------------------------------- 1 | library ieee; 2 | use ieee.std_logic_1164.all; 3 | use ieee.numeric_std.all; 4 | 5 | entity timer_test is 6 | end timer_test; 7 | 8 | architecture test of timer_test is 9 | component timer is 10 | port ( 11 | clock : in std_logic; 12 | reset : in std_logic; 13 | clear : in std_logic; 14 | unit : in std_logic_vector(2 downto 0); 15 | multiplier : in std_logic_vector(7 downto 0); 16 | triggered : out std_logic 17 | ); 18 | end component; 19 | 20 | signal clock, reset, clear, triggered : std_logic; 21 | signal unit : std_logic_vector(2 downto 0); 22 | signal multiplier : std_logic_vector(7 downto 0); 23 | begin 24 | t : timer 25 | port map( 26 | clock => clock, 27 | reset => reset, 28 | clear => clear, 29 | unit => unit, 30 | multiplier => multiplier, 31 | triggered => triggered 32 | ); 33 | 34 | vectors: process 35 | constant period: time := 10 ns; 36 | begin 37 | clear <= '0'; 38 | clock <= '0'; 39 | unit <= "110"; 40 | multiplier <= x"01"; 41 | 42 | -- Reset 43 | reset <= '1'; 44 | wait for period; 45 | clock <= '1'; 46 | wait for period; 47 | clock <= '0'; 48 | wait for period; 49 | clock <= '1'; 50 | wait for period; 51 | clock <= '0'; 52 | wait for period; 53 | reset <= '0'; 54 | 55 | for i in 1 to 50000100 loop 56 | wait for period; 57 | clock <= '1'; 58 | wait for period; 59 | clock <= '0'; 60 | end loop; 61 | 62 | wait; 63 | end process; 64 | end test; 65 | -------------------------------------------------------------------------------- /image_convert.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | # Converts images into lm-8 compatible binary formats 4 | 5 | import sys 6 | import os 7 | from PIL import Image 8 | import argparse 9 | 10 | parser = argparse.ArgumentParser(description='Convert an image to a binary') 11 | parser.add_argument('image', help='The image to convert') 12 | parser.add_argument('-t', '--type', default='sprite', choices=['sprite', 'oled'], type=str.lower, help="The type of image to convert") 13 | args = parser.parse_args() 14 | 15 | img = Image.open(args.image) 16 | 17 | output = bytearray() 18 | 19 | if args.type == 'sprite': 20 | if img.size[0] != 8 or img.size[1] != 8: 21 | print("Image must be 8x8 pixels") 22 | exit(-1) 23 | 24 | pixels = img.convert('RGB').load() 25 | 26 | for y in range(img.size[1]): 27 | for x in range(img.size[0]): 28 | output.append(int(pixels[x, y][0] * 0x7 / 0xFF) << 5 | int(pixels[x, y][1] * 0x7 / 0xFF) << 2 | int(pixels[x, y][2] * 0x3 / 0xFF)) 29 | elif args.type == 'oled': 30 | 31 | if img.size[0] != 128 or img.size[1] != 64: 32 | print("Image must be 128x64 pixels") 33 | exit(-1) 34 | 35 | pixels = img.convert('L').load() 36 | 37 | for page in range(8): 38 | for x in range(128): 39 | column = 0 40 | for i in range(8): 41 | if pixels[x, page * 8 + i] > 0: 42 | column |= 1 << i 43 | output.append(column) 44 | 45 | with open(os.path.splitext(sys.argv[1])[0] + ".bin", "wb") as f: 46 | f.write(output) 47 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'org.jetbrains.intellij' version '1.1.4' 4 | } 5 | 6 | group 'com.thelogicmaster' 7 | version '1.0' 8 | 9 | sourceCompatibility = 1.8 10 | 11 | repositories { 12 | mavenCentral() 13 | } 14 | 15 | // Include the generated files in the source set 16 | sourceSets.main.java.srcDirs 'src/main/gen' 17 | 18 | // See https://github.com/JetBrains/gradle-intellij-plugin/ 19 | intellij { 20 | //type = 'PC' // Uncomment to use PyCharm for runIde task 21 | version = '2021.2' 22 | plugins = ['PythonCore:212.4746.13', 'PsiViewer:212-SNAPSHOT'] 23 | } 24 | 25 | buildSearchableOptions { 26 | enabled = false 27 | } 28 | 29 | patchPluginXml { 30 | version = project.version 31 | sinceBuild = '202' 32 | } 33 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/jetbrains-assembly-plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'assembly-plugin' 2 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/gen/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyInstruction.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package com.thelogicmaster.custom_assembly_plugin.psi; 3 | 4 | import java.util.List; 5 | import org.jetbrains.annotations.*; 6 | import com.intellij.psi.PsiElement; 7 | import com.intellij.lang.ASTNode; 8 | 9 | public interface AssemblyInstruction extends AssemblyInstructionElement { 10 | 11 | String getMnemonic(); 12 | 13 | @Nullable ASTNode getLabelNode(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/gen/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyLabelDefinition.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package com.thelogicmaster.custom_assembly_plugin.psi; 3 | 4 | import java.util.List; 5 | import org.jetbrains.annotations.*; 6 | import com.intellij.psi.PsiElement; 7 | import com.intellij.navigation.ItemPresentation; 8 | 9 | public interface AssemblyLabelDefinition extends AssemblyLabelElement { 10 | 11 | String getName(); 12 | 13 | PsiElement setName(String newName); 14 | 15 | PsiElement getNameIdentifier(); 16 | 17 | ItemPresentation getPresentation(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/gen/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyTypes.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package com.thelogicmaster.custom_assembly_plugin.psi; 3 | 4 | import com.intellij.psi.tree.IElementType; 5 | import com.intellij.psi.PsiElement; 6 | import com.intellij.lang.ASTNode; 7 | import com.thelogicmaster.custom_assembly_plugin.psi.impl.*; 8 | 9 | public interface AssemblyTypes { 10 | 11 | IElementType INSTRUCTION = new AssemblyElementType("INSTRUCTION"); 12 | IElementType LABEL_DEFINITION = new AssemblyElementType("LABEL_DEFINITION"); 13 | 14 | IElementType ARRAY = new AssemblyTokenType("ARRAY"); 15 | IElementType COMMENT = new AssemblyTokenType("COMMENT"); 16 | IElementType CONDITION = new AssemblyTokenType("CONDITION"); 17 | IElementType CONSTANT = new AssemblyTokenType("CONSTANT"); 18 | IElementType CRLF = new AssemblyTokenType("CRLF"); 19 | IElementType DEFINITION = new AssemblyTokenType("DEFINITION"); 20 | IElementType HL = new AssemblyTokenType("HL"); 21 | IElementType LABEL = new AssemblyTokenType("LABEL"); 22 | IElementType LABEL_DEF = new AssemblyTokenType("LABEL_DEF"); 23 | IElementType MNEMONIC = new AssemblyTokenType("MNEMONIC"); 24 | IElementType REGISTER = new AssemblyTokenType("REGISTER"); 25 | IElementType SEPARATOR = new AssemblyTokenType("SEPARATOR"); 26 | IElementType STRING = new AssemblyTokenType("STRING"); 27 | 28 | class Factory { 29 | public static PsiElement createElement(ASTNode node) { 30 | IElementType type = node.getElementType(); 31 | if (type == INSTRUCTION) { 32 | return new AssemblyInstructionImpl(node); 33 | } 34 | else if (type == LABEL_DEFINITION) { 35 | return new AssemblyLabelDefinitionImpl(node); 36 | } 37 | throw new AssertionError("Unknown element type: " + type); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/gen/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyVisitor.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package com.thelogicmaster.custom_assembly_plugin.psi; 3 | 4 | import org.jetbrains.annotations.*; 5 | import com.intellij.psi.PsiElementVisitor; 6 | import com.intellij.psi.PsiElement; 7 | 8 | public class AssemblyVisitor extends PsiElementVisitor { 9 | 10 | public void visitInstruction(@NotNull AssemblyInstruction o) { 11 | visitInstructionElement(o); 12 | } 13 | 14 | public void visitLabelDefinition(@NotNull AssemblyLabelDefinition o) { 15 | visitLabelElement(o); 16 | } 17 | 18 | public void visitInstructionElement(@NotNull AssemblyInstructionElement o) { 19 | visitPsiElement(o); 20 | } 21 | 22 | public void visitLabelElement(@NotNull AssemblyLabelElement o) { 23 | visitPsiElement(o); 24 | } 25 | 26 | public void visitPsiElement(@NotNull PsiElement o) { 27 | visitElement(o); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/gen/com/thelogicmaster/custom_assembly_plugin/psi/impl/AssemblyInstructionImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package com.thelogicmaster.custom_assembly_plugin.psi.impl; 3 | 4 | import java.util.List; 5 | import org.jetbrains.annotations.*; 6 | import com.intellij.lang.ASTNode; 7 | import com.intellij.psi.PsiElement; 8 | import com.intellij.psi.PsiElementVisitor; 9 | import com.intellij.psi.util.PsiTreeUtil; 10 | import static com.thelogicmaster.custom_assembly_plugin.psi.AssemblyTypes.*; 11 | import com.thelogicmaster.custom_assembly_plugin.psi.*; 12 | 13 | public class AssemblyInstructionImpl extends AssemblyInstructionElementImpl implements AssemblyInstruction { 14 | 15 | public AssemblyInstructionImpl(@NotNull ASTNode node) { 16 | super(node); 17 | } 18 | 19 | public void accept(@NotNull AssemblyVisitor visitor) { 20 | visitor.visitInstruction(this); 21 | } 22 | 23 | @Override 24 | public void accept(@NotNull PsiElementVisitor visitor) { 25 | if (visitor instanceof AssemblyVisitor) accept((AssemblyVisitor)visitor); 26 | else super.accept(visitor); 27 | } 28 | 29 | @Override 30 | public String getMnemonic() { 31 | return AssemblyPsiImplUtil.getMnemonic(this); 32 | } 33 | 34 | @Override 35 | public @Nullable ASTNode getLabelNode() { 36 | return AssemblyPsiImplUtil.getLabelNode(this); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/gen/com/thelogicmaster/custom_assembly_plugin/psi/impl/AssemblyLabelDefinitionImpl.java: -------------------------------------------------------------------------------- 1 | // This is a generated file. Not intended for manual editing. 2 | package com.thelogicmaster.custom_assembly_plugin.psi.impl; 3 | 4 | import java.util.List; 5 | import org.jetbrains.annotations.*; 6 | import com.intellij.lang.ASTNode; 7 | import com.intellij.psi.PsiElement; 8 | import com.intellij.psi.PsiElementVisitor; 9 | import com.intellij.psi.util.PsiTreeUtil; 10 | import static com.thelogicmaster.custom_assembly_plugin.psi.AssemblyTypes.*; 11 | import com.thelogicmaster.custom_assembly_plugin.psi.*; 12 | import com.intellij.navigation.ItemPresentation; 13 | 14 | public class AssemblyLabelDefinitionImpl extends AssemblyLabelElementImpl implements AssemblyLabelDefinition { 15 | 16 | public AssemblyLabelDefinitionImpl(@NotNull ASTNode node) { 17 | super(node); 18 | } 19 | 20 | public void accept(@NotNull AssemblyVisitor visitor) { 21 | visitor.visitLabelDefinition(this); 22 | } 23 | 24 | @Override 25 | public void accept(@NotNull PsiElementVisitor visitor) { 26 | if (visitor instanceof AssemblyVisitor) accept((AssemblyVisitor)visitor); 27 | else super.accept(visitor); 28 | } 29 | 30 | @Override 31 | public String getName() { 32 | return AssemblyPsiImplUtil.getName(this); 33 | } 34 | 35 | @Override 36 | public PsiElement setName(String newName) { 37 | return AssemblyPsiImplUtil.setName(this, newName); 38 | } 39 | 40 | @Override 41 | public PsiElement getNameIdentifier() { 42 | return AssemblyPsiImplUtil.getNameIdentifier(this); 43 | } 44 | 45 | @Override 46 | public ItemPresentation getPresentation() { 47 | return AssemblyPsiImplUtil.getPresentation(this); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/Assembly.bnf: -------------------------------------------------------------------------------- 1 | { 2 | parserClass="com.thelogicmaster.custom_assembly_plugin.AssemblyParser" 3 | 4 | extends="com.intellij.extapi.psi.ASTWrapperPsiElement" 5 | 6 | psiClassPrefix="Assembly" 7 | psiImplClassSuffix="Impl" 8 | psiPackage="com.thelogicmaster.custom_assembly_plugin.psi" 9 | psiImplPackage="com.thelogicmaster.custom_assembly_plugin.psi.impl" 10 | 11 | elementTypeHolderClass="com.thelogicmaster.custom_assembly_plugin.psi.AssemblyTypes" 12 | elementTypeClass="com.thelogicmaster.custom_assembly_plugin.psi.AssemblyElementType" 13 | tokenTypeClass="com.thelogicmaster.custom_assembly_plugin.psi.AssemblyTokenType" 14 | 15 | psiImplUtilClass="com.thelogicmaster.custom_assembly_plugin.psi.impl.AssemblyPsiImplUtil" 16 | } 17 | 18 | assemblyFile ::= item_* 19 | 20 | private item_ ::= (label_definition|instruction|COMMENT|CRLF) 21 | 22 | private operand ::= CONSTANT|LABEL|REGISTER|CONDITION|ARRAY|STRING|HL|DEFINITION 23 | 24 | instruction ::= MNEMONIC (operand (SEPARATOR operand)*)? { 25 | mixin="com.thelogicmaster.custom_assembly_plugin.psi.impl.AssemblyInstructionElementImpl" 26 | implements="com.thelogicmaster.custom_assembly_plugin.psi.AssemblyInstructionElement" 27 | methods=[getMnemonic getLabelNode] 28 | } 29 | 30 | label_definition ::= LABEL_DEF { 31 | mixin="com.thelogicmaster.custom_assembly_plugin.psi.impl.AssemblyLabelElementImpl" 32 | implements="com.thelogicmaster.custom_assembly_plugin.psi.AssemblyLabelElement" 33 | methods=[getName setName getNameIdentifier getPresentation] 34 | } -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyBlock.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.formatting.Alignment; 4 | import com.intellij.formatting.Block; 5 | import com.intellij.formatting.Indent; 6 | import com.intellij.formatting.Spacing; 7 | import com.intellij.formatting.SpacingBuilder; 8 | import com.intellij.formatting.Wrap; 9 | import com.intellij.formatting.WrapType; 10 | import com.intellij.lang.ASTNode; 11 | import com.intellij.psi.TokenType; 12 | import com.intellij.psi.formatter.common.AbstractBlock; 13 | import org.jetbrains.annotations.NotNull; 14 | import org.jetbrains.annotations.Nullable; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | public class AssemblyBlock extends AbstractBlock { 20 | 21 | private final SpacingBuilder spacingBuilder; 22 | 23 | public AssemblyBlock(@NotNull ASTNode node, @Nullable Wrap wrap, @Nullable Alignment alignment, SpacingBuilder spacingBuilder) { 24 | super(node, wrap, alignment); 25 | this.spacingBuilder = spacingBuilder; 26 | } 27 | 28 | @Override 29 | protected List buildChildren () { 30 | List blocks = new ArrayList<>(); 31 | ASTNode child = myNode.getFirstChildNode(); 32 | while (child != null) { 33 | if (child.getElementType() != TokenType.WHITE_SPACE) { 34 | Block block = new AssemblyBlock(child, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(), spacingBuilder); 35 | blocks.add(block); 36 | } 37 | child = child.getTreeNext(); 38 | } 39 | return blocks; 40 | } 41 | 42 | @Override 43 | public Indent getIndent () { 44 | return Indent.getNoneIndent(); 45 | } 46 | 47 | @Override 48 | public @Nullable Spacing getSpacing (@Nullable Block child1, @NotNull Block child2) { 49 | return spacingBuilder.getSpacing(this, child1, child2); 50 | } 51 | 52 | @Override 53 | public boolean isLeaf () { 54 | return myNode.getFirstChildNode() == null; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyCommenter.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.lang.Commenter; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public class AssemblyCommenter implements Commenter { 7 | 8 | @Override 9 | public @Nullable String getLineCommentPrefix () { 10 | return ";"; 11 | } 12 | 13 | @Override 14 | public @Nullable String getBlockCommentPrefix () { 15 | return null; 16 | } 17 | 18 | @Override 19 | public @Nullable String getBlockCommentSuffix () { 20 | return null; 21 | } 22 | 23 | @Override 24 | public @Nullable String getCommentedBlockCommentPrefix () { 25 | return null; 26 | } 27 | 28 | @Override 29 | public @Nullable String getCommentedBlockCommentSuffix () { 30 | return null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyConfigurationFactory.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.execution.configurations.ConfigurationFactory; 4 | import com.intellij.execution.configurations.RunConfiguration; 5 | import com.intellij.openapi.project.Project; 6 | import com.intellij.openapi.project.ProjectUtil; 7 | import com.intellij.openapi.vfs.VirtualFile; 8 | import com.jetbrains.python.run.PythonConfigurationType; 9 | import com.jetbrains.python.run.PythonRunConfiguration; 10 | import org.jetbrains.annotations.NotNull; 11 | 12 | import java.nio.file.Paths; 13 | 14 | public class AssemblyConfigurationFactory extends ConfigurationFactory { 15 | 16 | protected AssemblyConfigurationFactory () { 17 | super(PythonConfigurationType.getInstance()); 18 | } 19 | 20 | @Override 21 | public @NotNull String getId () { 22 | return "RunProgram"; 23 | } 24 | 25 | @Override 26 | public @NotNull RunConfiguration createTemplateConfiguration(@NotNull Project project) { 27 | PythonRunConfiguration config = (PythonRunConfiguration)PythonConfigurationType.getInstance().getFactory().createTemplateConfiguration(project); 28 | VirtualFile projectDir = ProjectUtil.guessProjectDir(project); 29 | config.setScriptName(Paths.get(projectDir.getParent().getPath(), "assembler.py").toAbsolutePath().toString()); 30 | return config; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyFileCreateAction.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.ide.actions.CreateFileFromTemplateAction; 4 | import com.intellij.ide.actions.CreateFileFromTemplateDialog; 5 | import com.intellij.openapi.project.Project; 6 | import com.intellij.psi.PsiDirectory; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | public class AssemblyFileCreateAction extends CreateFileFromTemplateAction { 10 | 11 | private static final String NAME = "Create Assembly Program"; 12 | 13 | public AssemblyFileCreateAction() { 14 | super(NAME, "Create an assembly program file", AssemblyIcons.LOGO); 15 | } 16 | 17 | @Override 18 | protected void buildDialog(@NotNull Project project, @NotNull PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) { 19 | builder 20 | .setTitle(NAME) 21 | .addKind("", AssemblyIcons.LOGO, "Assembly Program"); 22 | } 23 | 24 | @Override 25 | protected String getActionName(PsiDirectory directory, @NotNull String newName, String templateName) { 26 | return NAME; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyFileType.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.openapi.fileTypes.LanguageFileType; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import javax.swing.*; 8 | 9 | public class AssemblyFileType extends LanguageFileType { 10 | public static final AssemblyFileType INSTANCE = new AssemblyFileType(); 11 | 12 | private AssemblyFileType() { 13 | super(AssemblyLanguage.INSTANCE); 14 | } 15 | 16 | @NotNull 17 | @Override 18 | public String getName() { 19 | return "Assembly File"; 20 | } 21 | 22 | @NotNull 23 | @Override 24 | public String getDescription() { 25 | return "Assembly language file"; 26 | } 27 | 28 | @NotNull 29 | @Override 30 | public String getDefaultExtension() { 31 | return "asm"; 32 | } 33 | 34 | @Nullable 35 | @Override 36 | public Icon getIcon() { 37 | return AssemblyIcons.LOGO; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyFindUsagesProvider.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.lang.cacheBuilder.DefaultWordsScanner; 4 | import com.intellij.lang.cacheBuilder.WordsScanner; 5 | import com.intellij.lang.findUsages.FindUsagesProvider; 6 | import com.intellij.psi.PsiElement; 7 | import com.intellij.psi.tree.TokenSet; 8 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyLabelElement; 9 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyTypes; 10 | import org.jetbrains.annotations.Nls; 11 | import org.jetbrains.annotations.NotNull; 12 | import org.jetbrains.annotations.Nullable; 13 | 14 | public class AssemblyFindUsagesProvider implements FindUsagesProvider { 15 | 16 | @Override 17 | public @Nullable WordsScanner getWordsScanner () { 18 | return new DefaultWordsScanner(new AssemblyLexerAdaptor(), 19 | TokenSet.create(AssemblyTypes.LABEL), 20 | TokenSet.create(AssemblyTypes.COMMENT), 21 | TokenSet.create(AssemblyTypes.STRING) 22 | ); 23 | } 24 | 25 | @Override 26 | public boolean canFindUsagesFor (@NotNull PsiElement psiElement) { 27 | return psiElement instanceof AssemblyLabelElement; 28 | } 29 | 30 | @Override 31 | public @Nullable String getHelpId (@NotNull PsiElement psiElement) { 32 | return null; 33 | } 34 | 35 | @Override 36 | public @Nls @NotNull String getType (@NotNull PsiElement element) { 37 | if (element instanceof AssemblyLabelElement) 38 | return "label definition"; 39 | return ""; 40 | } 41 | 42 | @Override 43 | public @Nls @NotNull String getDescriptiveName (@NotNull PsiElement element) { 44 | if (!(element instanceof AssemblyLabelElement)) 45 | return ""; 46 | String name = ((AssemblyLabelElement)element).getName(); 47 | if (name == null) 48 | return ""; 49 | return name; 50 | } 51 | 52 | @Override 53 | public @Nls @NotNull String getNodeText (@NotNull PsiElement element, boolean useFullName) { 54 | return element.getText(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyIcons.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.openapi.util.IconLoader; 4 | 5 | import javax.swing.*; 6 | 7 | public class AssemblyIcons { 8 | public static final Icon LOGO = IconLoader.getIcon("/icons/logo_16.svg"); 9 | public static final Icon VARIABLE = IconLoader.getIcon("/icons/variable.svg"); 10 | public static final Icon LABEL = IconLoader.getIcon("/icons/label.svg"); 11 | public static final Icon CONSTANT = IconLoader.getIcon("/icons/constant.svg"); 12 | } 13 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyLexerAdaptor.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.lexer.FlexAdapter; 4 | 5 | public class AssemblyLexerAdaptor extends FlexAdapter { 6 | 7 | public AssemblyLexerAdaptor() { 8 | super(new AssemblyLexer(null)); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyNotificationProvider.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.openapi.fileEditor.FileEditor; 4 | import com.intellij.openapi.options.ShowSettingsUtil; 5 | import com.intellij.openapi.project.DumbAware; 6 | import com.intellij.openapi.project.Project; 7 | import com.intellij.openapi.util.Key; 8 | import com.intellij.openapi.vfs.VirtualFile; 9 | import com.intellij.ui.EditorNotificationPanel; 10 | import com.intellij.ui.EditorNotifications; 11 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyFile; 12 | import org.jetbrains.annotations.NotNull; 13 | import org.jetbrains.annotations.Nullable; 14 | 15 | public class AssemblyNotificationProvider extends EditorNotifications.Provider implements DumbAware { 16 | 17 | private static final Key KEY = Key.create("AssemblySdkNotification"); 18 | 19 | @Override 20 | public @NotNull Key getKey() { 21 | return KEY; 22 | } 23 | 24 | @Override 25 | public @Nullable EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor, @NotNull Project project) { 26 | if (!(file.getFileType() instanceof AssemblyFileType)) 27 | return null; 28 | 29 | if (AssemblySettingsState.getInstance().isConfigured(project)) 30 | return null; 31 | 32 | EditorNotificationPanel panel = new EditorNotificationPanel(); 33 | panel.setText("Set Assembler and Emulator paths for program runner support"); 34 | panel.setProject(project); 35 | panel.setProviderKey(KEY); 36 | panel.createActionLabel("Open settings", () -> ShowSettingsUtil.getInstance().showSettingsDialog(project, AssemblySettingsConfigurable.class)); 37 | return panel; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyRefactoringSupportProvider.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.lang.refactoring.RefactoringSupportProvider; 4 | import com.intellij.psi.PsiElement; 5 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyLabelDefinition; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | 9 | public class AssemblyRefactoringSupportProvider extends RefactoringSupportProvider { 10 | 11 | @Override 12 | public boolean isMemberInplaceRenameAvailable(@NotNull PsiElement elementToRename, @Nullable PsiElement context) { 13 | return (elementToRename instanceof AssemblyLabelDefinition); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyReference.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.openapi.util.TextRange; 4 | import com.intellij.psi.PsiElement; 5 | import com.intellij.psi.PsiReferenceBase; 6 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyLabelDefinition; 7 | import org.jetbrains.annotations.NotNull; 8 | import org.jetbrains.annotations.Nullable; 9 | 10 | import java.util.ArrayList; 11 | 12 | public class AssemblyReference extends PsiReferenceBase { 13 | 14 | private final String label; 15 | 16 | public AssemblyReference(@NotNull PsiElement element, TextRange textRange, String label) { 17 | super(element, textRange); 18 | 19 | this.label = label; 20 | } 21 | 22 | @Override 23 | public @Nullable PsiElement resolve () { 24 | for (PsiElement e: myElement.getContainingFile().getChildren()) 25 | if (e instanceof AssemblyLabelDefinition && label.equals(((AssemblyLabelDefinition)e).getName())) 26 | return e; 27 | 28 | ArrayList labels = new ArrayList<>(); 29 | AssemblyLanguage.collectVisibleLabels(myElement.getContainingFile(), labels); 30 | for (AssemblyLabelDefinition definition: labels) 31 | if (label.equals(definition.getName())) 32 | return definition; 33 | 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyReferenceContributor.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.lang.ASTNode; 4 | import com.intellij.openapi.util.TextRange; 5 | import com.intellij.patterns.PlatformPatterns; 6 | import com.intellij.psi.PsiElement; 7 | import com.intellij.psi.PsiReference; 8 | import com.intellij.psi.PsiReferenceContributor; 9 | import com.intellij.psi.PsiReferenceProvider; 10 | import com.intellij.psi.PsiReferenceRegistrar; 11 | import com.intellij.util.ProcessingContext; 12 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyInstructionElement; 13 | import org.jetbrains.annotations.NotNull; 14 | 15 | public class AssemblyReferenceContributor extends PsiReferenceContributor { 16 | 17 | @Override 18 | public void registerReferenceProviders (@NotNull PsiReferenceRegistrar registrar) { 19 | registrar.registerReferenceProvider(PlatformPatterns.psiElement(AssemblyInstructionElement.class), 20 | new PsiReferenceProvider() { 21 | @NotNull 22 | @Override 23 | public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { 24 | ASTNode label = ((AssemblyInstructionElement)element).getLabelNode(); 25 | if (label == null) 26 | return PsiReference.EMPTY_ARRAY; 27 | int offset = label.getStartOffsetInParent(); 28 | return new PsiReference[]{ 29 | new AssemblyReference(element, new TextRange(offset, offset + label.getTextLength()), label.getText().replaceAll("[=\\[\\]]", "")) 30 | }; 31 | } 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyRunLineMarkerContributor.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.execution.lineMarker.ExecutorAction; 4 | import com.intellij.execution.lineMarker.RunLineMarkerContributor; 5 | import com.intellij.icons.AllIcons; 6 | import com.intellij.openapi.actionSystem.AnAction; 7 | import com.intellij.openapi.util.text.StringUtil; 8 | import com.intellij.psi.PsiElement; 9 | import com.intellij.util.containers.ContainerUtil; 10 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyFile; 11 | import org.jetbrains.annotations.NotNull; 12 | import org.jetbrains.annotations.Nullable; 13 | import com.intellij.util.Function; 14 | 15 | public class AssemblyRunLineMarkerContributor extends RunLineMarkerContributor { 16 | 17 | @Override 18 | public @Nullable Info getInfo(@NotNull PsiElement element) { 19 | if (!(element instanceof AssemblyFile)) 20 | return null; 21 | 22 | final AnAction[] actions = ExecutorAction.getActions(); 23 | Function tooltipProvider = 24 | psiElement -> StringUtil.join(ContainerUtil.mapNotNull(actions, action -> getText(action, psiElement)), "\n"); 25 | return new Info(AllIcons.RunConfigurations.TestState.Run, tooltipProvider, actions); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblySettingsConfigurable.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.openapi.options.Configurable; 4 | import com.intellij.ui.EditorNotifications; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import javax.swing.*; 8 | 9 | public class AssemblySettingsConfigurable implements Configurable { 10 | 11 | private AssemblySettingsComponent settingsComponent; 12 | 13 | @Override 14 | public String getDisplayName() { 15 | return "Custom Assembly Settings"; 16 | } 17 | 18 | @Override 19 | public JComponent getPreferredFocusedComponent () { 20 | return settingsComponent.getPreferredFocusedComponent(); 21 | } 22 | 23 | @Override 24 | public @Nullable JComponent createComponent() { 25 | settingsComponent = new AssemblySettingsComponent(); 26 | return settingsComponent.getPanel(); 27 | } 28 | 29 | @Override 30 | public boolean isModified() { 31 | AssemblySettingsState settings = AssemblySettingsState.getInstance(); 32 | return !settingsComponent.getAssemblerPath().equals(settings.assemblerPath) || !settingsComponent.getEmulatorPath().equals(settings.emulatorPath) 33 | || !settingsComponent.getSimulatorPath().equals(settings.simulatorPath); 34 | } 35 | 36 | @Override 37 | public void apply() { 38 | AssemblySettingsState settings = AssemblySettingsState.getInstance(); 39 | settings.assemblerPath = settingsComponent.getAssemblerPath(); 40 | settings.emulatorPath = settingsComponent.getEmulatorPath(); 41 | settings.simulatorPath = settingsComponent.getSimulatorPath(); 42 | EditorNotifications.updateAll(); 43 | } 44 | 45 | @Override 46 | public void reset() { 47 | AssemblySettingsState settings = AssemblySettingsState.getInstance(); 48 | settingsComponent.setAssemblerPath(settings.assemblerPath); 49 | settingsComponent.setEmulatorPath(settings.emulatorPath); 50 | settingsComponent.setSimulatorPath(settings.simulatorPath); 51 | } 52 | 53 | @Override 54 | public void disposeUIResources() { 55 | settingsComponent = null; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyStructureViewFactory.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.ide.structureView.StructureViewBuilder; 4 | import com.intellij.ide.structureView.StructureViewModel; 5 | import com.intellij.ide.structureView.TreeBasedStructureViewBuilder; 6 | import com.intellij.lang.PsiStructureViewFactory; 7 | import com.intellij.openapi.editor.Editor; 8 | import com.intellij.psi.PsiFile; 9 | import org.jetbrains.annotations.NotNull; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | public class AssemblyStructureViewFactory implements PsiStructureViewFactory { 13 | 14 | @Override 15 | public @Nullable StructureViewBuilder getStructureViewBuilder (@NotNull PsiFile psiFile) { 16 | return new TreeBasedStructureViewBuilder() { 17 | @NotNull 18 | @Override 19 | public StructureViewModel createStructureViewModel(@Nullable Editor editor) { 20 | return new AssemblyStructureViewModel(psiFile); 21 | } 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblyStructureViewModel.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.ide.structureView.StructureViewModel; 4 | import com.intellij.ide.structureView.StructureViewModelBase; 5 | import com.intellij.ide.structureView.StructureViewTreeElement; 6 | import com.intellij.ide.util.treeView.smartTree.Sorter; 7 | import com.intellij.psi.PsiFile; 8 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyFile; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class AssemblyStructureViewModel extends StructureViewModelBase implements StructureViewModel.ElementInfoProvider { 12 | 13 | public AssemblyStructureViewModel(PsiFile psiFile) { 14 | super(psiFile, new AssemblyStructureViewElement(psiFile)); 15 | } 16 | 17 | @NotNull 18 | public Sorter @NotNull [] getSorters() { 19 | return new Sorter[]{Sorter.ALPHA_SORTER}; 20 | } 21 | 22 | 23 | @Override 24 | public boolean isAlwaysShowsPlus(StructureViewTreeElement element) { 25 | return false; 26 | } 27 | 28 | @Override 29 | public boolean isAlwaysLeaf(StructureViewTreeElement element) { 30 | return element instanceof AssemblyFile; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/AssemblySyntaxHighlighterFactory.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin; 2 | 3 | import com.intellij.openapi.fileTypes.SyntaxHighlighter; 4 | import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory; 5 | import com.intellij.openapi.project.Project; 6 | import com.intellij.openapi.vfs.VirtualFile; 7 | import org.jetbrains.annotations.NotNull; 8 | import org.jetbrains.annotations.Nullable; 9 | 10 | public class AssemblySyntaxHighlighterFactory extends SyntaxHighlighterFactory { 11 | 12 | @Override 13 | public @NotNull SyntaxHighlighter getSyntaxHighlighter (@Nullable Project project, @Nullable VirtualFile virtualFile) { 14 | return new AssemblySyntaxHighlighter(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyDocumentationElement.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin.psi; 2 | 3 | import com.intellij.psi.PsiElement; 4 | import com.intellij.psi.impl.FakePsiElement; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | public class AssemblyDocumentationElement extends FakePsiElement { 8 | private final PsiElement element; 9 | private final String documentation; 10 | 11 | public AssemblyDocumentationElement(PsiElement element, String documentation) { 12 | this.element = element; 13 | this.documentation = documentation; 14 | } 15 | 16 | @Override 17 | public PsiElement getParent() { 18 | return element; 19 | } 20 | 21 | @Nullable 22 | public String getDocumentation() { 23 | return documentation; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyElementFactory.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin.psi; 2 | 3 | import com.intellij.openapi.project.Project; 4 | import com.intellij.psi.PsiFileFactory; 5 | import com.thelogicmaster.custom_assembly_plugin.AssemblyFileType; 6 | 7 | public class AssemblyElementFactory { 8 | 9 | public static AssemblyFile createFile(Project project, String text) { 10 | String name = "dummy.asm"; 11 | return (AssemblyFile) PsiFileFactory.getInstance(project).createFileFromText(name, AssemblyFileType.INSTANCE, text); 12 | } 13 | 14 | public static AssemblyLabelDefinition createLabel(Project project, String name) { 15 | final AssemblyFile file = createFile(project, name + ":"); 16 | return (AssemblyLabelDefinition) file.getFirstChild(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyElementType.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin.psi; 2 | 3 | import com.intellij.psi.tree.IElementType; 4 | import com.thelogicmaster.custom_assembly_plugin.AssemblyLanguage; 5 | import org.jetbrains.annotations.NonNls; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public class AssemblyElementType extends IElementType { 9 | 10 | public AssemblyElementType(@NotNull @NonNls String debugName) { 11 | super(debugName, AssemblyLanguage.INSTANCE); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyFile.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin.psi; 2 | 3 | import com.intellij.extapi.psi.PsiFileBase; 4 | import com.intellij.openapi.fileTypes.FileType; 5 | import com.intellij.psi.FileViewProvider; 6 | import com.thelogicmaster.custom_assembly_plugin.AssemblyFileType; 7 | import com.thelogicmaster.custom_assembly_plugin.AssemblyLanguage; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | public class AssemblyFile extends PsiFileBase { 11 | public AssemblyFile(@NotNull FileViewProvider viewProvider) { 12 | super(viewProvider, AssemblyLanguage.INSTANCE); 13 | } 14 | 15 | @NotNull 16 | @Override 17 | public FileType getFileType() { 18 | return AssemblyFileType.INSTANCE; 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "Assembly File"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyInstructionElement.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin.psi; 2 | 3 | import com.intellij.lang.ASTNode; 4 | import com.intellij.model.psi.PsiExternalReferenceHost; 5 | import com.intellij.psi.PsiElement; 6 | 7 | public interface AssemblyInstructionElement extends PsiElement, PsiExternalReferenceHost { 8 | 9 | String getMnemonic(); 10 | ASTNode getLabelNode(); 11 | } 12 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyLabelElement.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin.psi; 2 | 3 | import com.intellij.psi.PsiNameIdentifierOwner; 4 | 5 | public interface AssemblyLabelElement extends PsiNameIdentifierOwner { 6 | } 7 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/psi/AssemblyTokenType.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin.psi; 2 | 3 | import com.intellij.psi.tree.IElementType; 4 | import com.thelogicmaster.custom_assembly_plugin.AssemblyLanguage; 5 | import org.jetbrains.annotations.NonNls; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public class AssemblyTokenType extends IElementType { 9 | public AssemblyTokenType(@NotNull @NonNls String debugName) { 10 | super(debugName, AssemblyLanguage.INSTANCE); 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return "AssemblyTokenType." + super.toString(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/psi/impl/AssemblyInstructionElementImpl.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin.psi.impl; 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 4 | import com.intellij.lang.ASTNode; 5 | import com.intellij.psi.PsiReference; 6 | import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry; 7 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyInstructionElement; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | public abstract class AssemblyInstructionElementImpl extends ASTWrapperPsiElement implements AssemblyInstructionElement { 11 | 12 | public AssemblyInstructionElementImpl(@NotNull ASTNode node) { 13 | super(node); 14 | } 15 | 16 | @Override 17 | public PsiReference getReference() { 18 | PsiReference[] references = ReferenceProvidersRegistry.getReferencesFromProviders(this); 19 | if (references.length == 0) 20 | return null; 21 | return references[0]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/java/com/thelogicmaster/custom_assembly_plugin/psi/impl/AssemblyLabelElementImpl.java: -------------------------------------------------------------------------------- 1 | package com.thelogicmaster.custom_assembly_plugin.psi.impl; 2 | 3 | import com.intellij.extapi.psi.ASTWrapperPsiElement; 4 | import com.intellij.lang.ASTNode; 5 | import com.thelogicmaster.custom_assembly_plugin.psi.AssemblyLabelElement; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public abstract class AssemblyLabelElementImpl extends ASTWrapperPsiElement implements AssemblyLabelElement { 9 | 10 | public AssemblyLabelElementImpl (@NotNull ASTNode node) { 11 | super(node); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/resources/META-INF/pluginIcon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | LM 16 | 17 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/resources/fileTemplates/Assembly Program.asm.ft: -------------------------------------------------------------------------------- 1 | ; ${NAME} 2 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/resources/icons/constant.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | C 16 | 17 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/resources/icons/label.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | L 16 | 17 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/resources/icons/logo_16.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | LM 16 | 17 | -------------------------------------------------------------------------------- /jetbrains-assembly-plugin/src/main/resources/icons/variable.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | image/svg+xml 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | V 16 | 17 | -------------------------------------------------------------------------------- /microcode-LE.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/microcode-LE.bin -------------------------------------------------------------------------------- /microcode.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/microcode.bin -------------------------------------------------------------------------------- /programs/All Instructions.asm: -------------------------------------------------------------------------------- 1 | ; A simple list of all current instructions in order with distinguishable parameters. 2 | 3 | nop 4 | ldr $1,a 5 | ldr [$1234],b 6 | ldr [HL],h 7 | str [$4321],l 8 | str [HL],a 9 | lda $2345 10 | in $2,a 11 | out $3,b 12 | inc h 13 | dec l 14 | ina 15 | dea 16 | add $4 17 | add a 18 | adc $5 19 | adc b 20 | sub $6 21 | sub h 22 | sbc $7 23 | sbc l 24 | and $8 25 | and a 26 | or $9 27 | or b 28 | xor $a 29 | xor h 30 | cmp $b 31 | cmp l 32 | jmp $3456 33 | jmp HL 34 | jr $c 35 | jr $d,z 36 | jr $e,nz 37 | in a 38 | out b 39 | push h 40 | pop l 41 | jsr $4567 42 | ret 43 | halt 44 | lsl 45 | lsr 46 | asr 47 | -------------------------------------------------------------------------------- /programs/Blink.asm: -------------------------------------------------------------------------------- 1 | ; Blinks an LED at 1Hz 2 | 3 | jmp main 4 | 5 | include "libraries/Utilities.asm" 6 | 7 | main: 8 | 9 | ldr $0,A 10 | 11 | loop: 12 | ; Sleep for 1 second 13 | ldr $1,B 14 | jsr delay_seconds 15 | 16 | ; Toggle LED 17 | xor $1 18 | out {led_0},A 19 | 20 | jr loop 21 | -------------------------------------------------------------------------------- /programs/Bootloader.asm: -------------------------------------------------------------------------------- 1 | ; Bootloader --- An SDHC/SDXC SD card program loader 2 | 3 | jmp program 4 | 5 | include "libraries/Serial.asm" 6 | include "libraries/SD.asm" 7 | 8 | program: 9 | ;jsr setup_serial ; Uncomment for debugging 10 | 11 | jsr setup_sd_card 12 | 13 | ; Start communication with card 14 | ldr $0,A 15 | out {sd_cs},A 16 | 17 | ; Copy program into RAM 18 | lda $8000 19 | ldr #0,A 20 | str [block_index],A 21 | load_program: 22 | cmp #0 23 | jr first_block,Z 24 | push A 25 | jsr spi_receive_byte 26 | jsr spi_receive_byte 27 | pop A 28 | first_block: 29 | jsr sd_read_block 30 | jr program,Z 31 | 32 | ; Copy block into memory 33 | ldr $2,A 34 | ldr $0,B 35 | copy_loop: 36 | push A 37 | jsr spi_receive_byte 38 | ;out {serial},A ; Uncomment for debugging 39 | str [HL],A 40 | pop A 41 | ina 42 | dec B 43 | jr copy_loop,nZ 44 | dec A 45 | jr copy_loop,nZ 46 | 47 | ldr [block_index],A 48 | inc A 49 | str [block_index],A 50 | cmp #32 51 | jr load_program,nZ 52 | 53 | ; Stop communication with card 54 | ldr $1,A 55 | out {sd_cs},A 56 | 57 | ; Execute program 58 | jmp $8000 59 | 60 | data 61 | org $C000 62 | block_index: var ; The current block number 63 | -------------------------------------------------------------------------------- /programs/Disassembler Test.asm: -------------------------------------------------------------------------------- 1 | ; This is a test of the emulator's static/dynamic disassembler functionality 2 | 3 | nop 4 | ldr $1,a 5 | ldr [$1234],b 6 | ldr [HL],h 7 | str [$4321],l 8 | str [HL],a 9 | lda $2345 10 | in $2,h 11 | out $3,b 12 | inc h 13 | dec l 14 | jmp label0 15 | ina 16 | dea 17 | 18 | 19 | label0: 20 | add $4 21 | add a 22 | adc $5 23 | adc b 24 | ldr #1,a 25 | jr label0,z 26 | add $4 27 | add a 28 | ldr #0,a 29 | jr label0,nz 30 | adc $5 31 | adc b 32 | jr label1 33 | adc $5 34 | adc b 35 | 36 | label1: 37 | sub $6 38 | sub h 39 | sbc $7 40 | sbc l 41 | and $8 42 | and a 43 | or $9 44 | or b 45 | xor $a 46 | xor h 47 | cmp $b 48 | cmp l 49 | in a 50 | out b 51 | push h 52 | pop l 53 | jsr label2 54 | lda $80 55 | jmp HL 56 | 57 | label2: 58 | sub $6 59 | sub h 60 | sbc $7 61 | sbc l 62 | ret 63 | adc $5 64 | adc b 65 | 66 | org $80 67 | label3: 68 | or $9 69 | or b 70 | xor $a 71 | xor h 72 | halt -------------------------------------------------------------------------------- /programs/Emulator Bootloader.asm: -------------------------------------------------------------------------------- 1 | ; Emulator Bootloader --- A hacked together emulator compatible bootloader for programs to run in memory 2 | 3 | lda program 4 | push H 5 | pop A 6 | push L 7 | pop B 8 | 9 | lda $8000 10 | copy: 11 | push A 12 | 13 | push H 14 | push L 15 | 16 | push A 17 | pop H 18 | push B 19 | pop L 20 | ldr [HL],A 21 | 22 | pop L 23 | pop H 24 | str [HL],A 25 | ina 26 | 27 | pop A 28 | 29 | ; Increment AB 30 | push H 31 | push L 32 | push A 33 | pop H 34 | push B 35 | pop L 36 | ina 37 | push H 38 | pop A 39 | push L 40 | pop B 41 | pop L 42 | pop H 43 | 44 | push A 45 | ldr $00,A 46 | cmp L 47 | pop A 48 | jr copy,nZ 49 | push A 50 | ldr $C0,A 51 | cmp H 52 | pop A 53 | jr copy,nZ 54 | 55 | ; Use variable jump to trigger emulator disassembler 56 | lda $8000 57 | jmp HL 58 | 59 | program: bin "build/test.img" 60 | -------------------------------------------------------------------------------- /programs/Hello World.asm: -------------------------------------------------------------------------------- 1 | ; Hello World --- The classic "Hello World" program using 8-bit and 16-bit string addressing 2 | 3 | jmp program ; Program entry point 4 | 5 | include "libraries/Serial.asm" 6 | 7 | message: db "Hello World!\n",$0 ; Message to print 8 | message_extended: db "Extended Hello!\n",$0 9 | 10 | program: 11 | jsr setup_serial ; Enable Serial output 12 | 13 | ; Print message from 8-bit address 14 | ldr =message,l ; Load message address into L 15 | jsr print_string ; Print message 16 | 17 | ; Print message from 16-bit address 18 | lda message_extended ; Load message address into HL 19 | jsr print_string_extended ; Print message 20 | 21 | halt ; Halt execution 22 | -------------------------------------------------------------------------------- /programs/LCD Hello.asm: -------------------------------------------------------------------------------- 1 | ; I2C LCD Hello World example 2 | 3 | jmp main 4 | 5 | include "libraries/LCD.asm" 6 | 7 | message: db "Hello World!", $0 8 | 9 | main: 10 | ldr $27,A 11 | str [lcd_addr],A 12 | 13 | jsr lcd_init 14 | 15 | jsr lcd_backlight_on 16 | 17 | ldr #1,A 18 | ldr #4,B 19 | jsr lcd_set_cursor 20 | 21 | lda message 22 | jsr lcd_print_string 23 | 24 | halt 25 | -------------------------------------------------------------------------------- /programs/LED Dimmer.asm: -------------------------------------------------------------------------------- 1 | ; LED Dimmer --- Dims an LED on arduino pin 3 2 | 3 | ; Enable PWM on LED pin 4 | ldr #3,A 5 | out {arduino_output},A 6 | out {pwm_enable},A 7 | 8 | ; Set a ~50% duty cycle for half brightness 9 | ldr $80,A 10 | out {pwm_3},A 11 | 12 | ; Infinite loop to maintain PWM in emulator 13 | loop: 14 | jr loop 15 | -------------------------------------------------------------------------------- /programs/Music.asm: -------------------------------------------------------------------------------- 1 | ; Music player --- Run the fetch_songs.sh script to generate the song binaries before assembling 2 | 3 | ; Set buzzer pin (Arduino 2) to output mode 4 | ldr $2,B 5 | out {arduino_output},B 6 | 7 | ; Setup timer 0 for note duration 8 | ldr {centiseconds},A 9 | out {timer_unit_0},A 10 | 11 | ; Load song address 12 | lda song 13 | str [index_high],H 14 | str [index_low],L 15 | 16 | loop: 17 | ; Load current note address 18 | ldr [index_high],H 19 | ldr [index_low],L 20 | 21 | ; Load note length and check for end of song 22 | ldr [HL],A 23 | cmp $FF 24 | jr done,Z 25 | ina 26 | 27 | ; Start note length timer 28 | out {timer_count_0},A 29 | out {timer_0},A 30 | 31 | ; Load note 32 | ldr [HL],A 33 | push A 34 | ina 35 | ldr [HL],B 36 | ina 37 | 38 | ; Store new note address 39 | str [index_high],H 40 | str [index_low],L 41 | 42 | pop H 43 | 44 | ; Set A to 0 to enable the buzzer if the note isn't a rest 45 | or B 46 | jr rest,Z 47 | ldr $0,A 48 | jr play_note 49 | rest: 50 | ldr $2,A ; Disable buzzer 51 | 52 | play_note: 53 | ldr {milliseconds},L 54 | out {timer_unit_1},L 55 | out {timer_count_1},H 56 | out {timer_1},L 57 | note_millis: 58 | in {timer_1},L 59 | jr note_millis,Z 60 | 61 | ldr {centimilliseconds},L 62 | out {timer_unit_1},L 63 | out {timer_count_1},B 64 | out {timer_1},L 65 | note_centimillis: 66 | in {timer_1},L 67 | jr note_centimillis,Z 68 | 69 | ; Toggle buzzer pin 70 | xor $1 71 | out {arduino_2},A 72 | 73 | ; Check if note ended 74 | in {timer_0},L 75 | jr play_note,Z 76 | 77 | ; Short note separation 78 | ldr $1,L 79 | out {timer_count_0},L 80 | out {timer_0},L 81 | separation: 82 | in {timer_0},L 83 | jr separation,Z 84 | 85 | jmp loop 86 | 87 | done: 88 | ldr $1,A 89 | out {led_0},A 90 | halt 91 | 92 | song: bin "songs/cannonind.bin" 93 | 94 | data 95 | index_high: var 96 | index_low: var 97 | -------------------------------------------------------------------------------- /programs/OLED Display Demo.asm: -------------------------------------------------------------------------------- 1 | ; OLED Display Demo --- Demo featuring I2C SSD1306 display at address 0x3C 2 | 3 | jmp main 4 | 5 | include "libraries/SSD1306.asm" 6 | 7 | 8 | main: 9 | ; Initialize display with address 0x3C 10 | ldr $3C,A 11 | str [ssd1306_addr],A 12 | jsr setup_ssd1306 13 | 14 | loop: 15 | ; Clear screen 16 | ldr $0,A 17 | str [ssd1306_color],A 18 | jsr ssd1306_clear 19 | 20 | ; Draw image to display buffer 21 | lda image 22 | jsr ssd1306_draw_image 23 | 24 | ; Draw lines along sides of sceen over image to demonstrate refresh rate 25 | ldr $1,A 26 | str [ssd1306_color],A 27 | ldr #63,A 28 | draw_lines: 29 | ldr #0,B 30 | jsr ssd1306_draw_pixel 31 | ldr #127,B 32 | jsr ssd1306_draw_pixel 33 | dec A 34 | cmp #15 35 | jr draw_lines,nZ 36 | 37 | ; Update display with display buffer 38 | jsr ssd1306_update 39 | 40 | ; Display 41 | lda image 42 | jsr ssd1306_display 43 | 44 | jmp loop 45 | 46 | image: bin "images/lm8.bin" 47 | -------------------------------------------------------------------------------- /programs/RC Car.asm: -------------------------------------------------------------------------------- 1 | ; RC Car --- Control an RC car using a Nunchuk controller to drive a dual H-bridge such as L298N. 2 | ; Uses arduino pins 7-10 for controlling the H-bridge 3 | 4 | jmp main 5 | 6 | include "libraries/Nunchuk.asm" 7 | 8 | 9 | main: 10 | jsr nunchuck_init 11 | 12 | ldr #7,A 13 | out {arduino_output},A 14 | ldr #8,A 15 | out {arduino_output},A 16 | ldr #9,A 17 | out {arduino_output},A 18 | ldr #10,A 19 | out {arduino_output},A 20 | 21 | 22 | loop: 23 | jsr nunchuck_update 24 | 25 | ldr [nunchuck_joystick_x],A 26 | cmp $A0 27 | jr not_turn_right,C 28 | ldr $1,A 29 | out {arduino_7},A 30 | ldr $0,A 31 | out {arduino_8},A 32 | out {arduino_9},A 33 | ldr $1,A 34 | out {arduino_10},A 35 | jmp loop 36 | not_turn_right: 37 | ldr [nunchuck_joystick_x],B 38 | ldr $60,A 39 | cmp B 40 | jr not_turn_left,C 41 | ldr $0,A 42 | out {arduino_7},A 43 | ldr $1,A 44 | out {arduino_8},A 45 | out {arduino_9},A 46 | ldr $0,A 47 | out {arduino_10},A 48 | jmp loop 49 | not_turn_left: 50 | ldr [nunchuck_joystick_y],A 51 | cmp $A0 52 | jr not_drive_forward,C 53 | ldr $1,A 54 | out {arduino_7},A 55 | ldr $0,A 56 | out {arduino_8},A 57 | ldr $1,A 58 | out {arduino_9},A 59 | ldr $0,A 60 | out {arduino_10},A 61 | jmp loop 62 | not_drive_forward: 63 | ldr [nunchuck_joystick_y],B 64 | ldr $60,A 65 | cmp B 66 | jr not_drive_reverse,C 67 | ldr $0,A 68 | out {arduino_7},A 69 | ldr $1,A 70 | out {arduino_8},A 71 | ldr $0,A 72 | out {arduino_9},A 73 | ldr $1,A 74 | out {arduino_10},A 75 | jmp loop 76 | not_drive_reverse: 77 | ldr $0,A 78 | out {arduino_7},A 79 | out {arduino_8},A 80 | out {arduino_9},A 81 | out {arduino_10},A 82 | jmp loop 83 | -------------------------------------------------------------------------------- /programs/Rotary Encoder.asm: -------------------------------------------------------------------------------- 1 | ; Incremental rotary encoder with pins CLK on Arduino 2 and DT on Arduino 3 2 | 3 | ; Setup timer 0 for 20 millis for "debounce" 4 | ldr {milliseconds},A 5 | out {timer_unit_0},A 6 | ldr #20,A 7 | out {timer_count_0},A 8 | 9 | loop: 10 | jsr update_encoder 11 | 12 | ldr [rotation],A 13 | out {seven_segment_0},A 14 | 15 | jmp loop 16 | 17 | 18 | ; Update the rotation variable based on the encoder 19 | update_encoder: 20 | push A 21 | push B 22 | push H 23 | 24 | ; Load previous rotation 25 | ldr [rotation],H 26 | 27 | ; Check if rotation event has occured 28 | in {arduino_2},A 29 | jr update_encoder_done,nZ 30 | ldr [prevCLK],B 31 | cmp B 32 | jr update_encoder_done,Z 33 | 34 | ; Update rotation value 35 | in {arduino_3},B 36 | cmp B 37 | jr update_encoder_ccw,nZ 38 | dec H 39 | jr update_encoder_changed 40 | update_encoder_ccw: 41 | inc H 42 | update_encoder_changed: 43 | 44 | ; Debounce 45 | out {timer_0},B 46 | update_encoder_debounce: 47 | in {timer_0},B 48 | jr update_encoder_debounce,Z 49 | 50 | ; Store new values 51 | update_encoder_done: 52 | str [prevCLK],A 53 | str [rotation],H 54 | 55 | pop H 56 | pop B 57 | pop A 58 | ret 59 | 60 | data 61 | prevCLK: var 62 | rotation: var -------------------------------------------------------------------------------- /programs/Serial Parot in C.c: -------------------------------------------------------------------------------- 1 | // Serial Parrot C program for LM-8 architecture 2 | 3 | extern void write(unsigned int port, unsigned int value); 4 | extern unsigned int read(unsigned int port); 5 | extern void draw_sprite(unsigned int x, unsigned int y, char* sprite); 6 | extern void draw_pixel(unsigned int x, unsigned int y, unsigned int color); 7 | extern void print(char* string); 8 | 9 | int main() { 10 | // Echo serial input 11 | while (1) { 12 | if (read(1)) { 13 | write(0, read(0)); // Echo character 14 | write(1, 0); // Pop char from input buffer 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /programs/Serial Parot.asm: -------------------------------------------------------------------------------- 1 | ; Serial Parot --- Parots anything recieved over UART back over UART 2 | 3 | jmp program 4 | 5 | include "libraries/Serial.asm" 6 | 7 | message: db "Say something!\n",$0 8 | 9 | program: 10 | jsr setup_serial 11 | 12 | ldr =message,l 13 | jsr print_string 14 | 15 | loop: 16 | in {serial_available},A 17 | jr loop,Z 18 | in {serial},A 19 | out {serial_available},A 20 | out {serial},A 21 | jr loop 22 | -------------------------------------------------------------------------------- /programs/Servo Wave.asm: -------------------------------------------------------------------------------- 1 | ; Servo Wave --- Example using a PCA9685 I2C PWM expander to control 12 servos in a "wave" motion 2 | 3 | jmp main 4 | 5 | include "libraries/PCA9685.asm" 6 | 7 | 8 | main: 9 | ldr $40,A 10 | str [pwm_expander_addr],A 11 | 12 | ; Reset expander 13 | jsr pwm_expander_reset 14 | 15 | ; Set prescaler to produce ~60 Hz for servo control 16 | ldr #122,A 17 | jsr pwm_expander_set_prescaler 18 | 19 | ; Setup timer 0 for 200 ms delay 20 | ldr {milliseconds},B 21 | out {timer_unit_0},B 22 | ldr #200,B 23 | out {timer_count_0},B 24 | 25 | ; Set initial PWM duty cycle 26 | ; Assuming servo accepts 600 to 2400 microsecond pulse length range for full range of motion 27 | ; For those pulse lengths, the duty cycle value range is from 9 to 37 at 60 Hz 28 | ldr #9,B 29 | 30 | 31 | loop: 32 | 33 | ; Set servo values on all 12 channels 34 | ldr #0,A 35 | set_servos: 36 | jsr pwm_expander_set_pin 37 | 38 | ; 200 ms delay 39 | out {timer_0},H 40 | delay: 41 | in {timer_0},H 42 | jr delay,Z 43 | 44 | inc A 45 | cmp #12 46 | jr set_servos,nZ 47 | 48 | ; Flip servo direction 49 | ldr #9,A 50 | cmp B 51 | jr flip_9,Z 52 | ldr #9,B 53 | jr flip_done 54 | flip_9: 55 | ldr #37,B 56 | flip_done: 57 | 58 | jmp loop 59 | -------------------------------------------------------------------------------- /programs/Servo.asm: -------------------------------------------------------------------------------- 1 | ; Servo test --- A worse version of the Arduino sweep example 2 | 3 | ; Set servo pin (Arduino 3) to output mode 4 | ldr $3,B 5 | out {arduino_output},B 6 | 7 | ; Setup timer 0 for 20ms cycles 8 | ldr {milliseconds},A 9 | out {timer_unit_0},A 10 | ldr #20,A 11 | out {timer_count_0},A 12 | 13 | ; Setup timer 1 for pulse 14 | ldr {centimilliseconds},A 15 | out {timer_unit_1},A 16 | 17 | loop: 18 | ; Reset timer 0 19 | out {timer_0},B 20 | 21 | ; Set Servo pin high 22 | ldr $1,B 23 | out {arduino_3},B 24 | 25 | ; Wait for pulse length 26 | out {timer_count_1},A 27 | out {timer_1},B 28 | pulse: 29 | in {timer_1},B 30 | jr pulse,Z 31 | 32 | ; Set Servo pin low 33 | ldr $0,B 34 | out {arduino_3},B 35 | 36 | ; Wait for next cycle 37 | finish_cycle: 38 | in {timer_0},B 39 | jr finish_cycle,Z 40 | 41 | inc A 42 | cmp #250 43 | jr not_reset,nZ 44 | ldr #50,A 45 | not_reset: 46 | 47 | jr loop -------------------------------------------------------------------------------- /programs/Simulator Test.asm: -------------------------------------------------------------------------------- 1 | ; Simulator Test 2 | 3 | ; Load and store operations 4 | ldr $FF,A 5 | str [var0],A 6 | ldr [var0],B 7 | ldr $EE,A 8 | lda var0 9 | ina 10 | str [HL],A 11 | ldr [HL],B 12 | dea 13 | ldr [HL],A 14 | 15 | ; Arithmatic opertions 16 | inc A 17 | inc B 18 | inc H 19 | inc L 20 | dec A 21 | ina 22 | dea 23 | add $FF 24 | add B 25 | adc $1 26 | adc H 27 | sub $1 28 | sub L 29 | sbc $1 30 | sbc A 31 | and $3 32 | and H 33 | or $4 34 | or B 35 | xor $F 36 | xor A 37 | cmp $0 38 | inc A 39 | cmp A 40 | 41 | ; Branching and subroutines 42 | label0: 43 | jmp label1 44 | halt 45 | label1: 46 | lda label2 47 | jmp HL 48 | halt 49 | label2: 50 | ldr $0,A 51 | jr label5,nZ 52 | jr label3,Z 53 | halt 54 | label3: 55 | ldr $1,A 56 | jr label5,Z 57 | jr label4,nZ 58 | halt 59 | label4: 60 | jsr label6 61 | jr label7 62 | halt 63 | label5: 64 | halt 65 | label6: 66 | ret 67 | halt 68 | label7: 69 | 70 | ; Stack functionality 71 | ldr $FF,A 72 | ldr $EE,B 73 | push A 74 | push B 75 | pop A 76 | pop B 77 | 78 | ; Port instructions 79 | in {rand},A 80 | out {seven_segment_0},A 81 | ldr {rand},A 82 | in H 83 | ldr {seven_segment_1},A 84 | out H 85 | 86 | halt 87 | 88 | data 89 | var0: var 90 | var1: var 91 | -------------------------------------------------------------------------------- /programs/Telnet Display.asm: -------------------------------------------------------------------------------- 1 | ; Telnet Dislay --- A demo of the modem telnet functionality using the I2C LCD peripheral 2 | 3 | jmp main 4 | 5 | include "libraries/LCD.asm" 6 | include "libraries/Modem.asm" 7 | 8 | 9 | main: 10 | ; Initialize LCD 11 | ldr $27,A 12 | str [lcd_addr],A 13 | jsr lcd_init 14 | jsr lcd_backlight_on 15 | 16 | ; Initialize modem with telnet server 17 | jsr modem_setup_telnet 18 | 19 | ; Display modem IP on LCD 20 | jsr modem_get_ip 21 | lda modem_ip 22 | ldr #1,A 23 | ldr #4,B 24 | jsr lcd_set_cursor 25 | jsr lcd_print_string 26 | 27 | loop: 28 | ldr $10,A 29 | jsr delay_milliseconds 30 | 31 | ; Display received string to LCD and echo to client 32 | jsr modem_receive_string 33 | jr loop,nZ 34 | lda modem_received_string 35 | jsr lcd_clear 36 | ldr #1,A 37 | ldr #4,B 38 | jsr lcd_set_cursor 39 | jsr lcd_print_string 40 | jsr modem_send_string 41 | 42 | jmp loop 43 | -------------------------------------------------------------------------------- /programs/Ultrasonic.asm: -------------------------------------------------------------------------------- 1 | ; Ultrasonic sensor test --- Measures the distance and outputs the number of decimillis to HEX0 2 | ; Doesn't work yet 3 | 4 | ldr $2,H 5 | out {arduino_output},H 6 | 7 | ; Setup timer 0 for 10 microseconds 8 | ldr {microseconds},A 9 | out {timer_unit_0},A 10 | ldr $10,A 11 | out {timer_count_0},A 12 | 13 | ; Setup timer 1 for measuring echo and timeout 14 | ldr {decimilliseconds},A 15 | out {timer_unit_1},A 16 | 17 | loop: 18 | ; Set Trigger high 19 | ldr $1,A 20 | out {arduino_2},A 21 | 22 | ; 10 microsecond delay 23 | out {timer_0},A 24 | trigger_delay: 25 | in {timer_0},A 26 | jr trigger_delay,Z 27 | 28 | ; Set Trigger low 29 | ldr $0,A 30 | out {arduino_2},A 31 | 32 | ; Wait for Echo start 33 | ldr $FF,A 34 | out {timer_count_1},A 35 | out {timer_1},A 36 | echo_start: 37 | in {timer_1},A 38 | jr loop,nZ 39 | in {arduino_3},A 40 | jr echo_start,Z 41 | 42 | ; Measure Echo time in B 43 | ldr $1,A 44 | out {timer_count_1},A 45 | ldr $0,B 46 | measure: 47 | out {timer_1},A 48 | measure_wait: 49 | in {timer_1},A 50 | jr measure_wait,Z 51 | inc B 52 | in {arduino_3},A 53 | jr measure,Z 54 | 55 | ; Output to HEX0 56 | out {seven_segment_0},B 57 | 58 | jmp loop 59 | 60 | halt 61 | -------------------------------------------------------------------------------- /programs/images/lm8.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/programs/images/lm8.bin -------------------------------------------------------------------------------- /programs/images/lm8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/programs/images/lm8.png -------------------------------------------------------------------------------- /programs/libraries/Graphics.asm: -------------------------------------------------------------------------------- 1 | ; Graphics utilities 2 | 3 | include "Math.asm" 4 | 5 | 6 | ; Draws sprite from [HL] at (B,A) 7 | draw_sprite_software: 8 | push A 9 | push B 10 | push H 11 | push L 12 | 13 | str [graphics_temp_],B 14 | ldr $0,B 15 | draw_sprite_software_loop_: 16 | push A 17 | 18 | ; Calculate Y 19 | push B 20 | push A 21 | push B 22 | pop A 23 | ldr $8,B 24 | jsr divide 25 | push A 26 | pop B 27 | pop A 28 | add B 29 | pop B 30 | 31 | push B 32 | 33 | ; Calculate X 34 | push A 35 | push B 36 | pop A 37 | ldr $8,B 38 | jsr modulus 39 | ldr [graphics_temp_],B 40 | add B 41 | push A 42 | pop B 43 | pop A 44 | 45 | ; Draw pixel 46 | out {graphics_x},B 47 | out {graphics_y},A 48 | ldr [HL],A 49 | ina 50 | out {draw_pixel},A 51 | 52 | pop B 53 | 54 | inc B 55 | ldr #64,A 56 | cmp B 57 | pop A 58 | jr draw_sprite_software_loop_,nZ 59 | 60 | pop L 61 | pop H 62 | pop B 63 | pop A 64 | ret 65 | 66 | 67 | data 68 | ; Temporary variable for graphics subroutines 69 | graphics_temp_: var 70 | -------------------------------------------------------------------------------- /programs/libraries/SPI.asm: -------------------------------------------------------------------------------- 1 | ; SPI serial utilities 2 | 3 | def clk={gpio_4} 4 | def miso={gpio_5} 5 | def mosi={gpio_6} 6 | 7 | 8 | ; Todo: Remove delay NOPs if not needed 9 | 10 | 11 | ; Setup the pins for SPI communication 12 | setup_spi: 13 | push A 14 | 15 | ldr #4,A 16 | out {gpio_output},A 17 | ldr #6,A 18 | out {gpio_output},A 19 | 20 | ldr $0,A 21 | out {clk},A 22 | 23 | pop A 24 | ret 25 | 26 | 27 | ; Receive a byte from the currently enabled SPI device in A 28 | spi_receive_byte: 29 | push B 30 | push H 31 | ldr $1,H 32 | out {mosi},H 33 | ldr $0,A 34 | ldr $8,B 35 | spi_receive_byte_loop_: 36 | ldr $1,H 37 | out {clk},H 38 | nop 39 | nop 40 | nop 41 | lsl 42 | in {miso},H 43 | or H 44 | ldr $0,H 45 | out {clk},H 46 | dec B 47 | jr spi_receive_byte_loop_,nZ 48 | pop H 49 | pop B 50 | ret 51 | 52 | 53 | ; Send a single byte to the currently enabled SPI slave from A 54 | spi_send_byte: 55 | push A 56 | push B 57 | nop 58 | nop 59 | nop 60 | ldr $8,B 61 | spi_send_byte_loop_: 62 | lsl 63 | push A 64 | jr spi_send_bit_1_,C 65 | ldr $0,A 66 | jr spi_send_byte_bit_ 67 | spi_send_bit_1_: 68 | ldr $1,A 69 | spi_send_byte_bit_: 70 | jsr spi_send_bit 71 | pop A 72 | dec B 73 | jr spi_send_byte_loop_,nZ 74 | nop 75 | nop 76 | nop 77 | pop B 78 | pop A 79 | ret 80 | 81 | 82 | ; Send a single bit in A to the currently enabled SPI slave 83 | spi_send_bit: 84 | push B 85 | out {mosi},A 86 | ldr $1,B 87 | out {clk},B 88 | nop 89 | nop 90 | nop 91 | ldr $0,B 92 | out {clk},B 93 | pop B 94 | ret 95 | -------------------------------------------------------------------------------- /programs/libraries/Serial.asm: -------------------------------------------------------------------------------- 1 | ; Serial utility functions 2 | 3 | 4 | ; Setup UART pins and output a null byte to prevent the first byte being corrupted 5 | setup_serial: 6 | push A 7 | 8 | ldr $1,A 9 | out {arduino_output},A 10 | out {serial_enable},A 11 | ldr $0,A 12 | out {serial},A 13 | 14 | pop A 15 | ret 16 | 17 | 18 | ; Print a null terminated string from [L] 19 | print_string: 20 | push H 21 | 22 | ldr $0,H 23 | jsr print_string_extended 24 | 25 | pop H 26 | ret 27 | 28 | 29 | ; Print a null terminated string from [HL] 30 | print_string_extended: 31 | push A 32 | push H 33 | push L 34 | 35 | print_string_extended_loop_: 36 | ldr [hl],a 37 | jr print_string_extended_done_,z 38 | out {serial},a 39 | ina 40 | jr print_string_extended_loop_ 41 | print_string_extended_done_: 42 | 43 | pop L 44 | pop H 45 | pop A 46 | ret 47 | 48 | 49 | ; Clears the serial receive buffer 50 | serial_clear_buffer: 51 | push A 52 | 53 | serial_clear_buffer_loop_: 54 | out {serial_available},A 55 | in {serial_available},A 56 | jr serial_clear_buffer_loop_,nZ 57 | 58 | pop A 59 | ret 60 | -------------------------------------------------------------------------------- /programs/sprites/apple.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/programs/sprites/apple.bin -------------------------------------------------------------------------------- /programs/sprites/apple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/programs/sprites/apple.png -------------------------------------------------------------------------------- /programs/sprites/face.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/programs/sprites/face.bin -------------------------------------------------------------------------------- /programs/sprites/face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/programs/sprites/face.png -------------------------------------------------------------------------------- /programs/sprites/snake_body.bin: -------------------------------------------------------------------------------- 1 | 888888 888888 888888 888888 888888 888888 -------------------------------------------------------------------------------- /programs/sprites/snake_body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/programs/sprites/snake_body.png -------------------------------------------------------------------------------- /programs/sprites/snake_head.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/programs/sprites/snake_head.bin -------------------------------------------------------------------------------- /programs/sprites/snake_head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheLogicMaster/lm8/8f75c0c0b269f699fc3ba574b20ceb1ff86a1b61/programs/sprites/snake_head.png -------------------------------------------------------------------------------- /simulation/.gitignore: -------------------------------------------------------------------------------- 1 | fpga/ 2 | -------------------------------------------------------------------------------- /simulation/adc_controller.vhd: -------------------------------------------------------------------------------- 1 | -- DE10-Lite ADC implementation that maps the top 8 bits of each ADC 2 | 3 | library ieee; 4 | use ieee.std_logic_1164.all; 5 | 6 | architecture impl of ADC_dummy is 7 | signal channel0, channel1, channel2, channel3, channel4, channel5 : std_logic_vector(11 downto 0); 8 | begin 9 | adc : ieee.adc 10 | port map ( 11 | CLOCK => adc_clk, 12 | RESET => '0', 13 | CH0 => channel0, 14 | CH1 => channel1, 15 | CH2 => channel2, 16 | CH3 => channel3, 17 | CH4 => channel4, 18 | CH5 => channel5 19 | ); 20 | 21 | ch0 <= channel0(11 downto 4); 22 | ch1 <= channel1(11 downto 4); 23 | ch2 <= channel2(11 downto 4); 24 | ch3 <= channel3(11 downto 4); 25 | ch4 <= channel4(11 downto 4); 26 | ch5 <= channel5(11 downto 4); 27 | end architecture; 28 | -------------------------------------------------------------------------------- /simulation/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Compiles the project 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | source "${SCRIPT_DIR}/env.sh" 9 | 10 | ( 11 | cd "${PROJECT}" 12 | 13 | "${QUARTUS_DIR}/quartus_map${EXT}" LogisimToplevelShell --optimize=area 14 | "${QUARTUS_DIR}/quartus_sh${EXT}" --flow compile LogisimToplevelShell 15 | ) 16 | -------------------------------------------------------------------------------- /simulation/compile_and_flash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Compiles the project and flashes the dev board 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | source "${SCRIPT_DIR}/env.sh" 9 | 10 | "${SCRIPT_DIR}/compile.sh" 11 | 12 | "${SCRIPT_DIR}/flash.sh" 13 | -------------------------------------------------------------------------------- /simulation/debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Opens the project in Quartus for debugging 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | source "${SCRIPT_DIR}/env.sh" 9 | 10 | "${QUARTUS_DIR}/quartus${EXT}" "${PROJECT_EXT}/LogisimToplevelShell.qpf" 11 | -------------------------------------------------------------------------------- /simulation/env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Source this file to load project environment variables 4 | 5 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 6 | 7 | PROJECT="${SCRIPT_DIR}/fpga" 8 | 9 | if grep -q Microsoft /proc/version; then 10 | # WSL variables 11 | QUARTUS_DIR_EXT='C:\intelFPGA_lite\20.1\quartus\bin64' 12 | 13 | QUARTUS_DIR="$(wslpath "${QUARTUS_DIR_EXT}")" 14 | WORKSPACE_EXT="$(wslpath -m "$(wslpath "$(wslvar USERPROFILE)")")"/logisim_evolution_workspace/simulation/main 15 | WORKSPACE="$(wslpath "${WORKSPACE_EXT}")" 16 | EXT=".exe" 17 | PROJECT_EXT="$(wslpath -m "${PROJECT}")" 18 | else 19 | # Linux variables 20 | QUARTUS_DIR=/mnt/Storage/Syncronized/Programs/Linux/Quartus-Prime/quartus/bin 21 | 22 | WORKSPACE="$(realpath ~/logisim_evolution_workspace/simulation/main)" 23 | EXT="" 24 | QUARTUS_DIR_EXT="${QUARTUS_DIR}" 25 | PROJECT_EXT="${PROJECT}" 26 | WORKSPACE_EXT="${WORKSPACE}" 27 | fi 28 | -------------------------------------------------------------------------------- /simulation/flash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Flashes the dev board with the compiled project 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | source "${SCRIPT_DIR}/env.sh" 9 | 10 | ( 11 | cd "${PROJECT}" 12 | 13 | # Flash dev board 14 | CABLE="$([[ $("${QUARTUS_DIR}/quartus_pgm${EXT}" --list) =~ ^([0-9]\)\ )(.+\]) ]] && echo ${BASH_REMATCH[2]})" 15 | "${QUARTUS_DIR}/quartus_pgm${EXT}" -c "${CABLE}" -m jtag -o "P;LogisimToplevelShell.sof@1" 16 | ) 17 | -------------------------------------------------------------------------------- /simulation/incremental_flash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Patches the ROM and flashes the board, only compiling if project has yet to be compiled 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | source "${SCRIPT_DIR}/env.sh" 9 | 10 | if [ -z "$1" ] 11 | then 12 | echo "Usage: incremental_flash.sh " 13 | exit -1 14 | fi 15 | 16 | "${SCRIPT_DIR}/patch_rom.sh" "$1" 17 | 18 | if [ ! -f "${PROJECT}/LogisimToplevelShell.sof" ]; then 19 | "${SCRIPT_DIR}/compile.sh" 20 | else 21 | ( 22 | cd "${PROJECT}" 23 | "${QUARTUS_DIR}/quartus_cdb${EXT}" LogisimToplevelShell -c LogisimToplevelShell --update_mif 24 | "${QUARTUS_DIR}/quartus_asm${EXT}" LogisimToplevelShell 25 | ) 26 | fi 27 | 28 | "${SCRIPT_DIR}/flash.sh" 29 | -------------------------------------------------------------------------------- /simulation/patch_microcode.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Patches the project microcode 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | source "${SCRIPT_DIR}/env.sh" 9 | 10 | SWITCH=$(python3 "${SCRIPT_DIR}/rom_to_vhdl.py" "${SCRIPT_DIR}/../microcode.bin" 9 3) 11 | 12 | perl -0777 -i -pe "s/CASE[\w\W]*END CASE/CASE (Address) IS\n${SWITCH}\n END CASE/g" "${PROJECT}/vhdl/memory/ROMCONTENTS_Microcode_behavior.vhd" 13 | -------------------------------------------------------------------------------- /simulation/patch_rom.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Patches the project ROM with the specified program binary file 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | source "${SCRIPT_DIR}/env.sh" 9 | 10 | if [ -z "$1" ] 11 | then 12 | echo "Usage: patch_rom.sh " 13 | exit -1 14 | fi 15 | 16 | python3 "${SCRIPT_DIR}/rom_to_mif.py" "$1" "${PROJECT}/rom.mif" 17 | -------------------------------------------------------------------------------- /simulation/persistent_flash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Converts a compiled .SOF file to a .POF file and persistently flashes the dev board 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | source "${SCRIPT_DIR}/env.sh" 9 | 10 | # Convert programming file 11 | "${QUARTUS_DIR}/quartus_cpf${EXT}" -c "${PROJECT_EXT}/LogisimToplevelShell.sof" "${PROJECT_EXT}/LogisimToplevelShell.pof" 12 | 13 | ( 14 | cd "${PROJECT}" 15 | 16 | # Flash dev board 17 | CABLE="$([[ $("${QUARTUS_DIR}/quartus_pgm${EXT}" --list) =~ ^([0-9]\)\ )(.+\]) ]] && echo ${BASH_REMATCH[2]})" 18 | "${QUARTUS_DIR}/quartus_pgm${EXT}" -c "${CABLE}" -m jtag -o "P;LogisimToplevelShell.pof@1" 19 | ) 20 | -------------------------------------------------------------------------------- /simulation/rom.vhd: -------------------------------------------------------------------------------- 1 | -- ROM component that uses a Memory Initialization File to optimize build times 2 | 3 | library ieee; 4 | use ieee.std_logic_1164.all; 5 | 6 | library altera_mf; 7 | use altera_mf.altera_mf_components.all; 8 | 9 | entity rom is 10 | port 11 | ( 12 | Address : in std_logic_vector (14 downto 0); 13 | Clock : in std_logic; 14 | Data : out std_logic_vector (7 downto 0) 15 | ); 16 | end rom; 17 | 18 | architecture impl of rom is 19 | begin 20 | altsyncram_component : altsyncram 21 | generic map ( 22 | address_aclr_a => "NONE", 23 | clock_enable_input_a => "BYPASS", 24 | clock_enable_output_a => "BYPASS", 25 | init_file => "rom.mif", 26 | intended_device_family => "MAX 10", 27 | lpm_hint => "ENABLE_RUNTIME_MOD=YES,INSTANCE_NAME=prgm", 28 | lpm_type => "altsyncram", 29 | numwords_a => 32768, 30 | operation_mode => "ROM", 31 | outdata_aclr_a => "NONE", 32 | outdata_reg_a => "UNREGISTERED", 33 | widthad_a => 15, 34 | width_a => 8, 35 | width_byteena_a => 1 36 | ) 37 | port map ( 38 | address_a => Address, 39 | clock0 => Clock, 40 | q_a => Data 41 | ); 42 | 43 | end impl; 44 | -------------------------------------------------------------------------------- /simulation/rom_to_mif.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | 3 | # This script takes a ROM binary and outputs an Intel Memory Initialization Format file 4 | 5 | import sys 6 | 7 | 8 | def main(): 9 | if len(sys.argv) != 3: 10 | print('Usage: python3 rom_to_vhdl_switch.py ') 11 | exit(-1) 12 | 13 | f = open(sys.argv[1], 'rb') 14 | binary = f.read() 15 | f.close() 16 | 17 | f = open(sys.argv[2], 'w') 18 | f.writelines([ 19 | f"DEPTH = {0x8000};\n", 20 | "WIDTH = 8;\n", 21 | "ADDRESS_RADIX = HEX;\n", 22 | "DATA_RADIX = HEX;\n" 23 | "CONTENT\n", 24 | "BEGIN\n" 25 | ]) 26 | for address in range(len(binary)): 27 | f.write(f'{format(address, "02x")}: {format(binary[address], "02x")};\n') 28 | f.write("END\n") 29 | f.close() 30 | 31 | 32 | if __name__ == '__main__': 33 | main() 34 | -------------------------------------------------------------------------------- /simulation/rom_to_vhdl.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | 3 | # This script takes a RAW binary file, converts it to VHDL switch when statements and spits it out to STDOUT 4 | 5 | import sys 6 | 7 | 8 | def main(): 9 | if len(sys.argv) != 4: 10 | print('Usage: python3 binary_to_vhdl_switch.py ') 11 | exit(-1) 12 | address_size = int(sys.argv[2]) 13 | data_size = int(sys.argv[3]) 14 | if data_size == 0: 15 | print('Invalid data size') 16 | exit(-1) 17 | 18 | f = open(sys.argv[1], 'rb') 19 | binary = f.read() 20 | f.close() 21 | 22 | i = 0 23 | while i < len(binary): 24 | data = "" 25 | for j in range(data_size): 26 | data += format(binary[i], "02x") 27 | i += 1 28 | if int(data, 16) > 0: 29 | print(f' WHEN "{format(int((i - data_size) / data_size), "0" + str(address_size) + "b")}" => Data <= x"{data}";') 30 | print(' WHEN OTHERS => Data <= (OTHERS => \'0\');') 31 | 32 | 33 | if __name__ == '__main__': 34 | main() 35 | -------------------------------------------------------------------------------- /simulation/synthesize_and_flash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # synthesizes, compiles, and flashes the project to the dev board using the specified ROM file 4 | 5 | set -e 6 | 7 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" 8 | source "${SCRIPT_DIR}/env.sh" 9 | 10 | if [ -z "$1" ] 11 | then 12 | echo "Usage: synthesize_and_flash.sh " 13 | exit -1 14 | fi 15 | 16 | "${SCRIPT_DIR}/synthesize.sh" 17 | 18 | "${SCRIPT_DIR}/patch_rom.sh" "$1" 19 | 20 | "${SCRIPT_DIR}/compile.sh" 21 | 22 | "${SCRIPT_DIR}/flash.sh" 23 | -------------------------------------------------------------------------------- /vbcc/machines/lm8/machine.dt: -------------------------------------------------------------------------------- 1 | S8BS 2 | S8BU 3 | S16BSLE S16BSBE 4 | S16BULE S16BUBE 5 | S16BSLE S16BSBE 6 | S16BULE S16BUBE 7 | S32BSLE S32BSBE 8 | S32BULE S32BUBE 9 | S64BSLE S64BSBE 10 | S64BULE S64BUBE 11 | S32BIEEELE 12 | S64BIEEELE 13 | S64BIEEELE 14 | S16BULE S16BUBE 15 | 16 | 17 | --------------------------------------------------------------------------------