You are free to use this code under the terms of this MIT license. Comments and suggestions are welcome, and it is available for download from this repository.
https://github.com/breakintoprogram/lib-spectrum
If you do find this code useful, and wish to contribute, then feel free to buy me a ko-fi.
The code is generally written with readability in mind rather than performance, unless performance is the goal, such as the scroll routine.
The demos are in the following directory structure:
- .vscode
- launch.json – configuration file for the run / debug functionality in Visual Studio Code
- tasks.json – configuration file for the build task in Visual Studio Code
- Demo
- demo_scroll.z80 – a flicker and tear free 25fps tiled map vertical scroller with sprites
- demo_sprites.z80 – rudimentary sprite routine that demonstrates pre-shifted sprites
- demo_vector.z80 – demo for the vector graphics library
- demo_3d.z80 – rudimentary 3D engine that demonstrates the filled vector graphics library
- Lib
You can see these demos running in a JavaScript Spectrum emulator here
Compile the relevant demo from the Demo directory; the demo will then include required library files from the Lib directory.
Compilation Instructions
- Install and configure your toolchain (see this page for more details)
- Download lib-spectrum from github
- Start ZEsarUX from its application folder
- Open the folder Break Into Program / ZX Spectrum in Visual Studio Code
- Open a source file (i.e. demo_scroll.z80) from the Demo folder
- Select Terminal > Run Build Task from the top menu of Visual Studio Code.
- The file opened for edit in Visual Studio Code is the one built out.
- The code should compile with no errors and create a SNA file in the same folder as the source file. It will also create a LST file for the debugger.
- Select Debug > Run Without Debugging from the top menu of Visual Studio Code.
- The created SNA file will be sent to ZEsarUX and should start running.