# NTC BASIC Cross Compiler

**URL:** <https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807>\
**Category:** Programming\
**Created:** [October 12, 2026, 9:29am UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807 "2026-10-12T09:29:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhulien](https://forum.cpcwiki.eu/letter_avatar_proxy/v4/letter/z/ce7236/32.png) [@zhulien](https://forum.cpcwiki.eu/u/zhulien)\
**Post date:** [October 12, 2026, 9:29am UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/1 "2026-10-12T09:29:01Z")

</div>

Hi Everyone, long time no see.

I have a major update to NTC BASIC. What is NTC BASIC?

- It is a Z80 cross compiler than runs in the browser
- Its syntax is based on VB5 / VB6
- Supports up to 4mb RAM
- In my testing it is faster than SCCZ80 and Small C, but not yet faster than SDCC (likely it won’t be, but we are only the first release here, not 27 years down the track)
- Compiled code should run on CPC (targetted for 64kb, 128kb and larger) support for paging and overlays (multiload games from tape possible).
- CP/M support should be symbos-friendly (I hope) and MSX-friendly (I hope).

What is NTC? Native Threaded Code. It can run in Turbo Mode (interrupts disabled) or Normal Mode (interrupts enabled). In both modes, NMIs are bad - but CPC rarely uses them.

What is missing and should be coming soon?

- Better file support for AMSDOS? This i need help with.
- How to get directory info in a useful way?
- Floats?
- Compiled Sprites and a graphics library of some type

I’d love your feedback - I am aiming to make it the most useful BASIC for 8bit computers - pitty it’s not self-hosted, but who knows. Maybe it can run through the CPC-PI Link some day - semi-self-hosted.

Where can you get it?

> **[GitHub - PrimalNinja/ntc: Native Threaded Compiler for Z80](https://github.com/PrimalNinja/ntc)**
>
> Native Threaded Compiler for Z80

Tutorial here:

> **[ntc/docs/tutorial at master · PrimalNinja/ntc](https://github.com/PrimalNinja/ntc/tree/master/docs/tutorial)**
>
> master/docs/tutorial

Demo DSK images here:

> **[ntc/src/build/dsk at master · PrimalNinja/ntc](https://github.com/PrimalNinja/ntc/tree/master/src/build/dsk)**
>
> master/src/build/dsk

Julian

---

<div class="post-metadata">

**Author:** ![zhulien](https://forum.cpcwiki.eu/letter_avatar_proxy/v4/letter/z/ce7236/32.png) [@zhulien](https://forum.cpcwiki.eu/u/zhulien)\
**Post date:** [October 12, 2026, 12:16pm UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/2 "2026-10-12T12:16:38Z")

</div>

How did we get here?

About 20 years ago I had developed a VB5 / VB6 compiler (vbcc) partially in VB5 in so it could cross compile itself to assembly or another high level language. This worked well but I wasn’t happy with all calling conventions at the time for Z80 and the project halted at about 50% of the code generation. Besides that, it was a good working VB5 / VB6 parser (with a few missing parts).

About 10 years ago I had created the realtime JavaScript to Z80 POC (jscc) which showed that you can type a JavaScript subset and see Z80 code appear as you type - fully generated in the window on the right.

10 years or so ago I had created parts of Primal (cross platform Z80-os) - this i hope to finish one day, parts of MCP (multitasking additions to Locomotive BASIC).

A few years back I proved the NTC concept generating code (tinybasic) that was typically more readable and faster than most assembler coders could code - most here doesn’t mean experts - most experts will beat this compiler hands down.

2 days ago I brought them altogether with my AI friend and beat the hell out of what I had into shape. Converted the VB5 to JS - removed the ability to compile itself, removed the ability to compile to different target languages - focusing on Z80 and here is the result. Taking parts of vbcc, jscc, primal, mcp and this is what I have gotten so far.

Here outlines what I have planned or ideas - it is evolving quite quickly. If anyone can give me code for the fastest z80 floating point library, the fastest compiled sprites, the simplest good networking (M4? and Ethernet), filesystem info - then I can create libraries for NTC that make it really convenient for CPC programmers who want to code BASIC.

> <https://github.com/PrimalNinja/ntc/blob/master/docs/todo.md>

---

<div class="post-metadata">

**Author:** ![Gryzor](https://forum.cpcwiki.eu/user_avatar/forum.cpcwiki.eu/gryzor/32/7_2.png) [@Gryzor](https://forum.cpcwiki.eu/u/Gryzor)\
**Post date:** [October 12, 2026, 12:20pm UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/3 "2026-10-12T12:20:31Z")

</div>

That was a fun read​🙂

---

<div class="post-metadata">

**Author:** ![HAL6128](https://forum.cpcwiki.eu/user_avatar/forum.cpcwiki.eu/hal6128/32/782_2.png) [@HAL6128](https://forum.cpcwiki.eu/u/HAL6128)\
**Post date:** [October 12, 2026, 8:23pm UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/4 "2026-10-12T20:23:23Z")

</div>

Lots and huge effort done ( impressive ) and seems to be a nice and complete implementation of a modern Basic dialect. even inline assembly seems to be easy to do. Will give it a try. is random access on a Amsdos file system really possible or did I read something wrong?

---

<div class="post-metadata">

**Author:** ![zhulien](https://forum.cpcwiki.eu/letter_avatar_proxy/v4/letter/z/ce7236/32.png) [@zhulien](https://forum.cpcwiki.eu/u/zhulien)\
**Post date:** [October 12, 2026, 10:52pm UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/5 "2026-10-12T22:52:12Z")

</div>

Please give it a try. It generates code for multiple targets - random access is currently only available for CP/M. It is possible for AMSDOS etc, but I don’t know how to do it - at least not in a way that is compatible with floppy drivers, X-MASS, M4, Albiero etc.

Targets currently are:

cpc - bang the hardware, currenlty no loading after the program loads  
cpcmin - bang the hardware, but leaves firmware in place for filesystem access  
cpcfw - completely uses the firmware  
cp/m - works with CPC CP/M 2.2, CP/M Plus, should work on Symbos CP/M (I will try later) & MSX  
cpcfwrom, cpcminrom, cpcrom - you can build and gain up to 8kb program space by having all support keywords in ROM, still more space to grow also

Yes, that is 3 ROMs max, but it gives developers lots of options. They can have 4mb actual programs now in a modern BASIC with no turbo (if they like) and keywords on ROM - which is a bit slower than not on ROM as it needs a redirection to get there.

All models a user can choose to NOT build with turbo options - turbo isn’t just disabled interrupts btw, it is actually the direct threaded code model using the SP as the PC which gives it a lot of performance in some situations - and it does depend on your logic - you can switch between turbo and non-turbo modes on the fly if you build without turning off turbo. In ROM gives about 10T per call.

How does it do this? The compiler with turbo on, builds the keywords twice (they are in the ROMs twice). A standard mode and a turbo mode. during execution a thread can choose which mode to execute because the native threaded mode always calls the turbo version, but the same thread that can be executed non-natively has to execute the non-turbo mode. This was done for compatability and for when you actually want interrupts on. So, turbo mode is like interrupts off + more performance.

Youc an see some timings in the readme.

---

<div class="post-metadata">

**Author:** ![zhulien](https://forum.cpcwiki.eu/letter_avatar_proxy/v4/letter/z/ce7236/32.png) [@zhulien](https://forum.cpcwiki.eu/u/zhulien)\
**Post date:** [October 13, 2026, 11:07am UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/6 "2026-10-13T11:07:49Z")

</div>

Added more features - now you can code in flavours… VB5/VB6 being the default, but now also JavaScript and Locomotive BASIC.

It’s possible that Locomotive BASIC flavour will be more complete as more libraries are created, but for now, it still eases the process for those who don’t like to code in modern BASIC, or JS.

Note: you can mix Locomotive BASIC, JS and VB5 syntax in a single program - one flavour per file.

User Guide:

[ntc/docs/userguide.md at master · PrimalNinja/ntc · GitHub](https://github.com/PrimalNinja/ntc/blob/master/docs/userguide.md#16-compiler-directives-and-options) (scroll down a little to get to flavours)

JS Flavour:

> <https://github.com/PrimalNinja/ntc/blob/master/docs/js_flavour.md>

Locomotive Flavour:

> <https://github.com/PrimalNinja/ntc/blob/master/docs/locomotive_flavour.md>

I am working now on reorganising the ROMs for when you want to use the ROM targets (not yet put your program on ROM, but concerve memory by having runtime in ROM).

---

<div class="post-metadata">

**Author:** ![zhulien](https://forum.cpcwiki.eu/letter_avatar_proxy/v4/letter/z/ce7236/32.png) [@zhulien](https://forum.cpcwiki.eu/u/zhulien)\
**Post date:** [October 13, 2026, 4:35pm UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/7 "2026-10-13T16:35:05Z")

</div>

Lots more updates, I hope you like my City3D demo. note: the FPS is a bug, it’s fixed in the version on GitHub. It was also hard to film with my phone steady.

[![](https://forum.cpcwiki.eu/uploads/default/original/2X/7/73a2161a79d4d8ff46c6ff4a459a4548ee8af37e.jpeg "Amstrad CPC City3D demo coded in NTC BASIC") ](https://www.youtube.com/watch?v=BpjIF6fXGF0)

Music Witch Bias:

[![](https://forum.cpcwiki.eu/uploads/default/original/2X/4/49d0ea22276460ca4c45175c1ebcb8a3451ea74e.jpeg "Witch Bias") ](https://www.youtube.com/watch?v=McOficdv0uI)

---

<div class="post-metadata">

**Author:** ![Gryzor](https://forum.cpcwiki.eu/user_avatar/forum.cpcwiki.eu/gryzor/32/7_2.png) [@Gryzor](https://forum.cpcwiki.eu/u/Gryzor)\
**Post date:** [October 13, 2026, 5:13pm UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/8 "2026-10-13T17:13:23Z")

</div>

Really like that demo. Can it be controllable?

---

<div class="post-metadata">

**Author:** ![slider271](https://forum.cpcwiki.eu/user_avatar/forum.cpcwiki.eu/slider271/32/501_2.png) [@slider271](https://forum.cpcwiki.eu/u/slider271)\
**Post date:** [October 13, 2026, 5:24pm UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/9 "2026-10-13T17:24:43Z")

</div>

Sky Ranger comes to the CPC! Very impressive vector work.

---

<div class="post-metadata">

**Author:** ![zhulien](https://forum.cpcwiki.eu/letter_avatar_proxy/v4/letter/z/ce7236/32.png) [@zhulien](https://forum.cpcwiki.eu/u/zhulien)\
**Post date:** [October 13, 2026, 6:05pm UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/10 "2026-10-13T18:05:05Z")

</div>

Thanks, I thought it would be faster to not do hidden line removal - I am now having second throughts and will try a hidden line removal version - if i don’t have to draw 90% of building you cannot see, it should be faster.

---

<div class="post-metadata">

**Author:** ![zhulien](https://forum.cpcwiki.eu/letter_avatar_proxy/v4/letter/z/ce7236/32.png) [@zhulien](https://forum.cpcwiki.eu/u/zhulien)\
**Post date:** [October 13, 2026, 6:08pm UTC](https://forum.cpcwiki.eu/t/ntc-basic-cross-compiler/807/11 "2026-10-13T18:08:00Z")

</div>

CyborgOS is now created as a new project in there - it is very early stages, a few hours old - it allows you to run multiple CP/M type programs with a full 61KB each coded in NTC BASIC at the same time fully pre-emptive. I expect it to get faster, but it proved I can run multiple programs in different 64kb banks.

Instructions are here, you NEED at least 128kb to run a single 61kb program. 4mb in the current build gives 5 programs with lots of data, class and driver spots - but that’s being addressed. More than 5 are coming and more responsiveness coming.

> **[ntc/docs at master · PrimalNinja/ntc](https://github.com/PrimalNinja/ntc/tree/master/docs)**
>
> master/docs
