GPT To Plugin Migration

· In development
Current features in v0.9.41
Speccy Next Coding Coach — Public Preview teaches retro programming and produces files you can use on the target machine. In v0.9.41 you can build a first NextBASIC sprite entirely in memory, trace a faulty Z80 routine, convert artwork for the Spectrum Next, or mount a disk of your own graphics in SimCoupe. SAM Coupé has the most extensive specialist tools outside the native Next.
This is the feature set as of . Dedicated lessons guide the teaching. The graphics and BASIC generators use fixed encoding rules and known test files, so their output can be checked after a change.
Scope, sources and the active machine
Every request begins with a scope check. The coach works with the ZX Spectrum Next, selected systems represented by FPGA cores on the Kickstarter 3 (KS3) Next, CP/M and Adventuron. A Python sprite converter, a modern editor, source control, build automation or a continuous integration job is in scope when it helps create, test or deploy retro software. The coach redirects unrelated modern development requests.
The active FPGA core determines the machine being programmed. On a SAM core, the coach uses SAM BASIC and the SAM display modes. On a QL core, it uses SuperBASIC and QL facilities. NextBASIC, NextRegs, Layer 2, hardware sprites, DMA and Copper belong to the native Spectrum Next environment. If another core implements an extension, the coach identifies it as a feature of that core.
For exact ports, registers, memory maps, instructions, file layouts and ROM or operating-system behaviour, the coach consults reputable technical references where possible and labels details it cannot verify. It can explain a manual in its own words, analyse a short excerpt you supply or point you to legitimate documentation. It does not distribute copyrighted manuals or ROM images. Speccy Next Coding Coach is an independent Dystopian Pixel project and makes no claim of manufacturer endorsement or certification.
NextBASIC lessons and native program files
A first hardware sprite
The first exercise builds a standard 8-bit, 16×16 sprite pattern in RAM. At one byte per pixel it occupies 256 bytes. The listing transfers those bytes to sprite-pattern memory, enables hardware sprites and uses the full eight-parameter SPRITE s,x,y,p,f,rf,mx,my form. The sprite number selects the on-screen sprite to control. The pattern number selects the picture it displays.
The lesson explains the coordinates, visibility and other flags, relative-sprite settings and horizontal and vertical scaling. Moving the sprite means changing its hardware coordinates. Editing a pattern byte changes its appearance. Both changes can be tried with the supplied listing. External .SPR banks come later, once the learner can see what loading a pattern achieves.
Readable source and tokenised BASIC
A downloadable native .BAS contains tokenised NextBASIC. Checks can cover the +3DOS header and checksum, BASIC file type, declared length, tokenised lines and their agreement with the intended listing. When the coach can supply only readable source, it delivers a .TXT or .TXTBAS file and explains how to convert it on the Next. For a file named SOURCE.TXT, enter this command in NextZXOS.
.TXT2BAS SOURCE.TXT PROGRAM.BAS
The first filename is the source and the second is the tokenised output. Desktop tools with similar names have their own command-line options.
Z80 and Z80N teaching and debugging
Assembly lessons begin with bits, nibbles, bytes, binary and hexadecimal. They introduce 8-bit registers and register pairs before flags, comparisons and branches. Memory examples cover addresses, indirect addressing and little-endian storage. The learner then meets the stack, PUSH and POP, labels, CALL and RET, and the extra Z80N instructions available on the Next.
For an existing routine, the coach starts with its contract. What does the caller pass in, which registers and flags may change, who owns the memory, and what must the caller get back? It traces each fault to its cause, considers side effects and proposes the smallest correction that preserves the API and the surrounding code’s responsibilities. The answer explains how to exercise the corrected path and check the state on return. A wider redesign, if useful, is a separate suggestion.
Spectrum Next graphics and downloadable files
| Workflow | Files you receive | Recorded check |
|---|---|---|
| Layer 2 artwork | A 256×192 .SL2 screen, a 512-byte .PAL for a custom palette, a reconstructed PNG, metadata and companion NextBASIC source. The loader applies the palette before displaying the screen. | Both neutral artwork and a brightly coloured smoke image displayed with the intended colours on a physical Spectrum Next. |
| Hardware sprite sheets | 16×16 patterns in .SPR banks, a native .PAL, a preview, a manifest mapping each pattern to its bank, and a companion example. The export preserves the chosen transparent colour where applicable. | A sheet of 560 patterns produced eight banks of 64 and a final bank of 48. Rebuilding the sheet reproduced the preview. The first and last banks displayed on the Next. |
Both converters have repeatable regression examples. They rebuild previews from the written pixels and palette, so you can inspect the colours, pattern order and transparency that the machine will receive. The sprite workflow checks capacity before exporting a subset of a larger sheet.
Finding every part of a conversion
The coach checks the delivery against the requested files. For a multi-file job this can include native binaries, preview PNGs, metadata JSON, editable source, a tokenised program or a disk image. Each requested item must have an accessible file or an explicit explanation of why it is unavailable. A requested companion loader is supplied as a named download whenever it can be produced.
SAM Coupé MODE 4 and MODE 3 screens
The SAM converter fits source artwork to the chosen mode, selects colours from the native 128-colour lookup table and writes a SAM SCREEN$. Each mode uses 24,576 bytes of display data. The saved screen also carries the palette and display state needed to reproduce it.
| Mode | Native representation | What you can check |
|---|---|---|
MODE 4 · .SS4 | 256×192 pixels, four bits per pixel and two pixels per byte. The image uses 16 active SAM colours. | The PNG is decoded from the saved bytes. The native screen and its SAM BASIC loader have displayed the image from a mounted disk in SimCoupe. |
MODE 3 · .SS3 | 512×192 pixels, two bits per pixel, four active colours and 128 bytes per scanline. Encoding and decoding use the native 0, 2, 1, 3 pixel-code order. | A raw raster preview shows the stored pixels. A display-corrected preview shows their intended proportions. Fourteen screens passed file checks and their MGT slideshow ran in SimCoupe. |
With four colours, a small area of red or cyan can matter more to the picture than a large area of grey. MODE 3 palette selection protects those colour families while keeping genuinely greyscale artwork neutral. Both modes can include conversion metadata, a loader and a mountable disk image.
Native SAM BASIC and SAMDOS disk images
The SAM workflow writes an editable, tokenised program in SAM BASIC. You can list and edit this three-line MODE 4 loader on the machine.
10 MODE 4
20 LOAD "IMAGE" SCREEN$
30 PAUSE 0
For the SAM interpreter to edit and run those lines, the saved program includes its tokenised program area, numeric-variable area, editing gap and saved-state boundaries. The generator writes these directly in the SAM format. The NextZXOS text-conversion step belongs to the Spectrum Next workflow.
A standard .MGT disk image is 819,200 bytes. The packager writes SAMDOS directory entries for type 16 BASIC, type 19 CODE and type 20 SCREEN$. Validation reopens the completed image, compares its embedded data byte for byte with the standalone files and checks the BASIC boundaries. The runtime test mounts the disk in SimCoupe, loads and lists the program, edits a line, runs it and checks that the expected screen appears and the interpreter remains usable.
SAM MODE 4 game graphics and scrolling
Tiles, masked sprites and restoring the background
A packed 16×16 tile takes 128 bytes. The tiles and software-sprite frames share a native 16-entry SAM palette. Each 16×16 masked frame interleaves an AND mask with OR pixel data. A transparent pixel keeps the background colour already on screen. An opaque pixel replaces it. The SimCoupe examples draw several positions and frames, restore the patterned background and return control to BASIC.
The tilemap stores one unsigned byte per cell in row-major order, allowing up to 256 tile IDs. A 256×192 display holds 16 columns by 12 rows of these tiles, so the visible map needs 192 bytes. When a sprite moves away, the renderer reads the tile ID beneath it to find the correct background.
A camera in a larger world
The tested world is 32×24 tiles with a 16×12 viewport. Camera bounds keep the window inside the map. A sprite stays at a fixed screen position while the scenery moves and the camera offset identifies the world tile to restore underneath it.
In v0.9.41 each accepted camera move advances one 16-pixel tile in any of four directions. For horizontal movement, row-wise Z80 LDIR or LDDR shifts the existing bitmap and the renderer draws only the newly exposed column. For vertical movement it shifts the bitmap and draws the exposed row. The result was visibly faster in SimCoupe than redrawing all 192 visible tiles on every move. This is the current coarse-scrolling implementation.
Checking the test program’s memory before it runs
The v0.9.40 test loaded code and graphics at $4000 and extended through $4B53, overlapping SAM ROM/BASIC workspace beginning at $4B00. The corrected v0.9.41 block ends at $4A53. For this loading arrangement the build now checks that the block stays below $4B00. A larger test needs a deliberately managed memory layout.
Adventuron, CP/M and other retro platforms
Adventuron adventure authoring
Adventuron has dedicated teaching in its own language. Lessons start with a map, a starting location and connections, then add objects, scenery and inventory. Parser commands and matching lead into events, conditions and variables. The learner can use those to build a locked door, a puzzle and a win or loss condition, then debug the command or state change that drives it.
The worked regression connects three locations and uses a custom command and a Boolean state to solve a puzzle. Teaching also covers graphics, HTML export and 8-bit constraints. End-to-end validation from authoring through graphics and compilation to running an exported adventure on a retro target is still outstanding.
CP/M programming foundations
The coach explains the command processor (CCP), the BDOS operating-system calls and the BIOS hardware interface. A transient program normally starts at $0100. The lessons cover Page Zero, file control blocks, DMA buffers, sequential access in 128-byte logical records and the return values to check after BDOS calls. Hardware-specific advice is tied to the machine running CP/M. Practical build and debugging coverage is still being migrated.
Machine-specific guidance
| Target | Current coverage |
|---|---|
| Sinclair QL | Core-aware SuperBASIC, QDOS/Minerva-style operation, channels, windows and QL graphics. A regression checks QL core isolation. The wider QL development workflow is partially migrated. |
| ZX80 and ZX81 | General guidance keeps the two machines’ BASIC dialects, memory behaviour, hardware assumptions and machine-code environments distinct. Each has partial coverage. |
| BBC Micro and Master | The coach recognises BBC BASIC, the BBC memory model, graphics, sound and operating-system interfaces. Dedicated Micro/Master training is still partial. |
Testing and current coverage
The test record distinguishes designed behaviour from a generated file. A structurally validated file has passed format checks such as length, headers and internal boundaries. A host-tested workflow has been exercised on the development computer, for example by reopening an MGT and comparing its contents.
Emulator-tested identifies a run such as editing and executing the SAM loader in SimCoupe. Hardware-tested identifies an observation on a physical machine, such as the custom Layer 2 palette on a Spectrum Next. A frozen example is an accepted reference kept so that later changes can be tested against it.
Scope and core isolation, NextBASIC and assembly teaching, Next graphics and file delivery, and the SAM workflows above are the strongest areas in this preview. Adventuron, CP/M, low-level Next hardware guidance and wider development workflows are still being completed. The 19 November audit estimates that 69% of the original GPT’s capabilities have been migrated, with 31% remaining. New plugin work has its own roadmap, including smooth SAM scrolling, a Commodore 64 track and investigation of a suitable future Amstrad CPC core.
Read the migration audit and recorded tests ↗