Git Product home page Git Product logo

virtual-nascom's Introduction

Virtual Nascom, Version 2.0, 2020-01-20

This is a version 2.0 of Virtual Nascom, yet another Nascom 2 emulator. There's emulation support for all(?) of the standard hardware and it runs nearly all of the software on the nascomhomepage.com (see KNOWN ISSUES below).

Version 1.9 switches from a (partially broken) X Window specific implementation to portable and more more robust SDL implementation. It also gained basic serial port support in the process.

Version 1.10 adds support for "natural" keyboard, that is, US keyboard events are translated into the equivalent Nascom keycombination.

INSTALLATION

Virtual Nascom should compile on all platform with SDL support, but has only been tested on macOS (10.12.4 and older) and various Linux versions.

Virtual Nascom depends on SDL2. For Ubuntu sudo apt install libsdl2-dev suffices.

To compile you may have to adapt the Makefile with the libraries you need and their path, but generally it should be enough to simply run

$ make

USAGE

Usage: ./virtual-nascom {flags} [NAS files]
           -i <file>       take serial port input from file (when tape led is on)
           -m <file>       use <file> as monitor (default is nassys3.nal)
           -v              verbose

Virtual Nascom expects to find nassys.nal (unless you changed the monitor using the -m option) and basic.nal upon startup. You can add files to be loaded by providing them as arguments at the end of the line.

For example to run Pac Man, run

$ ./virtual-nascom programs/e1000/pacman.nas

and type E1000 in the Nascom 2 window. Control with arrow keys.

The emulator conveniently dumps the memory state in memorydump.nas upon exit so one might resume execution later on.

The following keys are supported:

  • END - leaves a screendump in screendump
  • F4 - exits the emulator
  • F5 - toggles between stupidly fast and "normal" speed
  • F6 - force serial input on
  • F9 - resets the emulated Nascom
  • F10 - toggles between "raw" and "natural" keyboard emulation

All serial output is appended to serialout.txt which may be fed back in on a subsequent launch via the -i option.

CREDITS

A very crucial part of Virtual Nascom is the excellent Z-80 emulator from Yaze, Copyright (C) 1995,1998 Frank D. Cringle.

Thanks to Dene Carter for encouragement Thanks to Alan Cox for the pixel doubling

SOMETHING DIFFERENT

This repo includes a quick hack at a repackaging the Nascom font as an BDF file, for use in X11. Example usage:

$ cd BDF; mkfontdir; xset +fp $PWD; xset fp rehash
$ xterm -bg '#000' -fg '#0F0' -fn '-tommy-nascom-medium-r-normal--16-160-72-72-c-80-iso8859-1'

and enjoy the nostalgia :)

Known issues: should only be ~ 14 pixels tall, only the ASCII subset works, ~ and # looks funny, but that's Nascom.

TODO

  • Reconsider the name

  • Clean up code and document; improve UI

  • Allow for switching input and output file while running

  • Precise timings (a rough, but machine independent job should be easily done)

  • Emulate sound (requires precise timings)

KNOWN ISSUES

  • Galaxy Attack doesn't work on Virtual Nascom. As it does work on VNASCOM it must be an emulation bug.

virtual-nascom's People

Contributors

peterjensen avatar tommythorn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

virtual-nascom's Issues

Windows - Unable to clone repository due to name conflict

The file programs/e1000/ROM?-CGSARGON.NAS prevents cloning of the repository on Windows.
The ? in the name is illegal in windows and git clone fails because of it.
A simple rename would fix this e.g. ROM#-CGSARGON.NAS would be ok.

Build failure on Ubuntu (and presumably others too)

Compiling on Ubuntu Linux (and presumably other Linux versions, as this seems to be standard behaviour) I get the following errors:

gcc -std=c99 -lSDL2 virtual-nascom.o font.o simz80.o ihex.o -o virtual-nascom
virtual-nascom.o: In function sim_delay': virtual-nascom.c:(.text+0x147): undefined reference to SDL_UpdateTexture'
virtual-nascom.c:(.text+0x153): undefined reference to SDL_RenderClear' virtual-nascom.c:(.text+0x16b): undefined reference to SDL_RenderCopy'
virtual-nascom.c:(.text+0x177): undefined reference to SDL_RenderPresent' virtual-nascom.c:(.text+0x18a): undefined reference to SDL_Delay'
virtual-nascom.o: In function out': virtual-nascom.c:(.text+0xc34): undefined reference to SDL_PollEvent'
virtual-nascom.o: In function main': virtual-nascom.c:(.text.startup+0x36): undefined reference to SDL_Init'
virtual-nascom.c:(.text.startup+0x45): undefined reference to SDL_Quit' virtual-nascom.c:(.text.startup+0x71): undefined reference to SDL_CreateWindow'
virtual-nascom.c:(.text.startup+0x87): undefined reference to SDL_CreateRenderer' virtual-nascom.c:(.text.startup+0xa8): undefined reference to SDL_DestroyTexture'
virtual-nascom.c:(.text.startup+0xc9): undefined reference to SDL_CreateTexture' virtual-nascom.c:(.text.startup+0xf8): undefined reference to SDL_SetRenderDrawColor'
virtual-nascom.c:(.text.startup+0x104): undefined reference to SDL_RenderClear' virtual-nascom.c:(.text.startup+0x110): undefined reference to SDL_RenderPresent'
virtual-nascom.c:(.text.startup+0x123): undefined reference to SDL_SetHint' virtual-nascom.c:(.text.startup+0x139): undefined reference to SDL_RenderSetLogicalSize'
virtual-nascom.c:(.text.startup+0x336): undefined reference to SDL_GetError' virtual-nascom.c:(.text.startup+0x366): undefined reference to SDL_GetError'
virtual-nascom.c:(.text.startup+0x38a): undefined reference to SDL_GetError' virtual-nascom.c:(.text.startup+0x3bf): undefined reference to SDL_GetError'
collect2: error: ld returned 1 exit status
Makefile:14: recipe for target 'virtual-nascom' failed

This appears to be caused by placing the libraries for SDL before the object files on the command line. The following patch works for me:

diff --git a/Makefile b/Makefile
index a0df927..f6025e7 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ WARN=-Wall -Wno-parentheses
 CFLAGS=$(OPTIMIZE) $(WARN) $(shell sdl2-config --cflags)
 
 virtual-nascom: virtual-nascom.o font.o simz80.o ihex.o
-       $(CC) $(CWARN) $(shell sdl2-config --libs) $^ -o $@
+       $(CC) $(CWARN) $^ -o $@ $(shell sdl2-config --libs) 
 
 clean:
        rm -f *.o *~ core

Build error on Ubuntu

Compiling on Ubuntu Linux (and presumably other Linux versions, as this seems to be standard behaviour) I get the following errors:

gcc -std=c99 -lSDL2 virtual-nascom.o font.o simz80.o ihex.o -o virtual-nascom
virtual-nascom.o: In function sim_delay': virtual-nascom.c:(.text+0x147): undefined reference to SDL_UpdateTexture'
virtual-nascom.c:(.text+0x153): undefined reference to SDL_RenderClear' virtual-nascom.c:(.text+0x16b): undefined reference to SDL_RenderCopy'
virtual-nascom.c:(.text+0x177): undefined reference to SDL_RenderPresent' virtual-nascom.c:(.text+0x18a): undefined reference to SDL_Delay'
virtual-nascom.o: In function out': virtual-nascom.c:(.text+0xc34): undefined reference to SDL_PollEvent'
virtual-nascom.o: In function main': virtual-nascom.c:(.text.startup+0x36): undefined reference to SDL_Init'
virtual-nascom.c:(.text.startup+0x45): undefined reference to SDL_Quit' virtual-nascom.c:(.text.startup+0x71): undefined reference to SDL_CreateWindow'
virtual-nascom.c:(.text.startup+0x87): undefined reference to SDL_CreateRenderer' virtual-nascom.c:(.text.startup+0xa8): undefined reference to SDL_DestroyTexture'
virtual-nascom.c:(.text.startup+0xc9): undefined reference to SDL_CreateTexture' virtual-nascom.c:(.text.startup+0xf8): undefined reference to SDL_SetRenderDrawColor'
virtual-nascom.c:(.text.startup+0x104): undefined reference to SDL_RenderClear' virtual-nascom.c:(.text.startup+0x110): undefined reference to SDL_RenderPresent'
virtual-nascom.c:(.text.startup+0x123): undefined reference to SDL_SetHint' virtual-nascom.c:(.text.startup+0x139): undefined reference to SDL_RenderSetLogicalSize'
virtual-nascom.c:(.text.startup+0x336): undefined reference to SDL_GetError' virtual-nascom.c:(.text.startup+0x366): undefined reference to SDL_GetError'
virtual-nascom.c:(.text.startup+0x38a): undefined reference to SDL_GetError' virtual-nascom.c:(.text.startup+0x3bf): undefined reference to SDL_GetError'
collect2: error: ld returned 1 exit status
Makefile:14: recipe for target 'virtual-nascom' failed

This appears to be caused by placing the libraries for SDL before the object files on the command line. The following patch works for me:

diff --git a/Makefile b/Makefile
index a0df927..f6025e7 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ WARN=-Wall -Wno-parentheses
 CFLAGS=$(OPTIMIZE) $(WARN) $(shell sdl2-config --cflags)
 
 virtual-nascom: virtual-nascom.o font.o simz80.o ihex.o
-       $(CC) $(CWARN) $(shell sdl2-config --libs) $^ -o $@
+       $(CC) $(CWARN) $^ -o $@ $(shell sdl2-config --libs) 
 
 clean:
        rm -f *.o *~ core

problem with OUT (C),B

Hi Tommy
Think I've found another issue in the simz80.c code.

The OUT (C),B and OUT (C),C do not seem to output the correct value to the ports.

The 2 bits of code are

simx80.c

    case 0x41:            /* OUT (C),B */
        Output(lreg(BC), BC);
        break;

    case 0x49:            /* OUT (C),C */
        Output(lreg(BC), BC);
        break;

and should be

    case 0x41:            /* OUT (C),B */
        Output(lreg(BC), hreg(BC));
        break;

    case 0x49:            /* OUT (C),C */
        Output(lreg(BC), lreg(BC));
        break;

to ensure the correct value is sent to the out port

Stay safe
David

Errors in the simz80.c code

Hi - thanks for a brilliant Nascom 2 Emulator - allows me to test stuff before porting it to the real deal.

In checking the code I found some errors in simz80.c code.

Line 2198 - the INI command
It is decrementing the BC register but it should be just decrementing the B register, and it's not setting the Z flag.

Line 2203 - the OUTI command
The decrement of B is actually decrementing C and putting it in B
It should then be checking if B is zero.
Sethreg(BC, lreg(BC) - 1); should be Sethreg(BC, hreg(BC) - 1);
SETFLAG(Z, lreg(BC) == 0); should be SETFLAG(Z, hreg(BC) == 0);

Line 2228 - the IND command - same issue as with OUTI

Line 2234 - the OUTD command -same issue as with OUTI

Not sure if you are amending this file directly or still generating it from the perl script.

Kind regards
David

Special PocketCHIP support

The version of the chip branch works well, but it would be painful to merge.
I think what is needed is a more general key-remapping implementation, like
Xmodmap.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.