fixed file permissions
[fifth.git] / doc / index.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <head>
4 <meta
5     http-equiv="Content-Type"
6     content="text/html; charset=UTF-8">
7 <title>FIFTH</title>
8 </head>
9 <body>
10     <h1>FIFTH - virtual machine, operating system, programming language</h1>
11     <a href="http://www2.svjatoslav.eu/gitweb/?p=fifth.git;a=snapshot;h=HEAD;sf=tgz">Download</a>
12     &nbsp;&nbsp;
13     <a href="http://www2.svjatoslav.eu/gitbrowse/fifth/doc/index.html">Online homepage</a>
14     &nbsp;&nbsp;
15     <a href="http://svjatoslav.eu/programs.jsp">Other applications hosted on svjatoslav.eu</a>
16     <pre>
17 <b>Program author:</b>
18     Svjatoslav Agejenko
19     Homepage: <a href="http://svjatoslav.eu">http://svjatoslav.eu</a>
20     Email: <a href="mailto:svjatoslav@svjatoslav.eu">svjatoslav@svjatoslav.eu</a>
21
22 This software is distributed under <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU GENERAL PUBLIC LICENSE Version 2</a>.
23
24 <h2>Introduction</h2>
25
26 Fifth is programming lanquage & operating system, running on
27 <a href="emulator.html">virtual CPU</a>, with custom instruction set. It is much like
28 Charles Chunk Moore's Forth, it also uses stack architecture,
29 and many commands are similar. Basically I got familiar with
30 concepts of Forth, and being inspired created my own system.
31 <p />
32 Note:
33 <i>
34 Current implementation does not support object oriented programming.
35 While working on Fifth I got lots of cool new ideas that require reimplementation
36 of everything.
37  
38 Currently I try to implement those new ideas in the project called
39     <a href="http://www2.svjatoslav.eu/gitbrowse/sixth/doc/index.html">Sixth</a>.
40 </i>
41 <br />
42 <a href="shots/index.html">Screenshots</a>
43
44 Read more about:
45 <br>  <a href="emulator.html">Virtual CPU</a>
46 <br>  <a href="commands/index.html">Built-in commands</a>
47 <br>  <a href="modules/index.html">Additional commands, realized as loadable modules</a>
48 <br>  <a href="5TH_ET.txt">Example Fifth source file - text editor </a>
49
50
51     <h2>Installation</h2>
52
53 Just unpack all files, witout altering original directory structure,
54 somewhere in your hard disk. For example: C:\MISC\FIFTH\....
55 To run fifth you need minimally just 2 files.
56 emulator itself ( EMULATOR.EXE or EMULATOR.COM ), and
57 virtual disk file ( DISK.RAW ).
58 Read more about <a href="files.txt">distribution directory layout</a>.
59
60
61
62     <h2>Software/Hardware/Human requirements</h2>
63
64
65 Software:
66     MS-DOS 6.22, with HIMEM.SYS loaded.
67         Mouse driver if you have a mouse.
68         Does work only when CPU is in real mode.
69         To recompile ASM sources I used FASM (Flat Assembler).
70         I ran QBasic utilities on QB 4.5 .
71         VESA support by BIOS, or external driver (UNIVBE).
72
73 Hardware:
74     Minimum CPU 386.
75         64 KB free RAM below 640KB,
76         2 MB of free XMS.
77         VESA compatible video card.
78
79 Human:
80     Beginner level Forth knowledge is recommended.
81         Enthusiasm.
82
83
84
85     <h2>Numbers representation</h2>
86
87 <img src="numbers.png">
88
89 Fifth uses hexdecimal number representation as primary.
90 Numbers shape is formed by dividing a square into four parts.
91 And manipulating their color (black or white).
92
93
94
95     <h2>Disk file map, and it's data structures</h2>
96
97
98 Core and high-level boot code is stored outside of the filesystem to allow
99 easy access to it, at early booting time, when filesystem is not yet
100 initialized.
101
102                         disk allocation:
103
104 offset  length  description
105
106 0       ~4 Kb   Fifth core
107 4  Kb   ~32Kb   high-level boot code
108 37 Kb   ~65Kb   FAT
109 101Kb   ~16MB   filesystem data area
110
111                         FAT entry format:
112
113 -2      last sector
114 -1      empty sector
115 0 --  .. pointer to next block
116
117                         file entry format
118
119 offset  length  description
120
121 0       4       extension
122 4       16      name
123 20      4       entry point
124 24      4       size
125 28      4       last modification time
126
127
128
129     <h2>Core architecture</h2>
130
131
132 Fifth core is simply some amount of already compiled into machine code
133 and linked together modules (entries in other words). In compilation
134 process modules is compiled one by one and simply stored on top of
135 already existing and growing core. Separately from core is kept
136 dictionary, this is special list that contain names of compiled modules,
137 variables etc. and they locations in core. Constants use dictionary space
138 only. Random word can be removed from dictionary at any time. Currently
139 dictionary can contain at most 1000 entries.
140
141
142                         dictionary entry format
143
144 offset  length  description
145
146 0       4        0 &lt; previous entry
147                  0 = last
148                 -1 = empty
149 4       15      module name string
150 19      1       entry type
151 20      4       entry data
152
153 Core headers as linked list of module names make up something like dictionary.
154 When some entry address is needed compiler can quickly run through headers
155 backwards and find needed entry.
156
157                         Possible module types
158
159 type    description     "execute" action
160
161 0       data            compile "num" instruction
162                         with address to module
163 1       submodule       compile "call" instruction
164                         with address to module
165 2       imm. submodule  immediately call to module
166
167
168                 Memory map: (average)
169
170 <loc>   <size>  <desc>
171 0       ~4096   core
172 1500000 ~32000  highlevel Fifth boot code
173 200000h         core startup messages area
174 5200000         end of dynamic memory space
175
176
177
178     <h2>Fifth source format</h2>
179
180
181 Fifth uses a different character table and codes than ASCII.
182 I call it FSCII (Fifth Standard Code for Information Interchange)
183 for example space character is not 32 but 255 instead.
184 I plan to use mainly HEX numbers, and create new characters
185 to represent numeric values. So typical nemric characters "0123..."
186 is treated like ordinary letters.
187
188         FSCII:
189
190 DEC     HEX     function
191
192 0 - 15  0 - F   HEX numbers
193 252     FC      backspace
194 253     FD      tabulator (TAB)
195 254     FE      carriage return (CR)
196 255     FF      space
197
198 else            ordinary characters, like in ASCII.
199
200
201     
202     
203     
204     </pre>
205 </body>
206 </html>