NedoOS – Multitasking operating system for ZX Spectrum

Features

System requirements

Keyboard shortcuts

NedoOS handles keys and mouse events and forwards them to the task that is in focus. The key combinations Ext+letter (Tab+letter) correspond to ASCII control codes 1..26. The Ext+Number key combinations (Tab+Number, CapsShift+SymbolShift+Number) are equivalent to function keys F1..F10 on a PS/2 keyboard.

Keyboard shortcuts used by the kernel (PS/2 shortcuts are shown in brackets):

cmd – Command interpreter

It is an interactive prompt (command line) with scrolling to the left and right. Cursor key Up will recall the previous command.

Following file types are executed (the first character of the extension is checked):

Programs located in the bin/ directory of the system disk can be executed in the command line from any directory of any disk (the current directory has priority for calling programs before the bin/ directory). The current directory does not change when programs are executed.

The following commands (and their aliases) are supported:

You can also use the complex syntax:

dir > filename.txt
dir | more.com
more < filename.txt

The command-line parameters of the .bat file are available through macros %0 to %9 (%0 contains the filename of the script).

The idle system task launches the term.com terminal, which creates stdin and stdout pipes and launches the shell to execute autoexec.bat. When there is no running process, the idle enters into an infinite loop and it is waiting for C+M+D key combination (see above).

When launched, the shell looks at its command line and executes it. If the command line is cmd.com autoexec.bat, the shell enters interactive mode after autoexec.bat is executed, otherwise exits. You can start another independent terminal with term command or a network terminal (netterm) accessible via Telnet (TCP/IP port 2323).

nv, nvfast – Nedovigator, dual-pane file manager

Keyboard short cuts:

The remaining keys are used to edit the command line (numbers are not entered when the command line is empty).

The text output of the launched program from the command line is saved (but not a program launched in another terminal). See above, how to display it.

The configuration file nv.ext describes the association which launcher is used for the given file extension, for example:

bmp, scr: scratch.com
bat: cmd.com

texted – Text editor

Provide texted with the name of the file for editing as the command line parameter. The file size is only limited by the amount of available free memory.

Shortcuts:

Other keys are used to input the text.

basic – NedoBasic, BASIC interpreter

Files with *.bas extension can be called as command line parameter.

Data types:

Variable names must consist of only one alphabetical character, for example:

The following operations are used in expressions:

The function $rnd generates random numbers in the range 0..65535, at least one space must be used after the function name!

Commands (it is possible to join several commands on one line separated by a colon):

Press Esc (Break, CS+Space) to break the execution of the program or code scrolling.

tp – Turbo Pascal 3.0 by Borland

Short cuts are displayed on the screen. Source code can be compiled to the memory or file. English documentation is located in:

http://www.retroarchive.org/docs/software/turbodoc.html

See examples – t.pas (“Hello” in a cycle), mc.pas (spreadsheet).

BDS C compiler was developed by Brain Damage Software. Example: cc.bat ex (compile ex.c, link and run the code).

#include <stdio.h>

main(argc, argv)
char **argv;
{
  int i;
  printf("Hello world!\n");

  for (i = 1; i < argc; i++) printf("Arg #%d = %s\n",i,argv[i]);

  getchar();
}

Compiler collection examples and usage:

player – NedoPlayer

The simple music player for *.pt2, *.pt3 (with TurboSound support) and *.tfc formats. Use the command-line parameter to specify the filename for playing. Prints the filename when the screen is refreshed. To exit use Break (Esc, Caps Shift+Space).

modplay

The simplest MOD music player for General Sound compatible sound cards. Use the command-line parameter to specify the filename for playing. Launching without parameters is going to stop playback.

pkunzip

Unpacker for *.zip and *.gz archives. It unpacks the entire archive to the current directory.

tar

Unpacker for *.tar archives. It unpacks the entire archive to the current directory. If the parameter is not a .tar archive, then this is a file from which the archive will be created (if a directory is specified, then it will all be packed into an archive with all content, files, and directories). The archive name corresponds to the file name, with the extension replaced by .tar.

unrar – Unpack *.rar (2.x) archives

It reads the name of the archive via the command line, then it works in the interactive mode.

zxrar – Packer of (2.x) *.rar archives

It reads the name of file via the command line and creates archive mynewrar.rar or adds to it.

browser – NedoBrowser, web browser

NedoBrowser is a text-based web browser. Invoke from the command line:

The status bar is displayed at the bottom of the screen, it contains:

Following formats are supported:

Short cuts:

wget

The non-interactive HTTP downloader. It with play music files and display *.src images automatically.

dmm

The tool for mounting of TRD, SCL, FDI, TAP images via Evo Service. Can also mount TRD images using xBIOS ROM at ATM2.

time

The tool for network time protocol (NTP). Command-line options:

dmirc – IRC client

dmftp – FTP client

ping

Send ICMP ECHO_REQUEST to network hosts. Example: ping 1.2.3.4.

telnet – Telnet client

The user interface to the TELNET protocol. The TCP port can be specified with: telnet url:1234, the default port is 23.

3ws – Web server

The web server supports the sharing of the system disk. See 3ws.txt for more details. You can use your own page design (files in the subdirectory of the same name).

wizcfg

Provides basic network setup of ZXNETUSB. It uses configuration saved in net.ini.

nmisvc

Launches and translates snapshot. Runs a .SNA snapshots (48K or 128K) specified on the command line. Exit the snapshot to OS by pressing the NMI button. You can save the memory state to a new snapshot or continue the execution. At the same time, you can manually switch to another task in the OS. OS allows you to between snapshots and the system.

It can also run BASICs from TR-DOS disc.

view – NedoView, image viewer

NedoView supports the following graphics formats:

hddfdisk

Utility for partitioning and formatting IDE partitions.

term

Terminal emulator for programs that use stdio.asm.

netterm – TELNET server

The network terminal server listens on port 2323. Supports programs that use stdio.asm. Set the following configuration in your telnet client (for example PuTTY):

pt – Pro Tracker 3.x

Pro Tracker 3.x provides a larger window and supports hard disk and General Sound (see the manual in a separate file).

playtap – Player for .tap files.

TAP files are played on your physical tape output. The file to play must be named tilt.tap.

Programming (for details see api_base.txt)

User programs are compiled with the header file ../_sdk/sys_h.asm, which includes the file sysdefs.asm with constants.

Programs are loaded and run with PROGSTART (0x0100), with the command line in COMMANDLINE (0x0080) and with its length stored at COMMANDLINE_sz (0x0080). It is highly recommended to use these constants rather than numeric values (the same goes for key codes, call numbers, etc.). The stack initially grows from the top of 0x0000, it can be manually rearranged to any place above 0x3b00. File operations and data transfers in BDOS can be done at any address in the userspace.

It is not recommended to read keyboard ports manually, use OS_GETKEYMATRIX – it returns the pressed keys only to the task that is currently in focus.

It is not recommended to use the syssets.asm dependency in user programs.

Application developers use the symbolic key names defined in sysdefs.asm under “Usable key codes”.

The system is currently unable to assemble itself. To reach this goal, we will follow a number of guidelines for programming in assembly language:

As the native build system will be improved, these restrictions will be relaxed.

Restarts in the kernel (it is highly recommended to use them through macros since it is planned to free 0x0000 for the user, make CALLBDOS a restart, and SETPG... calls for speed):

BDOS functions: see sys_h.asm.

The entry to the standard interrupt handler looks like this:

    push af
    push bc
    push de

How to capture an interrupt handler in your program:

For example:

swapimer                    ;the first call will turn on your handler,
                            ;the second call will return the standard handler
        di
        ld hl, (0x0038 + 3) ;address intjp
        ld (intjpaddr), hl
        ld de, 0x0038
        ld hl, oldimer
        ld bc, 3
swapimer0
        ld a, (de)
        ldi                ;[oldimer] -> [0x0038]
        dec hl
        ld (hl), a         ;[0x0038] -> [oldimer]
        inc hl
        jp pe, swapimer0
        ei
        ret
oldimer
        jp on_int          ;will be replaced with the code from 0x0038
        jp 0x0038 + 3
on_int
        ex de, hl         ;de = "hl", hl = "de"
        ex (sp), hl       ;hl = exit address, de = "hl", on the stack "de"
        ld (on_int_jp), hl
        ld ( on_int_sp), SP
        ld sp, INTSTACK   ;in order not to mess up the stack
        push af
        push bc
        push de           ;"hl"
        ...
        call oldimer      ;ei
        ...
        pop de            ;"hl"
        pop bc
        pop af
on_int_sp = $ + 1
    ld sp , 0
; de = "hl", on the stack "de"
        pop de
        ;

Developers

The disk subsystem is based on the FatFS library with drivers from Savelij13 and DimkaM and the iofast library from the NedoLang suite.

The operating system idea was brought in 2007 when the first version of the kernel was written (but never tested). The main portion of the kernel code, cmd and nv, and part of Scratch graphic editor was written in 2018.

License

Free distribution of the program and its source code is allowed. Please ask for the approval from project manager if you want to port the code or its parts to a different platform.

System setup

Clock usage according to Mr. Gluk’s schematics for ATM2 is tested in UnrealSpeccy 0.37.1.

Disk images (the HDD image can be mounted through WinImage, and the SD-card image can be mounted in Windows). Do not forget to unmount it once done:

http://alonecoder.nedopc.com/sd.zip
http://alonecoder.nedopc.com/hdd.zip

Installing the system on a real HDD:

  1. Run mkatm2.bat (or mkatm3.bat for ATM3).
  2. Using nv, copy all the files from the *.trd received to e:/bin/.
  3. Run mkatm2hd.bat (or mkatm3hd.bat for ATM3), copy the resulting *.$c to drive 1.

Then you can start the system (*.$c) from the HDD.

Installation of the system on a real SD-card: copy the bin/ directory and the required $c to the root of a SD-card.

Settings for the UnrealSpeccy emulator:

[ZC]            ; Z-Controller settings
; sdcard image
SDCARD="sd.vhd"

[HDD]
Scheme = NEMO-DIVIDE (for ATM3 version) or ATM (for ATM2 version)

Image0 = hdd.ima
CHS0=609/16/63  ; max size, accessible through CHS. not used for real drive
LBA0=614400     ; max size, accessible through LBA. not used for real drive
HD0RO=0         ; read only flag
CD0=0           ; 1 if image is cdrom

eVHDattach.bat (you can mount also by clicking on *.vhd):

d:
cd zx\us035\
@echo off
if exist VHDattach.txt (
    @echo on
    echo VHDattach.txt exist
    @echo off
) else (
    @echo on
    echo create VHDattach.txt
    @echo off
    echo select vdisk file="%cd%\sd.vhd" > VHDattach.txt
    echo attach vdisk >> VHDattach.txt
    rem echo select vdisk file="%cd%\sd.vhd" >> VHDattach.txt
    rem echo select part 1 >> VHDattach.txt
    rem echo assign letter=K >> VHDattach.txt
)
if exist sd.vhd (
    @echo on
    echo sd.vhd attach
    diskpart /s VHDattach.txt
    @echo off
) else (
    @echo on
    echo create VHDcreate.txt
    @echo off
    echo create vdisk file="%cd%\sd.vhd" MAXIMUM=300 TYPE=FIXED >
VHDcreate.txt
    echo select vdisk file="%cd%\sd.vhd" >> VHDcreate.txt
    echo attach vdisk >> VHDcreate.txt
    echo create part primary  >> VHDcreate.txt
    echo select part 1 >> VHDcreate.txt
    echo format label="ZX" quick fs=FAT32 >> VHDcreate.txt
    echo assign >> VHDcreate.txt
    @echo on
    diskpart /s VHDcreate.txt
    del VHDcreate.txt
    @echo off
)
@echo on
pause

eVHDdetach.bat:

d:
cd zx\us035\
@echo off
if exist VHDdetach.txt (
    @echo on
    echo VHDdetach.txt exist
    @echo off
) else (
    @echo on
    echo create VHDdetach.txt
    @echo off
    echo select vdisk file="%cd%\sd.vhd" > VHDdetach.txt
    echo detach vdisk >> VHDdetach.txt
)
@echo on
diskpart /s VHDdetach.txt
pause

On Windows 10, you can use right-click to mount and unmount.