?login_element?

Subversion Repositories NedoOS

Rev

Rev 1404 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
874 alone 1
NedoOS -- Multitasking operating system for ZX Spectrum
2
=======================================================
3
 
4
Features
5
--------
6
 
7
* Works with TR-DOS floppies, SD-card, IDE HDD (FAT12/16 or FAT32 with
8
  long filenames support). Device letters:
9
  - "E".."H" - IDE HDD (Master),
10
  - "I".."L" - IDE HDD (Slave),
11
  - "M" - SD-card (Z-controller),
12
  - "N" - SD-card (NeoGS),
13
  - "O" - USB flash,
14
  - "A".."D" - TR-DOS floppies. IDE controller (ATM or Nemo IDE) depends
15
    on the batch file you run. Includes support for segmented TR-DOS files
16
    of any size (according to TR-DOS sequential access files standard).
17
* Up to 16 tasks running at the same time. Tasks may be active (one of them
18
  has the focus, so it can read input devices and print on visible
19
  terminal screen) or frozen. Tasks may give away their time slot to
20
  the system using `YIELD`, but don't have to.
21
* NedoOS can open up to 8 files on FAT, up to 8 files on TR-DOS, and
22
  up to 8 pipes between tasks at the same time.
23
* User program can access the whole memory between 0x0100..0xffff, any 16K
24
  window can be switched via OS calls (see below). File operations and
25
  BDOS data transfer can be done at any address in the userspace.
26
* User programs can modify the interrupt handler (for example, to restore
27
  stack data) and move the stack pointer.
28
* Gfx editor Scratch, music players NedoPlayer and modplay, text editor texted,
29
  disk image mounter dmm, snapshot runner/switcher nmisvc, compiler NedoLang,
30
  assembler NedoAsm, basic interpreter NedoBasic, picture viewer NedoView,
31
  decompressors for `*.zip`, `*.gz`, `*.rar`, `*.tar` and archivers for `*.rar` and
32
  `*.tar`, network utilities (NedoBrowser, dmirc, dmftp, netterm etc.), games...
33
 
34
System requirements
35
-------------------
36
 
37
* ATM Turbo 2 or ATM3 compatible computer (depends on the main executable)
38
* Kempston mouse with a wheel recommended
39
* SD-card recommended (Z-Controller with shadow ports or NeoGS) or
40
  harddrive (NemoIDE or ATM IDE)
41
* DDp's palette scheme (4+4+4) recommended
42
* Real-time clock (Mr.Gluk's schematics) recommended
43
* ZXNETUSB network interface card recommended
44
* General Sound or NeoGS sound card recommended
45
* TurboSound FM sound card recommended
46
 
47
Keyboard shortcuts
48
------------------
49
 
50
NedoOS handles keys and mouse events and forwards them to the task that
51
is in focus. The key combinations Ext+letter (Tab+letter) correspond to
52
ASCII control codes 1..26. The Ext+Number key combinations
53
(Tab+Number, CapsShift+SymbolShift+Number) are equivalent to function
54
keys F1..F10 on a PS/2 keyboard.
55
 
56
Keyboard shortcuts used by the kernel (PS/2 shortcuts are shown in brackets):
57
 
58
* Caps Shift (Left Shift) - hold down to stop scrolling on the screen
59
* Symbol Shift + Enter (Right Shift + Enter) - switches visual tasks (that
60
  is, those that called `CMD_SETGFX`), while the task to which they were
61
  switched receives the `key_redraw` key code (upon learning this, it can
62
  redraw the screen)
63
* C+M+D (press simultaneously) - execute `cmd.com` if there are no active
64
  tasks. (polled in the idle task, so it works only when there are no active
65
  tasks). To spawn a new terminal, use the command `term`.
66
* Caps Shift + 2 (Caps Lock) - switch case
67
* Caps Shift + 1 (Alt + Shift) - switch between keyboard layouts
68
  (Russian/English). In the Russian mode (it also supports the Ukrainian
69
  language), the ШВЕРТЫ layout is enabled. In this case, you can type some
70
  letters by two presses (ja=я, jo=ё, ju=ю, je=є, ji=ї, jy=i, cg=ґ, cc=ц,
71
  hh=э, jj=ъ). Because letters "й", "ц", "ш", "э" are used as a prefix of
72
  combinations, you can input them separately by pressing any other key after
73
  them that is not included in their combination. The key pressed afterward
74
  is not ignored, but also processed. In the literary text, the combinations
75
  "йа", "йо", "йу", "йe", "чч", "хх", "йи", "йы", "йй", "цг" are practically
76
  excluded (sometimes in foreign words). To enter such combinations use
77
  cursor movement. All punctuation marks available in Latin mode are also
78
  available in Russian. The Russian encoding is CP866 and CP1125 is used
79
  as Ukrainian encoding.
80
* Ext+Enter (Tab+Enter, Caps Shift+Symbol Shift+Enter, use Tab+Right Shift+Enter
81
  on incompatible keyboards) - switch on/off
82
  the pseudo-graphic input mode
83
* In case of TR-DOS errors (the  red border is shown), the R (Retry), I
84
  (Ignore sector), A (Abort) keys work.
85
 
86
cmd -- Command interpreter
87
--------------------------
88
 
89
It is an interactive prompt (command line) with scrolling to the left and
90
right. Cursor key Up will recall the previous command.
91
 
92
Following file types are executed (the first character of the extension is
93
checked):
94
 
95
* .com (the extension can be omitted) - an executable program, a new
96
  parallel process is created. Command-line parameters are passed to the
97
  process to the `COMMANDLINE` address (see the "Programming" section).
98
 
99
* .bat is a sequence of commands that `cmd` understands, including starting
100
  .com programs (commands are executed sequentially and not concurrently,
101
  except when the `start` command is used). Each command is shown on the
102
  screen before it is executed.
103
 
104
Programs located in the `bin/` directory of the system disk can be executed
105
in the command line from any directory of any disk (the current directory
106
has priority for calling programs before the `bin/` directory). The current
107
directory does not change when programs are executed.
108
 
109
The following commands (and their aliases) are supported:
110
 
111
* `exit` - quit cmd
112
* `a:` ... `o:` - change the current disk
113
* `dir (ls)` - list the content of the current directory. You can redirect
114
  output to a file: `dir> filename`
115
* `cd <path>` - change the current directory to <path>. <path> can contain
116
  a drive name.
117
* `cd ..` - change directory to the parent directory.
118
* `md (mkdir) <path/dirname>` - create a new directory with the specified
119
  name in the current or the specified path
120
* `del (rm) <path/filename>` - delete a file or an empty directory in the
121
  current directory
122
* `copy (cp) <path/filename> <newpath/newfilename>` - copy file
123
* `ren <path/filename> <newpath/newfilename>` - rename or move file
124
* `mem (free)` - print the number of free memory pages
125
* `proc (ps)` - list current processes and their state ("+" or "-" -
126
  activity, "g" for graphical tasks)
127
* `drop (kill) <ID>` - terminate the process with the given ID
128
* `date` - print current date and time
129
* `rem` - do nothing (needed for comments in .bat files)
130
* `start <path/filename>` - execute the program in the background (by
131
  default, the executed program blocks `cmd`)
132
* `copydir <dir1> <dir2>` - recursive copy of the _dir1_ directory with all
133
  files to the _dir2_ directory. Full paths must be specified, not relative!
134
* `pause` - wait for a keypress (used in `.bat` files)
135
* `echo <message>` - print a message (needed for `.bat` files)
136
* `type <path/filename>` - print file content
137
 
138
You can also use the complex syntax:
139
 
140
    dir > filename.txt
141
    dir | more.com
142
    more < filename.txt
143
 
144
The command-line parameters of the .bat file are available through macros
145
`%0` to `%9` (`%0` contains the filename of the script).
146
 
147
The _idle_ system task launches the `term.com` terminal, which creates
148
stdin and stdout pipes and launches the shell to execute `autoexec.bat`.
149
When there is no running process, the _idle_ enters into an infinite loop
150
and it is waiting for C+M+D key combination (see above).
151
 
152
When launched, the shell looks at its command line and executes it. If the
153
command line is `cmd.com autoexec.bat`, the shell enters interactive mode
154
after `autoexec.bat` is executed, otherwise exits. You can start another
155
independent terminal with `term` command or a network terminal
156
(`netterm`) accessible via Telnet (TCP/IP port 2323).
157
 
158
nv, nvfast -- Nedovigator, dual-pane file manager
159
-------------------------------------------------
160
 
161
Keyboard short cuts:
162
 
163
* cursor keys (up, down) - navigate through files
164
* Home (Symbol Shift+Q) - jump to the first file
165
* End (Symbol Shift+E) - jump to the last file
166
* Tab (Caps Shift+Symbol Shift) - change the current panel
167
* Space - tag file
1315 alone 168
* Ext+A (Alt+A) - invert tagging
874 alone 169
* BackSpace (Caps Shift+0) - switch to the parent directory
170
* Enter - launch the file under cursor in the blocking mode (`.com`
171
  and `.$c` are launched directly, other types may use the external
172
  launchers, see below)
173
* Enter - execute command line in the blocking mode, then `nv` will release
174
  the focus and will wait till the end of the called program or till
175
  `OS_HIDEFROMPARENT`in that program. Text output of the finished program can
176
  be displayed with the mouse wheel (in `nv`) or Esc (in `nvfast`).
177
* Caps Shift+Enter or F9 - insert the file name on the command line
178
* 3 - text files viewer
179
  - use cursor keys, PageUp (Caps Shift+3), PageDown (Caps Shift+4),
1180 dimkam 180
  - F1 - switch encoding,
181
  - Ins - switch line breaks,
874 alone 182
  - Break (Esc, Caps Shift + Space) - exit,
183
  - Tab (Caps Shift + Symbol Shift) - switch to hex viewer/editor:
184
    - use cursor for moving control, PgUp, PgDn,
185
    - input numbers and A-F
186
    - Caps Shift+Enter or F2 - save,
187
    - Break (Esc, Caps Shift + Space) - exit,
188
    - Tab (Caps Shift + Symbol Shift) - go to the normal text viewer
189
* 4 - open the text editor _texted_ to modify the file under the cursor
190
* 5 - copy marked files or the file under the cursor to the opposite panel
191
* 6 - rename the file/directory (do not use "/" and "\" in the name)
192
* 7 - create a directory in the current panel (Esc [CS+Space] - cancel)
193
* 8 - delete tagged files (only empty directories are deleted)
1180 dimkam 194
* 1 - select a drive in the current panel (cursor, Esc [CS+Space]
874 alone 195
  to cancel, Enter - confirm selection)
1180 dimkam 196
* 2 - find files (Tab - switch between filename and substring)
874 alone 197
 
198
  **Note:** Instead of numbers, you can press F1..F10 on the PS/2 keyboard.
199
 
200
* Symbol Shift+1..5 - select sorting mode (by name, extension, size, date, and
201
  no sorting). The sorting order is reversed if the same mode is invoked a
202
  second time. The change to a different mode will use the ascending order.
203
* Break (Esc, Caps Shift + Space) - exit (Esc - cancel, Enter - confirm)
204
 
205
The remaining keys are used to edit the command line (numbers are not
206
entered when the command line is empty).
207
 
208
The text output of the launched program from the command line is saved (but
209
not a program launched in another terminal). See above, how to display it.
210
 
211
The configuration file `nv.ext` describes the association which launcher
212
is used for the given file extension, for example:
213
 
214
    bmp, scr: scratch.com
215
    bat: cmd.com
216
 
217
texted -- Text editor
218
---------------------
219
 
220
Provide `texted` with the name of the file for editing as the command line
221
parameter. The file size is only limited by the amount of available free
222
memory.
223
 
224
Shortcuts:
225
 
226
* cursor keys, PageUp (Caps Shift+3), PageDown (Caps Shift+4) - cursor
227
  movement
228
* Home (Symbol Shift+Q) - jump to the beginning of the line
229
* End (Symbol Shift+E) - jump to the end of the line
1404 alone 230
* Symbol Shift+PageUp - jump to the beginning of text
231
* Symbol Shift+PageDown - jump to the end of text
874 alone 232
* BackSpace (Caps Shift+0) - delete a character before the cursor
233
* Del (Caps Shift + 9) - delete a character to the right of the cursor
234
* Break (Esc, Caps Shift + Space) - exit
1198 alone 235
* Ins (Symbol Shift+W) - wrap on/off
1404 alone 236
* F1 - help
237
* F2 or Caps Shift+Enter - save
1381 alone 238
* F9 - run build.bat in text directory
1404 alone 239
* F10 - change encoding (866/1251)
874 alone 240
 
241
Other keys are used to input the text.
242
 
243
basic -- NedoBasic, BASIC interpreter
244
-------------------------------------
245
 
246
Files with `*.bas` extension can be called as command line parameter.
247
 
248
Data types:
249
 
250
* integers (32bit signed), can be used for boolean values (0=false, -1=true).
251
  If used as an index for a cycle, they consume more memory,
252
* strings (up to 255 bytes + zero terminator), also used as an array of
253
  unsigned bytes,
254
* one-dimensional arrays of integers (32bit signed).
255
 
256
Variable names must consist of only one alphabetical character, for example:
257
 
258
* `i` (number),
259
* `a$` (string),
260
* `a(10)` (10th element of the array, counting from 0),
261
* `a$(10)` (10th character of the string, counting from zero).
262
 
263
The following operations are used in expressions:
264
 
265
* lowest priority: =, <, >, <=, >=, <>
266
* medium priority: +, -
267
* high priority: * and /
268
* highest priority: unary -, expression brackets ()
269
 
270
The function `$rnd` generates random numbers in the range 0..65535,
271
at least one space must be used after the function name!
272
 
273
Commands (it is possible to join several commands on one line separated by a
274
colon):
275
 
276
* `run` - start the program
277
* `list` - view the listing of the program
278
* `quit` - exit NedoBasic
279
* `edit <expression>` - call to edit the line with the specified number
280
* `clear` - clear variables
281
* `new` - erase the program
282
* `let <variable>=<expression>`
283
* `print <expression>; <expression>` - if the last character is a semicolon,
284
   then no line feed is printed at the end)
285
* `cls` - clear the screen in black
286
* `goto <expression>` - jump to the specified line number. When the
287
   number does not exist the program will continue from the next line
288
   after the used one.
289
* `if <expression> then <command>` - if expression is not false, execute
290
   commands to the end of the line
291
* `dim <variable> (<expression>)` - create an array of specified size
292
* `for <variable>=<initial value expression> to <final value expression>
293
   step <step expression>` - the beginning of the cycle. Step can be positive
294
   or negative, but not 0.
295
* `rem <text>` - use for text comments
296
* `next <variable>` - the end of for-cycle
297
* `gfx 0` - enable graphic mode 320x200x16 colors
298
* `gfx 6` - enable text mode (when the program exits, it will automatically
299
  enable text mode back)
300
* `pause` - waiting for the keypress
301
* `plot <x-expr>, <y-expr>, <color-expr>` - draw a point in the graphic mode
302
* `line <x2-expr>, <y2-expr>, <color-expr>` - draw a line in the graphic mode
303
   (from the previous point or the end of the previous line)
304
*  `save <filename>` - save the program. The filename can contain the
305
   path, for example, "m:/path/file.bas". The filename can be also
306
   a string variable.
307
* `load <filename>` - load a program. The filename can contain the
308
   path, for example, "m:/path/file.bas". The filename can be also a
309
   string variable.
310
* `system <command_line>` - launch a command via `cmd`, it is waiting for
311
   completion. Also, a string variable can be used.
312
 
313
Press Esc (Break, CS+Space) to break the execution of the program
314
or code scrolling.
315
 
316
tp -- Turbo Pascal 3.0 by Borland
317
---------------------------------
318
 
319
Short cuts are displayed on the screen. Source code can be compiled to the
320
memory or file. English documentation is located in:
321
 
322
    http://www.retroarchive.org/docs/software/turbodoc.html
323
 
324
See examples - `t.pas` ("Hello" in a cycle), `mc.pas` (spreadsheet).
325
 
326
cc, cc2, clink, c.ccc, deff.crl, deff2.crl -- BDS C compiler
327
------------------------------------------------------------
328
 
329
BDS C compiler was developed by Brain Damage Software. Example:
330
`cc.bat ex` (compile `ex.c`, link and run the code).
331
 
332
```
333
#include <stdio.h>
334
 
335
main(argc, argv)
336
char **argv;
337
{
338
  int i;
339
  printf("Hello world!\n");
340
 
341
  for (i = 1; i < argc; i++) printf("Arg #%d = %s\n",i,argv[i]);
342
 
343
  getchar();
344
}
345
```
346
 
347
Compiler collection examples and usage:
348
 
349
* `cc filename.c`
350
* `cc2` - second compilation is invoked automatically
351
* Object files and libraries have the `.crl` extension (deff2.crl is
352
  automatically connected by the linker). Examples of libraries are
353
`deff2a.csm`, `deffgfx.csm`.
354
* Link object file to executable:
355
  - `clink filename`
356
  - `clink filename deffgfx` (see `cc.bat` and example `ex.c`)
357
* How to build the concatenation tool (`concat outfile infile1 infile2`):
358
  - `cc concat.c`
359
  - `clink concat`
360
 
361
player -- NedoPlayer
362
--------------------
363
 
364
The simple music player for `*.pt2`, `*.pt3` (with TurboSound support) and
365
`*.tfc` formats. Use the command-line parameter to specify the filename for
366
playing. Prints the filename when the screen is refreshed. To exit use
367
Break (Esc, Caps Shift+Space).
368
 
369
modplay
370
-------
371
 
372
The simplest MOD music player for General Sound compatible sound cards. Use
373
the command-line parameter to specify the filename for playing. Launching
374
without parameters is going to stop playback.
375
 
376
pkunzip
377
-------
378
 
379
Unpacker for `*.zip` and `*.gz` archives. It unpacks the entire archive
380
to the current directory.
381
 
382
tar
383
---
384
 
385
Unpacker for `*.tar` archives. It unpacks the entire archive to the current
386
directory. If the parameter is not a `.tar` archive, then this is a file
387
from which the archive will be created (if a directory is specified, then
388
it will all be packed into an archive with all content, files, and
389
directories). The archive name corresponds to the file name, with the
390
extension replaced by `.tar`.
391
 
392
unrar -- Unpack `*.rar` (2.x) archives
393
--------------------------------------
394
 
395
It reads the name of the archive via the command line, then it works in
396
the interactive mode.
397
 
398
* v - view the contents of the archive
399
* e - unpack necessary files from the archive
400
* m - enter a mask for files (the first characters of the file name in
401
      the archive, including the internal path)
402
 
403
zxrar -- Packer of (2.x) `*.rar` archives
404
-----------------------------------------
405
 
406
It reads the name of file via the command line and creates archive
407
`mynewrar.rar` or adds to it.
408
 
409
browser -- NedoBrowser, web browser
410
-----------------------------------
411
 
412
NedoBrowser is a text-based web browser. Invoke from the command line:
413
 
414
* `browser file://m:/girl.jpg` (`file://` is optional)
415
* `browser http://alonecoder.nedopc.com/` (`http://` and the trailing
416
  slash is optional in the URL)
417
* HTTPS protocol (https://) is supported with a proxy.
418
 
419
The status bar is displayed at the bottom of the screen, it contains:
420
 
421
* full path to the current file
422
* number of busy pages
423
* rendering time
424
* errors (conn.err - connection error, load err - loading error)
425
 
426
Following formats are supported:
427
 
428
* html (does not support all tags yet and displays only windows-1251
429
  and UTF-8 encodings [by default]),
430
* jpeg (so far only plain scan),
431
* gif (so far only normal scan, animations are supported),
432
* png (only normal scan for now),
433
* bmp (so far only normal line order, 24bit),
434
* svg (no fill, coordinates in a limited range).
435
* For large pictures use cursor keys, Z - changes the scale.
436
 
437
Short cuts:
438
 
439
* cursor keys, PageUp (Caps Shift+3), PageDown (Caps Shift+4) - movement
440
* Enter - follow the link
441
* S - save the current file (it will be saved as `download.fil`, the first
442
  letter is increased with each file)
443
* L - download the file from the hyperlink (calls the `wget` program)
444
* 5 - reload the file
445
* E - edit url (arrows left, right, Enter, BackSpace [Caps Shift+0])
446
* U - change encoding UTF-8 / windows-1251
447
* BackSpace (Caps Shift + 0) - back in the browsing history
448
* Break (Esc, Caps Shift + Space) - exit browser
449
 
450
wget
451
----
452
 
453
The non-interactive HTTP downloader. It with play music files
454
and display `*.src` images automatically.
455
 
456
dmm
457
---
458
 
459
The tool for mounting of TRD, SCL, FDI, TAP images via Evo Service.
460
Can also mount TRD images using xBIOS ROM at ATM2.
461
 
462
time
463
----
464
 
465
The tool for network time protocol (NTP). Command-line options:
466
 
467
* `-H` help
468
* `-T` set time(-T17:59:38)
469
* `-D` set date(-D21-06-2019)
470
* `-N` ntp-server default: -N2.ru.pool.ntp.org
471
* `-Z` time-zone default: -Z3
472
* `-i` get date time from the internet
473
 
474
dmirc -- IRC client
475
-------------------
476
 
477
dmftp -- FTP client
478
-------------------
479
 
480
ping
481
----
482
 
483
Send ICMP `ECHO_REQUEST` to network hosts. Example: `ping 1.2.3.4`.
484
 
485
telnet -- Telnet client
486
-----------------------
487
 
488
The user interface to the TELNET protocol. The TCP port can be specified
489
with: `telnet url:1234`, the default port is 23.
490
 
491
3ws -- Web server
492
-----------------
493
 
494
The web server supports the sharing of the system disk. See `3ws.txt` for
495
more details. You can use your own page design (files in the subdirectory
496
of the same name).
497
 
498
wizcfg
499
------
500
 
501
Provides basic network setup of ZXNETUSB. It uses configuration
502
saved in `net.ini`.
503
 
504
nmisvc
505
------
506
 
507
Launches and translates snapshot. Runs a `.SNA` snapshots (48K or 128K)
508
specified on the command line. Exit the snapshot to OS by pressing the NMI
509
button. You can save the memory state to a new snapshot or continue the
510
execution. At the same time, you can manually switch to another task in the
511
OS. OS allows you to between snapshots and the system.
512
 
513
It can also run BASICs from TR-DOS disc.
514
 
515
view -- NedoView, image viewer
516
------------------------------
517
 
518
NedoView supports the following graphics formats:
519
 
520
* scr (6144 and 6912)
521
* fnt (linear and screen format, 768 and 2048)
522
* img (dual screens with interlace)
523
* 3 (AGA editors, 8col)
524
* 888 (8col editor)
525
* `+` or `-` (MultiStudio editor)
526
* Y (packed 8-color picture for the ManyColor+/XColor)
527
* plc (Laser Compact 5, BGE)
528
* mc (multicolor)
529
* mlt (multicolor from ZX Paintbrush editor)
530
* mcx (multicolor with interlace)
531
* grf (hardware multicolor ATM/Profi)
532
* ch$ (large pictures with attributes, with or without interlace)
533
* mg1, mg2, mg4, mg8 (MultiArtist editor)
534
* rm (R-Mode)
535
* 16c (32K memory image + 32 bytes palette)
536
 
537
hddfdisk
538
--------
539
 
540
Utility for partitioning and formatting IDE partitions.
541
 
542
term
543
----
544
 
545
Terminal emulator for programs that use `stdio.asm`.
546
 
547
* Transmits ANSI codes (VT-100+) with mouse events.
548
* Scrolling with the mouse wheel.
549
* Mouse click in the top left corner will save terminal text
550
  to `pasta.txt`
551
* Mouse click in the bottom left corner will insert 80 characters
552
  from `pasta.txt`.
553
 
554
netterm -- TELNET server
555
------------------------
556
 
557
The network terminal server listens on port 2323. Supports programs that
558
use `stdio.asm`. Set the following configuration in your telnet client (for
559
example PuTTY):
560
 
561
* VT-100
562
* Local echo off
563
* Local line editing off
564
* Backspace = Control-H
565
 
566
pt -- Pro Tracker 3.x
567
----------------------
568
 
569
Pro Tracker 3.x provides a larger window and supports hard disk and General
570
Sound (see the manual in a separate file).
571
 
572
playtap -- Player for `.tap` files.
573
-----------------------------------
574
 
575
TAP files are played on your physical tape output. The file to play must be
576
named `tilt.tap`.
577
 
578
Programming (for details see `api_base.txt`)
579
---------------------------------------------
580
 
581
User programs are compiled with the header file `../_sdk/sys_h.asm`, which
582
includes the file `sysdefs.asm` with constants.
583
 
584
Programs are loaded and run with `PROGSTART` (0x0100), with the command line in
585
`COMMANDLINE` (0x0080) and with its length stored at `COMMANDLINE_sz` (0x0080).
586
It is highly recommended to use these constants rather than numeric values (the
587
same goes for key codes, call numbers, etc.). The stack initially grows from
588
the top of 0x0000, it can be manually rearranged to any place above 0x3b00.
589
File operations and data transfers in BDOS can be done at any address in
590
the userspace.
591
 
592
It is not recommended to read keyboard ports manually, use `OS_GETKEYMATRIX` -
593
it returns the pressed keys only to the task that is currently in focus.
594
 
595
It is not recommended to use the `syssets.asm` dependency in user programs.
596
 
597
Application developers use the symbolic key names defined in `sysdefs.asm` under
598
"Usable key codes".
599
 
600
The system is currently unable to assemble itself. To reach this goal, we will
601
follow a number of guidelines for programming in assembly language:
602
 
603
* it is not recommended to use external utilities (`*.exe`) for building
604
  programs, except for the assembler and the NedoLang package.
605
* it is recommended to format hexadecimal numbers in the 0xffff format, it is
606
  not recommended to use binary numbers (in extreme cases, write in the 0b0101
607
  format).
608
* it is recommended to write arithmetic expressions so that they are executed
609
  correctly even in the absence of priority of operations. If this requires
610
  starting an expression with a parenthesis, write a + sign before the
611
  parenthesis.
612
* it is recommended to write arithmetic expressions so that they are executed
613
  correctly in unsigned multiplication and division.
614
* it is not recommended to use `ifn a == b`, use `if a != b`.
615
* it is not recommended to use `ORG` other than the initial one. Use `ds addr-$`.
616
* it is not recommended to use `DUP..EDUP`, you can use `include` for large
617
  blocks, and expand small ones.
618
* it is not recommended to use `EQU` and `STRUCT`, use the "=" sign.
619
* it is not recommended to use digital labels and transitions of type 1b
620
  (especially transitions of type 1f!).
621
* it is not recommended to write several commands in a line and several sets of
622
  parameters for one command.
623
* it is not recommended to use UTF-8 encoding, use Windows-1251 or CP866
624
  instead.
625
 
626
As the native build system will be improved, these restrictions will be relaxed.
627
 
628
Restarts in the kernel (it is highly recommended to use them through macros
629
since it is planned to free 0x0000 for the user, make `CALLBDOS` a restart, and
630
`SETPG...` calls for speed):
631
 
632
* `QUIT (0x0000)` - close the current task and free its memory
633
* `CALLBDOS (0x0005)` - calling BDOS (see functions in `sys_h.asm`, function
634
  number in C). You should not call this macro directly, for each command there
635
  is a separate macro `OS_...`. Registers are not saved!
636
* `OS_GETKEY (0x0008)` - read a key (HA=code with language, BC=code without
637
  language, key codes are specified in `sysdefs.asm`) and read the mouse at the
638
  same time (de=mouse position (y, x), l=mouse buttons (bits 0, 1, 2:
892 alone 639
  0=pressed)), and also Kempston joystick (LX),
640
  nz=the program is not in focus, the buttons are shown empty,
874 alone 641
  the mouse position must be ignored (=0)
642
* `OS_PRCHAR (0x0010)` - print character A (registers are not saved!)
643
* `SETPG4000 (0x0018)` - enable page A at 0x4000 (corrupts the BC register). The
644
  page number is stored in (CURPG16K)
645
* `SETPG8000 (0x0020)` - enable page A at 0x8000 (corrupts the BC register).
646
  The page number is stored in (CURPG32KLOW)
647
* `SETPGC000 (0x0028)` - enable page A at 0xc000 (corrupts the BC register).
648
  The page number is stored in (CURPG32KHIGH) (switch the page at 0x0000 via
649
  `OS_SETMAINPAGE`, while the page must have a kernel!)
650
* 0x0030 - far call is planned
651
* 0x0038 - interrupt handler
652
 
653
BDOS functions: see `sys_h.asm`.
654
 
655
The entry to the standard interrupt handler looks like this:
656
 
657
```
658
    push af
659
    push bc
660
    push de
661
```
662
 
663
How to capture an interrupt handler in your program:
664
 
665
* replace 3 bytes at 0x0038 with `jp <address of your handler>`, and take the
666
  `intjp` address from 0x0038+3 and copy to yourself.
667
 
668
For example:
669
 
670
```
671
swapimer                    ;the first call will turn on your handler,
672
                            ;the second call will return the standard handler
673
        di
674
        ld hl, (0x0038 + 3) ;address intjp
675
        ld (intjpaddr), hl
676
        ld de, 0x0038
677
        ld hl, oldimer
678
        ld bc, 3
679
swapimer0
680
        ld a, (de)
681
        ldi                ;[oldimer] -> [0x0038]
682
        dec hl
683
        ld (hl), a         ;[0x0038] -> [oldimer]
684
        inc hl
685
        jp pe, swapimer0
686
        ei
687
        ret
688
oldimer
689
        jp on_int          ;will be replaced with the code from 0x0038
690
        jp 0x0038 + 3
691
```
692
 
693
* your interrupt handler should call `oldimer`.  For example:
694
 
695
```
696
on_int
697
        ex de, hl         ;de = "hl", hl = "de"
698
        ex (sp), hl       ;hl = exit address, de = "hl", on the stack "de"
699
        ld (on_int_jp), hl
700
        ld ( on_int_sp), SP
701
        ld sp, INTSTACK   ;in order not to mess up the stack
702
        push af
703
        push bc
704
        push de           ;"hl"
705
        ...
706
        call oldimer      ;ei
707
        ...
708
        pop de            ;"hl"
709
        pop bc
710
        pop af
711
on_int_sp = $ + 1
712
    ld sp , 0
713
; de = "hl", on the stack "de"
714
        pop de
715
        ;
716
```
717
 
718
* do not use `YIELD`, use `HALT` instead. Otherwise, the interrupt will go to
719
  another task, and there is another interrupt handler.
720
* Call NedoOS functions (except for page switching) either in the interrupt
721
  handler or immediately after HALT.
722
* if you just install your music player, use `OS_SETMUSIC`, while you can ignore
723
  the previous two points (music will work anyway).
724
 
725
Developers
726
----------
727
 
728
* Project manager, code, documentation - Dmitry Mikhailovich Bystrov
729
  (Alone Coder/Conscience).
730
* Networking, patches to the disk subsystem, utilities, testing - DimkaM.
731
* A bit of code and documentation - Nikolay Aleksandrovich Grivin.
732
* NedoBasic was written with the participation of Kirill Lovyagin as part of the
733
  assembly language training.
734
* Further development of NedoBasic and Nedovigator, build scripts for Linux,
735
  utilities - demige.
736
* Sorting files, fixing build scripts for Linux, `aynet_psg` utility, sjasm and
737
  UnrealSpeccy fixes - Lord Vader.
738
* rdtrd, wrtrd - Konstantin Kosarev.
739
* ZX Battle City game - Slip, music - nq, testing - Videogames Sematary,
740
  porting - Alone Coder.
741
* Porting the game Eric and the Floaters - Rasmer, coloring - Alone Coder,
742
  Sashapont.
743
* Porting the game Black Raven - Alone Coder, coloring - Alone Coder, Sashapont,
744
  Kitty, Louisa.
745
* Logos - Louisa, Sashapont, Wizard.
746
 
747
The disk subsystem is based on the FatFS library with drivers from Savelij13
748
and DimkaM and the iofast library from the NedoLang suite.
749
 
750
The operating system idea was brought in 2007 when the first version of the
751
kernel was written (but never tested). The main portion of the kernel code,
752
`cmd` and `nv`, and part of Scratch graphic editor was written in 2018.
753
 
754
License
755
-------
756
 
757
Free distribution of the program and its source code is allowed. Please ask
758
for the approval from project manager if you want to port the code or its
759
parts to a different platform.
760
 
761
System setup
762
------------
763
 
764
Clock usage according to Mr. Gluk's schematics for ATM2 is tested in
765
UnrealSpeccy 0.37.1.
766
 
767
Disk images (the HDD image can be mounted through WinImage, and the SD-card
768
image can be mounted in Windows). Do not forget to unmount it once done:
769
 
770
    http://alonecoder.nedopc.com/sd.zip
771
    http://alonecoder.nedopc.com/hdd.zip
772
 
773
Installing the system on a real HDD:
774
 
775
1. Run `mkatm2.bat` (or `mkatm3.bat` for ATM3).
776
2. Using `nv`, copy all the files from the `*.trd` received to `e:/bin/`.
777
3. Run `mkatm2hd.bat` (or `mkatm3hd.bat` for ATM3), copy the resulting `*.$c`
778
   to drive 1.
779
 
780
Then you can start the system (`*.$c`) from the HDD.
781
 
782
Installation of the system on a real SD-card: copy the `bin/` directory and
783
the required `$c` to the root of a SD-card.
784
 
785
Settings for the UnrealSpeccy emulator:
786
 
787
```
788
[ZC]            ; Z-Controller settings
789
; sdcard image
790
SDCARD="sd.vhd"
791
 
792
[HDD]
793
Scheme = NEMO-DIVIDE (for ATM3 version) or ATM (for ATM2 version)
794
 
795
Image0 = hdd.ima
796
CHS0=609/16/63  ; max size, accessible through CHS. not used for real drive
797
LBA0=614400     ; max size, accessible through LBA. not used for real drive
798
HD0RO=0         ; read only flag
799
CD0=0           ; 1 if image is cdrom
800
```
801
 
802
`eVHDattach.bat` (you can mount also by clicking on `*.vhd`):
803
 
804
```
805
d:
806
cd zx\us035\
807
@echo off
808
if exist VHDattach.txt (
809
    @echo on
810
    echo VHDattach.txt exist
811
    @echo off
812
) else (
813
    @echo on
814
    echo create VHDattach.txt
815
    @echo off
816
    echo select vdisk file="%cd%\sd.vhd" > VHDattach.txt
817
    echo attach vdisk >> VHDattach.txt
818
    rem echo select vdisk file="%cd%\sd.vhd" >> VHDattach.txt
819
    rem echo select part 1 >> VHDattach.txt
820
    rem echo assign letter=K >> VHDattach.txt
821
)
822
if exist sd.vhd (
823
    @echo on
824
    echo sd.vhd attach
825
    diskpart /s VHDattach.txt
826
    @echo off
827
) else (
828
    @echo on
829
    echo create VHDcreate.txt
830
    @echo off
831
    echo create vdisk file="%cd%\sd.vhd" MAXIMUM=300 TYPE=FIXED >
832
VHDcreate.txt
833
    echo select vdisk file="%cd%\sd.vhd" >> VHDcreate.txt
834
    echo attach vdisk >> VHDcreate.txt
835
    echo create part primary  >> VHDcreate.txt
836
    echo select part 1 >> VHDcreate.txt
837
    echo format label="ZX" quick fs=FAT32 >> VHDcreate.txt
838
    echo assign >> VHDcreate.txt
839
    @echo on
840
    diskpart /s VHDcreate.txt
841
    del VHDcreate.txt
842
    @echo off
843
)
844
@echo on
845
pause
846
```
847
 
848
`eVHDdetach.bat:`
849
 
850
```
851
d:
852
cd zx\us035\
853
@echo off
854
if exist VHDdetach.txt (
855
    @echo on
856
    echo VHDdetach.txt exist
857
    @echo off
858
) else (
859
    @echo on
860
    echo create VHDdetach.txt
861
    @echo off
862
    echo select vdisk file="%cd%\sd.vhd" > VHDdetach.txt
863
    echo detach vdisk >> VHDdetach.txt
864
)
865
@echo on
866
diskpart /s VHDdetach.txt
867
pause
868
```
869
 
870
On Windows 10, you can use right-click to mount and unmount.