initial commit
[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://php.svjatoslav.eu/gitweb/?p=fifth.git;a=snapshot;h=HEAD;sf=tgz">Download</a>
12     &nbsp;&nbsp;
13     <a href="http://svjatoslav.eu/static/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>Introdution</h2>
25
26 Fifth is programming lanquage & operating system, running on
27 <a href="emulator.html">virtual CPU</a>, with custom instructionset. It is mutch like
28 Charles Chunk Moore's Forth, it also uses stack architecture,
29 and many commands are similar. Basically I got famailiar 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 <a
39                 href="http://svjatoslav.eu/static/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:       MS-DOS 6.22, with HIMEM.SYS loaded.
66                 Mouse driver if you have a mouse.
67                 Does work only when CPU is in real mode.
68                 To recompile ASM sources I used FASM (Flat Assembler).
69                 I ran QBasic utilites on QB 4.5 .
70                 VESA support by BIOS, or external driver (UNIVBE).
71
72 Hardware:       Minimum CPU 386.
73                 Recommended CPU Pentium 133.
74                 64 KB free RAM below 640KB,
75                 2 MB of free XMS.
76                 VESA compatible video card.
77
78 Human:          Beginner level Forth knowledge is recommended.
79                 Enthusiasm.
80
81
82
83     <h2>Numbers representation</h2>
84
85 <img src="numbers.png">
86
87 Fifth uses hexdecimal number representation as primary.
88 Numbers shape is formed by dividing a square into four parts.
89 And manipulating their color (black or white).
90
91
92
93     <h2>Disk file map, and it's data structures</h2>
94
95
96 Core & highlevel boot code is stored outside of the filesystem to allow
97 easy access to it, at early booting time, when filesystem is not yet
98 initialized.
99
100                         disk allocation:
101
102 offset  length  description
103
104 0       ~4 Kb   Fifth core
105 4  Kb   ~32Kb   highlevel boot code
106 37 Kb   ~65Kb   FAT
107 101Kb   ~16MB   filesystem data area
108
109                         FAT entry format:
110
111 -2      last sector
112 -1      empty sector
113 0 --  .. pointer to next block
114
115                         file entry format
116
117 offset  length  description
118
119 0       4       extension
120 4       16      name
121 20      4       entry point
122 24      4       size
123 28      4       last modification time
124
125
126
127     <h2>Core architecture</h2>
128
129
130 Fifth core is simply some amount of already compiled into machine code
131 and linked together modules (entries in other words). In compilation
132 process modules is compiled one by one and simply stored on top of
133 already existing and growing core. Separately from core is kept
134 dictionary, this is special list that contain names of compiled modules,
135 variables etc. and they locations in core. Constants use dictionary space
136 only. Random word can be removed from dictionary at any time. Currently
137 dictionary can contain at most 1000 entries.
138
139
140                         dictionary entry format
141
142 offset  length  description
143
144 0       4        0 &lt; previous entry
145                  0 = last
146                 -1 = empty
147 4       15      module name string
148 19      1       entry type
149 20      4       entry data
150
151 Core headers as linked list of module names make up something like dictionary.
152 When some entry address is needed compiler can quickly run through headers
153 backwards and find needed entry.
154
155                         Possible module types
156
157 type    description     "execute" action
158
159 0       data            compile "num" instruction
160                         with address to module
161 1       submodule       compile "call" instruction
162                         with address to module
163 2       imm. submodule  immideately call to module
164
165
166                 Memory map: (average)
167
168 <loc>   <size>  <desc>
169 0       ~4096   core
170 1500000 ~32000  highlevel Fifth boot code
171 200000h         core startup messages area
172 5200000         end of dynamic memory space
173
174
175
176     <h2>Fifth source format</h2>
177
178
179 Fifth uses a different character table and codes than ASCII.
180 I call it FSCII (Fifth Standard Code for Information Interchange)
181 for example space character is not 32 but 255 instead.
182 I plan to use mainly HEX numbers, and create new characters
183 to represent numeric values. So typical nemric characters "0123..."
184 is treated like ordinary letters.
185
186         FSCII:
187
188 DEC     HEX     function
189
190 0 - 15  0 - F   HEX numbers
191 252     FC      backspace
192 253     FD      tabulator (TAB)
193 254     FE      carriage return (CR)
194 255     FF      space
195
196 else            ordinary characters, like in ASCII.
197
198
199     
200     
201     
202     </pre>
203 </body>
204 </html>