[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 )

 http://thorn.ws/jsnascom/jsnascom.html  
   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

http://wwwhomes.uni-bielefeld.de/achim/z80-asm.html

I patched xvirtualnascom.c to load the hex files.

You can also use SDCC.

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 */

main(){
  printf("Hello World!");
  return 1 ;
}

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

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:-

https://groups.io/g/Nascom-Computers/wiki/home

https://nascom.wordpress.com/about/

https://tupel.jloh.de/nascom/magazines/

emulating z80 links:-

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

http://www.cpcmania.com/Docs/Programming/Introduction_to_programming_in_SDCC_Compiling_and_testing_a_Hello_World.htm

http://www.mdfsnet.f9.co.uk/Software/Z80/Exerciser/

https://github.com/feilipu/NASCOM_BASIC_4.7

FPGA links:-

http://searle.wales/ - z80 multicomp

https://www.retrobrewcomputers.org/doku.php?id=boards:sbc:multicomp:cycloneii-c:start

http://zx80.netai.net/grant/Multicomp/index.html

https://www.uelectronics.info/multigen.html

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

Conclusion

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
Search:
dougFooter