Nascom Emulator VNASCOM
=======================

Version 3.1
-----------

Welcome to the Nascom 1, Nascom 2 and Nascom 3 emulator for the 
MS-DOS/Windows operating system. 

Features of VNascom:
--------------------
- comprehensive emulation of the Nascom 1, 2 and 3 hardware,
  including single step logic, cassette, sound, NMI and Reset keys.
- input and output of Nascom cassettes as an audio signal or WAV file.
- PC keyboard translation for the US, UK, GERMAN, FRENCH, SWEDISH, DUTCH and
  DANISH keyboard layouts.
- automatic emulation speed adjustment.
- automatic cassette recorder emulation inclusive the Drive LED display.
- ability to create a screen snapshot as a windows compatible bitmap file.
- output redirection of the UART output to a printer (LPT1:) and RS-232 (COM1:).
- emulation of a parallel printer interface with the standard PIO
- emulation of the Nascom 2/3 Floppy Disk Controller board for use with 
  Nas-Dos 1 and CP/M Version 2.2.
- emulation of the Advanced Video Card (AVC) in monochrome high-res and
  colour low-res mode.
- Small 16 Bit MS-DOS executable (for real mode) to build a Virtual Nascom with
  a standard embedded PC motherboard (SBC) with 2 MByte DiskOnChip (FlashDisk).
- optional programmable graphics character generator

How to start:
-------------
VNascom can be used by starting the executable :
	VNASCOM.EXE
VNascom emulates a standard Nascom 2 with NASCOM ROM BASIC and 64 KB memory
if started without any parameters.
VNascom has limited support for Windows XP/NT/20000. If you are interested in
sound for games, or in audio cassette support, choose MS-DOS or Windows 9x
as your operating system. 

The get a listing of the advanced options of VNascom use:
	VNASCOM /?

How to end:
-----------
To end emulation use the F10 key.

How to work with VNascom:
-------------------------
To start VNascom as a Nascom 3 with a floppy disk drive and colour graphics:
	VNASCOM MOD=3
and to start VNascom as a CP/M capable Nascom 2 or 3:
        VNASCOM MOD=CPM
	to enable the 80 character display enter AVCTXT in CP/M.
and to start VNascom as a Nascom 1 use
	VNASCOM MOD=1

Some keyboard layouts are supported by VNascom for easy typing on text
oriented Nascom programs. Due to the complexity of this keyboard layout
translation, from a european keyboard PC layout to the original Nascom 
keyboard layout, the dynamic behavior on fast keyboard strokes differs from 
the translated to untranslated mode.
For all arcade type games, it is recommended to disable any keyboard
translation (default), but you may find it convenient to enable a
suitable keyboard translation for any serious(!) program like pascal, 
basic or naspen. Start VNascom with a suitable translation option:
e.g.	VNASCOM MOD=3 TRA=UK		for a UK keyboard	

For example, if you want to play SNOWBALL on an german keyboard, start 
VNascom mit the TRA=GER option:
	VNASCOM RAM=SNOWBALL.NAS TRA=GER KBD=E1000

	
VNascom uses, if available, the SVGA resolution (800*600 points 16 colours).
Under Windows XP/NT/2000 the standard VGA resolution is used. This VGA 
(640*480) resolution results in a compressed display of the Nascom screen.
It is strongly recommended to use the SVGA resolution under pure MS-DOS or
Windows 9x with the appropriate video hardware.

File list of vnascom.zip package:
---------------------------------
; Nascom 1, 2, 3 Emulator
VNASCOM.EXE		Nascom Emulator
NASSYS1.NAS		Nas-Sys 1 monitor (default for MOD=2)
NASSYS3.NAS		Nas-Sys 3 monitor (default for MOD=3)
NASBUGT2.NAS            Nas-Bug T2 monitor (default for MOD=1)  
NASDOS.NAS	        Nas-Dos 1 disk operating system (default for MOD=3) 
CPMBOOT.NAS		CP/M boot loader (default for MOD=CPM)
NASCHR.NAS		Character set, a combination of alpha and graphics rom
BASIC.NAS		Nascom ROM Basic 4.7 (default)
AVCBAS.NAS		AVC Nascom ROM Basic extention (default for MOD=3)
TAPE.CAS		Default Basic program. To load, enter "CLOAD". (#)
NASTEST.NAS		Z80 instruction exerciser. (#)
README.TXT		This file. (#)
FLOPPY.DSK              Default floppy disk image. (#)
                        Files on the image:
			DEMO		simple BASIC program
			AVCDEMO		draws coloured lines on the AVC
CPMV22.DSK		CP/M Version 2.2 Nascom Microcomputers 2.1 (#)
			distribution disk SSDD for 55 KByte TPA.
; SoundBlaster check utilities
PLAY.EXE		Plays a 8 Bit mono WAV file. (#)
RECORD.EXE		Records a 8 Bit mono WAV file. (#)
; VNascom cassettes utilities
PC2NAS.EXE		Send a Nascom file as cassette audio stream,
			or create a WAV file. (#)
NAS2PC.EXE		Receives a Nascom file from a cassette audio stream,
			or from a WAV file. (#)

; VNascom disk utilities
DSK.COM			Read and write DSK images of real floppy disks.
			For a standard PC use 3.5" 720KB floppy disks and
			not 1.44MB (the common format). 
(#)	optional file, not needed for basic operation of VNascom as model 2.

Filenames:
----------
VNascom is a 16 bit program and can't access long file names under Windows.
If you have a nascom program with a long file name, rename it to the old
8.3 MS-DOS standard or use the short file name instead (DIR /V). 
Example: The file "This_is_my_best_nascom_game.nas" can't be loaded. Rename it
         to "my_game.nas" !
Microsoft Internet Explorer users cannot directly download NAS files from 
The Nascom Homepage because this program changes the file type to .txt e.g.
????????.nas.txt.
You have to rename the file to ????????.nas for use with VNascom.


The VNascom options:
--------------------
VNascom emulates the Nascom hardware and runs the software of your choice.
To run a program, you have to know which operating system (Monitor) your
program needs to run it. For example, the Nascom ROM Basic BASIC.NAS runs on
four different monitors: NAS-BUG T2, NAS-BUG T4, NAS-SYS 1 and NAS-SYS 3.
Other programs will run only on one of them.
Example: The game REVERSI.NAS runs on NAS-SYS 1 and NAS-SYS 3
         To run REVERSI.NAS, VNascom needs the file NASSYS1.NAS or NASSYS3.NAS
	 and REVERSI.NAS. To run REVERSI.NAS start VNascom with:
	 
	 VNASCOM ROM=nassys1.nas RAM=reversi.nas KBD=E1000
	 
The parameter KBD=E1000 is optional. If given, the program is started at
address 1000. The KBD parameter simulates the keystrokes 'E' '1' '0' '0' '0'
at the start of VNascom. See the Nas-sys manuals for details.
	 
If no ROM file on the address range 0000-03FF is given, VNascom will use
NAS-SYS 1 as the default operating system. That works with the most of
the programs presented at The Nascom Homepage.

The advanced VNascom options are:

ROM=	: loads a NAS file as a read only memory (ROM) on a 1K Byte boundary.
          
RAM=	: loads a NAS file in the normal random access memory (RAM).

          example:
	  VNASCOM ROM=nassys3.nas ROM=basic.nas RAM=zeap10.nas
	  
	  VNascom loads Nas-sys 3, the Basic ROM and the Assembler Zeap in RAM.
	   
KBD=	: predefines keys that are automatically send to VNascom at startup.
	  example:
	  VNASOM ROM=nassys3.nas ROM=basic.nas KBD=J~

	  VNascom loads Nas-sys 3, the Basic ROM and sends the 'J' and
	  the 'ENTER' key to start basic.
	  The 'ENTER' key is mapped to '~' the 'SPACE' key is mapped to '_'.

	  One 'ENTER' key is automatically appended at the end of the KBD list.
	  The @ represents the start serial stream command character F9.
	  A control character, e.g. control-D can be defined with the '{'
	  prefix character. Example: {D 
	  
RST=	: set the power on jump address. This option is useful with 
          special NAS files assembled with that feature (e.g. BASIC.NAS, 
	  TOOLKIT.NAS, NASDOS.NAS, HOBBIT.NAS). Valid addresses are: 
              B000, C000, D000 and E000
	  example:
	  VNASCOM ROM=nassys3.nas ROM=basic.nas RST=E000

INP=	: assign the logical UART (cassette) input to a file or stream
OUT=	: assign the logical UART (cassette) output to a file or stream
          INP and OUT can be assigned to the same file or stream. 
	  Example:
	  VNASCOM ROM=nassys3.nas ROM=basic.nas INP=mybas.cas OUT=mybas.cas
	  
	  VNascom loads the Nas-sys 3 Monitor and the Nascom ROM Basic.
	  The cassette input and output are assigned to the file mybas.cas.
	  In VNascom use CLOAD and CSAVE "X" to load or save your basic program
	  mybas.cas as you would do that on the real Nascom.
	  If the file extention is WAV, e.g. MYGAME.WAV, the file is
	  interpreted or created as a standard WAV file 22050 Hz, 8Bit, mono 
	  with sampled cassette audio information.
	  VNascom accecpts also the following pseudo file names:
	  SND:		SoundBlaster input or output (e.g. INP=SND:)
	  LPT1:		Printer output (e.g. OUT=LPT1: )
	  COM1:		RS-232 input or output (e.g. INP=COM1:)
	  
TRA=	: defines a keyboard layout. The NAS Nascom layout is default, other
	  options are US, UK, GER, FRA, SWE, NED, DAN for the us, uk, german, 
	  french, swedish, dutch and danish keyboards. 
          That country list represents the main distribution area of the
	  Nascom products.
	  
	  The NAS keyboard layout uses the TAB key as the Nascom 2 GRAPH key.
	  On all keyboard layouts the CAPS-LOCK key acts as the Nascom 2
	  Graph key.
	  
MOD=	: sets the Nascom model to 1 = Nascom 1, 2 = Nascom 2 or 3 = Nascom 3.
	  The option 1 defines a 7 bit character set, the option 2,3 defines
	  a 8 bit character set. On a 7 bit character set the MSB (bit7) is 
	  ignored on the screen.
	  The model parameter also defines the virtual cassette interface.
	  The parameter mod=1 activates the Nascom 1 compatible cassette
	  interface mode with 244 Baud, and the parameter mod=2,3 activates the
	  Nascom 2/3 compatible cassette interface with two baud rate options
	  1200 Baud and 300 Baud (see F7 key and CBR definition below).
	  The Nascom 1 option displays 16 tv-lines per character and the 
	  Nascom 2 and Nascom 3 option displays 14 tv-lines per character. You
	  can override that display mode with the SHIFT-F8 key and with the
	  TVL= option.
	  CP/M Version 2.2 support:
	  The parameter MOD=CPM sets the memory map to the Nascom CP/M 
	  requirements boot loader at F000, video RAM at F800 and USER RAM at
	  FC00. The power on start address is set to F000. This parameter is
	  used with the CPMBOOT.NAS loader and the CPMV22.DSK disk image.

CBR=    : sets the baud rate for the virtual cassette interface. For the 
          Nascom 2/3 option MOD=2 or 3 use:
	  1200 or 300 Baud. Example: CBR=1200
          For Nascom 1 MOD=1 only 244 Baud is available.

SBR=    : sets the baud rate for the RS-232 input and output. The following
          values are valid for MOD=2 or 3:
	  2400, 1200, 300, 110 Baud.
	  On Nascom 1 only 110 is valid. Example: SBR=2400
	  
CHR=	: set an alternate character set if you have another character eprom
          file. This file describes both, the alpha character rom and the
	  optional graphics character rom. The resulted file defines
	  4 KByte of memory.

DSK=    : defines a floppy disk image file. Four different files can be 
          assigned with this option. The default file is floppy.dsk. 
	  Every disk image contains two sides and represents two logical
	  drives. See the Nasdos documentation for details.
          example:
	  VNASCOM DSK=mygames.dsk DSK=mytools.dsk
	  results four logical drives: 0,1,2,3 or two physical drives: 0,2

TVL=	  sets the number of tv-lines per character. Valid numbers are
          16 (default for Nascom 1), or 14 (default for Nascom 2,3)

@file	: load and use a configuration file instead of a parameter list.
	  example: 
	  VNASCOM @mygame.vn
	  
	  VNascom uses the configuration file mygame.vn which contains
	  a text line for each option described above.
	  content of an example file mygame.vn :
	  --------------------------------------
  	  ROM=nassys1.nas
	  ROM=basic.nas
	  RAM=mygame.nas
	  KBD=E1000
	  TRA=NAS
	  --------------------------------------	  

The keys in VNascom:
--------------------
F1	: resets the Z-80 CPU
F2	: Break key in Nascom Basic, NMI key in other programs.
F3	: creates a bitmap vnascom.bmp from the current screen.
F4	: toggle simulation speed: 4MHz, 2MHz and Turbo mode.
F5	: changes the UART output from file, printer (LPT1:), SoundBlaster SND:
          or RS-232 (COM1:). 
          The option is disabled while an output stream is active.
	  Some seconds after the end of a transmission, the option is
	  automatically enabled to select another output.
F6	: changes the UART input from file, RS-232 to SoundBlaster SND:.
          The option is disabled while an input stream is active.
F7	: changes the cassette baud rate 
             Nascom 1: MOD=1 only 244 Baud option available
             Nascom 2: MOD=2 values 1200 Baud or 300 Baud
F8	: toggle display of simulation speed: on, off. The display shows the
	  speed compared to a original 4MHz Nascom. The second value
	  shows the headroom of the emulator for additional processing CPU
	  power for each simulated Z80 opcode. A high value indicates a fast
	  host CPU, a low value (e.g. 0001) indicates a low speed CPU. 
F9	: opens the cassette input stream if the calling program
          reads from the UART without setting the DRIVE LED.
	  example:
	  VNASCOM ROM=nassys3.nas INP=readme.txt
	  
	  press F9 while in VNascom. The ASCII characters from 
	  readme.txt are send to NAS-SYS 3. This option can be used
	  with any nascom program, which scans the keyboard and the UART
	  to input data from the PC file system. For example a basic listing
	  as an ASCII file can be transferred to X-tal basic. Example:
	  File TEST.TXT:
	    10 INPUT A$
	    20 PRINT A$
	  can be transferred to xtal with:
	  VNASCOM RAM=XTAL.NAS INP=TEST.TXT
	  start X-tal with E1000, and press F9. The program is ready to
	  run or to be saved.  
	  
F10	: end VNascom, return to MS-DOS/Windows
F11	: toggle the baud rate for the RS-232 input/output on COM1:
F12	: toggle PC-Speaker or Soundblaster Sound. The Soundblaster
          is initialised in direct DAC mode without DMA. Some 'compatible'
	  cards or Soundblaster emulators have problems with that mode.
SHIFT-F6: switch the input for audio cassette signals from Line Input to
          Microphone. The UART input must be linked to SND: to use this option.
SHIFT-F8: switch the display mode from 16 to 14 tv-lines per character. The
          Nascom 1 displays 16 tv-lines per characters, the others 14. There
	  where several hardware modifications on the market to display 16
	  tv-lines per character also for the Nascom 2. 
SHIFT-F11 Volume decrease if SoundBlaster device is present.
SHIFT-F12 Volume increase if SoundBlaster device is present.
		
The status line:
----------------
The status line is visable at the bottom of the screen.
Any message on the status line is shown for some seconds and then
cleared to present an authentic emulation display.

HALT	: indicates the CPU is halted. Press F1=Reset or F2=NMI to
          continue.

DRIVE	: indicates that the DRIVE LED is activ. Any cassette tape
          load or save function will turn on the DRIVE LED. Some games
	  with sound output flashes the DRIVE LED due to the reason, that
	  the sound output bit is the same bit as the DRIVE LED.
	  
PIO->LPT1 : VNascom has detected, that a working printer is connected
          to the PC. Any output to the PIO will be redirected to the 
	  printer. 
	  The NASPRINT.NAS utility uses the PIO interface to print
	  to a non-standard parallel printer (centronics compatible). 
	  The standard Nascom printer was equipped with a serial interface
	  (300 Baud without handshake signals) connected to the UART.

UART->SND:
          The UART output is redirected to the virtual Cassette interface.
	  SND: is a shortname for SoundBlaster.
	  
UART->LPT1:
          The UART output is redirected to the printer port LPT1.

UART->COM1:
           The UART output is redirected to the COM1: RS-232 interface.
	   
UART->Filename:
           The UART output is redirected to a given filename.

Filename->UART:
           The UART input is linked to the given filename.

SND:->UART:
	   The Uart input is connected to the virtual Cassette interface.

COM1:->UART:
           The UART input is connected to the COM1: RS-232 interface.

4 MHz	: indicates VNascom is running at a equivalent speed of a 4 MHz Z80.
          Currently VNascom don't emulate the Wait state option, which would
	  decrease the Z80 timing by 30%. The Wait state option was common
	  on many Nascom 2's, because the Nascom 2 uses a ROM chip for the
	  8K ROM BASIC with very long access time (>= 450ns). The Nascom 2
	  uses a simple wait state generator with a delay for every memory 
	  request, but some german ECB (European Computer Bus) remakes uses 
	  the faster version with wait states on each M1 cycle (8% decrease). 
2 MHz	: the same, but 2 MHz
TURBO   : VNascom runs without any delays, on a modern PC at a much higher
          speed than a real Z80 microprocessor. See the F8 option above.

The environment vaiable OS is used to check if Windows NT/2000 is active. Under
Windows NT/2000 the value of that variable is OS=Windows_NT, which indicates
VNascom to use the standard VGA (640*480) video mode instead of the better
matching SVGA (800*600) video mode.
To force VNascom to use the standard VGA resolution on other operating systems,
it is possible to set the envionment variable before starting VNascom:

	SET OS=Windows_NT

VNascom needs at least a Pentium I 100Mhz computer to simulate a Z80 4 MHz
CPU in real time. This configuration is powerful enough to read 1200 Baud
Nascom cassettes in real time while running under Windows 9x. 

Reading Nascom cassettes with VNascom
-------------------------------------
VNascom is designed as a 16 Bit program to get an very small memory 
and disk usage. With an embedded single board computer, it is easy possible 
to build a Nascom clone on Intel x86 basis. 16 Bit applications can't get full
access to the hardware level in Windows NT/2000 environments due to their 
security model.
If you want to read or write Nascom cassettes, use pure MS-DOS or
Windows 9x/ME for running VNascom. 
On Windows NT/2000 you can use 3rd party SoundBlaster emulators, like
SoundFX or VDM-Sound, only for the output section. Maybe future releases will 
support a input functionality.
Several Soundcards are not initialised while running under pure MS-DOS.
These PnP or PCI cards needs a configuration utility, normally found on the
drivers CD, to configure the address, interrupt and DMA values. Without
that procedure, the card can't be accessed by a MS-DOS program.
Example: The ViBRA16X card is initialised by the CTCM.EXE utility and the 
blaster variable is set. VNascom can use the card without problems after
running the CTCM.EXE file. If you can't access the soundcard in MS-DOS or
Windows 9x, check the web site of your soundcard manufacturer to get the
latest driver version.
Example 1: My Compaq PIII computer, with Windows 2000, Windows 98 SE and MS-DOS
uses the C-Media CM8738 on board sound device. Result
on Windows 2000: 
   no cassette output, no cassette input, no games sound.
   After Intallation of SoundFX, the cassette output works. Game sound
   has a very bad quality, and cassette input is not working 
   (not implemented in this SoundFX release).
on Windows 98: 
   no cassette input, but cassette output and games sound are ok.
   After installing the lastest C-Media driver from the Internet, all functions
   are working.
on MS-DOS: 
   No access to the sound chip.
   After installing a MS-DOS setup program for the PCI chip, all functions
   are working.

Example 2: A notebook uses the ESS ES1869 Soundchip under Windows 98-SE. 
No game sound is working with the standard WDM driver from Microsoft.
After installing the lastest, non-WDM driver from ESS, all sound funtions are 
working well.

If you want to read or write Nascom cassettes, check your computer 
and audio environment in the following order:

1. Check your computer, operating system and soundcard:
   You will need a true SoundBlaster 8 Bit compatible board and MS-DOS or
   Windows 9x/ME.
   Check the environment variable BLASTER. SoundBlaster compatible
   installations have that variable active like
   BLASTER=A220 I5 D1
2. Connect a cassette recorder or a real Nascom to the input and output
   plugs of your soundcard. Use the line in input and one of the
   outputs (phones or line out) for the cassette recorder. Currently
   VNascom sets the internal mixer of the soundcard to enable the line-in
   plug for recording. Check the input and output with a Windows sound
   editor program to check the connections. 
3. Check the playback and record functions inclusive the mixer settings
   with the Windows audio recorder program SNDREC32.EXE or with
   the original utilities of your soundcard. Check carefully the audio 
   quality of your configuration with your favorite music titles to identify
   problems in your configuration. Dissortions, noise or bad connections
   will affect the cassette decoding. Some machines have a very bad signal 
   processing quality, so that the sound interface is only suitable for
   games, but not for signal processing. Every dissortion will produce errors
   while decoding cassettes. Check also for earth loops (50/60 Hz). I am using
   now a standard stereo HiFi cassette recorder and a notebook with
   very good results in decoding Nascom cassettes. It is necessary to disable
   any noise reduction (Dolby B/C) or sound enhancement systems (e.g. FLEX).
   The error rate on my 1200 Baud cassettes is now about 1 error on 150 KByte
   on medium quality type cassettes (IEC Type II).  
4. Check the playback and record functions with the 16Bit utilities
   PLAY.EXE and RECORD.EXE from the VNascom.zip package. Here are some
   critical points to explain: PLAY.EXE have normally no problems, due to
   the reason, that output compatibility on PC's is quiet sufficient. 
   RECORD.EXE have problems on some machines: 
   The 8 Bit DMA and the Mixer Input. If you get a WAV file with 44 Bytes in 
   length, then the DMA is not running. Try again under pure DOS if VNascom is
   running under Windows. For the mixer check the WAV file with a standard
   disk/file editor to see the hexadecimal dump of the file. Silence is coded
   as 80 hex (0x80) and very small signals are in the range of 0x7E to 0x82.
   If you see that kind of changing patterns then maybe your mixer in the
   soundcard is not right programmed and blocks that signal before it can 
   passes the signal to the A/D converter.
   Notice, that there is a programmed silence area of around two seconds
   at the start of each generated WAV file. 
5. Create a test cassette. Start VNascom with:
   VNASCOM ROM=nassys1.nas OUT=SND: CBR=1200 
   Under Nas-sys, write a cassette image to tape with 
   M1000			// enter a 0x55 at address 1000
   55.
   C1000 1001 EFFF		// fill the whole memory with 0x55
   W0000 FFFF			// write test file
6. Check the cassette input with the NAS2PC.EXE utility:
   NAS2PC 1200 test
   Wait for unformatted characters 'U'. Watch error messages enclosed in
   '{}' characters. Some error messages at the start of a transfer are
   normal. During the transfer, error messages indicates problems
   with the signal level, signal quality or with the baud rate.
   The NAS2PC ancd PC2NAS utilities are simple utilities to convert
   files to the FSK signals and FSK signals to files without parsing any
   Nascom cassette data structures. You can use that utilities also for other
   "Kansas City" type computer tapes. 
7. Rewind the tape and check the input. Start VNascom with:
   VNASCOM ROM=nassys1.nas INP=SND: CBR=1200
   Under Nas-sys, use 'Verify'
   V
8. Proceed with your old cassettes, and if you are successfull
   please support The Nascom Homepage with your old Nascom programs.

IF you have no luck to get full sound input and output support for
your computer with 16 Bit applications, you can use WAV files created 
with 3rd party sound editors. 
The standard Windows application SNDREC32.EXE can't be used for recording 
WAV files due to time restrictions (one minute) and nonstandard wave 
header extentions. The Sound editor Wavelab (Version 1.5) from Steinberg is 
a very good example for a simple and professional sound tool.

Create a WAV file with a WIN32 sound editor as a 8Bit mono 22050 Hz 
sample rate file and start VNascom with:
VNASCOM ROM=nassys1.nas INP=myfile.wav CBR=1200 OUT=myfile.cas
where myfile is the file you like to read in. Under NAS-SYS read from the
WAV file and write to the CAS file with the standard R and W commands.

IF you like to create a cassette, you can first create a WAV file with VNascom:
VNASCOM ROM=nassys1.nas OUT=nassys1.wav CBR=1200
under Nas-sys enter:
W0000 0800		for a copy of Nas-sys 1 in WAV file format.
Under Windows double click the file nassys1.wav to create a cassette.

Working with floppy disk images:
--------------------------------
VNascom has now limited suppport for floppy disks as image files.
The direct access to a real floppy disk drive is not implemented at
the moment (don't use A: or B: as parameter for the DSK= option).
If you like to create floppy disk images, choose a new file name for the
DSK= option, and format the "floppy" with the NAS-DOS command ]F:name:.
Select a skew value of 1. After "formatting" the image, you will get a
complete written image file of your given name in your file system.
To save an object code, use the NAS-DOS command ]O:filename:xxxx yyyy zzzz,
where filename is the NAS-DOS filename for the new program, xxxx is the
beginning address in memory, yyyy is the end of memory +1, and zzzz is the
start address for your program. To load and execute the program use the
command ]E:filename: and to get a directory listing use ]D.
To save a NASCOM BASIC program use ]B:filename:.

example:
  Start VNascom as a Nascom 3, which loads NAS-DOS by default, 
  choose tape.cas as input, and select a new floppy disk image myfloppy.dsk.

  VNASCOM MOD=3 INP=tape.cas DSK=myfloppy.dsk

  
  Under BASIC/NASDOS enter
  MONITOR	// go to NAS-SYS (never format under BASIC!!!)
  ]F0:MYFLOPPY:	// format the image myfloppy.dsk named MYFLOPPY
  Y		//   yes to format 
  1		// Skew value
  J		// cold start basic again because format destroys the 
  <CR>          //   basic initialisation.
  CLOAD		// load default basic program tape.cas
  ]B:DEMO:	// Save basic program as DEMO
  ]D		// List directory
  NEW		// delete program in memory
  ]L:DEMO:	// load the basic program from image
  LIST		// check it

Working with CP/M floppy disks:
-------------------------------
You can define your own CP/M floppy disk images by using the
DSK.COM utility to read and write a DSK image to a floppy disk,
and the shareware program 22DISK from Sydex to insert or extract
CP/M file to a disk. You will insert two disk definitions as described
in the 22DISK manual for the Nascom single side and double side formats:

BEGIN NAS2  NASCOM SS 2,3 - SSDD 96 tpi 5.25"
DENSITY MFM ,LOW
CYLINDERS 77 SIDES 1 SECTORS 10,512 SKEW 3
SIDE1 0 1,2,3,4,5,6,7,8,9,10
BSH 4 BLM 15 EXM 1 DSM 186 DRM 127 AL0 0C0H AL1 0 OFS 2
END

BEGIN NAS3  NASCOM DS 2,3 - DSDD 96 tpi 5.25"
DENSITY MFM ,LOW
CYLINDERS 77 SIDES 2 SECTORS 10,512 SKEW 3
SIDE1 0 1,2,3,4,5,6,7,8,9,10
SIDE2 1 1,2,3,4,5,6,7,8,9,10
ORDER CYLINDERS
BSH 4 BLM 15 EXM 0 DSM 379 DRM 127 AL0 0C0H AL1 0 OFS 2
END

How to create your own CP/M disk image to use with VNascom: 
-----------------------------------------------------------
1. Download 22DISK Version 1.44 and insert the two Nascom disk definitions.
2. Format a 720KB 3.5" floppy disk with CFMT.EXE.
   Best results are under pure MS-DOS or Windows 9x on slow (non MMX) PC's.
3. Copy your CP/M files with the DTOC.EXE utility.
4. Read the DSK dsk_file.DSK image with the DSK.COM utility.
   Start 		DSK.COM
   select 		NASCPM
   select		A:
   read file		READ dsk_file.DSK
5. Run VNascom with VNASCOM MOD=CPM DSK=cpmv22.DSK DSK=dsk_file.DSK
   Your disk image would be interpreted as a 374KB SSDD drive. If you have
   a 760KB DSDD drive image, place your DSK= parameter as the third or
   forth drive for disk C: or disk D:
   e.g. VNASCOM DSK=cpmv22.DSK DSK=B.DSK DSK=C.DSK DSK=dsk_file.DSK 
                  ^             ^         ^         ^
		  A:            B:        C:        D:

Programmable graphics character generator:
------------------------------------------
The graphics character rom is normally outside of the z80 address range.
If you enable the programmable character generator at port 3 bit 0 with
the Nas-sys command:
	O 3 1 
or with the Z80 opcodes:
	3E 01	LD A,1 
	D3 03	OUT (3),A
a program can write to the graphic character generator mapped to the 
address range 0000-07FF. Any Z80 read access reads from the rom at 0000-7FFF
and any write access writes to the graphics character generator. 

Defaults:
---------
 
Nascom 2: MOD=2 (default)
 VNASCOM  ROM=nassys1.nas  ROM=basic.nas  TRA=nas   MOD=2          CBR=1200
          INP=tape.cas     OUT=tape.cas   KBD=J~    CHR=naschr.nas SBR=1200
          DSK=floppy.dsk   TVL=14

Nascom 1: MOD=1
 VNASCOM  ROM=nasbugt2.nas ROM=basic.nas  TRA=nas   MOD=1          CBR=244
          INP=tape.cas     OUT=tape.cas   KBD=EE000 CHR=naschr.nas SBR=110
          DSK=floppy.dsk   TVL=16

Nascom 3: MOD=3
 VNASCOM  ROM=nassys3.nas  ROM=basic.nas  TRA=nas   MOD=3          CBR=1200
          INP=tape.cas     OUT=tape.cas             CHR=naschr.nas SBR=1200
          DSK=floppy.dsk   ROM=nasdos.nas RST=D000  RAM=avcbas.nas TVL=14
	  KBD=J~~MONITOR~ECFFA~Z

Nascom 2/3: MOD=CPM
 VNASCOM  ROM=Cpmboot.nas  TRA=nas   MOD=CPM        CBR=1200       KBD=
          INP=tape.cas     OUT=tape.cas             CHR=naschr.nas SBR=1200
          DSK=cpmv22.dsk   TVL=14



I/O ports defined in VNascom
----------------------------
hexadecimal address
port 00		Nascom keyboard port
port 01..02	Nascom UART 6402 ports
port 03		(#) VNascom page zero bank switch
		bit 7 : enable/disable nonstandard RAM 0000..0FFF
		bit 0 : enable/disable the programmable character generator
		        mapped to 0000..07FF
		Port 3 is cleared (0) if the Z80 CPU is resetted. The default
		value of port 3 is 0, that means the nonstandard RAM is 
		disabled and the programmable character generator is disabled.
port 04..07	Nascom Z80 PIO  
port 80		(#) VNascom speed and stop emulation control
		bit 7 : stop emulation
		bit 1 \  01=4Mhz, 10=2MHz, 11=TURBO
		bit 0 /
		example in Nas-sys:
		O 80 80		// stop VNascom and return to DOS/Windows
		O 80 1		// set 4 Mhz
		O 80 2		// set 2 MHz
		O 80 3		// set Turbo
		The stop emulation bit is useful to build a batch job.
		
port 81		(#) VNascom keyboard translation
		00=Nascom 	02=German	04=UK		06=Dutch
		01=US		03=Swedish	05=French	07=Danish
		example in Nas-sys: 
		O 81 04		// enable UK keyboard translation
		example in Basic:
		OUT 129,2	// enable german keyboard translation
port 82		(#) VNascom cassette baud rate
		01 = 300 Baud	02 = 1200 Baud	03 = 244 Baud
		example in Basic:
		OUT 130,1	// set 300 Baud
port 83		(#) VNascom serial baud rate
		01 = 300  Baud	02 = 1200 Baud
		03 = 2400 Baud	04 = 110  Baud
port 84		(#) VNascom Uart output
                00=file   01=LPT1:  02=SND:  03=COM1:
port 85         (#) VNascom Uart input
                00=file   01=SND:   02=COM1:
		example in Nas-sys:
		O 85 01		// set Soundblaster input
port 86         (#) VNascom switch for 16 or 14 tv-lines per character
                00= 16 tv-lines
		01= 14 tv-lines
		example in Basic
		OUT 134,0	// set 16 tv-lines per character
port B0..B2	Advanced Video Card (AVC)
port E0..E5	Nascom floppy disk controller card

(#) VNascom only. Not defined in a standard Nascom 1,2,3

Environment variables:
----------------------
BLASTER=	VNascom reads that variable for the SoundBlaster configuration.
OS=		If that variable has the value 'Windows_NT', VNascom uses
		standard VGA resolution. Note, that in the VGA resolution
		you can't use the high resolution graphic mode in the
		AVC emulation. 

The BLASTER variable is also used by PLAY.EXE, RECORD.EXE, PC2NAS.EXE and 
NAS2PC.EXE.


Not emulated items:
-------------------
1. Screen flickery:
   The Nascom video memory access was not synchronised with the video
   timing, so every access to the video RAM was visible as black or
   black and white stripe. 
   A commercial add-on with a small PCB was available to synchronise the CPU
   with wait states to the video timing.
2. Screen weaves:
   The Nascom 2 uses a simplified video timing generator with the ability
   to switch from 625 tv lines to 525. For this reason, the video timing
   generator produces 50.25Hz instead of 50.00Hz. On many monitors,
   especially good monitors, the nascom screen weaves with some Hz.
   A commercial add-on with a small PCB was available to fix the timing to 
   exactly 50.00Hz.
3. Z80 Pio:
   A standard PC with only one LPT interface does not have enough independent 
   input and output pins to emulate a standard Z80 PIO.
   The Z80 PIO is not fully emulated. I am still searching for a suitable
   solution.
4. AVC:
   Due to the complexity of the MC6845 video controller, only those parts
   of this chip are emulated, which are accessed by known Nascom programs.
5. FDC:
   Due to the complexity of the WD179x floppy disk controller, only those parts
   of this chip are emulated, which are accessed by known Nascom programs.
 

More advanced stuff for the real Nascomaniac:
---------------------------------------------
(don't read this if you hate batch jobs, hacks and consoles)
Here is an example to compile a pascal program from an ASCII file in the
PC file system. The result is generated as a NAS file. This example shows
the usage of the end emulation bit (bit 7) in port 80 and how to start
the serial input stream from a PC batch job.
The BLS Pascal 1.2 is used to read in the file and to compile it. The CAS2NAS
utility is used to convert the temporary CAS file to a NAS file.

The following steps are processed by PAS8.BAT:
- enable full speed of the emulator		O 80 1
- enable serial input in the BLS editor         (219D)=78
- read in the ASCII file 			F9
- end BLS editor, compile to tape		control-X, T, O 80 80
- end pass 1, start pass 2 of this batch job
- read the compiled program in tape format
- write the complete program with run time package to a CAS file
- convert CAS file to a NAS file with a external utility CAS2NAS.BAS
The @ parameter in the KBD= option starts the serial stream (same as F9) and
the { key is a control prefix. Example: {X is the control-X character.

PAS8.BAT
-----------------------------------------------------------
	@echo off
	rem compile a pascal program with vnascom
	if "%1"=="" goto usage
	if exist "%1.pas" goto pascal
	echo file %1.pas not found.
	goto end
:pascal
	echo compile a nascom pascal program
	if exist tmp.cas del tmp.cas
	rem pass 1 : read in the file and compile
	vnascom ram=blspas.nas kbd=O80_1~M219D~78~.~E1000_9000~E@~{XT~Q~O80_80 inp=%1.pas out=tmp.cas
	if not exist tmp.cas goto error
	rem pass 2 : read in the compiled program and combine it with runtime
        vnascom rom=nassys1.nas ram=blspas.nas kbd=O80_1~R~W1000_4000~O80_80 inp=tmp.cas out=%1.cas
	if exist tmp.cas del tmp.cas
	rem pass 3 : convert source file to a nas file
	if exist %1.cas cas2nas %1
	del %1.cas
	goto end
:error
	echo error in job PAS8.BAT.
	goto end
:usage
	echo PAS8 source_file_without_extention
	echo      valid extentions:
	echo                   pas  
	echo example:
	echo   pas8 demo 
	echo       compiles DEMO.PAS to DEMO.NAS
	echo
	goto end
:end
-----------------------------------------------------------------
DEMO.PAS		note: upper case keywords only!!
-----------------------------------------------------------------
VAR I : INTEGER;
BEGIN
  FOR I:=1 TO 10 DO BEGIN
     WRITELN ('HELLO NASCOMANIAC');
  END;
  WRITELN('ok.');
END.
-----------------------------------------------------------------

For questions, error reports or suggestions to VNascom send
an e-mail to vnascom@nascomhomepage.com.

Constantin Olbrich

Berlin/Germany 08/31/2002

Whats New:
----------
08/31/2002	CP/M functionality added. New model switch MOD=CPM sets
		a CP/M compatible memory map and sets the power on jump
		address to the CP/M boot loader at 0F000h.
		Keyboard translation code improoved on shifted charcaters.
06/29/2002	Microphone and Line Input switch added (Shift-F6) for notebooks
		without Line Input plugs. 
		Volume control added (Shift-F11 and Shift-F12).
03/16/2002	Switch for 16 and 14 tv-lines per character added.
03/09/2002	Caps-Lock key works now as the Nascom GRAPH key on all
		keyboard layouts. New keyboard layout Dutch and Danish
		implemented.
02/24/2002	Bitmap output file contains only nascom screen pixels
		and suppresses the vnascom status line and margins.
		The DSK= parameter can be repeated for a definition of
		4 physical drives or 8 logical drives.
02/23/2002	More keyboard translation options: UK and FRA for United
		Kingdom and France. Corrections of the german and swedish
		layouts. 
		Implementation of the programmable character generator.
		The Nascom sound interface is linked to the Soundblaster if
		available.
02/04/2002      Correction of the load RAM= and ROM= option to load nasbugt4
		and nasbugt2 files. Loaded NAS files can contain now the 
		NAS-BUG end of line characters.
10/31/2001	Correction of the AVC emulation code. Demo RUN ME runs without
		known problems. Thanks to Richard Espley for the avc demo disk.
		To run the AVC demo, start VNascom with:
		VNASCOM MOD=3 DSK=AVC-DEMO.DSK
		in VNascom start the demo then by:
		]E:RUN ME
10/22/2001	VNascom control ports 0x80..0x85 implemented.
10/21/2001	Cassette input of 244 Baud Nascom 1 signals is working now.
10/20/2001	Soundblaster mixer now set to line-in to record for cards
		with dsp version > 0x300 (SB-PRO).
10/13/2001	Emulation of the Advanced Video Card AVC.
		Thanks to Richard Espley for sending me the complete AVC
		manual! 
10/05/2001	Improved SoundBlaster code for better compatibility.
10/03/2001	Nascom Floppy Disk Controller is mostly implemented.
		Nas-Dos 1 is running well.
		Bugfix: Serial OUT= fixed.
09/17/2001	Bugfix: F11, F12 not working in TRA=US | GER | SWE mode.
09/16/2001	RS-232 input and output for the UART is implemented.
09/08/2001	Nascom Sound (used by games) can now be redirected to the 
                Soundblaster DAC, if available. 
		PC-Speaker is used if no Soundblaster is found. 
		Windows NT/2000 users will suffer from the lack
		of either Speaker support as well as Soundblaster support
		for 16 Bit applications, like VNascom. 
		VNascom is small enough to run on a MS-DOS or Windows
		Boot diskette on Windows NT/2000 machines.
09/04/2001	Virtual Cassette interface implemented for true SoundBlaster
                8 Bit compatible soundcards. 
		
		Output: 1200, 300, 244 Baud working.
		
		Input: 1200 Baud working on cassettes,
		        300 Baud working only on perfect audio streams,
			244 Baud currently not working (see above). 
		Input is working on SB-PRO compatible soundcards with DSP
		version numbers 3.x. SB16 boards seems to have problems with
		8 Bit DMA input modes.
                The error rate on real cassettes are a little higher with the 
		virtual cassette interface than with the original Nascom 2 
		hardware interface. 
		In future, I will inprove the selected algorithm for detecting
		and decoding FSK (frequency shift keying) signals to reduce 
		the error rate. 
			
08/01/2001	Page mode operation for address 0000-0FFFh:
		port 03 bit 7 toggles between Nas-sys, Workspace RAM & Video 
		and nonstandard static ram. 
		TDL 12K Basic needs that address space for internal use.
		example:
		3E 80 	LD A,80H
		D3 03	OUT (3),A	
		enables the nonstandard RAM.
		
		3E 00   LD A,00H
		D3 03   OUT (3),A
		disabled the nonstandard RAM.
06/15/2001	Fixes some errors in the Z80 emulation core. The Z80 
		instruction exerciser NASTEST.NAS checks all documented and 
		undocumented opcodes and flags. VNascom's 2.1 emulated Z80
		now runs exact like a real Z80 of the Nascom 1/2.
		To run this test, start VNascom with:
		
		VNASCOM RAM=NASTEST.NAS KBD=E1000
		
		This program needs around 3 hours on a real Nascom 2 to run.
		New also is an emulation speed indicator on the status line.
		This indicator is activated by the F8 key.
		Some minor optimisations allows better performance of the
		Z80 emulation core.
		
