[Home]Nascom 2 Notes

HomePage | RecentChanges | Preferences

NASCOM 2 - notes

The Nascom 2 was a z80 based computer. I bought one in about 1980 and used it till 1986. Being Z80 microprocessor based, it can execute programs out of the RAM. Microchip micro Controllers execute the program out of Flash memory. I wanted to try out this way of working and Tommy Thorn's emulator would allow this. It is also extendable, as it is possible to build the code.

I found the SDCC small device C compiler, so the NASCOM emulator was an ideal platform to try it out. You write C code on a PC, compile it using SDCC and upload it to the Nascom emulator, using

  sdcc -mz80 --code-loc0x1000 --no-std-crt0 test.c
  ./virtual-nascom test.ihx 

The NASCOM 2 site is: http://www.nascomhomepage.com/#TheNascomRepository

Tommy Thorn has continued working on his NASCOM 2 emulator.

He has a version for X11, SDL1.2, and Javascript.

Tommy has a few versions using X11, SDL and JavaScript & web browser to do the graphics and keyboard. See https://github.com/tommythorn

Tommy has an SDL version at: https://github.com/tommythorn/virtual-nascom There is now a JavaScript Version. http://thorn.ws/jsnascom/jsnascom.html which is a tough ask. He also has a github on SDCC.

I hvas ported the NASCOM 2 to use SDL2 and is on my github: https://github.com/doug-h-rice

The Linux emulation is good as you have to compile it and I have a tool chain using SDCC for C code. ( http://sdcc.sourceforge.net/ )

I had built the UNIX emulator on Ubuntu using GCC having installed enough add on X11 packages. Eventually the Ubuntu updates broke this. Tommy ported this to work with SDL 1.2, which I ported to run on SDL2.

The other day I got the SDL1.2 version to build on Ubuntu, and on the Raspberry Pi after I installed SDL1.2 and SDL2. It did not run on Raspbarian stretch, so I ported it to SDL2.

See: http://www.dougrice.plus.com/nascom2 and https://github.com/doug-h-rice/virtual-nascom

For the Java script version I used FIREFOX to download the emulator to my desktop, and it runs.

Tommy wrote a JavaScript version.

I added some code to the JavaScript. I added a PORT 0xA with 4 LEDs which you could set using the emulator.

( http://www.dougrice.plus.com/nascom2/JavaScript%20Nascom%202%20Emulator_files/ns_use_chrome.htm )

Example of SDL version with tape recorder and 7 segment display experiment.

JavaScript NASCOM and SDCC

SDCC Small device C compiler allows C code and assembler code to be written on a PC and loaded onto the nascom emulator.

 usage: sdcc -V -mz80 --code-loc0x1000 --no-std-crt0 test_a.c

 The JavaScript NASCOM 2 simulator version works in Chrome / Firefox browser. ( 22/11/2014 )

   load test_a.ihx

 The reload button allows new code to be reloaded.

 see: http://www.dougrice.plus.com/nascom2/ for files.

 It is possible to patch the JavaScript to add ports and LED [NASCOM JAVASCRIPT]? 

SDCC - Assembler

To try writing in assembler the SDCC compiler can be used. Write a C program and use the -V to get the commands. Use the .asm file as a starter.

SDL version

See my github: https://github.com/doug-h-rice

http://www.dougrice.plus.com/nascom2/ has some files.

I modified xvirtualnascom.c for X11 and virtualnascom.c for the SDL version to load other Hex file formats and the output from SDCC the small device compiler. Hello World on a Nascom emulator!

Also see http://www.dougrice.plus.com/nascom2/test_a.c for an example C program with functions to allow printf and a function the get key presses called rin.

SDL version with added tape recoder

I added some functionality to add a tape recorder.

Tommy Thorn also amened his code at the same time.

z80 assembler

I found and used this one


I patched xvirtualnascom.c to load the hex files.

You can also use SDCC.


SDCC is the Small device compiler.

see: http://sdcc.sourceforge.net/

I used SDCC to build some C code to run on the Nascom.

See the C files in http://www.dougrice.plus.com/nascom2/

I need to patch the putchar() function to use the NAS-SYS routines so that printf works.

* usage: sdcc -mz80 --code-loc0x1000 --no-std-crt0 test.c
* gcc -Wall -c "%f"
#include <stdio.h>

/* code seems to start here, when I run E1000 */

  printf("Hello World!");
  return 1 ;

void putchar( char x ){
/* call nascom software interupt */  
	;x = x +1; use first parameter
	;ADD A	, #10;
  	RST	0x30;  		

My SDL2 code loads both .nas and .ihx file formats.

Selecting SDCC or Assembler code is done by selecting the right loader functions

I added a loader function for the HEX files. I modify the virtualnascom.c files to select what software rom is loaded when ./virtualnascom is started.

Some Links

nascom links:-




emulating z80 links:-

https://github.com/doug-h-rice/virtual-multicomp -- z80 emulator and SDCC




FPGA links:-

http://searle.wales/ - z80 multicomp




https://github.com/doug-h-rice/virtual-multicomp -- z80 emulator and SDCC


Here are a few notes about some dabbles with emulating the NASCOM 2 and using an assembler or SDCC compiler

Adding the tape recorder functionality makes it more enjoyable.

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited November 9, 2019 8:18 am by dougrice.plus.com