X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=fifth.git;a=blobdiff_plain;f=doc%2Findex.html;h=a46af2c5bdccc6522ca531966e3506d6499383df;hp=d367d2a5c25d534f79f88670af8d54c9205e80ca;hb=HEAD;hpb=1bfb3ff178c78561252ef705b9aad2857a95e424 diff --git a/doc/index.html b/doc/index.html index d367d2a..174e5ec 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,255 +1,298 @@ - - + + + + + + Fifth - virtual machine, operating system, programming language - - - - - - - -" - - - - - - + #org-div-home-and-up + { text-align: right; font-size: 70%; white-space: nowrap; } + textarea { overflow-x: auto; } + .linenr { font-size: smaller } + .code-highlighted { background-color: #ffff00; } + .org-info-js_info-navigation { border-style: none; } + #org-info-js_console-label + { font-size: 10px; font-weight: bold; white-space: nowrap; } + .org-info-js_search-highlight + { background-color: #ffff00; color: #000000; font-weight: bold; } + .org-svg { } + + -
-

Fifth - virtual machine, operating system, programming language

-
-
    -
  • download latest snapshot +
    +

    Fifth - virtual machine, operating system, programming language

    + -
    -

    1 !Project deprecated!

    +
    +

    1. General

    + +
    + +
    +

    1.1. Source code

    +
    + +
    +
    +
    + +
    +

    2. !Project deprecated!

    +

    Current implementation does not support object oriented programming. While working on Fifth I got lots of cool new ideas that @@ -258,7 +301,7 @@ require reimplementation of everything.

    Currently I try to implement those new ideas in the project called -Sixth +Sixth.

    @@ -267,274 +310,329 @@ operating system.

    -
    -

    2 Introduction

    -
    +
    +

    3. Introduction

    +

    -Fifth is programming lanquage & operating system, running on virtual -CPU, with custom instruction set. It is much like Charles Chunk -Moore's Forth, it also uses stack architecture, and many commands are -similar. Basically I got familiar with concepts of Forth, and being -inspired created my own system. +Fifth is a combination of:

    + +
    +
    +

    3.1. Screenshots

    +
    +
    +

    start.png +

    +

    -Screenshots +Startup screen diplaying Fifth logo and full file list.

    + +
    +

    dictionary.png +

    +
    +

    -Read more about: +Sample words defined. Most of the words are commands that can be +executed interactively from the command line or from a file. When +executed, they can be selectively compiled or interpreted. +

    + + + +
    +

    text editor.png +

    +
    + +

    +Built in text editor.

    -
    -
    -

    3 Installation

    -
    +
    + +
    +

    4. Installation

    +

    Just unpack all files, witout altering original directory structure, -somewhere in your hard disk. For example: C:\MISC\FIFTH\…. To run -fifth you need minimally just 2 files. emulator itself ( EMULATOR.EXE -or EMULATOR.COM ), and virtual disk file ( DISK.RAW ). +somewhere in your hard disk. For example: +

    + +
    +C:\MISC\FIFTH\
    +
    + + +

    +To run fifth you need minimally just 2 files:

    +
    +
    EMULATOR.COM
    Virtual CPU emulator
    +
    DISK.RAW
    Virtual disk file
    +

    -Read more about distribution directory layout +For more information, please refer to Fifth distribution directory +tree description.

    -
    -

    4 Software/Hardware/Human requirements

    -
    -
    -

    4.1 Software:

    -
    -
      -
    • MS-DOS 6.22, with HIMEM.SYS loaded. -
    • -
    • Mouse driver if you have a mouse. -
    • -
    • Does work only when CPU is in real mode. -
    • -
    • To recompile ASM sources I used FASM (Flat Assembler). -
    • -
    • I ran QBasic utilities on QB 4.5 . -
    • -
    • VESA support by BIOS, or external driver (UNIVBE). -
    • -
    + +
    +

    5. Fifth distribution directory tree description

    +
    +

    +After downloading and unpacking the ZIP file you shoud get directory +tree similar to this: +

    + +

    +DOC - Fifth documentation
    +  commands - documentation on Fifth built-in commands
    +  modules - documentation on additional commands, realized as loadable modules
    +  shots - Fifth screenshots
    +
    +imageFile - files contained within 'disk.raw', just an extracted form.
    +
    +source - source files
    +  emulator - emulator source
    +  util - utilites
    +
    +disk.raw - Virtual disk file, has filesystem inside.
    +emulator.com - main executable.
    +

    +
    + +
    +

    6. Requirements

    +
    -
    -

    4.2 Hardware:

    -
    +
    +

    6.1. Software

    +
      -
    • Minimum CPU 386. -
    • -
    • 64 KB free RAM below 640KB, -
    • -
    • 2 MB of free XMS. -
    • -
    • VESA compatible video card. -
    • +
    • MS-DOS 6.22 with HIMEM.SYS loaded.
    • +
    • Mouse driver (optional, if you have a mouse).
    • +
    • CPU is initialized into Unreal Mode during operation.
    • +
    • To recompile ASM sources, you can use FASM (Flat Assembler).
    • +
    • To run Quick Basic utilities, use Microsoft Quick Basic 4.5.
    • +
    • VESA support through BIOS or external driver (UNIVBE).
    -
    -

    4.3 Human:

    -
    + +
    +

    6.2. Hardware

    +
      -
    • Beginner level Forth knowledge is recommended. -
    • -
    • Lots of enthusiasm. -
    • +
    • A minimum of a i386 CPU.
    • +
    • 64 KB of free RAM below 640KB.
    • +
    • 2 MB of free extended memory.
    • +
    • A VESA-compatible video card.
    -
    -

    5 Numbers representation

    -
    -
    -

    numbers.png +

    +

    7. Numbers representation within Fifth

    +
    +

    +Because we are in full experimentation mode here (no regard for +compatibility whatsoever), why not to try also alternative number +representation ?

    -

    -Because I can define everything, starting from CPU, why not try also -alternative and unique number representation ? +Here alternative hexadecimal number representation format is devised: +

    + + +
    +

    numbers.png +

    +
    + +

    +Essentially square is split into 4 triangles. Each triangle represents +one bit.

    -Fifth uses its hexdecimal number representation as primary. Numbers -shape is formed by dividing a square into four parts. And manipulating -their color (black or white). +Fifth uses this hexadecimal format as primary throughout entire +system. +

    + +

    +See also: Bibi-binary.

    -
    -

    6 Disk file map, and it's data structures

    -
    + +
    +

    8. Disk file map, and it's data structures

    +

    Core and high-level boot code is stored outside of the filesystem to allow easy access to it, at early booting time, when filesystem is not yet initialized.

    -
    -

    6.1 disk allocation

    -
    - +
    +

    8.1. Disk allocation

    +
    +
    -+-+-+ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
    offsetlengthdescriptionoffsetlengthdescription
    0~4 KbFifth core0~4 KbFifth core
    4 Kb~32Kbhigh-level boot code4 Kb~32 Kbhigh-level boot code
    37 Kb~65KbFAT37 Kb~65 KbFAT
    101Kb~16MBfilesystem data area101 Kb~16 MBfilesystem data area
    -
    -

    6.2 FAT entry format:

    -
    - +
    +

    8.2. FAT entry format:

    +
    +
    -+-+ - - + + - - + + - - + + - - + +
    codemeaningcodemeaning
    -2last sector-2last sector
    -1empty sector-1empty sector
    0 --.. pointer to next block0 --.. pointer to next block
    -
    -

    6.3 file entry format

    -
    - +
    +

    8.3. File entry format

    +
    +
    -+-+-+ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
    offsetlengthdescriptionoffsetlengthdescription
    04extension04extension
    416name416name
    204entry point204entry point
    244size244size
    284last modification time284last modification time
    -
    -

    7 Core architecture

    -
    +
    +

    9. Core architecture

    +

    Fifth core is simply some amount of already compiled into machine code and linked together modules (entries in other words). In compilation @@ -546,64 +644,64 @@ dictionary space only. Random word can be removed from dictionary at any time. Currently dictionary can contain at most 1000 entries.

    -
    -

    7.1 dictionary entry format

    -
    - +
    +

    9.1. Dictionary entry format

    +
    +
    -+-+-+ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
    offsetlengthdescriptionoffsetlengthdescription
    040 < previous entry040 < previous entry
      0 = last  0 = last
      -1 = empty  -1 = empty
    415module name string415module name string
    191entry type191entry type
    204entry data204entry data
    @@ -615,226 +713,236 @@ run through headers backwards and find needed entry.

    -
    -

    7.2 Possible module types

    -
    - +
    +

    9.2. Possible module types

    +
    +
    -+-+-+ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
    typedescription"execute" actiontypedescription"execute" action
    0datacompile "num" instruction0datacompile "num" instruction
      with address to module  with address to module
    1submodulecompile "call" instruction1submodulecompile "call" instruction
      with address to module  with address to module
    2imm. submoduleimmediately call to module2imm. submoduleimmediately call to module
    -
    -

    7.3 Memory map: (average)

    -
    - +
    +

    9.3. Memory map

    +
    +
    -+-+-+ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
    <loc><size><desc>locationsizedescription
    0~4096core0~4096core
    1500000~32000highlevel Fifth boot code1500000~32000highlevel Fifth boot code
    200000h core startup messages area200000h core startup messages area
    5200000 end of dynamic memory space5200000 end of dynamic memory space
    -
    -

    8 Fifth source format

    -
    -

    -Fifth uses a different character table and codes than ASCII (still -almost similar). I call it FSCII (Fifth Standard Code for Information -Interchange) for example space character is not 32 but 255 instead. I -plan to use mainly HEX numbers, and create new characters to represent -numeric values. So typical nemric characters "0123…" is treated -like ordinary letters. +

    +

    10. Dynamically loadable modules

    +
    +
    +
    +

    10.1. Keyboard driver

    +
    +

    +
    +KBD_@ ( – code ) get scancodes for pressed keys from keyboard.
    +KBD_down? ( key – result ) check is key with specified scancode
    +                currently pressed down.
    +KBD_SC2FSCII ( code – FSCII ) convert key scancode into FSCII code,
    +                or in FSK (Fifth standard keycode).
    +KBD_F@ ( – FSCII ) read pressed key FSCII or FSK, returns -1 if no
    +                keys are pressed.
    +KBD_FW@ ( – FSCII ) read pressed key FSCII or FSK, if no keys is
    +                are pressed then waits until there is.
    +
    +                FSK
    +                —
    +In HEX.
    +
    +FC backspace
    +FD TAB
    +FE enter
    +FF space
    +
    +400 ESC
    +401 … F1 …
    +410 up
    +411 right
    +412 down
    +413 left
    +414 INS
    +415 DEL
    +416 home
    +417 end
    +418 PG/UP
    +419 PG/DN

    -
    -

    8.1 FSCII:

    -
    - - - --+ +
    +

    10.2. Mouse driver

    +
    +

    +mousex var Mouse x coordinate.
    +mousey var Mouse y coordinate.
    +mousekeyl var Mouse left key.
    +mousekeym var Mouse middle key.
    +mousekeyr var Mouse right key.
    +mousec var Display current mouse coordinates in top left part of screen,
    +                if true. (good for debugging)
    +mousepointer var Image buffer, holding current mouse pointer.
    +mouseadd ( ModuleAddr x1 x2 y1 y2 – ) Add specified area on screen,
    +                into mause click buffer. If any mouse button is clicked on
    +                that area, module at "ModuleAddr" will be executed.
    +mousebe var Amount of buffer elements.
    +mousedo ( – ) Updates mouse coordinates and keys. Parse mouse
    +                click buffer, and draw mouse cursor to "screen".
    +

    +
    +
    +
    +

    10.3. 2D graphic library

    +
    +
    +
    lineh ( color len x y imgbuf – )
    draws horisontal line from X,Y +coordinates to right, with specified length.
    -
    +
    linev ( color len x y imgbuf – )
    draws vertical line down, from +coordinates X,Y, with specified length.
    -- - - - - - - - - - - - - - +
    box ( color x2 x1 y2 y1 imgbuf – )

    +draws rectangular box. x2 +bust be >= x1, y2 must be >= y1. +

    -
    - - - - +
    +x1,y1-----------+
    +  |             |
    +  |             |
    +  +-----------x2,y2
    +
    - - - - - +
    flipv ( imgbuf – )
    flip image vertically.
    - - - - - +
    imgcoltrans ( ImgBuf Color ToColor – )
    Translate all pixels in +specified image with "Color" into "ToColor".
    - - - - - +
    imgfill ( color x y imgbuf – )
    Fill image region starting at +location X & Y with specified color.
    + + + - - - - - - -
    DECHEXfunction
    0 - 150 - FHEX numbers
    252FCbackspace
    253FDtabulator (TAB)
    254FEcarriage return (CR)
    255FFspace
    else ordinary characters, same as in ASCII.
    +
    +

    10.4. Trigonometry functions

    +
    +
    +
    +

    10.4.1. sin ( a – result )

    +
    +

    +Return sinus from given angle "a", 360ø is 2000. So 1000 represents +180ø angle. Result will be in range -10'000 to 10'000, instead of ñ1. +

    +
    +
    +
    +

    10.4.2. cos ( a – result )

    +
    +

    +Return cosinus from given angle. Parameters are like in sin function. +

    +
    -
    -