File size: 11,477 Bytes
806d4b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361

                                    Glossery

-] Abbreviations
  Abs   Absolute
  AC    AutoComplete
  Acct  Account
  ACD   AutoComplete Dictionary
  Addr  Address
  Alloc Allocate
  Alt   Alternate
  AOT   Ahead-of-Time
  AP    ApplicationProcessor (Core1 - Core7)
  Arg   Argument
  Asm   Assemble, Assembler or Assembly
  Attr  Attribute
  Aux   Auxilliary
  BG    Backround
  Bin   Binary
  Blk   Block
  Bmp   BitMap
  Bttn  Button
  Buf   Buffer
  Bwd   Backward
  CB    Call-Back, Code Block
  Cfg   Config
  Chg   Change
  Chk   Check
  Clip  Clipboard
  Clus  Cluster
  Cmd   Command
  Cmp   Compiler
  Cnt   Count
  Const Consant
  Cont  Continue
  Ctrl  Control.  The ctrl key is indicated with "^" in documentation.
  Cur   Current
  Cvt   Convert
  Dbg   Debug
  Dbl   Double
  DC    Device Context
  Del   Delete
  Desc  Descriptor, Description
  Dev   Device
  Dft   Default
  Dir   Directory, Direction
  Div   Divide
  Doc   Document
  Drv   Drive
  Dsk   Disk
  Dst   Destination
  Ed    Edit, Editor
  Elem  Element
  Equ   Equal
  Evt   Event
  Exe   Execute
  Ext   Extern, Extended, Extract
  Feat  Feature
  FG    Foreground
  Fmt   Format
  Fwd   Forward
  FPS   Frames per Second, First Person Shooter
  fp_   Function ptr
  Fun   Function
  Gen   Generate
  Glbl  Global
  Gr    Graphic
  Hndlr Handler
  IDE   Integrated Drive Electronics, Integrated Development Environment
  Id    Identification
  Ident Identifier, Identity, Identical
  IDT   Interrupt Descriptor Table
  Idx   Index
  Init  Initialize
  Ins   Insert, Install
  Inst  Instruction
  Int   Interrupt, Integer
  Irq   Interrupt (Request)
  JIT   Just-in-Time
  Kbd   Keyboard
  KD    Keyboard Device
  Len   Length
  Let   Letter
  Lex   Lexical Analyser
  Loc   Location, Lines of Code
  Log   Logarithm, Logical
  Lst   List
  Man   Manual
  Mem   Memory
  Mgd   Managed
  Mgr   Manager
  Mid   Middle
  Mon   Month
  MP    MultiProcessor
  Ms    Mouse
  Msg   Message
  Num   Number
  Obj   Object
  Occ   Occurrence
  ODE   Ordinary Differential Equation
  Opt   Option, Optimize
  Paren Parenthesis
  Pix   Pixel
  Pkg   Package
  Poly  Polygon
  Pos   Position
  Pow   Power
  Prec  Precedence
  Prev  Previous
  Pri   Primary
  Prod  Product, Production
  Prof  Profile, Profiler
  Prs   Parse, Parser
  Prt   Partition
  FunSeg Program Section
  Pt    Point
  Ptr   Pointer
  Que   Queue
  Rand  Random
  Ref   Reference
  Reg   Register, Registry, Regular
  Rem   Remove
  Rep   Report, Repeat
  Res   Result
  Rev   Reverse, Reversed
  Rqst  Request
  Rst   Reset
  Rot   Rotation
  Rx    Receive
  Sched Sceduler
  Scrn  Screen
  Sec   Second, Secondary
  Sect  Sector
  Sel   Select, Selected
  Seq   Sequence
  Snd   Sound
  SP    SingleProcessor
  Src   Source
  Srv   Servant
  Stat  Status, Statistic
  Std   Standard
  Stk   Stack
  Stmt  Statement
  Str   String
  Sym   Symbol
  Sync  Synchronization
  Sys   System
  Tbl   Table
  Term  Terminal
  Tmp   Temporary
  Tri   Triangle
  Tx    Transmit
  UAsm  Unassemble
  Val   Value
  Var   Variable
  Vect  Vector
  Vis   Visible
  Vol   Volume
  Win   Window
  Wiz   Wizard
-] Task/Process/Thread
  There is no distinction between task, process or thread.  The Fs segment reg
  is kept pointing to the current task's CTask.  There is only one window per
  task, and only Core0 tasks can have windows.  Each task has a code and data
  heap so memory is returned when it dies.  Each task has a hash symbol table.

  Since there is not friendly disk sharing and all tasks have the same address
  map, it might be accurate to call TempleOS, "multi-thread/single-process".
  You run a single application process on Core0 and it can create threads on the
  same core or others.  If you run multiple processes, it should be safe, but
  one process will wait until another completely finishes a long disk access.
-] Adam Task
  This is Adam, as in Adam and Eve, the parent of all tasks.  Adam is immortal.
  The adam task is created at start-up and appears in the small window at the
  top beneath the user terminal windows.  Since the Adam task is immortal, on
  Adam's heap go all memory objects which you don't want destroyed by any single
  task's death.  When created, Adam runs the file ::/StartOS.HC.  When start-up
  is finished, the adam task enters a server mode where it accepts requests from
  other tasks.  The Adam("") routine will make Adam compile and run text src
  code.  #include stmts can be sent to Adam(""), creating system-wide code and
  data which are immortal.
-] Seth Tasks
  In the Bible, Seth is Adam and Eve's child.  Each CPU core has an executive
  task called Seth that is immortal.  The Adam task on Core0 is also its Seth
  task.
-] Code and Data Heaps
  TempleOS uses the asm CALL inst, exclusively, and that inst is limited to
  calling routines +/-2Gig from the current code location.  To prevent
  out-of-range issues, I decided to separate code and data, placing all code
  within the lowest 2Gig of memory, addresses 00000000-7FFFFFFF.  The compiler
  and Load()er alloc memory from the code heap to store code and glbl vars,
  unless the compiler option OPTf_GLBLS_ON_DATA_HEAP is used.  When programs
  call MAlloc() is from the data heap, which in not limited in size, except by
  physical RAM memory.  You can alloc from any heap in any task at any time on
  any core, even making independent heaps.
-] Parent, Child and PopUp Tasks
  Often a task will Spawn() or PopUp() a task as a helper.  The helper is known
  as a child Task, though you can Spawn a task and assign it a different
  parent... like Adam.  Links are kept as to who's whose child, so when one task
  is Kill()ed the child helper tasks die, too.  You can get a report of current
  system tasks with TaskRep().  There is just one window per task, so child
  tasks are needed for pop-ups.
-] HolyC
  HolyC is more than C and less than C++.  It has the default args of C++ and
  uses class in place of struct.  It uses U0,U8,U16,U32,I64 and I0,I8,I16,I32,I6
  4 for signed and unsigned ints.  It has different operator precedence.  It has
  PASCAL-like function calls with no parens, but requires an & when referring to
  function addresses.
-] AOT Compile Mode
  Ahead-of-Time compiling is conventional compilation mode.  Do not use AOT, use
  JIT compiling.

  In AOT mode, .PRJ files are compiled to .BIN files, skipping .OBJ files.
  After compiling, .BIN files are Load()ed.

  There is no main() routine.  Instead, stmts outside functions are
  automatically executed upon loading.  There is no way to unload except by
  killing the task.  To invoke AOT Compiled Mode, Cmp() is used.  The Kernel
  module and compiler are made in AOT compiled mode.  See BootHDIns()  which
  calls MakeAll() where ::/Kernel.BIN.C and ::/Compiler/Compiler.BIN are
  created.
-] JIT Compile Mode
  In just-in-time mode, the compiler places code and data in memory alloced from
  the heap, incrementally, making them immediately ready for in-place execution.
   This mode is used during cmd line operations.  When you #include a file, it
  is compiled function by function and code ends-up all over in the memory, at
  least in the first 2Gig of memory.  The ExeFile() routine is the same as #incl
  ude but can be used in programs.  ExePrint() routine will compile and run a
  string.
-] Compiler Intermediate Code
  The compiler generates insts one step before making actual assembly (machine)
  language insts.  This code is rev polish stack machine in nature and can be
  viewed with PassTrace().  The compiler does not interpret code, except in the
  process of optimization to make the final machine code.  Assembly language
  output can be viewed when code is compiled with the Trace(), or, afterward,
  with U() or Uf("").
-] Drive/Partition

  There is no distinction between drive or partition.  They are specified with a
  single letter from A-Z.

  ':' is the boot drive.
  '~' is the home drive.

  The letters are reserved for different uses.

  A-B are RAM drives.
  C-L are ATA hard drives.
  M-P are ISO file read drives.
  Q-S are ISO file write drives.
  T-Z are ATAPI CD/DVD drives.

  For commands taking a drive letter as an argument, char 0 is the current
  drive.
Bt, Bts, Btr, Btc, BEqu
Define
DolDoc
Editor Link Types
files_find_mask
Hash Table
InFile
Ona
Pag
RedSea File System
Sprite

-] CLI, STI, PUSHFD, POPFD
  These are x86 assembly insts.
  CLI disable interrupts.
  STI enable interrupts.
  PUSHFD pushes the CPU flags.
  POPFD pops the CPU flags.
-] Filename Extention Types
  *.???.Z
    These files are automatically compressed or uncompresses files when read or
  written.
  *.???.C
    Contiguous files--NOT compressed.
  *.DD.Z;*.DD
    Text Files
  *.HC.Z;*.HC
    HolyC src files.  The default HolyC compiler type is .HC.Z.
  *.PRJ.Z;*.PRJ
    HolyC src files to be compiled AOT.
  *.HH.Z;*.HH
    HolyC src header files.
  *.MAP.Z;*.MAP
    Compiler "map" files
  *.BIN.Z;*.BIN.C;*.BIN
    Binary executable files, created by Cmp() and read by Load().
  *.DATA.Z;*.DATA
    Data files
  *.ISO
    CD/DVD image file--ISO9660.
  *.IN.Z;*.IN
    InFile Basically a HolyC program whose stdout goes to the input of a task
  when InFile() is called.
  *.GR.Z;*.GR
    Graphics file

  FILEMASK_TXT
  FILEMASK_SRC
  FILEMASK_AOT
  FILEMASK_JIT
  FILEMASK_GR
-] Naming Convention
  Since there are no namespaces and I don't plan to implement name spaces, I
  highly recommend putting a 2-3 character module code prefix on syms. e.g. WS,
  Doc, Lex

  ALL_CAPS
    Assembly Language labels are capitalized with underscores between words.  So
  are #define's.

  _ALL_CAPS
    Asm routines which are HolyC callable must have a leading underscore.

  MixedCaps
    HolyC Functions and class names are MixedCaps.

  lower_case
    Local function vars and glbl vars are lower case.  Class member names are
  also lower_case.

  _lower_case
    Function args which are outputs (passed as ptrs) have leading underscores.
  Also, args which have idently named local variable counterparts have leading
  underscores.

  DOCf_????
    Flags bit nums instead of bit values are designated with a lower case f.

  DOCG_????
    Flag groups are designated with "G".

  res is reserved for local variables that hold the function return val.

  * I used C++ like naming.  I place New, Del, Init, Rst, ect. on the end of a
  function name instead of at the beginning.  RstMusicSettings should be MusicSe
  ttingsRst.
-] Fs
  The CPU FS segment reg.  This reg points to the current task's CTask.
-] Gs
  The CPU GS segment reg.  This reg points to the current core's CCPU.
-] Heap
  Programs can dynamically request chunks of memory alloced from a heap using
  MAlloc().  They must Free() it when finished.  Ptrs are used to refer to the
  chunk.  The heap is dynamically alloced mem.
-] Join
  When two parts of a program have a common low-level routine, that routine is
  often labeled SomethingJoin.
-] user_data
  Many operating system structures have space set aside for you to store values.
   You are on your own managing these with multiple applications and libraries.
-] Multicore Core0/CoreAP
  Core0, has the Adam Task, and it is the master.  The application processors
  have an executive Seth Tasks and are the slave processors.  Only Core0 tasks
  can have windows and can launch applications.  Slave cores are used if the
  application explicitly Spawns() a task or JobQue() a job on them.