Simple example demonstrating banked function calls, which allow code execution across different memory banks without manual bank switching. Note: Banked calls require the z88dk nightly snapshot from September 7th, 2025 or later.
- Debuggin capabilities with Dezog
- Problem matcher for error messages
- Relatively good intellisense
- Example Makefile
- Banked function calls
- Root Makefile: delegates build rules to the Makefile in the 'src' folder. This structure allows the project to scale, supporting additional folders with specialized Makefiles as needed.
-
build: output folder for the resulting .nex and accompanying .map and .lis file.
-
.vscode/launch.json: configuration of DeZog debugging options
-
.vscode/c_cpp_properties.json: configuration of the C extension in code for proper syntax checks
-
.vscode/tasks.json: configuration of the build task (launching the Makefile) with a problem matcher adapted to the output of Z88dk
-
.vscode/settings: settings of the editor, included the automatic launch of the building process
-
src: folder with source files. Object (.obj) and List (.lis) files are generated in this folder (but are excluded from version control in .gitignore).
-
src/zpgrama.inc: file for pragma output values that enable the customisation of the CRT (C runtime)
-
src/mmap.inc: This file defines the logical memory map for the project, specifying how code and data sections are organized across different banks and pages in the ZX Spectrum Next’s memory and its base address for that section in the target memory map. The address is typically encoded as 0xPPAAAA, where PP is the page and AAAA is the address in the memory map.
-
src/main.c: Example program calling two functions in different memory banks (factorial and fibonacci). The example shows how no wrapping to switch banks is necessary.
-
src/factorial.h: Header file declaring the factorial function, which shows the usage of the __banked qualifier.
-
src/fibonacci.h: Header file declaring the fibonacci function, which shows the usage of the __banked qualifier.
-
src/factorial.c: Implementation of the factorial function. To make it banked, simply add the
__bankedqualifier and use#pragma codesegto specify the memory page for placement; no other changes are required. -
src/fibonacci.c: Implementation of the fibonacci function. To make it banked, simply add the
__bankedqualifier and use#pragma codesegto specify the memory page for placement; no other changes are required.