home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / FLIGHTSI / TEKSTEN / FSSTRUC3 / FSSTRUCT.TXT
Text File  |  1993-06-13  |  158KB  |  4,034 lines

  1.  
  2.                          MICROSOFT FLIGHT SIMULATOR
  3.                             DATA FILE STRUCTURES
  4.  
  5. INTRODUCTION
  6.  
  7. Document version 3, release data: 6 June 1993
  8.  
  9. Updates:
  10. ∙ Added records 0Ah, 11h, 39h, 47h, 57h, 59h
  11. ∙ Updated record 10h, 27h, 58h
  12. ∙ Extended the description of SC0 files (John Blackie's contribution)
  13. ∙ Extended .DRV description with checksum routine explained
  14. ∙ Added .DYN description with a reference for dynamic records (John Mechalas'
  15.   contribution)
  16. ∙ Added .ADV description with a reference for dynamic records (John Mechalas'
  17.   contribution)
  18. ∙ Added a short note on ATP SCNs (source: Simon Hradecky).
  19.  
  20. ────────────────────
  21.  
  22. Document version 2.2, release date: 10 February 1993
  23.  
  24. Updates:
  25. ∙ The descriptions of following records have been updated:
  26. 00h, 05h, 0Bh, 0Eh, 0Fh, 10h, 13h, 14h, 15h, 16h, 17h, 18h, 19h, 1Bh, 1Ch,
  27.   1Fh, 23h, 24h, 27h, 28h, 29h, 2Ah, 2Bh, 35h, 36h, 3Bh, 3Ch, 3Dh, 3Eh, 42h,
  28.   43h, 44h, 49h, 4Ah, 79h
  29. ∙ Extended variable treatment; the variable usage of the standard scenery F1
  30.   is described in some detail, many variables have been added
  31. ∙ F1 format description has been extended
  32. ∙ Added notes on the .SC0, .ELE and .DRV formats
  33.  
  34. ────────────────────
  35.  
  36. Document version 2.1, release date: 10 December 1992.
  37.  
  38. Updates:
  39. ∙ Added 3 variables and all the records present in the default scenery F1
  40.  
  41. ────────────────────
  42.  
  43. Document version 2.0, release date: 15 November 1992.
  44.  
  45. Updates:
  46. ∙ Added static scenery record codes reference
  47. ∙ Completed 5Ah record in mountain description
  48. ∙ Corrected description of 0Bh, 0Eh, 16h, 25h records and "range" records
  49. ∙ Added ATC records and many records used in other kinds of scenery
  50. ∙ Added .DEM and .MOD file structures
  51.  
  52. Many record codes have been added, and more obscure points have surfaced.
  53.  
  54. ────────────────────
  55.  
  56. Document version 1.0, release date: 15 September 1992.
  57.  
  58.   This document describes the structures of files created or provided with
  59.   Microsoft Flight Simulator 4.0 and/or the Microsof Aircraft and Scenery
  60.   Designer ver 1. The document is ideally addressed to developers and
  61.   requires a good knowledge of hex notation and some familiarity with
  62.   programming concepts.
  63.  
  64.  
  65. Conventions:
  66. ∙ The symbol "m" always means meters, while nautical miles are noted by "NM".
  67. ∙ Hex values are marked with an final 'h', non-marked values are decimal, the
  68.   only exception being code dumps in examples which are in hex.
  69. ∙ Within scenery files, all multi-byte values follow the Intel convention:
  70.   lower order bytes precede higher order bytes; they are always transcribed
  71.   as a single value restoring the correct digit positions ("53h 07h" means a
  72.   byte value 53h followed by a byte value 07h, while "FFFBh" means a word
  73.   value FFFBh made of a first byte FBh and a second byte FFh).
  74. ∙ Record structure is given in columnar form: in the 1st column the offset
  75.   within the record, in the 2nd the length of each field, in the 3rd the des-
  76.   cription of the field.
  77. ∙ Unindentified or undeciphered (parts of) records are marked with "???".
  78. ∙ Records fields which have the same value xxxx in all the examples I saw are
  79.   described as "always xxxx ??".
  80. ∙ Fields whose value, when arbitrarely changed by hand, does not affect
  81.   object appearance or behaviour are declared "irrelevant".
  82.  
  83. Additions, corrections or suggestions are welcome. I apologize for English
  84. language errors and inelegancies.
  85.  
  86. ┌──────────────────────────────────────────────────────────────────┐
  87. │      I would like express my debt to:                            │
  88. │ Greg Pierson [72520,1775]                                        │
  89. │      whose program DCOD01.EXE is at the origin of my work and to │
  90. │ John Blackie [100032,532],                                       │
  91. │ John Mechalas,                                                   │
  92. │ Dan Samuel [70110,434],                                          │
  93. │ Andrew Tuline [70742,3176] and                                   │
  94. │ Steve Turley [71340,1562]                                        │
  95. │      for their additions, suggestions and friendly support.      │
  96. └──────────────────────────────────────────────────────────────────┘
  97.  
  98.                     Maurizio M. Gavioli
  99.  
  100.  CompuServe: 100021,2335                               (checked once a week)
  101.  InterNet:   "Maurizio M. Gavioli"<VINCIGLI@idg.fi.cnr.it> (checked daily)
  102.  
  103.  
  104. --------------------------
  105. DISCLAIMER
  106. --------------------------
  107.  
  108. The below information was derived from months of analysis of FS4/ASD files
  109. (often manually generated for this very purpose), during which I also had
  110. many occasions to appreciate the sophistication of FS scenery description
  111. language.  The FS/ASD community as a whole has spent way too much time decod-
  112. ing this information in order to generate useful utilities.  It would be nice
  113. if the original authors chose to publish an "official" documentation of FS
  114. data files.  However, the below information is not distributed with an eye
  115. towards enabling anyone to rob the original authors of any rightful profits
  116. and should be used only for the common good of the FS community and to
  117. encourage availability and sales of FS and related products and utilities.
  118.  
  119. ========================================
  120.  
  121.                               GENERAL CONCEPTS
  122.  
  123. FS COORDINATES AND GEOGRAPHIC UNIT
  124.  
  125. FS coordinate unit (thereafter "FSu") is very close to 256 meters.
  126.  
  127. FS North and East coordinates are internally coded with code 49,152 (= C000h)
  128. representing coordinate 0; therefore codes from 49,152 to 65,535 (C000h to
  129. FFFFh) represent coordinates from 0 to 16,383 and codes from 0 to 49,151
  130. (0000h to BFFFh) represent coordinates from 16,384 to 65,535.
  131.  
  132. Within programs, internally coded coordinates can be convert to external FS
  133. coordinated by subtracting 49152 (C000h) from the value considered as
  134. unsigned.
  135.  
  136. Manually, coded coordinates below 49,152 can be converted to FS coordinates
  137. by adding 16,384, and coded coordinates above 49,151 can be converted by sub-
  138. tracting 49,152.
  139.  
  140. Coded coordinates can appear in object definitions in one of three ways:
  141.  
  142. ∙ INTEGER (2 bytes): a word containing only an integer coordinate (indicated
  143.   as "int FSu")
  144.  
  145. ∙ FRACTIONARY (4 bytes): a double word made of a high order word (4th and 3rd
  146.   bytes) containing the coordinate integer part and a low order word (2nd and
  147.   1st bytes) containing the fractionary part.  Fractionary coordinates can
  148.   also be interpreted as made by 3 high order bytes expressing a distance in
  149.   meters from coordinate origin and a low order byte containing a fractionary
  150.   part in 256th of meter; this is confirmed by altitude fields, because
  151.   altitude is almost invariably indicated in this way (with the fractionary
  152.   byte left often unfilled). Both interpretations are indicated as "fract
  153.   FSu".
  154.  
  155. ∙ DELTA (2 bytes): a word representing the difference from an actual
  156.   reference coordinate given in a previous reference point record 24h.
  157.   Delta coordinates have not a fixed magnitude, but depend on a scale factor
  158.   set with byte 1 of record 24h: for scale factor 0, delta coordinates are
  159.   aligned with the fractionary word of fract FSu, for scale factor 8, delta
  160.   coordinates are aligned with the integer word of fract FSu, and for inter-
  161.   mediate scale factors intermediate alignments are used; for a detailed dis-
  162.   cussion, see below under record 24h description.
  163.   Contrarily to the other two representations, which are always positive,
  164.   this one is signed. This representation is indicated as "delta FSu".
  165.  
  166.  
  167. OBJECT ORIENTATION
  168.  
  169. Some objects, like runways, buildings and aircraft positions, are oriented.
  170. The angle of this orientation is always given relatively to the North axis of
  171. the FS coordinate system. For some kind of cartographic compensation not dis-
  172. cussed here (but see var 02F2h and 02F4h below), this axis is not necessarily
  173. the same as the compass North. Directions displayed by FS and ASD are rela-
  174. tive to the compass North and, therefore, there can be a rotation between the
  175. directions as displayed by ASD and FS4 and as memorized in the files.
  176.  
  177. Unless otherwise stated, orientation or heading fields, as well as "pitch"
  178. and "bank" fields, are 2 bytes long and are expressed in 1/182.04°:
  179.       0000h = 0°  ->  10000h = 360°
  180.  
  181.  
  182. RECORDS
  183.  
  184. Many kinds of FS data files are made of "records", i.e. chunks whose struc-
  185. ture, contents and meaning are determined by the first record byte (there-
  186. after called "record code"); records may contain many values (thereafter
  187. called "fields"), and, with a few exceptions, each record has a fixed length.
  188. Records appear in the files one after the other; given the start point and
  189. the structure (or at least the length) corresponding to each record code, a
  190. file can be sequentially parsed and decoded.
  191.  
  192. Record code meanings may change (and usually do) from file type to file type.
  193. Some file types (as .SC1 and .DY1) start with a non-record coded portion
  194. ("header") containing general information about the file.
  195.  
  196.  
  197. BYTE OFFSET
  198.  
  199. Many of the records used in static sceneries contain an offset, pointing to
  200. another record.  It is used to provide some forms of inter-record addressing
  201. for conditional (after variable test) or unconditional jumps.  These offsets
  202. are indicates as "bytes offset" and are always relative to first byte (code
  203. byte) of the record which contains them.
  204.  
  205.  
  206. ======================================================================
  207.  
  208.                            FS4 INTERNAL VARIABLES
  209.  
  210. FS maintains somewhere in memory a set of 16-byte variables, which affect the
  211. display engine and the flight simulation engine.  These variables are
  212. accessed with a value which is actually a memory address and has been called
  213. "variable address".  Variables can be set and tested from within a scenery
  214. file.
  215.  
  216. Known variables:
  217.  
  218.  
  219. 0280      AGL altitude of current view point in m.
  220. 0282      "counter": its value seems to be a single bit which cycles from
  221.           0001h to 8000h in about 6 sec.  Checked 45 times in F1, never writ-
  222.           ten
  223. 0284      Crash flag: when this var is set to a non-0 value, the plane
  224.           crashes; the displayed message depends on the value:
  225.                2         "mountain crash"
  226.                6         "building crash"
  227.                8         "splash" (see also var 02E6)
  228.                Ah        "crash - lower your gear next time"
  229.           Any other value results in a simple "crash" message
  230. 0286      set to 0000 during 3D window drawing, to 0001 during map window
  231.           drawing
  232. 0288      set to 0001 in SC1 fuel boxes; set 15 t. to 1 and once to 2 in F1
  233. 028A      FS version number (0300h = 3, 0400h = 4, 040Bh = 4b), never
  234.           accessed in F1
  235. 028C      holds the daytime code (1 = day; 2 = dusk; 4 = night).
  236. 028E      In F1, set 1 time to 1111h
  237. 0290      Low  word of current view point East  coord.
  238. 0292      High word of current view point East  coord.
  239. 0294      Low  word of current view point Alt.  coord.
  240. 0296      High word of current view point Alt.  coord.
  241. 0298      Low  word of current view point North coord.
  242. 029A      High word of current view point North coord.
  243. 029C      Current view point delta East  from last ref. point
  244. 029E      Current view point delta Alt.  from last ref. point
  245. 02A0      Current view point delta North from last ref. point
  246.  
  247. 02A2 - 02AA    Never accessed in F1
  248.  
  249. 02AC      View direction in 1/182.04°; North = 0000
  250.  
  251. Many of the following vars contain colour codes (repeated in all the 4 nib-
  252. bles): "reference" colours are loaded by FS4 at start up and never reset;
  253. "current" colours are set by the scenery itself (often by copying the rele-
  254. vant "reference" value) and usually affect the screen appearance of an item.
  255.  
  256. 02AE      Reference day colour of ground
  257. 02B0      Reference day colour of sky
  258. 02B2      Reference for ?? (used in F1 as source for current colour vars)
  259. 02B4      Reference for ?? (  "  "  )
  260. 02B6      Reference for ?? (  "  "  )
  261. 02B8      Reference for ?? (  "  "  )
  262. 02BA      Reference for ?? (  "  "  )
  263. 02BC      Reference dusk colour of sky
  264. 02BE      Reference for ?? (  "  "  )
  265. 02C0      Reference for ?? (  "  "  )
  266. 02C2      Reference day colour of water
  267. 02C4      Reference for ?? (used 9 t. as source for var 02E8)
  268.  
  269. 02C6 - 02CA    Never checked or set in F1.
  270.  
  271. 02CC      Reference for ?? (used 9 t. as source for var 02E8)
  272. 02CE      Never checked or set in F1.
  273.  
  274. 02D0 - 02DC    These seem to be 'spare' vars, used here and there to hold
  275.           temporary values or copies of other vars' values
  276.  
  277. 02DE      Current colour of sky (setting this var changes the colour in the
  278.           display)
  279. 02E0      Current colour of ground (   "   "    )
  280. 02E2      Surface fill colour.  In F1, the var value is set very often to
  281.           literal colour codes (with record 25h) or copied from other colour
  282.           vars (with record 1Ah).
  283. 02E4      In F1 set 16 times to 5555h and 16 times to FFFFh
  284. 02E6      Current colour of water.  Setting this var does not affect the dis-
  285.           play in any way, because lakes, rivers, seas and water surfaces in
  286.           general are just standard polygons whose colour is governed by var
  287.           02E2; however the value of this var is internally checked by FS,
  288.           because when landing onto or entering a polygon with a fill colour
  289.           equal to var 02E6, the plain "SPLASH"es.
  290. 02E8      Current colour of ??; in F1 it is set 16 t. to 0000, 14 times to
  291.           AAAAh, 9 t. to the value of 02C4 and 9 t. to the value of 02CC;
  292.           used 8 t. as source for var 02E2 value.
  293. 02EA      Current colour of ??; in F1 it is set 16 t. to 0000 and 16 t. to
  294.           the value of var 02C6; used twice as source for var 02E2 value.
  295.  
  296. 02EC      In F1 it is set once to 0023h, once to 0046h, once to 0089h
  297. 02EE      Low  word of MSL altitude of current area in m.
  298. 02F0      High word of MSL altitude of current area in m.
  299. 02F2      Cant in 1/182.04°
  300. 02F4      Magnetic variation in 1/182.04°.  The heading actually displayed by
  301.           FS is the absolute heading MINUS the sum of var 02F2 and var 02F4
  302.           values.
  303. 02F6      Set to 0001 for inner markers, never reset.
  304. 02F8      Set to 0001 for outer markers, never reset.
  305. 02FA      Set to 0001 for middle markers, never reset.
  306. 02FC      Set to ILS glideslope (source: Peter Burri). Set 9 t. in F1 where,
  307.           however, the record 4Fh is also used 25 times
  308. 02FE      Set to ILS approach course (source: Peter Burri). Set 9 t. in F1
  309.           where, however, the record 4Fh is also used 25 times
  310. 0300      In F1, set twice to 0004, twice to 0005, 7 t. to 0007. Never read
  311. 0302      Base of bottom clouds in m.
  312. 0304      Top of bottom clouds in m.
  313. 0306      Base of top clouds in m.
  314. 0308      Top of top clouds in m.
  315.  
  316. 030A - 0310    Apparently never used in F1 or in SC1 files
  317.  
  318. 0312      Set to 0001 by SEE before some lists of 1Fh subroutine calls. Used
  319.           in F1 as a 'spare' var to hold temporary values or a copy of
  320.           another var value (often a delta altitude)
  321.  
  322. 0314 - 031C    Used in F1 as 'spare' var
  323.  
  324. 031E      Set to 0000 and 0001 in SC1 mountains. Unused by F1
  325. 0320      'Spare' ??
  326.  
  327. 0322 - 034C    Apparently never used in F1 or in SC1 files
  328.  
  329. 034E      In F1 tested once against -1; tested against -1 in SEE custom
  330.           objects (with 23h records) and in SC1 buildings (with 28h 36h
  331.           records).
  332.  
  333. 0350 - 0360    Apparently never used in F1 or in SC1 files
  334.  
  335. 0362      Current hour (LSB) and minute (MSB). Not used in F1, SCN or SC1.
  336. 0364      Scenery detail level (0 sparse, 1 medium, 2 complex).
  337.  
  338. From .DYN files, the following variables can be added:
  339.  
  340. 1AC6      Dynamic scenery detail level (0 sparse, 1 medium, 2 complex)
  341. 1AD0      Ait traffic (0 off, 1 on)
  342. 1AD2      Airport aircraft ground traffic (0 off, 1 on)
  343. 1AD4      Airport service traffic (0 off, 1 on)
  344. 1AD6      Misc. traffic (0 off, 1 on)
  345.  
  346. More variable addresses are listed in the ADV section at the end of this
  347. document.
  348.  
  349.  
  350. ======================================================================
  351.  
  352.                         SCENERY DESCRIPTION LANGUAGE
  353.                         STATIC RECORD CODE REFERENCE
  354.  
  355. Static records are used in three types of files, all related to static
  356. scenery descriptions: the default scenery (F1), add-on sceneries (.SCN) and
  357. ASD static sceneries (.SC1).  SDL portion has been found also in .DYN and
  358. .APL files as well as in the FS4.EXE file itself.
  359.  
  360. While static records are geared toward scenery display, they build up a real
  361. procedural programming language, which we call Scenery Description Language
  362. (SDL), with variable tests, conditional and unconditional jumps, subroutine
  363. calls and so on.
  364.  
  365. Scenery files are made of several scenery procedures and, within FS4, an SDL
  366. processor 'executes' them to display the scenery.  Procedure entry points are
  367. listed at fixed locations of .SC1 and F1 files; .SCN files contain a special-
  368. ized record (0Ah) which defines such a table.
  369.  
  370. Given the procedural nature of SDL, scenery objects do not usually have a
  371. fixed structure, but are made of the SDL statements (records) required to
  372. 'build' them, with the notably exception of unenhanced .SC1 files, which
  373. objects, perhaps to make the job of the ASD editor easier, follow standard
  374. record patterns.
  375.  
  376. In the following reference, all records found in F1, SD-EUR and unenhanced
  377. .SC1 files are listed; some records from SEE enhanced .SC1 files are also
  378. added; for some records, however, the meaning is unknown and only the length
  379. has been determined.
  380.  
  381. Record are listed by code.  Field at offset 0 always contains the record code
  382. and is 1 byte long.
  383.  
  384. Records found only in SEE enhanced sceneries are marked with =SEE=,
  385. records found only in SC1 files are marked with =SC1=,
  386. while records found, even not exclusively, in the default scenery F1 and in
  387. SD-EUR are considered part of the 'basic' SDL and not marked.
  388.  
  389. Record description contributed by Dan Samuel are marked with a DS.  Other
  390. contributions are individually detailed.
  391.  
  392.  
  393. -- 00h ------------- Flashing light (7 bytes)
  394.  
  395. 1         2    E coord (delta FSu)
  396. 3         2    A coord (delta FSu)
  397. 5         2    N coord (delta FSu)
  398.  
  399. Places a flashing light at the delta point.  Light colour is given by a
  400. previous record 12h.
  401.  
  402. -- 01h ------------- Move pen to 3D point (7 bytes)
  403. -- 02h ------------- Draw to 3D point     (7 bytes)
  404.  
  405. 1         2    E coord (delta FSu)
  406. 3         2    A coord (delta FSu)
  407. 5         2    N coord (delta FSu)
  408.  
  409. These records, resp., move the pen and draw a line to a 3D point given rela-
  410. tively to the current ref. point.
  411.  
  412. -- 03h ------------- Simple runway (6 bytes)
  413.  
  414. 1         1    heading
  415. 2         2    half-length in m
  416. 4         2    half-width in m
  417.  
  418. Draws a simple black runway with a dashed line in the middle, centered at the
  419. current ref. point.
  420.  
  421. -- 04h ------------- ???-point list (variable)
  422.  
  423. This record is used in F1 (only 4 times) after some points are defined with
  424. 31h records and it contains, after the record code, only a list of points
  425. (indicated by their numbers); the list is of variable length and is
  426. terminated by a FFh byte.
  427.  
  428. -- 05h ------------- NDB (11 bytes)
  429.  
  430. 1         2    frequency; BCD coded (ex.: 327 kHZ -> 27h 03h)
  431. 3         4    E coord. (fract. FSu)
  432. 7         4    N coord. (fract. FSu)
  433.  
  434. -- 07h ------------- ??? (1 byte)
  435.  
  436. Used only once in SD-EUR
  437.  
  438. -- 0Ah xxxx -------- Proc list (xxxx bytes)
  439.  
  440. 1         2    record length
  441.  
  442. After the record length, a 4-byte per entry table lists all the procedures in
  443. the scenery file.  Each entry has the format:
  444.  
  445. 0         1    Proc code
  446. 1         2    Proc file offset in kB
  447. 3         1    Proc length in kB
  448.  
  449. Proc code is a conventional ID (IDs need not to be consecutive nor in any
  450. particular order) with which the proc could afterward be invoked with a 0F
  451. record.  File offset and length are expressed in 1 kB units.  Only the low
  452. byte of the file offset is taken into account by FS, then SCN sceneries CAN-
  453. NOT BE LONGER THAN 256 kB.
  454.  
  455. This record is equivalent to the procedure table found at offset 0022h of F1-
  456. format sceneries and is used only in SCN-format sceneries.
  457.  
  458. In FS sceneries, this record is typically used only once in the main proce-
  459. dure (which in SCN-format sceneries is located at file offset 010800h).
  460.  
  461. -- 0Bh ------DS----- Unconditional jump (3 bytes)
  462.  
  463. 1         2    byte offset
  464.  
  465. This record tells FS to jump over a given amount of bytes, avoiding the
  466. execution of some SDL statements.
  467.  
  468. It is also used in .SC1 to unconditionally skip over 2-byte "signatures"
  469. inserted by ASD, usually before building descriptions, and not intended to be
  470. executed: they are probably only a help for the editor in recognizing the
  471. kind of object; record 0Bh is used in SEE files to skip over embedded ASCII
  472. "comments" (source: Steve Turley).
  473.  
  474. Even if these kinds of non-SDL embedded material have been found only in SC1
  475. objects (possibly SEE-enhanced) which follow rigid record patterns, they make
  476. the life difficult for scenery parsing utilities; the only general way I
  477. found to deal with them is to keep track of referenced record addresses and
  478. to skip to the given byte offset if the address of the record after the 0Bh
  479. record is not referenced by any previous SDL statement, but caveat: some
  480. backward byte offsets have been detected in F1.
  481.  
  482. -- 0Ch ------------- ??? (3 bytes)
  483.  
  484. Used only twice (at offsets 00BBF1 and 00D8E5) in F1, always after a 2Eh
  485. record and always in the form:
  486.           2E 09 80  0C 05 50
  487.  
  488. -- 0E/8Eh ---------- Delayed subroutine call (3 bytes)
  489.  
  490. 1         2    byte offset
  491.  
  492. This record has been one of most difficult to understand.  It is basically a
  493. subroutine call, but the referenced address, instead of being called
  494. immediately, is collected in some kind of stack; at some point, presumably
  495. during the execution of a 79h record, all the collected routines are sorted
  496. in order of decreasing distance of the object they draw from the view point
  497. and executed.  For the sorting to be effective, referenced routines have to
  498. begin with a ref point record (24h); if a routine lacks this record, it is
  499. executed first.
  500.  
  501. This record is extensively used in .SC1 (but less in F1) to collect groups of
  502. routines drawing buildings and other elevated objects and provides a simple
  503. way to draw them in a perspective correct fashion.  While it requires little
  504. code overhead to achieve a quite complex goal, it has probably a significant
  505. performance overhead.
  506.  
  507. Record 0Eh is consistently used in .SC1 files in a way that makes such a
  508. behaviour very unclear, because in .SC1 each 0Eh is followed by a 0Bh record
  509. which jumps over the routine referenced in the 0Eh record; sometime after the
  510. 0Bh record a 2-byte "signature" is embedded (see above, under 0Bh record).
  511.  
  512. -- 0Fh ------------- Load procedure (6 bytes)
  513.  
  514. 1         1    procedure number
  515. 2         1    class
  516. 3         2    loading address (as byte offset)
  517. 5         1    nesting level
  518.  
  519. This record loads from disk (if not already loaded) at the given memory
  520. address the specified scenery procedure; the number refers to the scenery
  521. position in the scenery table at file offset 000020h (see F1 description
  522. below) or, for SCN's, to the conventional code attributed to the procedure by
  523. the 0Ah record.
  524.  
  525. Class is a parameter which, in F1, varies from 1 to 8; its purpose is not
  526. clear but may related to memory management or other housekeeping tasks; when
  527. arbitrarely modified, no visible difference can be detected.  The most common
  528. value seems to be 6.
  529.  
  530. The loading address (expressed as a byte offset from the 0F record) is
  531. presumably the memory address at which the procedure has to be loaded from
  532. disk.  In all the examples I have seen, it consistently points right after
  533. the last record of the procedure containing the 0F record (calling proce-
  534. dure); the loaded routine is then activated with a Jump record.  Apparently,
  535. the loaded procedure must not overwrite the calling procedure, in order to
  536. not invalidate it.
  537.  
  538. Procedure calling can be nested: the nesting level is 0 for the first nesting
  539. and increases by 1 each time a called procedure calls another one.
  540.  
  541. -- 10h ------------- Hidden surface check (5 bytes)
  542.  
  543. 1         2    byte offset
  544. 3         1    point number
  545. 4         1    control vector number
  546.  
  547. This record is a conditional jump.  The vector (previously defined with a
  548. record 27h) applied to the point (previously defined with a record 31h)
  549. defines a 3D plane (the plane perpendicular to the vector and passing through
  550. the point); the vector, by definition, protrudes into the "inside" side of
  551. the plane.  The record jumps to the given offset if the current view point is
  552. also in the "inside" side of the plane.
  553.  
  554. A practical (and recurrent) application of this record is the hidden surface
  555. check for buildings and mountains.  Building walls and mountain slopes are
  556. planar and have an "inside" and an "outside" side; considering the plane
  557. passing through one of them, if the view point is in the "inside" side, the
  558. wall (or slope) cannot be seen, because it will be hidden by other walls
  559. (buildings and mountains are usually closed).  In that case, the record 10h
  560. is used to jump over the code drawing that wall.
  561.  
  562. See also discussion of record 27h.
  563.  
  564. -- 11h ------------- ??? (2 bytes)
  565.  
  566. 1         1    ??
  567.  
  568. This record has been found after the record 57h. Its purpose is not clear.  A
  569. default value for the second byte seems to be 11h.
  570.  
  571. -- 12h ------------- Line Colour (2 bytes)
  572.  
  573. 1         1    colour code from the following table:
  574.  
  575.                0         Black
  576.                1         Dark Green
  577.                2         Dark Blue
  578.                3         Dark Cyan
  579.                4         Orange
  580.                5         Light Grey
  581.                6         Light Blue
  582.                7         Cyan
  583.                8         Brown
  584.                9         Yellow
  585.                Ah        Dark Grey
  586.                Bh        Light Green
  587.                Ch        Red
  588.                Dh        Gold
  589.                Eh        (White*)
  590.                Fh        White
  591.  
  592. -- 13h ------------- Line multi-colour (10 bytes)
  593.  
  594. 1         1    line colour for day time
  595. 2         1    line colour for dusk time
  596. 3         1    line colour for night time
  597. 4         3    second colour triplet
  598. 7         3    third colour triplet
  599.  
  600. This record applies to following lines different colours for different
  601. daytimes; its effect ceases with the next 12h record.
  602.  
  603. The second and third colour triplets are filled with consistent patterns of
  604. colours and, probably, refer to colours for other kinds of display
  605. (monochrome...).
  606.  
  607. -- 14h ------------- Surface multi-colour (10 bytes)
  608.  
  609. 1         1    surface colour for day time
  610. 2         1    surface colour for dusk time
  611. 3         1    surface colour for night time
  612. 4         3    second colour triplet
  613. 7         3    third colour triplet
  614.  
  615. All colour codes are repeated in both nibbles.
  616.  
  617. This record applies to following surfaces different colours for different
  618. daytimes; its effect ceases when variable 02E2h is set again.
  619.  
  620. The second and third colour triplets are filled with consistent patterns of
  621. colours and, probably, refer to colours for other kinds of display
  622. (monochrome...).
  623.  
  624. -- 15h ------DS----- Axis roto-translation (15 bytes) =SEE=
  625.  
  626. 1         2    angle around E axis (x)
  627. 3         2    angle around N axis (y)
  628. 5         2    angle around A axis (z)
  629. 7         2    delta E (delta FSu)
  630. 9         2    delta A (delta FSu)
  631. 11        2    delta N (delta FSu)
  632. 13        2    byte offset
  633.  
  634. The same observations made below for record 16h apply to this record also.
  635. With it, local coordinate system is both rotated and translated.
  636.  
  637. -- 16h ------------- Axis rotation (9 bytes)
  638.  
  639. 1         2    angle around E axis (x)
  640. 3         2    angle around N axis (y)
  641. 5         2    angle around A axis (z)
  642. 7         2    byte offset
  643.  
  644. This record is one of the most ingenuous: it applies to the local coordinate
  645. system (used for delta FSus, and by default centered in the ref. point and
  646. parallel to global axes) the described rotations, then it calls the
  647. referenced subroutine: anything (not only buildings) drawn by this routine
  648. with delta coords. will appear rotated; when the subroutine returns, the
  649. coordinate system is restored.  The record can be used to display tilted
  650. objects with a very small code overhead.
  651. It is extensively used by .SC1 object, but only one in F1 and never in other
  652. SCN's; execution overhead is probably significant.
  653.  
  654. -- 17h ------------- Return17 (1 byte)
  655.  
  656. This single byte record returns from a subroutine; its difference from record
  657. 19h is not clear.
  658.  
  659. In .SC1 it has been observed only in timing gate definitions, but in F1 it is
  660. used 26 times in various contexts.
  661.  
  662. -- 18h ------------- Call18 (3 bytes)
  663.  
  664. 1         2    byte offset (subroutine address)
  665.  
  666. Calls a subroutine; its difference from record 1Fh is not clear.  Used 624
  667. times in F1.
  668.  
  669. -- 19h ------------- Return19 (1 byte)
  670.  
  671. This single byte record returns from a subroutine; its difference from record
  672. 17h is not clear. Used 276 times in F1.
  673.  
  674. -- 1Ah ------------- Equ var (5 bytes)
  675.  
  676. 1         2    var1 address
  677. 3         2    var2 address
  678.  
  679. Sets var1 to the value of var2.
  680.  
  681. -- 1Bh ------------- Line night colour on (1 byte)
  682.  
  683. This record set the night and dusk colours of following lines to a standard
  684. colour (in FS4, light blue).  Its effect ceases with the next record 12h.
  685.  
  686. -- 1Ch ------------- Line night colour off (1 byte)
  687.  
  688. Restores the night and dusk colours of following lines to the same colour
  689. used for day.
  690.  
  691. -- 1Dh ------------- VOR (11 bytes)
  692.  
  693. 1         2    frequency; BCD coded (ex.: 109.15 MHz -> 15h 09h)
  694. 3         4    E coord. (fract. FSu)
  695. 7         4    N coord. (fract. FSu)
  696.  
  697. -- 1Eh xxxx -------- ATC message (xxxx bytes)
  698.  
  699. 1         2    record length
  700. 3         2    frequency; BCD coded (ex.: 127.15 MHz -> 15h 27h)
  701. 5         1    recommended runway number for NE winds
  702. 6         1    recommended runway number for SE winds
  703. 7         1    recommended runway number for NW winds
  704. 8         1    recommended runway number for SW winds
  705. 9         4    ??
  706. 13        var  message text (0-terminated)
  707.  
  708. The message text can include any character from ASCII 20h to ASCII 93h.
  709. Characters greater than 93h result in garbage being printed. When the message
  710. is played back, characters from 80h to 93h are expanded into the following
  711. strings (stored in ATC.FS4):
  712.  
  713. 80h       " Whether - "
  714. 81h       " OBSERVATION "
  715. 82h       " XX:00 ZULU " (where XX is replaced by the current hour time)
  716. 83h       "" (empty string)
  717. 84h       " TEMPERATURE 25 - "
  718. 85h       " INFORMATION "
  719. 86h       " LANDING AND DEPARTING RUNWAY XX - " (where XX is replaced by the
  720.           runway number given at offset 5)
  721. 87h       " ADVISE CONTROLLER "
  722. 88h       " ALTIMETER 29.95 - "
  723. 89h       " VISIBILITY 10 - "
  724. 8Ah       " WIND XXX at YY - " (where XXX and YY are replaced by wind
  725.           direction and speed defined by the wind menu or generated by the
  726.           weather generator; if both are off, this character is ignored)
  727. 8Bh       " MEASURED CEILING 00600 OVERCAST "
  728. 8Ch       "" (empty string)
  729. 8Dh       "" (empty string)
  730. 8Eh       "Microsoft Flight Simulator"
  731. 8Fh       " requesting "
  732. 90h       "clearance "
  733. 91h       ", your are cleared "
  734. 92h       "... "
  735. 93h       "7777 "
  736.  
  737. -- 1Fh ------DS----- Call1F (3 bytes)
  738.  
  739. 1         2    byte offset (subroutine address)
  740.  
  741. Subroutine call; its difference from record 18h is not clear.  Used 191 times
  742. in F1.
  743.  
  744. -- 20h ------------- Jump if var outside (9 bytes)
  745.  
  746. 1         2    byte offset
  747. 3         2    var address
  748. 5         2    value1
  749. 7         2    value2
  750.  
  751. This record jumps over the given amount of bytes, if the value of the given
  752. variable is outside the range value1 - value2.
  753.  
  754. -- 21h ------------- Jump if 2 vars outside (15 bytes)
  755.  
  756. 1         2    byte offset
  757. 3         2    var1 address
  758. 5         2    min1 value
  759. 7         2    max1 value
  760. 9         2    var2 address
  761. 11        2    min2 value
  762. 13        2    max2 value
  763.  
  764. This record jumps over the given amount of bytes, if var1 is outside the
  765. range min1 - max1 OR var2 is outside the range min2 - max2.
  766.  
  767. -- 22h ------------- Jump if 3 vars outside (21 bytes)
  768.  
  769. 1         2    byte offset
  770. 3         2    var1 address
  771. 5         2    var1 min value
  772. 7         2    var1 max value
  773. 9         2    var2 address
  774. 11        2    var2 min value
  775. 13        2    var2 max offset
  776. 15        2    var3 address
  777. 17        2    var3 min value
  778. 19        2    var3 max offset
  779.  
  780. This record is similar to the previous, but involves 3 variables.
  781.  
  782. -- 23h ------------- NAND Jump (7 bytes)
  783.  
  784. 1         2    byte offset
  785. 3         2    var address
  786. 5         2    value
  787.  
  788. Jumps if the bitwise AND of the given var value and the given value is 0.
  789.  
  790. -- 24h ------------- Reference point (14 bytes)
  791.  
  792. 1         1    scale factor
  793. 2         4    E coord. (fract. FSu)
  794. 6         4    AGL alt. (fract. FSu)
  795. 10        4    N coord. (fract. FSu)
  796.  
  797. A reference point record is a temporary coordinate origin for delta FSunits.
  798. It is extensively used to define a point in 3D; the points of following
  799. objects are then defined relatively to this one.  In vars 029A, 029C, 02A0,
  800. FS maintains the coordinates of the current view point relative to the cur-
  801. rent reference point.  If the point is defined in a subroutine, it is
  802. apparently lost when the subroutine returns.
  803.  
  804. Byte 1 is a scale factor determining delta unit magnitude:
  805.  
  806. Factor  1 delta unit is         max absolute delta (32768 units)
  807.  
  808. 00        1/256 m                128 m -   1/2 FSu
  809. 01         1/64 m                512 m -     2 FSu
  810. 02         1/16 m               2048 m -     8 FSu (AAF objects, Fuel box)
  811. 03          1/4 m               8192 m -    32 FSu
  812. 04            1 m              32.8 km -   128 FSu (Most ASD objects)
  813. 05            4 m               131 km -   512 FSu
  814. 06           16 m               524 km -  2048 FSu
  815. 07           64 m               210 km -  8192 FSu
  816. 08          256 m (= 1 FSu)     837 km - 32768 FSu
  817.  
  818. Most ASD created objects use factor 04 (plus factor 02 in fuel boxes only);
  819. F1 uses factors 02, 04, 06, 08; AAF created object use a factor of 02, all
  820. other factors have been tested manually.
  821.  
  822. -- 25h ------DS----- Set variable (5 bytes)
  823.  
  824. 1         2    variable address
  825. 3         2    new variable value
  826.  
  827. Sets the given variable to the given value.
  828.  
  829. -- 27h ------------- Define control vector (8 bytes)
  830.  
  831. 1         2    x component of vector
  832. 3         2    z component of vector
  833. 5         2    y component of vector
  834. 6         1    vector number
  835.  
  836. Defines a control vector.  This vector is usually perpendicular to a surface
  837. and is it used by record 10h tests to check the "insideness" of the current
  838. point of view with respect to the surface.
  839.  
  840. The vector components are computed as follows:
  841. 1) chosen 3 points, P, Q, and R, of the surface (usually 3 vertices of a 3D
  842. polygon) in clockwise order when seeing the surface from the "outside",
  843.  
  844. 2) vector a = Q-P and has as components:
  845. a(x) = Q(x)-P(x);  a(z) = Q(z)-P(z);  a(y) = Q(y)-P(y);
  846.  
  847. 3) vector b = R-Q and has as components:
  848. b(x) = R(x)-Q(x);  b(z) = R(z)-Q(z);  b(y) = R(y)-Q(y);
  849.  
  850. 4) the vectorial product  c = a x b is computed:
  851. c(x) = a(y) b(z) - a(z) b(y)
  852. c(z) = a(x) b(y) - a(y) b(x)
  853. c(y) = a(z) b(x) - a(x) b(z)
  854.  
  855. 5) These components are finally scaled in order they fit in a signed 16-bit
  856. value (actually, in F1, they are almost always scaled so none of them is
  857. greater of 0x4000 in modulus).  This algorithm has been determined on the
  858. example of Dan Samuel's algorithm for record 5Ah.
  859.  
  860. See also discussion of record 10h, for practical applications.
  861.  
  862. -- 28 -------------- Compare vars (8 bytes)
  863.  
  864. 1         1    value:    condition:
  865.                02        var1 > var2 ?
  866.                04        var1 < var2 ?
  867. 2         2    byte offset
  868. 4         2    var1
  869. 6         2    var2
  870.  
  871. Jumps to the given byte offset if the condition is true.  Var values are
  872. treated as unsigned (8000h > 7FFFh).
  873.  
  874. In SC1 buildings, a record 28h in which condition value = 36h, var1 = 034Eh,
  875. var2 = FFFFh is often used; in this case, var2 is obviously a literal value,
  876. but the performed test is not clear.
  877.  
  878. -- 29h ------------- Close path (1 byte)
  879.  
  880. This record, made of the single byte 29h, is used to close a path being drawn
  881. with 01h, 02h, 32h, 33h, 40h and 41h records.  A line is drawn from the cur-
  882. rent point to the starting point of the last executed MoveTo record (01h,
  883. 40h, 32h).  If the path begun with the surface record (2Fh), the path is
  884. filled with the colour stored in var 02E2.
  885.  
  886. -- 2Ah ------------- Dotted line (14 bytes)
  887.  
  888. 1         2    P1 E coord. (delta FSu)
  889. 3         2    P1 A coord. (delta FSu)
  890. 5         2    P1 N coord. (delta FSu)
  891. 7         2    P2 E coord. (delta FSu)
  892. 9         2    P2 A coord. (delta FSu)
  893. 11        2    P2 N coord. (delta FSu)
  894. 13        1    Number of dots / 2
  895.  
  896. This record draws a dotted line from P1 to P2, containing twice the number of
  897. dots given at byte 13.
  898.  
  899. -- 2Bh ------------- Dashed line (14 bytes)
  900.  
  901. 1         2    P1 E coord. (delta FSu)
  902. 3         2    P1 A coord. (delta FSu)
  903. 5         2    P1 N coord. (delta FSu)
  904. 7         2    P2 E coord. (delta FSu)
  905. 9         2    P2 A coord. (delta FSu)
  906. 11        2    P2 N coord. (delta FSu)
  907. 13        1    Number of dashes
  908.  
  909. This record draws a dashed line from P1 to P2, containing the number of
  910. dashes given at byte 13.  Note that, as each dash has two end points, this
  911. record defines the same number of points as record 2Ah.
  912.  
  913. -- 2Eh ------------- ??? (3 byte)
  914.  
  915. Used only twice (at offsets 00BBEE and 00D8E2) in F1, always before a 0Ch
  916. record and always in the form:
  917.           2E 09 80  0C 05 50
  918.  
  919. -- 2Fh ------------- Surface (1 byte)
  920.  
  921. This record, made of the single byte 2Fh, is used to start a surface
  922. perimeter.
  923.  
  924. When the perimeter is closed with 29h record, the surface is filled with the
  925. colour stored in var 02E2.
  926.  
  927. -- 31h ------------- 3D-point (8 bytes)
  928.  
  929. 1         1    point number
  930. 2         2    E coord (delta FSu)
  931. 4         2    A coord (delta FSu)
  932. 6         2    N coord (delta FSu)
  933.  
  934. Used to define a point in 3D; the record has no display effect but the point
  935. can be thereafter addressed by drawing records through its number.
  936.  
  937. -- 32h ------DS----- Move to 3D point (2 bytes)
  938.  
  939. 1         1    point number
  940.  
  941. Moves the pen (without drawing) to the point.  Point numbers have been set by
  942. a previous 31h record.
  943.  
  944. -- 33h ------DS----- Draw to 3D point (2 bytes)
  945.  
  946. 1         1    point number
  947.  
  948. Draws to the point.  Point numbers have been set by a previous 31h record.
  949.  
  950. -- 34h ------------- ??? (2 bytes)
  951.  
  952. This record has been found in James Shrubsall's SC1 files right after a
  953. record 57h.
  954.  
  955. -- 35h ------------- Dot (2 bytes)
  956.  
  957. 1         1    point number
  958.  
  959. Draws a dot at the given 3D point, prev. defined with a 31h record.
  960.  
  961. -- 36h ------------- ??? (2 bytes)
  962.  
  963. 1         1    ??
  964.  
  965. This record occurs only once in F1 and in each SCN, each time at the end of
  966. the AUTOLOAD scenery procedure.  Byte 1 contains either the scenery number or
  967. the scenery number + 1.
  968.  
  969. -- 39h ------------- ??? (5 bytes, source: Enrico Schiratti)
  970.  
  971. 1         2?   ???
  972. 3         2    byte offset
  973.  
  974. This record has been found by Enrico Schiratti in SD-NL (F1-format) at off-
  975. sets 001A74h and 001AC5.
  976.  
  977. -- 3Bh ------------- Set elevation (5 bytes)
  978.  
  979. 1         4    elevation level (fract. FSu)
  980.  
  981. Set an elevation level above current ground level.  Used in F1 to make
  982. elevated 'solid' surfaces, like the carrier deck or the Golden Gate Bridge.
  983.  
  984. -- 3Ch ------------- ??? (4 bytes)
  985.  
  986. 1         1    ??
  987. 2         1    Scenery number (SD-x = xxh, SD-EUR = 0Eh, F1 = FFh)
  988. 3         1    AUTOLOAD procedure length
  989.  
  990. This record occurs only once in F1 and in each SCN, each time at the
  991. beginning of the AUTOLOAD scenery procedure.
  992.  
  993. -- 3Dh ------------- Jump if outside area (19 bytes)
  994.  
  995. 1         2    byte offset
  996. 3         4    min E (fract. FSu)
  997. 7         4    max E (fract. FSu)
  998. 11        4    min N (fract. FSu)
  999. 15        4    max N (fract. FSu)
  1000.  
  1001. Jumps if current plane position (not the view point) is outside the delimited
  1002. rectangular area.
  1003.  
  1004. -- 3Eh ------------- Jump if outside rectangle (Area record) (9 bytes)
  1005.  
  1006. 1         2    byte offset
  1007. 3         2    N coord. (int FSu)
  1008. 5         2    E coord. (int FSu)
  1009. 7         2    area semi-side (int FSu)
  1010.  
  1011. Jumps if current plane position (not the view point) is outside the delimited
  1012. rectangular area.  The record tests for a rectangular area not a circular
  1013. one.
  1014.  
  1015. A 3Eh record (used to be called "AREA record") starts the representation of
  1016. each object in SC1 files and, in fact, is the easiest way to avoid rendering
  1017. an object if the aircraft is too away from it; however, as for any SDL
  1018. record, it is a procedural statement and does not define an object property,
  1019. it is not even mandatory: many times, in F1, several related objects are
  1020. grouped within a single 3Eh rec, or a complex object is broken in many inde-
  1021. pendently displayed parts.  Sometimes, it is totally absent and the
  1022. visibility of the object is checked by others ways.
  1023.  
  1024. -- 40/C0h ---------- Move to 2D point (5 bytes)
  1025. -- 41h ------------- Draw to 2D point (5 bytes)
  1026.  
  1027. 1         2    E coord. of the point (delta FSu)
  1028. 3         2    N coord. of the point (delta FSu)
  1029.  
  1030. Move and draw records are used to draw line segments.  A move record moves to
  1031. the point given in the record without drawing anything, a draw record draws a
  1032. line segment from the previous point to the given point.  As Alt. coordinate,
  1033. the Alt. of current reference point is used.
  1034. Within SC1 files, Move record code can be either 40h or C0h, without any
  1035. visible difference.
  1036.  
  1037. -- 42h ------------- Jump if outside area (11 bytes)
  1038.  
  1039. 1         2    byte offset
  1040. 3         2    min E (int. FSu)
  1041. 5         2    max E (int. FSu)
  1042. 7         2    min N (int. FSu)
  1043. 9         2    max N (int. FSu)
  1044.  
  1045. Jumps if current plane position (not the view point) is outside the delimited
  1046. rectangular area.
  1047.  
  1048. -- 43h ------------- ??? (29 byte)
  1049.  
  1050. 1         2    byte offset
  1051. 3         4    E coord (fract FSu)
  1052. 7         4    A coord (fract FSu)
  1053. 11        4    N coord (fract FSu)
  1054. 15        14   ??
  1055.  
  1056. Used only 5 times in F1, 4 times after 00BF4C (around the Catalina I.) and 1
  1057. time at 01E1E1 (within Oakland Int'l).  It seems to be a test based on some
  1058. geometrical property of the given point.
  1059.  
  1060. -- 44h ------------- Define array of points (15 bytes)
  1061.  
  1062. 1         1    i, first point number
  1063. 2         2    P1 E (delta FSu)
  1064. 4         2    P1 A (delta FSu)
  1065. 6         2    P1 N (delta FSu)
  1066. 8         2    P2 E (delta FSu)
  1067. 10        2    P2 A (delta FSu)
  1068. 12        2    P2 N (delta FSu)
  1069. 14        1    n, number of points
  1070.  
  1071. Defines n points, consecutively numbered from i onward and evenly distributed
  1072. across the 3D segment from P1 to P2.  Used only 4 times in F1 to define the
  1073. points for the 'net' on the side of the mountain in front of San Francisco.
  1074.  
  1075. -- 45h xxxx -------- Thermal generator (xxxx bytes)
  1076.  
  1077. 1         2    record length (0025h)
  1078. 3         4    E coord of generator center (fract FSu)
  1079. 7         4    altitude AGL of generator center ?
  1080. 11        4    N coord of generator center (fract FSu)
  1081. 15        2    orientation
  1082. 17        1    ???
  1083. 18        2    generator width (in m)
  1084. 20        2    ???
  1085. 22        2    thermal effect height (in feet)
  1086. 24        2    ???
  1087. 26        2    generator length (in m)
  1088. 28        9    ???
  1089.  
  1090. This record has been found only in thermal generators.  Used 11 times in F1.
  1091.  
  1092. -- 47h ------------- Conditional point list ??? (8 bytes)
  1093.  
  1094. 1         2    byte offset
  1095. 3         4    four point numbers
  1096. 7         1    always FFh
  1097.  
  1098. Seems to be a conditional jump.  Bytes 3-6 contain point numbers (previously
  1099. defined with records 31h).  The test performed is not clear; as it used to
  1100. jump over the rendition of entire buildings (not of individual walls), it
  1101. seems more reasonable to think to a magnitude test, than to an orientation
  1102. test.
  1103.  
  1104. Found 11 times in F1:
  1105.  
  1106. 006059  47 54 01 01 03 05 06 FF
  1107. 0073DD  47 8F 00 01 02 05 06 FF
  1108. 007EC1  47 66 00 00 00 00 00 FF
  1109. 007F96  47 49 00 01 03 06 00 FF
  1110. 007FF6  47 33 00 00 00 00 00 FF
  1111. 0080B4  47 8D 01 01 04 08 0C FF
  1112. 008289  47 59 00 00 01 02 03 FF
  1113. 0083D3  47 B0 00 00 05 07 02 FF
  1114. 0084AA  47 F3 00 03 09 0A 00 FF
  1115. 009729  47 EE 00 03 09 0A 00 FF
  1116. 01FC06  47 E9 05 01 02 03 04 FF
  1117.  
  1118. -- 49h ------------- Runway end lights (20 bytes)
  1119.  
  1120. 1         4    E coord (fract. FSu)
  1121. 5         4    A coord (fract. FSu)
  1122. 9         4    N coord (fract. FSu)
  1123. 13        2    heading (in 1/182.04°)
  1124. 15        1    light bits:
  1125.                          0  end lights
  1126.                          1  MALSR
  1127.                          2  REIL
  1128.                          3  VASI
  1129.                          4  moving strobes
  1130.                          5  ?? (irrelevant?)
  1131.                          6  ?? (irrelevant?)
  1132.                          7  ?? (irrelevant?)
  1133. 16        1    moving strobe length (in ??)
  1134. 17        2    VASI glide slope (in 1/10°)
  1135. 19        1    ??
  1136.  
  1137. Places a runway end light system.  The given point is the end of the runway
  1138. to which this record is always ideally applied.
  1139.  
  1140. -- 4Ah ------------- Surface4A ?? (1 byte)
  1141.  
  1142. This single byte record is used to start a surface path; the difference with
  1143. record 2Fh is not clear.  Used 8 times in F1.
  1144.  
  1145. -- 4Bh ------------- Jump4B ?? (3 bytes)
  1146.  
  1147. 1         2    byte offset
  1148.  
  1149. This record, used only once in F1, seems to be another jump instruction.  Its
  1150. difference with record 0Bh is not apparent.
  1151.  
  1152. -- 4Ch ------DS----- ??? (2 bytes) =SEE=
  1153.  
  1154. -- 4Dh xxxx--DS----- Thermal generator (xxxx bytes)
  1155.  
  1156. 1         2    record length
  1157. 3         4    E coord (fract FSu)
  1158. 7         4    A coord (fract FSu)
  1159. 11        4    N coord (fract FSu)
  1160. 15        ??   ??
  1161.  
  1162. Another thermal generator defining record.  Used 7 times in F1.
  1163.  
  1164. -- 4Eh ------DS----- ??? (4 bytes) =SEE=
  1165.  
  1166. -- 4Fh ------------- ILS (15 bytes)
  1167.  
  1168. 1         2    frequency; BCD coded (ex.: 109.15 MHz -> 15h 09h)
  1169. 3         4    E coord. (fract. FSu)
  1170. 7         4    N coord. (fract. FSu)
  1171. 11        2    Approach course in 1/3° (0 -> 0, 359 -> 0435h)
  1172. 13        2    Glide slope in 1/9100° (0 -> 0, 7.20 -> FFFFh)
  1173.  
  1174. -----
  1175.  
  1176. The following records, up to 79h excluded, are never used in F1 but only in
  1177. SC1 files, either standard or SEE enhanced; they seem not to be recognized by
  1178. FS4 and are probably an ASD extension.
  1179.  
  1180. -----
  1181.  
  1182. -- 50/D0h ---------- Runway (35 bytes) =SC1=
  1183.  
  1184. See below under runway description for details.
  1185.  
  1186. -- 51h ------------- Side list end (used in mountains, 1 byte) =SC1=
  1187.  
  1188. -- 52h ------DS----- ??? (2 bytes) =SEE=
  1189.  
  1190. -- 53h ------------- Building (variable) =SC1=
  1191.  
  1192. The building record defines the aspect of a building; its length and struc-
  1193. ture varies according to the building type. Here a summary is given, see
  1194. below, under building descriptions, for details.
  1195.  
  1196. byte 1                   building type and length
  1197.  
  1198. 01             Rectangular building record (18 [flat] and 19 [peaked] bytes)
  1199. 02             L building record (24 [flat] and 27 [peaked] bytes)
  1200. 03             T building record (28 [flat] and 32 [peaked] bytes)
  1201. 04             U building record (28 [flat] and 33 [peaked] bytes)
  1202. 05             H building record (34 [flat] and 41 [peaked] bytes)
  1203. 06             Reversed L build. record (24 [flat] and 27 [peaked] bytes)
  1204. 07             Control tower record (20 bytes)
  1205. 29             Tower record (6 bytes)
  1206. 33             Suspended bridge record (10 bytes)
  1207. 34             Bridge record (10 bytes)
  1208. 3D             Timing gate record (17 bytes)
  1209. 42             Coniferous tree record (7 bytes)
  1210. 43             Deciduous tree record (7 bytes)
  1211. 47             Auto record (3 bytes)
  1212. 4C             Multi-sided building record (13 bytes)
  1213.  
  1214. -- 57h ------------- Exec 8088 code (3 bytes, source: James Shrubsall) =SC1=
  1215.  
  1216. 2         2    8088 routine offset
  1217.  
  1218. This record executes the 8088 code routine at offset.  The routine must end
  1219. with a RETF instruction and may access the SDL code in the SC1 addressing the
  1220. CS: segment, the offset 0 of this segment is at the beginning of the SC1.
  1221.  
  1222. -- 58h ------DS----- 3D text (variable) =SEE=
  1223.  
  1224. 1         8    ???
  1225. 9         1    text size
  1226. 10        xx   text, 0-terminated
  1227.  
  1228. -- 59h ------------- ??? (3 bytes) =ATP=
  1229.  
  1230. 1         2    ??
  1231.  
  1232. This record has been found only the ATP (NOT FS4) default scenery F1.
  1233.  
  1234. -- 5Ah ------DS----- 3D-triangle (10 bytes) =SC1=
  1235.  
  1236. 1         2    E component of the "triangle vector" (see below)
  1237. 3         2    A component
  1238. 5         2    N component
  1239. 7         3    numbers of the 3 points, listed in anti-clockwise order
  1240.                looking to the triangle from outside
  1241.  
  1242. This record is used in .SC1 mountains to draw 3D triangles with hidden sur-
  1243. face removing.  The "triangle vector" is the cross product of the vectors for
  1244. the P2-P1 and the P3-P1 edges of the tiangle, the cross product is then
  1245. scaled so that no coord value is > 16767 (see also record 27h for examples).
  1246. Point numbers at offset 7-9 correspond to mountain vertices defined by
  1247. previous 31h records.
  1248.  
  1249. -- 62h ------------- ??? (10 bytes) =SC1=
  1250.  
  1251. -- 6Fh ------DS----- ??? (11 bytes) =SEE=
  1252.  
  1253. -- 79h ------------- SDL End (1 byte)
  1254.  
  1255. Exits the SDL processor.  Used in SC1 only at the end of each section, within
  1256. F1 it occurs even in the middle of procedure with a complex execution flow
  1257. and multiple exit points (SDL is not structured, after all!); it cannot be
  1258. used within subroutines, otherwise FS4 crashes.
  1259.  
  1260.  
  1261. ======================================================================
  1262.  
  1263.                           NOTES ON FILES STRUCTURES
  1264.  
  1265. GENERAL CONSIDERATIONS
  1266.  
  1267. At least two scenery disk formats exist: one is the format of the default
  1268. scenery F1 and of some of the new add-on sceneries (at least the MS-x.SCN
  1269. series is in this format); the other is the format of the older .SCN files.
  1270. These two formats have been conventionally called "F1" and "SCN" formats.  To
  1271. these base scenery format, the format of .SC1 additional sceneries can be
  1272. added.
  1273.  
  1274. Sceneries are made of "procedures", each procedure being a single piece of
  1275. SDL code individually executed.  Procedures do not contain absolute
  1276. references to other procedures, the only inter-procedural link known so far
  1277. being the 0Fh record.
  1278.  
  1279. Procedure entry points are listed in the headers of SC1 files and of F1; SCN
  1280. files contain a 0Ah record defining the procedure list in the main procedure
  1281. (see below).
  1282.  
  1283. One of the procedures is the main scenery entry point, henceforth called
  1284. "procedure 00"; it is directly called by FS and it activates (through the 0Fh
  1285. record) other procedures according to the current view point position, which
  1286. it checks with appropriate tests (generally on the view point coordinate vars
  1287. 0292h to 029Ah).  In the F1 format, the main procedure is the first listed in
  1288. the procedure table at offset 000022h; in the SCN format, the main procedure
  1289. starts at the fixed offset 010800h.  In SCN-format sceneries for ATP,
  1290. however, proc 00 address is declared at file offset 000204h.
  1291.  
  1292. Interaction between the base scenery and SC1 is complex: the nine SC1 layers
  1293. are not executed together AFTER base scenery procedures, because at least
  1294. base scenery buildings are drawn after some of the SC1 additions: one can
  1295. imagine that ASD, after selecting the SC1 file appropriate to the current
  1296. plane position, intercepts FS4 calls to the SDL processor and intermixes
  1297. calls to it passing the SC1 layers.
  1298.  
  1299. ====================================
  1300.  
  1301.                           SOME NOTES ON F1 CONTENTS
  1302.  
  1303. F1 HEADER
  1304.  
  1305. F1 begins with a header made of the elements listed below; given values come
  1306. from ver. 4.0b's F1.
  1307.  
  1308. 0000      02DD           F1 format signature
  1309. 0002      00000106 0081  offset and length of the dialogue descriptor
  1310. 0008      00000187 0028  offset and length of the AUTOLOAD procedure
  1311. 000E      00000000 0000  offset and length of RESERVED1
  1312. 0014      00000000 0000  offset and length of RESERVED2
  1313. 001A      00000000 0000  offset and length of RESERVED3
  1314. 0020      0026           number of scenery procedures
  1315.  
  1316. Then, a 6-byte entry table is given with, for each scenery procedure:
  1317.  
  1318.           oooooooo llll  file offset and length of each procedure
  1319.  
  1320. This table is used to locate the procedures activated with the 0F record;
  1321. procedures are implicitly numbered from 0. A descriptor of the dialogue
  1322. window displayed when the scenery is selected follows, each text line is
  1323. described by:
  1324.  
  1325.           01 xxxx yyyy 00 "line text " 00 00
  1326.  
  1327. xxxx and yyyy being the video coordinates of the line starting point, in some
  1328. sort of device independent unit of measure.  A record:
  1329.  
  1330.           00
  1331.  
  1332. may mark the end of the descriptor; the surest clue to detect the end is,
  1333. however, the length of the descriptor stated at offset 0006h.  Also, the
  1334. dialogue appears right after the table in F1 and Microscene's F1-format
  1335. sceneries; in other F1-format sceneries, it appears at other positions;
  1336. again, the surest clue is the dialogue descriptor offset stated at offset
  1337. 000002h.
  1338.  
  1339. The dialogue is followed by the AUTOLOAD procedure (its nature has been dis-
  1340. covered by John Blackie):
  1341.  
  1342. 0187      3C 00 FF 28         ???
  1343. 018B      21 0012             Jump to 019D if
  1344.              0000 F470 FD80      var 0000 outside F470-FD80 or
  1345.              0000 D972 E312      var 0000 outside D972-E312
  1346. 019A      0B 0012             Jump to 01AC
  1347. 019D      21 0012             Jump to 01AF (addr. of the 1st procedure) if
  1348.              0000 EFEC FB8C      var 0000 outside EFEC-FB8C or
  1349.              0000 E312 EBEC      var 0000 outside E312-EBEC
  1350. 01AC      36 00               ???
  1351. 01AE      79                  END SDL Processor
  1352.  
  1353. where, in each 21h test, the first instance of var 0000 stand for a North
  1354. range and the second for an East range.  Actually, in F1 this procedure does
  1355. not make much sense, but in other sceneries its tests match the populated
  1356. areas; moreover FS, at startup, scans all *.SCN files for this procedure.
  1357. Practically, this procedure implements the Scenery Automatic Loading option
  1358. found in the Scenery Selection Menu.
  1359. It is worth noting that in some F1-format files (like the MS-x.SCN series),
  1360. the AUTOLOAD procedure is made only a 79h record, with a copryright notice
  1361. embedded after it.
  1362.  
  1363. After that, at 01AF, the first scenery procedure (procedure 00) begins.
  1364.  
  1365.  
  1366. ----------
  1367.  
  1368. F1 PROCEDURES
  1369.  
  1370. F1 contains 38 procedures.
  1371.  
  1372. PROCEDURE 00
  1373.  
  1374. Procedure 00 is the main procedure and is made of a big "switch"-like series
  1375. of tests which activates the appropriate procedure, according to the current
  1376. view point position.
  1377.  
  1378. This is a rendition of F1 procedure 00 in a C-like pseudo-code:
  1379.  
  1380. 01AF  if(East in 16884-17884  &&  North in 21884-22884)
  1381. 01B8    END;
  1382. 01B9  if(East in 15884-16884  &&  North in 21884-22884)
  1383. 01C2  { 0F(07, 06, 0177, 00);           // Walls in the sky
  1384. 01C8    goto 0339;
  1385.       }
  1386. 01CB  if( (var0286 && 0x0001)           // if drawing in the map window
  1387. 01D2    & (Alt && 0xFF00))              // AND Alt > 65536 m
  1388. 01D9      goto 0333;                    // draw world map
  1389.  
  1390. 01DC  if(East in 15884-16884  &&  North in 16950-17584)    // MICHIGAN AREA
  1391. 01EB  { 0F(25, 06, 014E, 00);
  1392. 01F1    goto 0339;
  1393.       }
  1394. 01F4  if(East in 15884-16884  &&  North in 15950-16950)   // ILLINOIS AREA
  1395. 01FD  { 0F(02, 06, 013C, 00);
  1396. 0203    goto 0339;
  1397.       }
  1398. 0206  if(East in  5384-6384   &&  North in 14501-16301)   // SOUTH CALIF.
  1399. AREA
  1400. 0215    if(North in 15301-16301)
  1401. 021E    { 0F(0A, 06, 011B, 00);                           // Los Angeles area
  1402. 0224      goto 0339;
  1403.         }
  1404.         else
  1405. 0227    { 0F(09, 06, 0112, 00);                           // San Diego area
  1406. 022D      goto 0339;
  1407.         }
  1408. 0230  if(East in  5534-7084   &&  North in 20384-22164)   // WASHINGTON AREA
  1409. 023F    if(North in 21384-22164)
  1410. 0248    { 0F(0E, 06, 00F1, 00);
  1411. 024E      goto 0339;
  1412.         }
  1413.         else
  1414. 0251    { 0F(0F, 05, 00E8, 00);
  1415. 0257      goto 0339;
  1416.         }
  1417. 025A  if(East in 20413-21414  &&  North in 16814-17884)   // NEW YORK AREA
  1418. 0269  { 0F(16, 05, 00D0, 00);
  1419. 026F    goto 0339;
  1420.       }
  1421. 0272  if(East in 21403-22603  &&  North in 17034-18234)   // BOSTON AREA
  1422. 027B  { 0F(15, 06, 00BE, 00);
  1423. 0281    goto 0339;
  1424.       }
  1425. 0284  if(East in  6884-7884   &&  North in 16884-17884)   // WORLD WAR I AREA
  1426. 028D  { 0F(08, 04, 00AC, 00);
  1427. 0293    goto 0339;
  1428.       }
  1429. 0296  if(East in 4784-6244  &&  North in 16210-18584)     // N. CALIF. AREA
  1430. 02A5  { if(East in 4944-5444  &&  North in 17084-17584)
  1431. 02B4    { if(var02AC & 0x8000)                  // if looking westward (?)
  1432. 02BB       if(East in 5098-5151  &&  North in 17391-17484)
  1433. 02CA          goto 02EE;
  1434.             else
  1435.               goto 02DF;
  1436. 02CD      if(East in 5098-5126  &&  North in 17391-17484)
  1437. 02DC        goto  02EE;
  1438. 02DF      if(East in 4974-5098  &&  North in 17366-17534)
  1439. 02EE      { 0F(1B, 08, 004B, 00);
  1440. 02F4        goto 0339;
  1441.           }
  1442. 02F7      if(East in 4384-5251   &&  North in 17291-17583)
  1443. 0306      { if(East in 5174-5274   &&  North in 17279-17329)
  1444. 0315          goto 0321;
  1445. 0318        0F(23, 05, 0021, 00);
  1446. 031E        goto 0339;
  1447.           }
  1448.           else
  1449. 0321      { 0F(1E, 05, 0018, 00);
  1450. 0327        goto 0339;
  1451.           }
  1452.         }
  1453. 032A    0F(24, 07, 000F, 00);
  1454. 0330    goto 0339;
  1455.       }
  1456. 0333  0F(01, 06, 0006, 00);                               // word map
  1457. 0339  END
  1458.  
  1459.  
  1460. Procedure 01 is the continent map.  It is activated by proc 00 if the window
  1461. being drawn is the map window (testing var 0286) and the view point is above
  1462. 65537 m AGL or if no other procedure applies.  It is worth noting that, as
  1463. with any other scenery, the seas are drawn over the ground with blue polygons
  1464. and not viceversa.  As John Blackie pointed to me, one important reason for
  1465. that is the possibility to add tests before sea polygon drawing, in order to
  1466. avoid drawing them if the view point is sufficiently inland, thus simulating
  1467. the Earth surface curvature.
  1468. The procedure is quite complex and directly contains the more detailed local
  1469. variants.
  1470.  
  1471. Procedures 2 to 37 draw the 7 populated areas (New York-Boston, Chicago,
  1472. Seattle, San Francisco, Los Angeles, WW1 area and Wall in the Sky area).
  1473. Simpler areas are rendered by just one procedure, the most complex by many
  1474. procedures either adjacent (as the Los Angeles and the San Diego procedures)
  1475. or layered one above the other; in the latter case, layering is obtained with
  1476. nested 0Fh record calls.
  1477.  
  1478. This is a summary of procedure properties.
  1479.  
  1480. no   length area      called with       by    calling
  1481. --   ------ ----    ---------------     --    -------
  1482. 00     395 selector   --                --    01, 02, 07, 08, 09, 0A, 0E, 0F,
  1483.                                               15, 16, 1B, 1E, 23, 24, 25
  1484. 01    4620   map    0F 01 06 0006 00    00
  1485. 02   11969   IL     0F 02 06 013C 00    00
  1486. 03    7607   MI     0F 03 06 000A 01    25    06
  1487. 04    4783   MI     0F 04 06 0031 01    25
  1488. 05    7070   MI     0F 05 06 0013 01    25
  1489. 06    2203   MI     0F 06 06 0006 02    03
  1490. 07    3799   WItS   0F 07 06 0177 00    00
  1491. 08    4003   WWI    0F 08 04 00AC 00    00
  1492. 09    7372   SD     0F 09 06 0112 00    00
  1493. 0A    5639   LA     0F 0A 06 011B 00    00    0B, 0C, 0D
  1494. 0B    1149   LA     0F 0B 02 0C36 01    0A
  1495.                     0F 0B 02 0CF6 01    0A
  1496. 0C     775   LA     0F 0C 01 0785 01    0A
  1497.                     0F 0C 01 084A 01    0A
  1498. 0D     557   LA     0F 0D 01 08CA 01    0A
  1499.                     0F 0D 01 099E 01    0A
  1500.                     0F 0D 01 0D7E 01    0A
  1501.                     0F 0D 01 0E09 01    0A
  1502. 0E    8674   WA     0F 0E 06 00F1 00    00    10, 11
  1503. 0F    5824   WA     0F 0F 05 00E8 00    00    12, 13, 14
  1504. 10     791          0F 10 01 11D1 01    0B
  1505.                     0F 10 01 12AF 01    0B
  1506. 11     407   WA     0F 11 01 1390 01    0E
  1507.                     0F 11 01 145C 01    0E
  1508. 12     770          0F 12 01 08AC 01    0F
  1509.                     0F 12 01 0972 01    0F
  1510. 13     554          0F 13 01 0C6E 01    0F
  1511.                     0F 13 01 0D25 01    0F
  1512. 14     413          0F 14 01 09F1 01    0F
  1513.                     0F 14 01 0AB6 01    0F
  1514. 15    6597   MA     0F 15 06 00BE 00    00
  1515. 16    4634   NY     0F 16 05 00D0 00    00    17, 18, 19
  1516. 17    1202   NY     0F 17 02 0972 01    16
  1517.                     0F 17 02 0A14 01    16
  1518. 18     597   NY     0F 18 01 082F 01    16
  1519.                     0F 18 01 08B5 01    16
  1520. 19    2422   NY     0F 19 02 018F 01    16
  1521. 1A     699   CA     0F 1A 02 10F7 01    23
  1522. 1B    9806   CA     0F 1B 08 004B 00    00
  1523. 1C     421   CA     0F 1C 01 0523 02    21
  1524. 1D    3900   CA     0F 1D 04 0009 01    1E
  1525. 1E    3347   CA     0F 1E 05 0018 00    00    1D, 21
  1526. 1F    1970   CA     0F 1F 02 12B1 01    23
  1527. 20    1562   CA     0F 20 02 1307 01    23
  1528. 21    3370   CA     0F 21 03 0012 01    1E    1C, 22
  1529. 22    1504   CA     0F 22 02 0686 02    21
  1530. 23    9733   CA     0F 23 05 0021 00    00    1A, 1F, 20
  1531. 24    6404   CA     0F 24 07 000F 00    00
  1532. 25    1516   MI     0F 25 06 014E 00    00    03, 04, 05
  1533.  
  1534. RECORD 0Fh OCCURRENCES IN CALLING HIERACHY
  1535.  
  1536. 0F 01 06 0006 00
  1537. 0F 02 06 013C 00
  1538. 0F 07 06 0177 00
  1539. 0F 08 04 00AC 00
  1540. 0F 09 06 0112 00
  1541. 0F 0A 06 011B 00 ─┬─> 0F 0D 01 0E09 01
  1542.                   ├─> 0F 0D 01 0D7E 01
  1543.                   ├─> 0F 0B 02 0CF6 01
  1544.                   ├─> 0F 0B 02 0C36 01
  1545.                   ├─> 0F 0D 01 099E 01
  1546.                   ├─> 0F 0D 01 08CA 01
  1547.                   ├─> 0F 0C 01 084A 01
  1548.                   └─> 0F 0C 01 0785 01
  1549. 0F 0E 06 00F1 00 ─┬─> 0F 11 01 145C 01
  1550.                   ├─> 0F 11 01 1390 01
  1551.                   ├─> 0F 10 01 12AF 01
  1552.                   └─> 0F 10 01 11D1 01
  1553. 0F 0F 05 00E8 00 ─┬─> 0F 13 01 0D25 01
  1554.                   ├─> 0F 13 01 0C6E 01
  1555.                   ├─> 0F 14 01 0AB6 01
  1556.                   ├─> 0F 14 01 09F1 01
  1557.                   ├─> 0F 12 01 0972 01
  1558.                   └─> 0F 12 01 08AC 01
  1559. 0F 15 06 00BE 00
  1560. 0F 16 05 00D0 00 ─┬─> 0F 17 02 0A14 01
  1561.                   ├─> 0F 17 02 0972 01
  1562.                   ├─> 0F 18 01 08B5 01
  1563.                   ├─> 0F 18 01 082F 01
  1564.                   └─> 0F 19 02 018F 01
  1565. 0F 1B 08 004B 00
  1566. 0F 1E 05 0018 00 ─┬─> 0F 21 03 0012 01 ─┬─> 0F 22 02 0686 02
  1567.                   │                     └─> 0F 1C 01 0523 02
  1568.                   └─> 0F 1D 04 0009 01
  1569. 0F 23 05 0021 00 ─┬─> 0F 20 02 1307 01
  1570.                   ├─> 0F 1F 02 12B1 01
  1571.                   └─> 0F 1A 02 10F7 01
  1572. 0F 24 07 000F 00
  1573. 0F 25 06 014E 00 ─┬─> 0F 04 06 0031 01
  1574.                   ├─> 0F 05 06 0013 01
  1575.                   └─> 0F 03 06 000A 01 ───> 0F 06 06 0006 02
  1576.  
  1577. ----------
  1578.  
  1579. F1 RECORD COUNTS
  1580.  
  1581.   record  times      record   times       record   times
  1582.  
  1583.   0(00):    43       28(1C):   411        53(35):    19
  1584.   1(01):   137       29(1D):   173        54(36):     1
  1585.   2(02):   449       30(1E):    45        59(3B):     9
  1586.   3(03):   178       31(1F):   191        60(3C):     1
  1587.   4(04):     4       32(20):   158        61(3D):     7
  1588.   5(05):    68       33(21):   416        62(3E):   917
  1589.  11(0B):   408       34(22):   235        64(40):  1746
  1590.  12(0C):     2       35(23):   417        65(41):  8157
  1591.  14(0E):    39       36(24):   783        66(42):    78
  1592.  15(0F):    49       37(25):   849        67(43):     5
  1593.  16(10):    99       39(27):   121        68(44):     4
  1594.  18(12):   270       40(28):   161        71(47):    11
  1595.  19(13):    63       41(29):  1298        73(49):    32
  1596.  20(14):    81       42(2A):   117        74(4A):     8
  1597.  22(16):     1       43(2B):    62        75(4B):     1
  1598.  23(17):    26       46(2E):    19        77(4D):     7
  1599.  24(18):   624       47(2F):   832        79(4F):    25
  1600.  25(19):   276       49(31):  1405       121(79):   123
  1601.  26(1A):   314       50(32):   771
  1602.  27(1B):   454       51(33):  2107
  1603.  
  1604.  
  1605. ----------
  1606.  
  1607. NOTE ON SCN FILES
  1608.  
  1609. SCN files have a very different structure than F1.  Generally speaking, the
  1610. SCN structure seems to be an old leftover of the time when sceneries were
  1611. loaded from floppy disks without a secure DOS aid (FS was an auto-booting
  1612. protected program).  Now, the only reason for implementing such a format
  1613. seems to be a possible compatibility with the SubLogic's ATP program.
  1614.  
  1615. The general structure of SCN files can be outlined as follows:
  1616.  
  1617. 000000-0002FF  Only garbage: some files contain a boot-strap sector, other
  1618.                just a lot of 79h records.
  1619. 000300-0003FF  The first bytes contain the AUTOLOAD procedure.  The remaining
  1620.                part of this area does not have any apparent sense.
  1621. 000400-00E7FF  Available for scenery procedures.
  1622. 00E800-00EBFF  Dialogue descriptor area
  1623. 00EC00-0107FF  Available for scenery procedures.
  1624. 010800-010BFF  Procedure 0
  1625. 010C00-end     Available for scenery procedures.
  1626.  
  1627.  
  1628. SCN file space is allocated in 1 kB "clusters" or blocks.  If the length of a
  1629. procedure is not an exact multiple of 1 kB, the portion from its end to the
  1630. next kB boundary is left uninitialized.
  1631.  
  1632. Procedure 00 is at the fixed file offset 010800h and, judging from FS file
  1633. activity during SCN loading, seems to be limited to 1 kB (see below for info
  1634. on ATP's F1 proc 00).
  1635.  
  1636. SCN format does not contain a procedure table, as F1 format does; it uses
  1637. instead a record 0A in procedure 00 to define the code, file offset and
  1638. length of other procedures.  Because only the hight byte of procedure offset
  1639. fields in record 0A is actually ingored, SCN format scenery cannot be longer
  1640. than 256 kB.
  1641.  
  1642. DIALOGUE DESCRIPTOR
  1643.  
  1644. SCN-format dialogue descriptor has a different structure than F1-format's.
  1645. In particular, it does not include screen coordinates of text lines; a
  1646. rudimentary layout formatting is obtained through blank lines (which however
  1647. always contain at least a white space).  Dialogue text lines begin at offset
  1648. 00E832 and have the following structure:
  1649.  
  1650.           01 00 "line text" 00
  1651.  
  1652. the dialogue text end is marked by:
  1653.  
  1654.           00 00
  1655.  
  1656. Sections 00E800-00E831 and from the end of the text to 00EBFF contain machine
  1657. code and replicate the structure of a .DRV (see below); they are probably
  1658. useless, now.
  1659.  
  1660. It is worth noting that a file may have an .SCN extension and still use the
  1661. F1 structure, as the MS-x.SCN scenery series does.
  1662.  
  1663. ----------
  1664.  
  1665. ATP SCN FORMAT
  1666.  
  1667. ATP sceneries are in the same SCN format, with some notable exceptions:
  1668.  
  1669. At file offset 000200h, there is a sort of header (from an indirect (!) com-
  1670. munication of Simon Hradezky):
  1671.  
  1672. 000200    1    01 (ATP flag, differentiates ATP SCNs from FS SCNs)
  1673. 000201    1    Reserved
  1674. 000202    2    required RAM in paragraphs (16 bytes)
  1675. 000204    2    offset of Proc 00 in kB units
  1676. 000206    2    length of Proc 00 in kB units
  1677. 000208    2    Reference number (identifies the scenery?)
  1678.  
  1679. ATP sceneries contain at least one record unattested in FS SCN (record 59h).
  1680.  
  1681. In ATP sceneries, the main entry proc is not fixed at file offset 0010800h
  1682. and to 1 kB length, but is parametrized in the header.
  1683.  
  1684. ======================================================================
  1685.  
  1686.                        ASD STATIC SCENERY FILES (.SC1)
  1687.  
  1688. (Beyond its specific contents, this section can also be seen as a sort of
  1689. tutorial in interpreting SDL records, because of the commented examples it
  1690. contains.)
  1691.  
  1692. .SC1 GENERAL STRUCTURE
  1693.  
  1694. .SC1 files are made of:
  1695.  
  1696. ∙ a header containing a lookup table for the various file sections, the
  1697.   scenery boundaries, and the scenery name; this header is 73 bytes long;
  1698.  
  1699. ∙ 9 sections, containing definitions of Navaids, Polygon, Rivers, Roads,
  1700.   Lines, Runways, Mountains, Timing gates, and Buildings respectively.  Each
  1701.   section is terminated by a 79h record.
  1702.  
  1703. In SC1 files, some record codes can have the most significant bit set or
  1704. reset, without any apparent difference.
  1705.  
  1706. ====================
  1707.  
  1708. HEADER STRUCTURE - length: 73 bytes
  1709.  
  1710. 0         2    file size
  1711. 2         2    0003h (a kind of signature?)
  1712. 4         2    002Ah (= 42, pointer to scenery name)
  1713. 6         2    0049h (= 73, header length)
  1714. 8         2    pointer to Navaid section (always 73)
  1715. 10        2    pointer to Polygon section
  1716. 12        2    pointer to River section
  1717. 14        2    pointer to Road section
  1718. 16        2    pointer to Line section
  1719. 18        2    pointer to Runway section
  1720. 20        2    pointer to Mountain section
  1721. 22        2    pointer to Timing gate section
  1722. 24        2    pointer to Building section
  1723. 26        4    E coord. of scenery center (fract. FSu)
  1724. 30        4    N coord. of scenery center (fract. FSu)
  1725. 34        2    scenery radius (int. FSu)
  1726. 36        6    always 0 ??
  1727. 42        31   scenery names: up to 30 characters (padded with space, if
  1728.                shorter) plus a 0 ending byte
  1729.  
  1730. ====================
  1731.  
  1732.           OBJECT DETAILED DESCRIPTIONS
  1733.  
  1734. The following section contains a detailed description of structure of all the
  1735. objects found in standard .SC1 files, with examples of decoding.  With the
  1736. exception of ATC messages, SEE extensions are not included.
  1737.  
  1738. One must not assume that the following structures are THE object structures,
  1739. because base sceneries (either in F1 or SCN format) are not bound to them
  1740. and, given the procedural nature of SDL, any succession of records yielding
  1741. the same, or similar, result could work.  I found that even ASD is not bound
  1742. to them and can correctly execute SC1 files containing other record succes-
  1743. sions, while it may no longer able to edit them.
  1744.  
  1745. In SC1, there is a 3Eh record at the beginning of each object, skipping it if
  1746. it cannot be seen (or tuned) from the current plane position; under the spe-
  1747. cial SC1 conditions, I keep the previous name of "AREA record" and the byte
  1748. offset in it as "object length".
  1749.  
  1750. ====================
  1751.  
  1752. NAV AIDS
  1753.  
  1754. Like all .SC1 object, navaids begin with an area record; to the area record,
  1755. NDB, VOR, and ILS add a specific record (05h, 1Dh, 4Fh, resp.); Markers add a
  1756. 25h record setting var 02F6h (inner marker), 02F8h (outer marker) or 02FAh
  1757. (middle marker) to 0001.
  1758.  
  1759. Adding the 9 bytes of the area record, the total length of each kind of Nav
  1760. aids is (in parenthesis, the default area radius set by ASD):
  1761.  
  1762. NDB       20 bytes       (500 FSu = 128 Km = 69 NM)
  1763. VOR       20 bytes       (500 FSu = 128 Km = 69 NM)
  1764. ILS       24 bytes       (250 FSu = 64 Km = 34.6 NM)
  1765. OM        14 bytes       (2 FSu = 512 m)
  1766. MM        14 bytes       (2 FSu = 512 m)
  1767. IM        14 bytes       (1 FSu = 256 m)
  1768.  
  1769. Example:
  1770.  
  1771. 3E 18 00 92 03 8C 04 FA 00 4F 25 09 00 06 8C 04 00 00 92 03 2C 01 FF 6A
  1772.  
  1773. is interpreted as:
  1774.  
  1775. 3Eh       Area record
  1776.   0018h        object is 24 bytes long
  1777.   0392h        N coord of visib. area is [0392h =] 914 + 16384 = 17298
  1778.   048Ch        E coord of visib. area is [048Ch =] 1164 + 16384 = 17548
  1779.   00FA         area radius is [FAh =] 500 FSu
  1780. 4Fh       ILS record
  1781.   0925h        frequency is 109.25 MHz
  1782.   048C0600h    E coord is [0485.06h =] 1164+6/256 + 16384 = 17548.0234
  1783.   03920000h    N coord is [0392.00h =]  914+0/256 + 16384 = 17298.0000
  1784.   012Ch        approach course is [012Ch =] 300 / 3 = 100°
  1785.   6AFFh        glide slope is [6AFFh = ] 27391 / 9100 = 3.01°
  1786.  
  1787. ====================
  1788.  
  1789. ATC MESSAGES
  1790.  
  1791. ASD cannot add ATC messages to sceneries. However, messages added to .SC1
  1792. files with other programs (or manually!) are correctly played by FS4 and do
  1793. not interfere with ASD ability to manipulate the modified .SC1.
  1794. The following structure has been determined from SEE4-modified sceneries.
  1795.  
  1796. ATC messages are made by:
  1797. ∙ an area record
  1798. ∙ a 0B jump record with 2-byte embedded code: 0Bh 0005h 41h 43h (where 41h
  1799. 43h, "AC", is probably an ID meaning "ATC")
  1800. ∙ an ATC message record (1Eh)
  1801.  
  1802. ====================
  1803.  
  1804. POLYGONS
  1805.  
  1806. Polygon descriptions are made of an area record, a ref. point record, a sur-
  1807. face colour record and a 2Fh, 40h, 41h, [41h...] 29h record sequence (there-
  1808. after called "perimeter") describing the polygon perimeter.  As for any
  1809. object of variable size, area radius is not fixed, like in nav aids, but
  1810. depends on the polygon size.
  1811.  
  1812. Triangles are special, because, after the polygon proper, they add a 3-point
  1813. line corresponding to two of the three sides of the triangle; this line has
  1814. the same colour of the triangle and cannot be seen.
  1815.  
  1816. Example:
  1817.  
  1818. 3E 3E 00 92 03 8D 04 03 00 24 04 00 4D 8D 04 00
  1819. 0A 00 00 00 B9 92 03 25 E2 02 99 99 2F 40 F2 FF
  1820. 08 00 41 0D 00 0B 00 41 0F 00 F6 FF 29 12 09 40
  1821. F2 FF 08 00 41 0D 00 0B 00 41 0F 00 F6 FF
  1822.  
  1823. is interpreted as:
  1824.  
  1825. 3Eh       Area record
  1826.   003Eh        object is 62 bytes long
  1827.   0392h        N coord of visib. area is 17298
  1828.   048Dh        E coord of visib. area is 17549
  1829.   0003         area radius is 3 FSu
  1830. 24h 04h   Ref. point record, scale factor = 4
  1831.   048D4D00h    E coord is [048D.4Dh =] 1165+77/256 + 16384 = 17549.0273
  1832.   00000A00h    altitude above ground level is [00000Ah =] 10 m
  1833.   0392B900h    N coord is [0392.B9h =] 914+185/256 + 16384 = 17298.7227
  1834. 25h       Set variable record
  1835.   02E2h        variable at 02E2 (surface colour)
  1836.   9999h        set to colour 9 (yellow)
  1837. 2Fh       Path
  1838. 40h       Move record
  1839.   FFF2h        E coord of P1: [FF.F2h =] -14/256 + 17549.0273 = 17548.9726
  1840.   0008h        N coord of P1: [00.08h =]   8/256 + 17298.7227 = 17298.7540
  1841. 41h       Draw record
  1842.   000Dh        E coord of P2: [00.0Dh =]  13/256 + 17549.0273 = 17549.0781
  1843.   000Bh        N coord of P2: [00.0Bh =]  11/256 + 17298.7227 = 17298.7657
  1844. 41h       Draw record
  1845.   000Fh        E coord of P3: [00.0Fh =]  15/256 + 17549.0273 = 17549.0859
  1846.   FFF6h        N coord of P3: [FF.F6h =] -10/256 + 17298.7227 = 17298.6836
  1847. 29h       Close path (polygons with 4 or more points, would stop there)
  1848. 12h 09h   Line colour is 9 (yellow)
  1849. 40h FFF2h 0008h same move record as above
  1850. 41h 000Dh 000Bh same draw record as above
  1851. 41h 000Fh FFF6h same draw record as above
  1852.  
  1853. ====================
  1854.  
  1855. RIVERS
  1856.  
  1857. Even if they are created in ASD by stretching and bending rectangular strips
  1858. of colour, rivers are actually memorized in scenery files as polygons, and
  1859. follow the same format described in the previous section. The reason for
  1860. keeping them in a specific section resides probably in the order in which
  1861. scenery object are drawn.
  1862.  
  1863. Rivers can also contain skips: in this case, the river description contains a
  1864. single area record and a single ref. point record followed by a surface
  1865. colour record and a perimeter for each polygon created by skipping.
  1866.  
  1867. ====================
  1868.  
  1869. ROADS
  1870.  
  1871. Roads also are memorized as polygons, and follow the polygon format. For
  1872. skippings, the same observation made about rivers, holds also for roads.
  1873.  
  1874. Country roads and city streets require no observations.
  1875.  
  1876. 4-lane roads contain, after the perimeter describing the road perimeter, a
  1877. line colour record and a multi-line describing the road middle line.
  1878.  
  1879. Divided highways, after the area and ref. point records, contain a single
  1880. surface colour record (25h) with two perimeters to describe the two road
  1881. ways, then a line colour record, a conditional jump record (23h) on var 028Ch
  1882. value and another line colour record to change colour line according to day
  1883. time, and a multi-line with 4 jumps to describe the 4 borders of the ways.
  1884.  
  1885. ====================
  1886.  
  1887. LINES
  1888.  
  1889. Line descriptions are made of an area record, a ref. point record, a line
  1890. colour record and a 40h, 41h, [41h...] record sequence ("multi-line") des-
  1891. cribing the line shape.  If the line contains skips, a new line colour record
  1892. and a new multi-line are generated for each line section.
  1893.  
  1894. ====================
  1895.  
  1896. RUNWAYS
  1897.  
  1898. Runway descriptions are made of 2 area records referring to the same point
  1899. (one spanning the entire object and the other covering only the altitude set-
  1900. ting), a 25h record to set area altitude and the specialized runway record:
  1901.  
  1902. Runway record - code: 50h/D0h  length: 35 bytes
  1903.  
  1904. 0         1    50h or D0h: record code
  1905. 1         4    E coord of center (fract. FSu)
  1906. 5         4    Altitude of center (fract. FSu)
  1907. 9         4    N coord of center (fract. FSu)
  1908. 13        1    Design elements (bit is 1 if the element is present):
  1909.                bit       7: always 1
  1910.                          6: always 1
  1911.                          5: Numbers
  1912.                          4: Dashes
  1913.                          3: Fixed distance markers
  1914.                          2: Touchdown markers
  1915.                          1: Threshold markers
  1916.                          0: Edges
  1917. 14        1    Runway colour (repeated in each nibble)
  1918. 15        1    Edge colour                (")
  1919. 16        1    Threshold marker colour    (")
  1920. 17        1    Touchdown marker colour    (")
  1921. 18        1    Fixed distance mrkr colour (")
  1922. 19        1    Dash colour                (")
  1923. 20        1    Number colour              (")
  1924. 21        1    Runway number (down side) as hex number
  1925. 22        1    Designator:
  1926.                          0: none
  1927.                          1: LEFT/RIGHT
  1928.                          2: RIGHT/LEFT
  1929.                          3: CENTER/CENTER
  1930. 23        1    Down side lights:
  1931.                bit       0: End light
  1932.                          1: always 0?
  1933.                          2: REIL
  1934.                          3: VASI
  1935.                high nibble value:
  1936.                          0: none
  1937.                          1: MASLR
  1938.                          2: MASLR with strobes
  1939.                          3: SSALR
  1940.                          4: SSALR with strobes
  1941.                          5: MALSF
  1942.                          6: MALSF with strobes
  1943.                          7: SSALF
  1944.                          8: SSALF with strobes
  1945.                          9: ALSF-I
  1946.                          A: ALSF-II
  1947. 24        2    Down side VASI slope in 1/10°
  1948. 26        1    Up side lights (as in byte 23)
  1949. 27        2    Up side VASI slope in 1/10°
  1950. 29        2    Up side direction in 1/182.04°
  1951. 31        2    Runway width in m
  1952. 33        2    Runway length in m
  1953.  
  1954. Note: up side refers to the runway end located up when placing it, down side
  1955. is the other end.
  1956.  
  1957. Example:
  1958.  
  1959. 3E 3A 00 2B F9 2D 05 32 00 3E 0E 00 2B F9 2D 05
  1960. 15 00 25 EF 02 0F 00 D0 00 4C 2D 05 00 00 00 00
  1961. 00 21 2B F9 FF 00 88 DD 88 99 FF FF 04 00 01 1C
  1962. 00 39 1E 00 5C 15 2D 00 52 08
  1963.  
  1964. is interpreted as:
  1965.  
  1966. 3Eh       Area record
  1967.   003Ah        object is 58 bytes long (includes the entire object)
  1968.   F92Bh        N coord is [F92Bh =] 63787 - 49152 = 14635
  1969.   052Dh        E coord is [052Dh =]  1325 + 16384 = 17709
  1970.   0032h        area radius is 50 FSu (12.8 Km)
  1971. 3Eh       Area record
  1972.   000Eh        14 bytes (includes only this record and the following)
  1973.   F92Bh        N coord is 14635 again
  1974.   052Dh        E coord is 17709 again
  1975.   0015h        inner area radius is 21 FSu (5.4 Km)
  1976. 25h       Set var
  1977.   02EFh        at 02EFh (area altitude)
  1978.   000Fh        to 15 m above sea level
  1979. D0h       Runway record
  1980.   052D4C00h    E coord. of runway is 17709.2969
  1981.   00000000h    Altitude is 0
  1982.   F92B2100h    N coord. of runway is 14635.8711
  1983.   FFh          runway has all design elements
  1984.   00h          runway colour is Black
  1985.   88h          edge colour is Brown
  1986.   DDh          threshold mkr colour is Gold
  1987.   88h          touchdown mkr colour is Brown
  1988.   99h          fix. dist.mkr colour is Yellow
  1989.   FFh          dash colour is White
  1990.   FFh          number colour is White
  1991.   04h          runway number is 4
  1992.   00h          no designator
  1993.   01h          down side has end lights
  1994.   001Ch        down side VASI slope is [1Ch =] 28 / 10 = 2.8° *
  1995.   39h          up side has VASI and end light (9) of type SSALR (3)
  1996.   001Eh        up side VASI slope is [1Eh =] 30 / 10 = 3.0°
  1997.   155Ch        runway direction is [155Ch =] 5468 / 182.04 = 30.04°
  1998.   002Dh        runway is [002Dh =] 45 meter wide
  1999.   0852h        runway is [0852h =] 2130 meter long
  2000.  
  2001. Note: down side VASI slope is actually undefined because down side has no
  2002. VASI.
  2003.  
  2004. ====================
  2005.  
  2006. MOUNTAINS
  2007.  
  2008. Mountains are among the most complex ASD objects.  These are the records used
  2009. to define a mountain:
  2010.  
  2011. ∙ an area record,
  2012. ∙ a delayed call (0Eh) calling the actually drawing routine
  2013. ∙ a jump record (0Bh) skipping the entire mountain definition
  2014.  
  2015. The drawing routine follows, made of:
  2016. ∙ a ref. point record.
  2017.  
  2018. for each peak and each point of the base there is:
  2019. ∙ a 3D-point record (31h)
  2020.  
  2021. ∙ a 25h 031Eh 0000h constant record
  2022. ∙ a 22h record with a byte offset of 001Ah and checking values of vars at
  2023. 029Ch (delta E coord.), 029Eh (delta A coord.), and 02A0h (delta N coord.)
  2024. ∙ a 25h 031Eh 0001h constant record
  2025.  
  2026. Then, for each side of the mountain, two records are given:
  2027. ∙ an area colour record (25h 02E2h xxxxh)
  2028. ∙ a 3D-triangle record (5Ah)
  2029.  
  2030. ∙ a 51h record
  2031. ∙ a RET from subroutine (19h)
  2032.  
  2033. Example:
  2034. This example describes a square mountain, with sides 2 FSu long and parallel
  2035. to the coordinate axes.
  2036.  
  2037. 3E 00A2 0393 048C 0040   Center: 17299, 17548; radius: 64 FSu
  2038. 8E 0006                  Call the subroutine
  2039. 0B 0096                  Jump over [0096h =] 150 bytes
  2040. ; the drawing routine:
  2041. 24 04 048C0000 00000000 03930000
  2042.                          Ref. point: 17548 E, 0 AGL, 17299 N
  2043. 31 01 0080 0098 0080     1st peak: +0.5 E,+152 m, +0.5 N from ref. point
  2044. 31 21 FF00 0000 0100     1st point:-1.0 E, + 0 m, +1.0 N from ref. point
  2045. 31 22 0100 0000 0100     2nd point:+1.0 E, + 0 m, +1.0 N from ref. point
  2046. 31 23 0100 0000 FF00     3rd point:+1.0 E, + 0 m, -1.0 N from ref. point
  2047. 31 24 FF00 0000 FF00     4th point:-1.0 E, + 0 m, -1.0 N from ref. point
  2048. 25 031E 0000             Set var at 031Eh to 0 (fixed)
  2049. 22 001A                  3-var rec.: byte offs. 26 (skips over next 25h rec)
  2050.   029C FF00 0100         var 029Ch (E range): -1.0 to +1.0 around ref. point
  2051.   029E 0000 0198         var 029Eh (A range): 0 to [0198h - 0100h =] 152 m
  2052.   02A0 FF00 0100         var 02A0h (N range): -1.0 to +1.0 around ref. point
  2053. 25 031E 0001             set var at 031Eh to 1 (fixed)
  2054. 25 02E2 5555             Surface colour: Light Grey
  2055. 5A 1300 D000 0000 01 21 24    Triangle thru 1st peak, 1st and 4th points
  2056. 25 02E2 8888             Surface colour: Brown
  2057. 5A 0000 D000 1300 01 24 23    Triangle thru 1st peak, 4th and 3rd points
  2058. 25 02E2 AAAA             Surface colour: Dark Grey
  2059. 5A DA00 E000 0000 01 23 22    Triangle thru 1st peak, 3rd and 2nd points
  2060. 25 02E2 5555             Surface colour: Light Grey
  2061. 5A 0000 E000 DA00 01 22 21    Triangle thru 1st peak, 2nd and 1st points
  2062. 51                       End of triangle list
  2063. 19                       RETurn
  2064.  
  2065. ====================
  2066.  
  2067. TIMING GATES
  2068.  
  2069. Timing gate description is not fully deciphered. It is made of:
  2070. ∙ an area record
  2071. ∙ a delayed call (0Eh) calling the drawing routine
  2072. ∙ a jump record (0B) skipping over the drawing routine
  2073. Then the drawing routine follows, made of:
  2074. ∙ a reference point record
  2075. ∙ an orientation record calling a tilt-drawing sub-routine
  2076. ∙ a RET from subroutine (17h) (return from delayed call)
  2077. The tilt-drawing sub-routine follows, made of:
  2078. ∙ a specialized timing gate record (53h 3Dh)
  2079. ∙ a RET from subroutine (19h) (return from the orientation call).
  2080.  
  2081. -- 53h 3Dh --------- Timing gate (17 bytes)
  2082.  
  2083. 0         0    53h: object record code
  2084. 1         1    3Dh: timing gate sub-code
  2085. 2         2    gate width in m
  2086. 4         2    gate height in m
  2087. 6         1    front colour (code in both nibbles)
  2088. 7         1    back colour (code in both nibbles)
  2089. 8         2    always 0 ??
  2090. 10        1    gate number from 0 onward; last gate number has msb set
  2091. 11        2    ??
  2092. 13        2    ??
  2093. 15        2    ??
  2094.  
  2095. Note: the last 3 field values vary from gate to gate of the same amounts of
  2096. which E coord., alt. and N coord. vary; they are perhaps connected with the
  2097. distance from gate to gate.
  2098.  
  2099. ====================
  2100.  
  2101. BUILDINGS
  2102.  
  2103. All real buildings share the same structure (poles, bridges, trees, autos,
  2104. fuel boxes and thermal generators depart somewhat from this structure):
  2105.  
  2106. ∙ an area record
  2107. ∙ a delayed call (0Eh) calling the actually drawing routine
  2108. ∙ a jump record (0Bh) skipping over the entire object
  2109. ∙ a 2-byte embedded code related to building type and detailed below
  2110. ; drawing routine:
  2111. ∙ a reference point record
  2112. ∙ an orientation record calling a tilt-drawing sub-routine
  2113. ∙ a RET (19h) returning from the delayed call
  2114. ; titl-drawing sub-routine:
  2115. ∙ a 53h variable record depending on the object
  2116. ∙ a RET (19h) returning from the orientation call.
  2117.  
  2118. Towers, wind socks and trees lack a separated tilt-drawing sub-routine and
  2119. have the following structure:
  2120.  
  2121. ∙ an area record
  2122. ∙ a delayed call (0Eh) calling the actually drawing routine
  2123. ∙ a jump record (0Bh) skipping over the drawing routine
  2124. ∙ a 2-byte embedded code related to building type and detailed below
  2125. ; drawing routine:
  2126. ∙ a reference point record
  2127. ∙ a 53h variable record depending on the object
  2128. ∙ a RET (19h) returning from the orientation call.
  2129.  
  2130. For buildings, the 53h record contains:
  2131. ∙ the record code 53h in the 1st byte
  2132. ∙ a sub-code related to the building type in  byte 1
  2133. ∙ a series of 2-bytes fields defining wall distances from ref. point (first
  2134.   horizontal positions from left [negative] to right [positive], then verti-
  2135.   cal positions from top [positive] to bottom [negative])
  2136. ∙ a 2-bytes field with base height
  2137. ∙ a single byte field with peak height (0 for flat roofs)
  2138. ∙ a series of single byte fields with wall colours and roof pitches colours
  2139.   (just one if the roof is flat).
  2140.  
  2141. All distances are in meters, and colour codes are repeated in both nibbles.
  2142.  
  2143. In the following sketches, for each kind of building, code and sub-code of
  2144. 53h record as well as the build. type in the enbedded code are given; numbers
  2145. and letters show the order in which wall positions and colour codes respec-
  2146. tively appear within the 53h record.
  2147.  
  2148. Rectangular building (53h 01h)
  2149.   flat roof (type 0003h)     peaked roof (type 0005h)
  2150.  
  2151.   1           2              1           2
  2152.   │     a     │              │     a     │
  2153.   ┌───────────┐─ 3           ┌───────────┐─ 3
  2154.   │           │              │     f     │
  2155. d │     e     │ b          d ├───────────┤ b
  2156.   │           │              │     g     │
  2157.   └───────────┘─ 4           └───────────┘─ 4
  2158.         c                          c
  2159.  
  2160. L building (53h 02h)
  2161.   flat roof (type 0007h)     peaked roof (type 0009h)
  2162.  
  2163.   1       2      3             1       2      3
  2164.   │   a   │      │             │   a   │      │
  2165.   ┌───────┐       ─ 4          ┌───┬───┐       ─ 4
  2166.   │       │b                   │   │   │ b
  2167.   │       │   c                │   │ h │   c
  2168.   │       └──────┐─ 5          │ g │  /└──────┐─ 5
  2169. f │      g       │           f │   │/    i    │
  2170.   │              │ d           │  /└──────────┤ d
  2171.   │              │             │/      l      │
  2172.   └──────────────┘─ 6          └──────────────┘─ 6
  2173.          e                            e
  2174.  
  2175. Reversed L building (53h 06h)
  2176.   flat roof (type 000Bh)     peaked roof (type 000Dh)
  2177.  
  2178.   1       2      3             1       2       3
  2179.   │       │   c  │             │       │   c   │
  2180.           ┌──────┐─ 4                  ┌───┬───┐─ 4
  2181.         b │      │                   b │   │   │
  2182.       a   │      │                 a   │ h │   │
  2183.   ┌───────┘      │─ 5          ┌───────┘\  │ g │─ 5
  2184.   │         g    │ d           │     i    \│   │ d
  2185. f │              │           f ├───────────┘\  │
  2186.   │              │             │       j      \│
  2187.   └──────────────┘─ 6          └───────────────┘─ 6
  2188.          e                            e
  2189.  
  2190. T building (53h 03h)
  2191.   flat roof (type 000Fh)          peaked roof (type 0011h)
  2192.  
  2193.   1       2       3       4       1       2       3       4
  2194.   │       │   a   │       │       │       │   a   │       │
  2195.   ┌───────────────────────┐─ 5    ┌───────────────────────┐─ 5
  2196.   │                       │       │           i           │
  2197. h │                       │ b   h ├───────────┬───────────┤ b
  2198.   │           i           │       │     j    /│\    m     │
  2199.   └───────┐       ┌───────┘─ 6    └───────┐/  │  \┌───────┘─ 6
  2200.       g   │       │    c              g   │   │   │    c
  2201.         f │       │ d                   f │ k │ l │ d
  2202.           │       │                       │   │   │
  2203.           └───────┘        ─ 7            └───┴───┘        ─ 7
  2204.               e                               e
  2205.  
  2206. U building (53h 04h)
  2207.   flat roof (type 0013h)          peaked roof (type 0015h)
  2208.  
  2209.   1       2       3       4       1       2       3       4
  2210.   │   a   │       │   e   │       │   a   │       │   e   │
  2211.   ┌───────┐       ┌───────┐─ 5    ┌───┬───┐       ┌───┬───┐─ 5
  2212.   │       │b     d│       │       │   │   │b     d│   │   │
  2213.   │       │   c   │       │       │   │ j │   c   │ m │   │
  2214. h │       └───────┘       │─ 6  h │ i │  /└───────┘\  │ n │─ 6
  2215.   │                       │ f     │   │/      k      \│   │ f
  2216.   │           i           │       │  /└───────────────┘\  │
  2217.   │                       │       │/          l          \│
  2218.   └───────────────────────┘─ 7    └───────────────────────┘─ 7
  2219.               g                               g
  2220.  
  2221. H building (53h 05h)
  2222.   flat roof (type 0017h)          peaked roof (type 0019h)
  2223.  
  2224.   1       2       3       4       1       2       3       4
  2225.   │   a   │       │   e   │       │   a   │       │   e   │
  2226.   ┌───────┐       ┌───────┐─ 5    ┌───┬───┐       ┌───┬───┐─ 5
  2227.   │       │b     d│       │       │   │   │b     d│   │   │
  2228.   │       │   c   │       │       │   │ n │   c   │ r │   │
  2229.   │       └───────┘       │─ 6    │   │  /└───────┘\  │   │─ 6
  2230.   │                       │       │   │/      p      \│   │
  2231. l │           m           │ f   l │ m ├───────────────┤ t │ f
  2232.   │                       │       │   │\      q      /│   │
  2233.   │       ┌───────┐       │─ 7    │   │  \┌───────┐/  │   │─ 7
  2234.   │       │   i   │       │       │   │ o │   i   │ s │   │
  2235.   │       │j     h│       │       │   │   │j     h│   │   │
  2236.   └───────┘       └───────┘─ 8    └───┴───┘       └───┴───┘─ 8
  2237.       k               g              k                g
  2238.  
  2239. Example of a peaked L building:
  2240.  
  2241. 3E 0045 0391 048C 0003        Area record
  2242. 8E 0008                       Call the drawing routine
  2243. 0B 0039                       Jump over the entire object
  2244. 0009                          Embedded code: object type is 9
  2245. ; the drawing routine:
  2246. 24 04 048C0A00 00000000 03918700
  2247.                               Ref. point record (center of the object)
  2248. 16 0000 0000 FC6E 000A        Orient. record: 0° pitch, 0° bank,
  2249.                               [FC6E =] -914 / 182.04 = -5.02°; call the
  2250.                               tilt-drawing sub-routine
  2251. 19                            RET from delayed call
  2252. ; the tilt-drawing sub-routine:
  2253. 53 02                         L building record
  2254.   FFF6 FFFF 000A              Ascisses of walls are -10, -1, 10
  2255.   0007 0001 FFF9              Ordinates of walls are 7, 1, -7
  2256.   0004 02                     base heigh is 4 m, peak height is 2 m
  2257.   66 88 99 66 88 99           wall colours are L.Blue, Brown, Yellow, L.Blue,
  2258.                               Brown, Yellow
  2259.   55 AA 55 AA                 roof colours are L.Grey, D.Grey, L.Grey, D.Grey
  2260. 19                            RET from orientation record call
  2261.  
  2262.  
  2263. Multi-sided building (53h 4Ch)
  2264.   flat roof (type 001Bh) and peaked roof (type 001D) have the same contents:
  2265.  
  2266. 0         1    53h: record code
  2267. 1         1    4Ch: record sub-code
  2268. 2         1    number of sides
  2269. 3         2    length in m
  2270. 5         2    width in m
  2271. 7         2    height in m
  2272. 9         2    two alternating colours for sides
  2273. 11        2    two alternating colours for roof pitches
  2274. 12        1    peak height in m
  2275.  
  2276. Control tower (type 001Fh; codes 53h 07h)
  2277.  
  2278. 0         1    53h: record code
  2279. 1         1    07h: record sub-code
  2280. 2         8    four wall positions as for rectangular buildings
  2281. 10        2    base height
  2282. 12        2    always 0Ah ?? (irrelevant)
  2283. 14        4    four side colours as for rectangular buildings
  2284. 18        1    roof colour
  2285. 19        1    always 00h ?? (irrelevant)
  2286.  
  2287. Bridge (type 0025h; codes 53h 34h):
  2288.  
  2289. 0         1    53h: record code
  2290. 1         1    34h: record sub-code
  2291. 2         2    length
  2292. 4         2    width
  2293. 6         1    suspension colour (0 for non-suspended bridge)
  2294. 7         1    bridge colour
  2295. 8         2    suspension height
  2296.  
  2297.  
  2298. The following 4 object types lack the orientation record:
  2299.  
  2300. Tower (type 0020h; codes 53h 29h) and wind sock (type 0022h; codes 53h 2Eh)
  2301. have the same structure:
  2302.  
  2303. 0         1    53h: record code
  2304. 1         2    29h / 2Eh: record sub-code
  2305. 2         1    always 0 ?? (irrelevant)
  2306. 3         2    height
  2307.  
  2308. Coniferous (type 0028h; codes 53h 42h) and deciduous tree (type 002Bh; codes
  2309. 53h 43h) have the same structure:
  2310.  
  2311. 0         1    53h: record code
  2312. 1         1    42h / 43h: record sub-code
  2313. 2         1    total height
  2314. 3         1    width
  2315. 4         1    trunk height
  2316. 5         1    leave colour
  2317. 6         1    trunk colour
  2318.  
  2319. Suspended bridges (type 0027h; codes 53h 33h) and autos (type 002Dh; codes
  2320. 53h 47h) add a 28h 36h record right before the 53h record.
  2321.  
  2322. Suspended bridges have the same 53h record as standard bridges (of course,
  2323. sub-code is 33h instead of 34h).
  2324.  
  2325. Autos have a 3-byte 53h record containing, after code and sub-code, only a
  2326. byte with the auto colour.
  2327.  
  2328. --------------------
  2329.  
  2330. Fuel box (type 002Fh).
  2331.  
  2332. Fuel box descriptions are complex, but the great part is fixed because fuel
  2333. boxes have a fixed size and are always oriented toward the North. Below a
  2334. template is given:
  2335.  
  2336. 3E 0076 xxxx xxxx 0007        Area record (coords may vary, length [118
  2337.                               bytes] and radius [7 FSu=ca 1 NM] are constant)
  2338. 8E 0008                       Delayed call to the actually drawing routine
  2339. 0B 006A                       Jump over 106 bytes skipping the entire object
  2340. 002F                          Embedded code: object type 2Fh
  2341. ; the drawing routine:
  2342. 24 02 xxxxxxxx xxxxxxxx xxxxxxxx  Ref. point record (coords and alt. may
  2343.                               vary); note the reduced scale factor (02)
  2344. 16 0000 0000 0000 000A        Orientation is always flat and North; call the
  2345.                               tilt-drawing sub-routine
  2346. 19                            RET from delayed call
  2347. ; the tilt-drawing sub-routine:
  2348. 28 36 004C 034E FFFF          Jump over 004Ch bytes (to the end of the sub-
  2349.                               routine) if var 034E tests in some way against
  2350.                               value -1
  2351. 12 99                         yellow line
  2352. 40 FF80 FF44                  the "F", described with normal lines:
  2353. 41 FF80 0098                      leg
  2354. 41 0080 0098                      upper arm
  2355. 40 007A FFF4                      jump to
  2356. 41 FF80 FFF4                      lower arm
  2357. 40 FEFB FEFB                  the box:
  2358. 41 00F9 FEFB                      lower side
  2359. 41 00F9 0101                      right side
  2360. 41 FEFB 0101                      upper side
  2361. 29                            close the box
  2362. 21 0014                       Skip 20 bytes (to rec 19h) if:
  2363.   029C FEFB 00FF                  var 029Ch (delta E) outside -260 - 255
  2364.   02A0 FEFB 0101                  var 02A0h (delta N) outside -260 - 257
  2365. 25 0288 0001                  Set var 0288 to 1
  2366. 19                            RET from orientation record call
  2367.  
  2368. --------------------
  2369.  
  2370. Thermal generator (type 0031h)
  2371.  
  2372. Thermal generators also have a very special description including some gen-
  2373. eral records. Again, a template is given.
  2374.  
  2375. 3E 006A xxxx xxxx xxxx        Area record (106 bytes long, coords may vary,
  2376.                               as well as radius, which depend on size)
  2377. 8E 0008                       Delayed call to drawing routine
  2378. 0B 005E                       Jump over 94 bytes skipping the entire object
  2379. 0031                          Embedded code: object type is 0031
  2380. ; the drawing routine:
  2381. 24 04 xxxxxxxx xxxxxxxx xxxxxxxx
  2382.                               Ref. point record
  2383. 16 xxxx xxxx xxxx 000A        Orientation record; call tilt-dr. sub-routine
  2384. 19                            RET from delayed call
  2385. ; tilt-drawing sub-routine:
  2386. 25 02E2 xxxx                  Surface colour record
  2387. 2F                            Polygon begin
  2388. 40 xxxx xxxx                  generator area as a polygon
  2389. 41 xxxx xxxx
  2390. 41 xxxx xxxx
  2391. 41 xxxx xxxx
  2392. 29                            close area and fill
  2393. 4D 0025                       a 4Dh record, 0025h bytes long, follow:
  2394.     xxxxxxxx                  E coord of generator center
  2395.     ????????                  ??? (4 bytes)
  2396.     xxxxxxxx                  N coord of generator center
  2397.     xxxx                      orientation
  2398.     ??                        ??? (1 byte)
  2399.     xxxx                      generator width (in m)
  2400.     ????                      ??? (2 bytes)
  2401.     xxxx                      thermal effect height (in feet)
  2402.     ????                      ??? (2 bytes)
  2403.     xxxx                      generator length
  2404.     ??????????????????        ??? (9 bytes)
  2405. 19                            RET from orientation record call
  2406.  
  2407. ======================================================================
  2408.  
  2409.                             NOTE ON .SC0 and .ELE
  2410.                               SEE04 DATA FILES
  2411.  
  2412. .SC0 FILES
  2413.  
  2414. .SC0 files begin with a word containg the length of the following SDL code.
  2415.  
  2416. The SDL code actually used to draw the object follows; it basically follows
  2417. .SC1 structures, but may include more records to achieve the special SEE
  2418. effects.  It always starts with a 3Eh record, but its coordinates are zeroed,
  2419. because the actual object coordinates are supposed to be filled in by SEE
  2420. itself when the object is inserted in an SC1.
  2421.  
  2422. After the SDL code, a table of SEE control codes is appended
  2423.  
  2424. After the table, an ASCII text portion describing the object and its intended
  2425. usage may appear.
  2426.  
  2427. SEE CONTROL CODES (by John Blackie)
  2428.  
  2429. The codes are needed to allow SEE to place an object at a desired location
  2430. and orientation.  To do this a series of 3 byte codes are used following the
  2431. object information.  The control sequence is terminated by FF FF FF.
  2432.  
  2433. Control codes are 3 bytes long and have the structure:
  2434.  
  2435. xx yy yy       dump contents of SEE Register xx to file offset yyyy.
  2436.  
  2437. The following table summarises the characteristics of each of the known SEE
  2438. Registers.
  2439.  
  2440.       REGISTER          LENGTH    USE
  2441.    Hex        Dec        Bytes
  2442.     01          1          1       Custom
  2443.     02          2          1       Custom
  2444.     03          3          1       Custom
  2445.     04          4          1       Custom (Night colour)
  2446.     05          5          1       Custom (Dusk colour)
  2447.     06          6          1       Custom (Day colour)
  2448.     07          8          1       Custom
  2449.     09          9          1       Custom
  2450.     0A         10          1       Custom
  2451.     0B         11          1       Custom
  2452.     0C         12          1       Custom
  2453.     41         65          4       ALTITUDE
  2454.     45         69          4       NORTH (long)
  2455.     49         73          1       Control Code (substitution??)
  2456.     4E         78          4       EAST (long)
  2457.     54         84          32      TEXT (for signs)
  2458.     62         98          2       BANK
  2459.     65        101          2       EAST (short)
  2460.     68        104          2       HEADING
  2461.     6E        110          2       NORTH (short)
  2462.     70        112          2       PITCH
  2463.     72        114          1       RANGE
  2464.     73        115          2       SCALE
  2465.     78        120          2       Delta East
  2466.     79        121          2       Delta North
  2467.     7A        122          2       Delta Altitude (HEIGHT)
  2468.  
  2469. Many of the above SEE variables are Custom variables which can be used as 1
  2470. byte register to dump any user specified information.  Uninitialized Custom
  2471. variables have a default 0 value and can be used to extend 1-byte registers
  2472. into 2-byte file words.
  2473.  
  2474. SEE code 49H appears to set one variable equal to another. The sequence
  2475.           49 41 7A
  2476. is often used and appears to transfer the contents of the ALTITUDE variable
  2477. 41 into the Delta Altitude variable 7A.  Variable 41 is zeroed after the
  2478. operation.  This command appears to keep the object with a zero altitude
  2479. ground reference.  The object is raised by Delta Altitude.
  2480.  
  2481. SEE can make either polygon or line .sc0s, each of which is limited to one
  2482. object.  The default object position/orientation and control codes are con-
  2483. tained in two binary files in SEE. The standard control codes are found in
  2484. P_STD.SEE (for polygons) and L_STD.SEE for lines.  The only difference
  2485. between these two files is the presence of the orientation control record for
  2486. the polygons.  Both these files are decodable using FSDECODE.
  2487.  
  2488. SEE only creates .sc0s from a line or a poly, other kinds of objects were
  2489. hand coded.  Perhaps SEE will be later updated to allow any object to be con-
  2490. verted to .sc0 format.
  2491.  
  2492. For more complex .sc0s requiring more than one line or poly, use Aircraft
  2493. and Adventure factory.  Be careful, however, as the scale setting of 2
  2494. used for these files only allows the objects to be viewed up to 8 FS
  2495. units.  If you set the range higher than this, the object will "repeat".
  2496. The solution is to make the object to 1/4 or 1/16 scale and then use the
  2497. X4 or X16 command on the .sc0 file in SEE to return it to full size.  The
  2498. inbuilt range of the object will then be extended to 32 or 128 FS units.
  2499.  
  2500. .ELE FILES
  2501.  
  2502. .ELE files contain just the SDL portion of .SC0 files.
  2503.  
  2504. ======================================================================
  2505.  
  2506.  
  2507.  
  2508.                           DYNAMIC SCENERIES (.DY1)
  2509.  
  2510.  
  2511. GENERAL STRUCTURE
  2512.  
  2513. Dynamic scenery files are made of:
  2514. ∙ a header containing various pointers
  2515. ∙ a pattern definition section containing the definitions of all the patterns
  2516. in the file
  2517. ∙ a pattern code section containing the actual description of the patterns.
  2518.  
  2519. ====================
  2520.  
  2521. HEADER STRUCTURE; length: 43 bytes
  2522.  
  2523. 0         2    file length
  2524. 2         2    0002h (a kind of signature?)
  2525. 4         2    000Ch (= 12; pointer to scenery name)
  2526. 6         2    002Bh (= 43; header length)
  2527. 8         2    number to be assigned to the next pattern that will be defined
  2528. 10        2    pointer to pattern code section
  2529. 12        31   scenery names: up to 30 characters (padded with space, if
  2530.                shorter) plus a 0 ending byte
  2531.  
  2532. ====================
  2533.  
  2534. PATTERN DEFINITION SECTION
  2535.  
  2536. The pattern definition section contains a 48-byte block for each pattern of
  2537. the scenery.
  2538.  
  2539. 0         2    pattern number (see note)
  2540. 2         2    model:    0065h  Cessna R182
  2541.                          0066h  Boeing 747
  2542.                          0067h  Gates Learjet
  2543.                          0068h  F14
  2544.                          0069h  Schweizer SGS
  2545.                          012Dh  Fuel truck
  2546.                          0137h  Red car
  2547.                          0138h  Blue car
  2548.                          0139h  White car
  2549.                          0191h  Sail boat
  2550.                Any other model code is rendered by ASD as a Cessna R182.
  2551. 4         2    pointer to the corresponding pattern code
  2552. 6         2    length of the corresponding pattern code
  2553. 8         2    number of the pattern after which this pattern will start,
  2554.                zero if patter starts immediately
  2555. 10        1    begin code:
  2556.                          0    immediately
  2557.                          1    after other pattern starts
  2558.                          2    after other pattern takes off
  2559.                          3    after other pattern lands
  2560.                          4    after other pattern parks
  2561. 11        1    status code: 0 - inactive, 1 - active
  2562. 12        1    end action code:
  2563.                          0    start over
  2564.                          1    park
  2565.                          2    disappear
  2566. 13        1    display before start: 0 - yes, 1 - no (sic!!)
  2567. 14        4    ??? (irrelevant)
  2568. 18        30   pattern name, padded with spaces, no ending zero
  2569.  
  2570. Note: to each new pattern is assigned the number contained at byte 8 of file
  2571. header which is then increased; when a pattern is deleted, its record is
  2572. removed and other patterns are shifted but its number is not made available,
  2573. nor other pattern numbers are modified to fill a possible gap, as a con-
  2574. sequence patterns can have numbers greater than the total number of patterns
  2575. present in the file.
  2576.  
  2577. ====================
  2578.  
  2579. PATTERN CODE SECTION
  2580.  
  2581. This section contains all the definitions of the scenery patterns, one after
  2582. the other. Pattern definitions are made of 5 kinds of records:
  2583. 00h       Initial record      20 bytes
  2584. FFh       Position record     21 bytes
  2585. 02h       Look record         5 bytes
  2586. 06h       Take off/Land record 2 bytes
  2587. 04h       End of pattern record 1 byte
  2588.  
  2589. -- 00h ------------- Initial record (20 bytes)
  2590.  
  2591. Used to set the initial position of the object at the beginning of the pat-
  2592. tern.
  2593.  
  2594. 1         4    E coord (fract. FSu; all 4 bytes used)
  2595. 5         4    alt. AGL (fract. FSu; all 4 bytes used)
  2596. 9         4    N coord (fract. FSu; all 4 bytes used)
  2597. 13        2    pitch (noze down is positive, noze up is negative)
  2598. 15        2    bank (left is positive, right is negative)
  2599. 17        2    heading
  2600. 19        1    always 03 ??
  2601.  
  2602. Note: Pitch variation is somewhat special: if the object rotates more than
  2603. 90° up or down, it is reversed up side down and pitch sign is changed!
  2604.  
  2605. -- 02h ------------- Look record (5 bytes)
  2606.  
  2607. Look record defines some visual detail of the object. To my knowledge, a look
  2608. record may have 3 sub-codes, related to 3 visual aspect; patterns always
  2609. begin defining the initial values of these aspects with 3 look records, one
  2610. for each sub-code.
  2611.  
  2612. 1         2    FFFEh:    shadow is visible or not
  2613.                FFFDh:    object is flying or landed
  2614.                FFFBh:    gear is lowered or not
  2615. 3         2    value:    for FFFEh: 1 = shadow on, 0 = shadow off
  2616.                          for FFFDh: 2 = landed, 0 = flying
  2617.                          for FFFBh: 4 = gear down, any other value = up
  2618.  
  2619. Notes: Shadow is switched off by ASD when the object raises above ca. 100 m
  2620. from ground level. Sub-code FFFDh probably triggers patterns starting after
  2621. another pattern's landing or taking off.
  2622.  
  2623. -- 04h ------------- End of pattern (1 byte)
  2624. End of pattern record
  2625.  
  2626. Used to mark the end of a pattern. It is made of the single byte 04h.
  2627.  
  2628. -- 06h ------------- Teake off/land record (2 bytes)
  2629.  
  2630. A take off (land) record is inserted after the movement that caused the model
  2631. to rise over (to sink at) the ground level. Each of them is always followed
  2632. by the corresponding 02h FFFDh record.
  2633.  
  2634. 1         1    02h: take off (always followed by a 02 FFFD 0000 record)
  2635.                03h: landing (always followed by a 02 FFFD 0002 record)
  2636.  
  2637. -- FFh ------------- Position record (21 bytes)
  2638.  
  2639. Position record is identical to initial record, excepted the record code and
  2640. the last field. It is used through the entire pattern description to mark
  2641. successive positions and orientations of the object.
  2642.  
  2643. 1         4    E coord  (fract. FSu)
  2644. 5         4    alt. AGL (fract. FSu)
  2645. 9         4    N coord  (fract. FSu)
  2646. 13        2    pitch (noze down is positive, noze up is negative)
  2647. 15        2    bank (left is positive, right is negative)
  2648. 17        2    direction
  2649. 19        2    time between the previous (or initial) position and this one
  2650.  
  2651. Note: The time interval between positions is apparently measured in ticks, 1
  2652. tick every 0.008 sec (or 126 ticks per sec). Time intervals are not constant
  2653. but shorter when the position (or orientation) variation is greater and
  2654. longer when it is smaller. It seems never to exceed ca 1500 ticks (12 sec).
  2655. About other fields, the same observations made for the initial record apply.
  2656.  
  2657. ====================
  2658.  
  2659. Patterns usually begin with:
  2660.  
  2661. record 02 FFFE           to define initial conditions
  2662. record 02 FFFB                "
  2663. record 02 FFFD                "
  2664. record 00                to define initial point and orientation
  2665.  
  2666. Then enough FFh records follow to define successive positions and orienta-
  2667. tions of the object. Change in visual aspects and flying condition are marked
  2668. by appropriate records. The pattern is closed by the
  2669.  
  2670. record 04
  2671.  
  2672. ========================================
  2673.  
  2674.                               DEMO FILES (.DEM)
  2675.  
  2676. Demo files, like dynamic sceneries, have a relatively simple structure and
  2677. record set. Basically, demo files describe successive positions (and orienta-
  2678. tions) of the aircraft with a flow of position records; these records,
  2679. however, are intermixed with single byte codes that correspond to the keys
  2680. pressed by the user during demo recording.
  2681. Contrarily to dynamic sceneries, aircraft position is sampled at a fixed rate
  2682. (either 1 or 5 sec) and all the codes for keys pressed between two samples
  2683. are grouped and inserted between the two corresponding position records.
  2684.  
  2685.                                   KEY CODES
  2686.  
  2687. Key codes correspond, in almost all cases, to the hardware press scan codes
  2688. generated by the keyboard and are, therefore, less than 80h.
  2689.  
  2690. Some kind of tanslation is, however, carried out by the demo recorder:
  2691.  
  2692. ∙ on all keyboards, some key codes are ignored and some other are converted
  2693.   to 00h
  2694. ∙ on 101-key keyboards, function keys are converted to their functional equi-
  2695.   valent of the 83-key keyboard and the corresponding scan code is used
  2696. ∙ some keys of the numeric pad have the same function in the 101-key keyboard
  2697.   (like Gray /, Gray * and ScrollLock, or Gray + and Gray Enter) and their
  2698.   scan code are merged
  2699. ∙ scan code prefixes used by 101-key keyboards to differentiate among dupli-
  2700.   cated keys (left and right Alt and Ctrl, white and gray cursor keys...) are
  2701.   thrown away.
  2702. ∙ release scan code are ignored.
  2703.  
  2704. Excepted for a few special keys (like Shift, Ctrl and Alt), all key presses
  2705. are recorded, even if they do nothing.
  2706.  
  2707. Key presses are executed as soon as they are met during demo play back: they
  2708. affect the instrument panel, the display and outer world simulation in the
  2709. same way as during normal flight; apparently, however they do not affect
  2710. flight simulation which is based on the position records. Subsequent position
  2711. records are interpolated to simulate a continuous flight.
  2712.  
  2713. The following table lists all the key codes generated by the demo recorder
  2714. with their corresponding key; function key codes have two corresponding keys,
  2715. the first is for 83-key keyboards, the second for 101-key keyboards.
  2716.  
  2717. All codes are in hex.
  2718.  
  2719. Alphanumeric keys
  2720.  
  2721. 01  Esc       0F  Tab       [1D ∙]        [2A ∙]        [38 ∙]
  2722. 02  '1'       10  'Q'       1E  'A'       [2B ∙]        39  Space
  2723. 03  '2'       11  'W'       1F  'S'       2C  'Z'       3A  CapsLk
  2724. 04  '3'       12  'E'       20  'D'       2D  'X'
  2725. 05  '4'       13  'R'       21  'F'       2E  'C'
  2726. 06  '5'       14  'T'       22  'G'       2F  'V'
  2727. 07  '6'       15  'Y'       23  'H'       30  'B'
  2728. 08  '7'       16  'U'       24  'J'       31  'N'
  2729. 09  '8'       17  'I'       25  'K'       32  'M'
  2730. 0A  '9'       18  'O'       26  'L'       33  ','
  2731. 0B  '0'       19  'P'       27  ';'       34  '.'
  2732. 0C  '-'       1A  '['       28  '''       35  '/'
  2733. 0D  '+'       1B  ']'       29  '`'       [36 ∙]
  2734. 0E  BkSp      1C  Enter                   37  '*'-PrtSc
  2735.  
  2736. Function keys               Numeric pad keys
  2737.  
  2738. 3B  F1/F5   3C  F2/F4       45  NumLk   46  Gr /|*|ScrollLk
  2739. 3D  F3/F6   3E  F4/F3       47  Home    48  Up      49  PgUp    4A  Gr -
  2740. 3F  F5/∙∙   40  F6/∙∙       4B  Left    4C  Pad 5   4D  Right   4E  Gr +|<─┘
  2741. 41  F7/F7   42  F8/F2       4F  End     50  Down    51  PgDn
  2742. 43  F9/F8   44  F10/F1      52  Ins     53  Del                 56 '<'∙∙∙
  2743.  
  2744. Notes:
  2745. ∙   Scan codes 1D, 2A, 2B, 36, 38 would correspond to Ctrl, Left Shift, '\',
  2746. Right Shift, Alt respectively; but within demos, Shift and '\' keys do not
  2747. generate any code, while Ctrl and Alt keys generate a 00 code.
  2748.  
  2749. ∙∙  No F key of 101-key keyboard correspond to F5 and F6 of 83-key keyboard:
  2750. therefore those codes are never recorded with a 101-key keyboard
  2751.  
  2752. ∙∙∙ Code 56 is generated (and recorded) only with 102-key European keyboards.
  2753.  
  2754.                                    RECORDS
  2755.  
  2756. All records have a code >= 80h and are therefore easily differentiated from
  2757. key codes.
  2758.  
  2759. Only 8 kinds of records have been recognized and are listed below. The first
  2760. four of them are actually found in demo files generated by the demo recorder;
  2761. the other four have been found in the demo supplied with the program (the
  2762. default demo as well as the instructor flights of the flight school and the
  2763. lead plane flights of the formation entertainement which are all regular demo
  2764. files), but are correctly played back if manually inserted in a recorded
  2765. demo.
  2766.  
  2767. A recorded demo has a very simple structure: it is made of sample rate
  2768. records (either 80h or 81h) followed by long position records; between a
  2769. position record and the next sample rate record, the codes for key pressed by
  2770. the user are inserted. The file is not divided in sections (like, for
  2771. instance, scenery files) nor its end is marked in any way.
  2772.  
  2773. -- 80h ------------- 1 sec (1 byte)
  2774.  
  2775. This single byte record marks a sample rate of 1 sec and is usually followed
  2776. by a long position record.
  2777.  
  2778. -- 81h ------------- 5 sec (1 byte)
  2779.  
  2780. This single byte record marks a sample rate of 5 sec and is usually followed
  2781. by a long position record.
  2782.  
  2783. -- 82h ------------- Long position record (19 bytes)
  2784.  
  2785. 1         4    E coord. (fract. FSu)
  2786. 5         4    Alt. AGL (fract. FSu)
  2787. 9         4    N coord. (fract. FSu)
  2788. 13        2    pitch (noze down is positive, noze up is negative)
  2789. 15        2    bank (left is positive, right is negative)
  2790. 17        2    heading
  2791.  
  2792. This record is usually preceded by a 1 sec or a 5 sec record.
  2793.  
  2794. --84h -------------- Message (mess.length+2 bytes)
  2795.  
  2796. 1         xx   Message text
  2797. 1+xx      1    00h
  2798.  
  2799. ====================
  2800.  
  2801. Supplied demos contain four more kinds of record, allowing for adding a major
  2802. feature (mode record) and for saving some bytes.
  2803.  
  2804. They usually begin with a mode record which sets the initial conditions; a 1
  2805. sec position record follows giving the aircraft initial position, then a flow
  2806. of short position records describes subsequent aircraft positions. As usual,
  2807. key codes are inserted among position records to interact with the simulator.
  2808.  
  2809. -- 8Ah ------------- Mode record (528 bytes)
  2810.  
  2811. 1         526  Mode
  2812. 527       1    8Bh: end of mode
  2813.  
  2814. This record embeds a full mode, with exactly the same structure of a .MOD
  2815. mode file; this allows specifying all the display, environment and flight
  2816. conditions within a demo.  Mode records are usually inserted at the beginnig
  2817. of a demo to prepare the field; other mode records can however appear any-
  2818. where in a .DEM to change simulation parameters.
  2819.  
  2820. -- 90h ------------- 1 sec/position (19 bytes)
  2821.  
  2822. 1         4    E coord. (fract. FSu)
  2823. 5         4    Alt. AGL (fract. FSu)
  2824. 9         4    N coord. (fract. FSu)
  2825. 13        2    pitch (noze down is positive, noze up is negative)
  2826. 15        2    bank (left is positive, right is negative)
  2827. 17        2    heading
  2828.  
  2829. This record has the same structure of the 82h record, but contains also a 1
  2830. sec sample rate information.
  2831.  
  2832. -- 91h ------------- 5 sec/position (19 bytes)
  2833.  
  2834. 1         4    E coord. (fract. FSu)
  2835. 5         4    Alt. AGL (fract. FSu)
  2836. 9         4    N coord. (fract. FSu)
  2837. 13        2    pitch (noze down is positive, noze up is negative)
  2838. 15        2    bank (left is positive, right is negative)
  2839. 17        2    heading
  2840.  
  2841. This record has the same structure of the 82h record, but contains also a 5
  2842. sec sample rate information.
  2843.  
  2844. -- 94h ------------- Short position record (7 bytes)
  2845.  
  2846. This record describes the variations of the 6 position parameters relatives
  2847. to a previous position record (either a 90h record or another 94h record). It
  2848. can be used also after an 82h record, even if MS demos never do so.
  2849. The record includes also 1 sec of sample rate.
  2850.  
  2851. 1         1    E coord. delta
  2852. 2         1    Alt. delta
  2853. 3         1    N coord. delta
  2854. 4         1    Pitch delta
  2855. 5         1    Bank delta
  2856. 6         1    Heading delta
  2857.  
  2858. Linear parameters are in m, angular parameters in 1.4° (= 360° / 256); all 6
  2859. parameters are signed: the max linear delta is therefore 127 m, and the max
  2860. angular delta is 180°.
  2861.  
  2862. Short position records save 12 bytes each over long position records.
  2863. Apparently, there is no short position record for 5 sec interval.
  2864.  
  2865. ======================================================================
  2866.  
  2867.                               MODE FILES (.MOD)
  2868.  
  2869. Mode files still have many obcure points, but almost all the parameters the
  2870. can be set from FS menu are decoded.  Exceptions are mouse sensitivity para-
  2871. meters, because I do not use a mouse with FS (it seems to me like driving a
  2872. car with the foots), and joystick parameters because I do not have one (I am
  2873. a serious person, I don't play games!).
  2874.  
  2875. There are several undecoded 1-byte fields; they are probably unused and maybe
  2876. are only the MSBytes of word fields which never exceed an 8-bit value.
  2877.  
  2878. Screen coordinates (for window positions) are apparently device-independent
  2879. (I tried on a VGA and a Hercules): ascissae span from 0032h to 1FD6h and
  2880. ordinates from 0032h to 17D4h; origin is in the upper left corner.
  2881.  
  2882. The following listing follows the same format used above, but, given the
  2883. length of the mode "record", a column with hex offset has been added.
  2884.  
  2885. Key labels (as <F1>) refer to the 101-key keyboard.
  2886.  
  2887.  
  2888.    0 0000   2  020Eh: file length
  2889.    2 0002   2  0017h: pointer to mode name
  2890.    4 0004   1  01h: mode file signature
  2891.    5 0005   4  Initial E coord. (fract. FSu)
  2892.    9 0009   4  Initial AGL alt. (fract. FSu)
  2893.   13 000D   4  Initial N coord. (fract. FSu)
  2894.   17 0011   2  Initial pitch
  2895.   19 0013   2  Initial bank
  2896.   21 0015   2  Initial heading
  2897.   23 0017  31  Mode name (padded with spaces and 0-terminated)
  2898.  
  2899.                FIRST 3D WINDOW
  2900.   54 0036   2  Left border position
  2901.   56 0038   2  Top border position
  2902.   58 003A   2  Width
  2903.   60 003C   2  Height
  2904.   62 003E   1  View:     00h    Cockpit
  2905.                          01h    Tower
  2906.                          02h    Track
  2907.                          03h    Spot plane
  2908.   63 003F   1  Cockpit view direction: counterclockwise 00h front -> 07h
  2909.                front left
  2910.   64 0040   2  Cockpit view zoom:
  2911.                          0010h  .16 x
  2912.                          0020h  .33 x
  2913.                          0040h  1 x
  2914.                          0081h  2 x
  2915.                          0103h  4 x
  2916.                          0207h  8 x
  2917.                          040Fh  16 x
  2918.                          081Fh  32 x
  2919.                          103Fh  64 x
  2920.                          207Fh  129 x
  2921.                          40FFh  256 x
  2922.                          7FFFh  511 x
  2923.   66 0042   2  Tower view zoom (as above)
  2924.   68 0044   2  Track view zoom (as above)
  2925.   70 0046   2  Spot plane view zoom (as above)
  2926.   72 0048   1
  2927.   73 0049   1  Spot view direction: counterclockwise 00h front -> E0h front
  2928.                left (01h = 1.4°)
  2929.   74 004A   2  Spot plane distance (in 1/256 m)
  2930.   76 004C   2
  2931.   78 004E   1  Spot plane preference:  00h roll  -  01h loop
  2932.   79 004F   1  Spot plane transition:  00h slow  -  01h fast
  2933.   80 0050   2  Spot plane altitude (in 1/256 m)
  2934.   82 0052  28  ?? (these bytes change when the cockpit view direction
  2935.                changes, but without any clear pattern)
  2936.  
  2937.                SECOND 3D WINDOW
  2938.  110 006E   2  Left border position
  2939.  112 0070   2  Top border position
  2940.  114 0072   2  Width
  2941.  116 0074   2  Height
  2942.  118 0076   1  View:     00h    Cockpit
  2943.                          01h    Tower
  2944.                          02h    Track
  2945.                          03h    Spot plane
  2946.  119 0077   1  Cockpit view direction: counterclockwise 00h front -> 07h
  2947.                front left
  2948.  120 0078   2  Cockpit view zoom (see byte 64)
  2949.  122 007A   2  Tower view zoom (as above)
  2950.  124 007C   2  Track view zoom (as above)
  2951.  126 007E   2  Spot plane view zoon (as above)
  2952.  128 0080   1
  2953.  129 0081   1  Spot view direction: counterclockwise 00h front -> E0h front
  2954.                left (01h = 1.4°)
  2955.  130 0082   2  Spot plane distance (in 1/256 m)
  2956.  132 0084   2
  2957.  134 0086   1  Spot plane preference:  00h roll  -  01h loop
  2958.  135 0087   1  Spot plane transition:  00h slow  -  01h fast
  2959.  136 0088   2  Spot plane altitude (in 1/256 m)
  2960.  138 008A  28  ?? (these bytes change when the cockpit view direction
  2961.                changes, but without any clear pattern)
  2962.  
  2963.  166 00A6   2  Map window left border position
  2964.  168 00A8   2  Map window top border position
  2965.  170 00AA   2  Map window width
  2966.  172 00AC   2  Map window height
  2967.  174 00AE   1  Current window:
  2968.                          00h    first 3D
  2969.                          01h    second 3D
  2970.                          02h    map
  2971.  175 00AF   1  First 3D:  00h off  -  01h on
  2972.  176 00B0   1  Second 3D:  00h off  -  01h on
  2973.  177 00B1   1  Map:  00h off  -  01h on
  2974.  178 00B2   1  Position indic.:  00h off  -  01h on
  2975.  179 00B3   1  Instr. panel:  00h off  -  01h on
  2976.  180 00B4   2  Full external view:  00h off  -  01h on
  2977.  182 00B6   2  Titles on windows:  00h off  -  01h on
  2978.  184 00B8   2  Shader:  00h off  -  01h on
  2979.  186 00BA   2  Stars:  00h off  -  01h on
  2980.  188 00BC   1  Ground text.:  00h off, 01h dots, 02h small rect, 03h big rect
  2981.  189 00BD   1  Crash:  00h off, 01h detect, 02h detect and analyse
  2982.  190 00BE   1  Sound:  00h off  -  01h on
  2983.  191 00BF   1  Pause:  00h off  -  01h on
  2984.  192 00C0   1  Realism, bits (realism scale is at offset 299):
  2985.                          0      engine
  2986.                          1      elevator trim
  2987.                          2      gyro drift
  2988.                          3      light burn
  2989.                          4      fast throttle
  2990.                          5      instrument lights
  2991.                          6      barometer drift
  2992.                          7      [unused]
  2993.  193 00C1   1  Axis indicator:
  2994.                          00h    none
  2995.                          01h    V-shaped
  2996.                          02h    4-dots
  2997.                          03h    small V
  2998.  194 00C2   2  Auto coordination:  00h off  -  01h on
  2999.  196 00C4   2  Smoke system:  00h off  -  01h on
  3000.  198 00C6   2  ATC comm:  00h off  -  01h 0n
  3001.  200 00C8   1  Slew:  00h off  -  01h on
  3002.  201 00C9   3  ??
  3003.  204 00CB   2  Rotat. slew: negative = right, positive = left (+- 80h each
  3004.                <End> or <PgDn>)
  3005.  206 00CE   1
  3006.  207 00CF   1  Altit. slew:  00h max up -> 40h stable -> 7Fh max down (+- 02h
  3007.                each <A> or <Q>, <F1> -> 7Fh, <F4> -> 00h)
  3008.  208 00D0   1
  3009.  209 00D1   1  Longit. slew: negative = forward, positive = rear (+-01h each
  3010.                <Down> or <Up>)
  3011.  210 00D2   1
  3012.  211 00D3   1  Side slew: negative = left, positive = right (+-01h each
  3013.                <Right> or <Left>)
  3014.  212 00D4   2  ??
  3015.  214 00D6   1  EFIS/CFPD:  00h off  -  01h on (equal to byte 394)
  3016.  215 00D7   3  ??
  3017.  218 00DA   3  Hours, min and sec as hex numbers
  3018.  221 00DD  12  ??
  3019.                Instrument panel display (instr. displayed when bit set):
  3020.  233 00E9   1  bits:     0      airspeed
  3021.                          1      turn coordination
  3022.                          2      gyro heading
  3023.                          3      altimeter
  3024.                          4      attitude
  3025.                          5      VOR 1
  3026.                          6      tacheometer
  3027.                          7      vertical velocity
  3028.  234 00EA   1  bits:     0      time
  3029.                          1      transponder
  3030.                          2      NAV 1
  3031.                          3      COM
  3032.                          4      compass
  3033.                          5      fuel
  3034.                          6      oil
  3035.                          7      AUX 2
  3036.  235 00EB   1  bits:     0      gear and carb heat
  3037.                          1      NAV 2
  3038.                          2      DME
  3039.                          3      VOR 2
  3040.                          4      ADF
  3041.                          5      AUX 1
  3042.                          6      AUX 4
  3043.                          7      AUX 3
  3044.  236 00EC   5  ??
  3045.  
  3046.                WINDS
  3047.  241 00F1   1  Layer 3 speed (in kt)
  3048.  242 00F2   1  Layer 3 turbulence:  00h -> 0Ah
  3049.  243 00F3   2  Layer 3 direction (in 1/182.04°)
  3050.  245 00F5   1  Layer 2 speed (in kt)
  3051.  246 00F6   1  Layer 2 turbulence:  00h -> 0Ah
  3052.  247 00F7   2  Layer 2 direction (in 1/182.04°)
  3053.  249 00F9   1  Layer 1 speed (in kt)
  3054.  250 00FA   1  Layer 1 turbulence:  00h -> 0Ah
  3055.  251 00FB   2  Layer 1 direction (in 1/182.04°)
  3056.  253 00FD   1  Surface speed (in kt)
  3057.  254 00FE   1  Surface turbulence:  00h -> 0Ah
  3058.  255 00FF   2  Surface direction (in 1/182.04°)
  3059.  257 0101   2  Layer 3 tops (in m)
  3060.  259 0103   2  Layer 3 base (in m)
  3061.  261 0105   2  Layer 2 tops (in m)
  3062.  263 0107   2  Layer 2 base (in m)
  3063.  265 0109   2  Layer 1 tops (in m)
  3064.  267 010B   2  Layer 1 base (in m)
  3065.  269 010D   2  Surface depth (in m)
  3066.  
  3067.                CLOUDS
  3068.  271 010F   2  Top layer tops (in m)
  3069.  273 0111   2  Top layer base (in m)
  3070.  275 0113   2  Top layer coverage:  00h clear  ->  08h overcast
  3071.  277 0115   2  Top layer deviation (in m)
  3072.  279 0117   2  Bottom layer tops (in m)
  3073.  281 0119   2  Bottom layer base (in m)
  3074.  283 011B   2  Bottom layer coverage:  00h clear  ->  08h overcast
  3075.  285 001D   2  Bottom layer deviation (in m)
  3076.  287 011F   2  Thunderstorm tops (in m)
  3077.  289 0121   2  Thunderstorm base (in m)
  3078.  291 0123   2  Thunderstorm coverage:  00h widely scatt.  ->  02h dense
  3079.  293 0125   2  Thunderstorm speed (in 1/2 kt)
  3080.  295 0127   2  Thunderstorm direction (in 1/182.04°)
  3081.  297 0129   1  Reliability:  00h  ->  64h
  3082.  298 012A   1
  3083.  299 012B   1  Realism:  00h  ->  64h
  3084.  300 012C   1
  3085.  301 012D  26  ?? this portion contains mouse and joystick parameters
  3086.  327 0147   1  Keyboard aileron sensibility:  01h = 1 -> 7Fh = 8
  3087.  328 0148   1
  3088.  329 0149   1  Keyboard elevator sensibility:  01h = 1 -> 7Fh = 8
  3089.  330 014A   1
  3090.  331 014B   1  Keyboard rudder sensibility:  01h = 1 -> 7Fh = 8
  3091.  332 014C   3  ??
  3092.  335 014F   2  Instrumental panel top border
  3093.  337 0151   2  ??
  3094.  339 0153   1  Season:  00h winter -> 03h autumn
  3095.  341 0155   6  COM freq as ASCII string of the form "120;30"
  3096.  347 015B   1  always 0 ??
  3097.  348 015C   1  NAV1 active:  00h off  -  01h on
  3098.  349 015D   6  NAV1 freq as ASCII string of the form "120;30"
  3099.  355 0163   1  always 0 ??
  3100.  356 0164   1  NAV2 active:  00h off  -  01h on
  3101.  357 0165   6  NAV2 freq as ASCII string of the form "120;30"
  3102.  363 016B   3  OBI1 inbound course as ASCII string of the form "120"
  3103.  366 016E   1  always 0 ??
  3104.  367 016F   1  VOR1 active:  00h off  -  01h on
  3105.  368 0170   3  OBI1 outbound course as ASCII string of the form "120"
  3106.  371 0173   1  always 0 ??
  3107.  372 0174   1  VOR2 active:  00h off  -  01h on
  3108.  373 0175   3  OBI2 inbound course as ASCII string of the form "120"
  3109.  376 0178   1  always 0 ??
  3110.  377 0179   1  VOR2 active:  00h off  -  01h on
  3111.  378 017A   3  OBI2 outbound course as ASCII string of the form "120"
  3112.  381 017D   1  always 0 ??
  3113.  382 017E   1  Transponder active:  00h off  -  01h on
  3114.  383 017F   4  Transponder freq as ASCII string of the form "1200"
  3115.  387 0183   1  always 0 ??
  3116.  388 0184   1  ADF active:  00h off  -  01h on
  3117.  389 0185   3  ADF freq as ASCII string of the form "120"
  3118.  
  3119.                EFIS/CFPD
  3120.  392 0188   2  00h       none
  3121.                01h       lock to ILS for landing approach
  3122.                02h       lock to navaid and alt. tracking
  3123.  394 018A   2  00h off  -  01h on (equal to byte 214)
  3124.  396 018C   2  type:  00h rect,  01h bricks,  02h poles
  3125.  398 018E   2  density:  00h thick,  01h medium,  02h thin
  3126.  400 0190   2  range:  00h short,  01h medium,  02h long
  3127.  402 0192   2  navaid:  00h NAV1,  01h NAV2
  3128.  404 0194   2  tracking altitude (in m)
  3129.  
  3130.  406 0196  66  ???? (this portion apparently contains, among other things,
  3131.                the dynamic parameters (velocity vector, angular
  3132.                velocities...), but no clear relation has emerged)
  3133.  472 01D8   1  Elevator 'carry':  01h when full pushed, FFh when full pulled,
  3134.                00h otherwise
  3135.  473 01D9   1  Elevator:  C0h full pushed -> 3F full pulled; +-01h each
  3136.                <Down> or <Up>
  3137.  474 01DA   1  Aileron 'carry':  01h when at full left, FFh when at full
  3138.                right, 00h otherwise
  3139.  475 01DB   1  Ailerons:  C0h full left -> 3Fh full right; +- 04h each
  3140.                <Rigth> or <Left>
  3141.  476 01DC   1  Rudder 'carry':  01h when at full left, FFh when at full
  3142.                right, 00h otherwise
  3143.  477 01DD   1  Rudder:  C0h full left -> 3Fh full right; +- 04h each <Rigth>
  3144.                or <Left>
  3145.  478 01DE   1  Throttle 'carry':  FFh when full, 00h otherwise
  3146.  479 01DF   1  Throttle:  00h cut -> 3Fh full; +-02h each <PgUp> or <PgDn>
  3147.  480 01E0   1  Trim 'carry':  01h when full down, FFh when full up, 00h
  3148.                otherwise
  3149.  481 01E1   1  Trim:  C0h full down -> 3F full up; +-01h each <End> or <Home>
  3150.  482 01E2  10  ??
  3151.  492 01EC   2  Position indic. window left border
  3152.  494 01EE   2  Position indic. window top border
  3153.  496 01F0   4  Tower E coord (fract FSu)
  3154.  500 01F4   4  Tower AGL alt (fract FSu)
  3155.  504 01F8   4  Tower N coord (fract FSu)
  3156.  508 01FC   2  ??
  3157.  510 01FE   1  Flap 'carry':  FFh when flap down, 00h otherwise
  3158.  511 01FF   1  Flap:     00h    0°
  3159.                          20h    10°
  3160.                          40h    20°
  3161.                          60h    30°
  3162.                          7Fh    40°
  3163.  512 0200   1  Gear:  00h up  -  FFh down
  3164.  513 0201   1  Lights:  00h off  -  FFh on
  3165.  514 0202   1  Mags:     00h    off
  3166.                          01h    left
  3167.                          02h    right
  3168.                          03h    both
  3169.                          04h    start
  3170.                          05h    lean
  3171.  515 0203   1
  3172.  516 0204   1  Carb heat:  00h off  -  FFh on
  3173.  517 0205   1  Strobe:  00h off  -  01h on
  3174.  518 0206   8  .SIM file name. .SIM files define the visual appearance of the
  3175.                aircraft; the name is padded with space if shorter than 8
  3176.                chars. No path nor extension are allowed (a standard .SIM
  3177.                extension is apparently supplied by the program)
  3178.                          FS4 .SIMs:
  3179.                SIM1.SIM         Cessna R182
  3180.                SIM2.SIM         Gates Learjet 25G
  3181. *              SIM3.SIM         Schweizer 2-32 Sailplane
  3182.                SIM4.SIM         Sopwith Camel
  3183.                SIM5.SIM         Experimental aircraft
  3184.                          ASD .SIMs:
  3185.                SIM7.SIM         Experimental jet aircraft
  3186.                SIM8.SIM         Experimental sailplane
  3187.                SIM9.SIM         Boeing 747-400
  3188.                SIMA.SIM         Beechcraft Starship
  3189.                SIMB.SIM         Piper Cherokee Archer II
  3190.                SIMC.SIM         Cessna 182 seaplane
  3191.  
  3192.  
  3193. ======================================================================
  3194.  
  3195.                           NOTE ON .DRV FILE FORMAT
  3196.  
  3197. .DRV file format applies to executable code resources installable in FS
  3198. and/or callable by it.
  3199.  
  3200. Even if the format has been called .DRV format, it is shared by other file
  3201. types; among them, all the .APL files supplied with FS4 are in .DRV format,
  3202. as well as *.GRA, *.KBD, *.DYN, ATC.FS4 and DYNAMIC.FS4.
  3203.  
  3204. .DRV are basically in 80x86 machine language, even if some of them may con-
  3205. tain portions in SDL.
  3206.  
  3207. .DRV has a 31-byte 'header' with the following contents:
  3208.  
  3209. 0000    2      file length
  3210. 0002    3      1st entry point: E9 xxxx  or  EB xx 90: long JMP  or
  3211.                short JMP NOP
  3212. 0005    3      same as above; the addresses (relative) point to two routines
  3213.                in the body of the file
  3214. 0008    5      ???
  3215. 000D    7      0 in all the examples I saw
  3216. 0014    2      0000 or FS reference version (040B = ver 4b)
  3217. 0016    2      1234h; a kind of signature
  3218. 0018    2      memory required by the DRV, often equal to file length
  3219. 001A    3      3rd entry point; same as 1st entry point
  3220. 001D    2      check sum
  3221.  
  3222. Bytes 001D-001E contain a cheksum of the file; the checksum algorithm can be
  3223. determined from the following routine, directly excerpted from the FS4.EXE
  3224. disassembly:
  3225.  
  3226. CheckLoop:
  3227.   lodsb
  3228.   add  dl,al
  3229.   adc  dh,0
  3230.   push cx
  3231.   mov  cl,al
  3232.   and  cl,7
  3233.   xor  cl,5
  3234.   rol  dx,cl
  3235.   pop  cx
  3236.   loop CheckLoop
  3237.  
  3238. At start DI points to the beginning of the DRV, AX and DX contain 0, CX con-
  3239. tains the length of the DRV and bytes 001A-001B contain 0; at the end, DX
  3240. contains the required checksum.
  3241.  
  3242. A data section for the use of the program may be inserted after the header
  3243. and is followed by the actual machine code.
  3244.  
  3245. .DRV programs are called by FS4 with the DS segment register loaded with the
  3246. data segment of FS, so that they can access the FS variables with the same
  3247. addresses used by SDL sceneries; the CS register is set so that the program
  3248. header starts at offset 0.
  3249.  
  3250. .DRV code uses the small memory model, with a single segment for the code and
  3251. one for the data.  When disassembling .DRV with DEBUG, you have to subctract
  3252. 0100h from memory addresses displayed by DEBUG itself to derive the CS: off-
  3253. set at which each instruction or datum will be actually located during execu-
  3254. tion within FS.
  3255.  
  3256. .DRV files can access the FS variables and use an FS API through indirect
  3257. calls to FS routines whose addresses are stored in a portion of the data seg-
  3258. ment spanning at least 0B00-1C00.  Clear details about this API have yet to
  3259. emerge.  Some of these calls pass as parameters absolute memory addresses
  3260. (segment:offset) of code and/or data contained in the .DRV itself.
  3261.  
  3262.  
  3263. ======================================================================
  3264.  
  3265.                                DYN FILE FORMAT
  3266.                           by John Mechalas and MMG
  3267.  
  3268. Because we know of only two .DYN files (F1.DYN and SD-9.DYN), the following
  3269. description is not complete.  I'm indebted to John Mechalas, who discovered
  3270. the majority of the following material and allowed me to include it in this
  3271. document.
  3272.  
  3273. .DYN files are made of three major parts:
  3274. ∙ a .DRV header
  3275. ∙ a DDL (Dynamic Description Language) section with the dynamic patterns
  3276. ∙ an SDL section with the model shapes.
  3277.  
  3278. THE HEADER
  3279.  
  3280. DYN header is a standard DRV header, with only two differences:
  3281. ∙ the three entry points may point nowhere, because there is no 8088 code to
  3282. be executed
  3283. ∙ the word at offset 0A probably points to the beginning of the DDL section.
  3284.  
  3285. THE DDL SECTION
  3286.  
  3287. This section is made of two parts: an initial "list" of patterns and then the
  3288. definitions of these patterns.  However, because DDL, like SDL, is a fully
  3289. procedural language, this distinction is only convenient from a logical per-
  3290. spective and not inforced by any structural reason; in fact, DDL records have
  3291. their own meaning, independently of their position.
  3292.  
  3293. It may be deducted, from the two existing examples, that each pattern is
  3294. given a memory area (always no more than 40h byte long and allocated right
  3295. after the end of the DYN file image), which will be called "pattern memory"
  3296. in the following.  Given than DDL records - unlike SDL - last in the time and
  3297. may occurr simultaneously, this area is probably where intermediate steps are
  3298. stored.
  3299.  
  3300. THE SDL SECTION
  3301.  
  3302. This section contains SDL records required to draw the dynamic models.  It
  3303. contains three special records (45h, 46h, 48h), not found in static sceneries
  3304. (or, like record 45h, found with a different structure and meaning), which
  3305. probably are the link between DDL and SDL.
  3306.  
  3307. -- 45h ----- ??? (4 bytes)
  3308.  
  3309. 1    1    value
  3310. 2    2    absolute address
  3311.  
  3312. Probably, places the given value at the given address.  The address is
  3313. usually the address of a pattern memory.
  3314.  
  3315. -- 46h ----- ??? (5 bytes)
  3316.  
  3317. 1    2    absolute address
  3318. 3    2    ???
  3319.  
  3320. -- 48h ----- ??? (5 bytes)
  3321.  
  3322. 1    2    ???
  3323. 3    2    ???
  3324.  
  3325. ======================================================================
  3326.  
  3327.                         DYNAMIC DESCRIPTION LANGUAGE
  3328.                         DYNAMIC RECORD CODE REFERENCE
  3329.  
  3330. Notes
  3331.  
  3332. Time fields are presumably in seconds, they are 2-byte fields but their
  3333. values cannot be larger than 255.
  3334.  
  3335. All addresses are absolute file locations and not relative offset as for SDL
  3336. records.
  3337.  
  3338. -- 01h ----- Rotate model to pitch attitude (5 bytes)
  3339.  
  3340. 1    2    Pitch angle
  3341. 3    2    Speed
  3342.  
  3343. This record rotates the model about its lateral axis to the desired pitch
  3344. angle.  It displays the rotation process, and the speed of rotation is
  3345. defined by the bytes 3-4.  This is a signed value with the sign determining
  3346. the direction of rotation (clockwise or counterclockwise, etc..).  Fastest
  3347. rotation rate is 0000h, and slowest rotation is 7FFFh.  If the record is fol-
  3348. lowed by a move record (12h-18h), the rotation is performed during the move
  3349. and not before.
  3350.  
  3351. -- 02h ----- Rotate model to bank attitude (5 bytes)
  3352.  
  3353. 1    2    Bank angle
  3354. 3    2    Speed
  3355.  
  3356. Same as record 01, but for bank attitude.
  3357.  
  3358. -- 03h ----- Rotate model to yaw attitude (5 bytes)
  3359.  
  3360. 1    2    Yaw angle
  3361. 3    2    Speed
  3362.  
  3363. Same as record 01, but for yaw attitude.
  3364.  
  3365. -- 04h ----- Gear up/down  (2 bytes)
  3366.  
  3367. 1    1    0 = gear up, 1 = gear down, FFh = ??
  3368.  
  3369. This record changes the apparence of the model.  It is probably related with
  3370. the three SDL entry points each model has.
  3371.  
  3372. -- 07h ----- Set heading (3 bytes)
  3373.  
  3374. 1    2    New heading
  3375.  
  3376. Instantaneously sets the heading of the model.  Final heading is a CANTED
  3377. value, not a geographical heading.
  3378.  
  3379. -- 08h ----- ??? (7 Bytes??)
  3380.  
  3381. -- 09h ----- ??? (7 Bytes??)
  3382.  
  3383. -- 0Dh ----- ??? (6 Bytes)
  3384.  
  3385. 1    1    ??
  3386. 2    2    ??
  3387. 4    2    ??
  3388.  
  3389. -- 12h ----- Move East (5 bytes)
  3390.  
  3391. 1    2    Time in seconds
  3392. 3    2    East coord (delta FSu)
  3393.  
  3394. This record moves the object from its current position to the delta position
  3395. in the defined number of seconds.
  3396.  
  3397. -- 13h ----- Move Alt (UNATTESTED, 5 bytes)
  3398.  
  3399. 1    2    Time in seconds
  3400. 3    2    Delta Alt. (delta FSu = m)
  3401.  
  3402. Same as record 12h, but for altitude.  The record has not been actually
  3403. found, it has been inferred from the general pattern of record codes.
  3404.  
  3405. -- 14h ----- Move North (5 bytes)
  3406.  
  3407. 1    2    Time in seconds
  3408. 3    2    Delta Alt.
  3409.  
  3410. Same as record 12h, but for North coordinate.
  3411.  
  3412. -- 15h ----- Move East / North (7 bytes)
  3413.  
  3414. 1    2    Time in seconds
  3415. 3    2    E coord (delta FSu)
  3416. 5    2    N coord (delta FSu)
  3417.  
  3418. Same as record 12h, but for East and North coordinates.
  3419.  
  3420. -- 16h ----- Move East / Alt (7 bytes)
  3421.  
  3422. 1    2    Time in seconds
  3423. 3    2    E coord (delta FSu)
  3424. 5    2    A coord (delta FSu)
  3425.  
  3426. Same as record 12h, but for East and Alt. coordinates.
  3427.  
  3428. -- 17h ----- Move Alt. / North (7 bytes)
  3429.  
  3430. 1    2    Time in seconds
  3431. 3    2    A coord (delta FSu)
  3432. 5    2    N coord (delta FSu)
  3433.  
  3434. Same as record 12h, but for Alt. and North coordinates.
  3435.  
  3436. -- 18h ----- Move 3D (9 bytes)
  3437.  
  3438. 1    2    Time in seconds
  3439. 3    2    E coord (delta FSu)
  3440. 5    2    A coord (delta FSu)
  3441. 7    2    N coord (delta FSu)
  3442.  
  3443. Same as record 12h, but for East, Alt. and North coordinates.
  3444.  
  3445. -- 19h ----- Accelerate East (7 bytes)
  3446.  
  3447. 1    2    Time in second
  3448. 3    2    Rate
  3449. 5    2    E coord (delta FSu)
  3450.  
  3451. This record accelerates object motion from it's current position to the delta
  3452. position in the defined number of seconds.  The Rate parameter influences the
  3453. acceleration rate in a yet unclear way.
  3454.  
  3455. -- 1Ah ----- Accelerate Alt (UNATTESTED, 7 bytes)
  3456.  
  3457. 1    2    Time in second
  3458. 3    2    Rate
  3459. 5    2    A coord (delta FSu = m)
  3460.  
  3461. Same as record 19h, but for altitude.  The record has not been actually
  3462. found, it has been inferred from the general pattern of record codes.
  3463.  
  3464. -- 1Bh ----- Accelerate North (7 bytes)
  3465.  
  3466. 1    2    Time in second
  3467. 3    2    Rate
  3468. 5    2    N coord (delta FSu)
  3469.  
  3470. Same as record 19h, but for the North coordinate.
  3471.  
  3472. -- 1Ch ----- Accelerate East / North (7 bytes)
  3473.  
  3474. 1    2    Time in second
  3475. 3    2    Rate
  3476. 5    2    E coord (delta FSu)
  3477. 7    2    N coord (delta FSu)
  3478.  
  3479. Same as record 19h, but for the East and North coordinates.
  3480.  
  3481. -- 1Dh ----- Accelerate East / Alt (9 bytes)
  3482.  
  3483. 1    2    Time in second
  3484. 3    2    Rate
  3485. 5    2    E coord (delta FSu)
  3486. 7    2    A coord (delta FSu)
  3487.  
  3488. Same as record 19h, but for the East and Alt. coordinates.
  3489.  
  3490. -- 1Eh ----- Accelerate Alt. / North (UNATTESTED, 9 bytes)
  3491.  
  3492. 1    2    Time in second
  3493. 3    2    Rate
  3494. 5    2    A coord (delta FSu)
  3495. 7    2    N coord (delta FSu)
  3496.  
  3497. Same as record 19h, but for the Alt. and North coordinates.  The record has
  3498. not been actually found, it has been inferred from the general pattern of
  3499. record codes.
  3500.  
  3501. -- 1Fh ----- Accelerate 3D (11 bytes)
  3502.  
  3503. 1    2    Time in second
  3504. 3    2    Rate
  3505. 5    2    E coord (delta FSu)
  3506. 7    2    A coord (delta FSu)
  3507. 9    2    N coord (delta FSu)
  3508.  
  3509. Same as record 19h, but for the East, Alt. and North coordinates.
  3510.  
  3511. -- 20h ----- Turn left/right about point (7 bytes)
  3512.  
  3513. 1    2    Time in seconds
  3514. 3    2    Final heading
  3515. 5    2    Turning radius (delta FSu)
  3516.  
  3517. Turns the model to the new heading in the given amount of time.  The center
  3518. of the turning circle is defined in delta FSu from the current position along
  3519. the lateral axis.  Left/right turns are performed depending on the current
  3520. and final heading so that no turn is greater than 180 degrees.
  3521.  
  3522. Final heading is a CANTED value, not a geographical heading.
  3523.  
  3524. -- 24h ----- Jump (3 bytes)
  3525.  
  3526. 1    2    Address to jump to
  3527.  
  3528. The record jumps to another file location.
  3529.  
  3530. -- 25h ----- Call subroutine (3 bytes)
  3531.  
  3532. 1    2    Subroutine absolute address
  3533.  
  3534. -- 26h----- Return from subroutine (1 byte)
  3535.  
  3536. -- 27h ----- Hold position (3 bytes)
  3537.  
  3538. 1    2    Wait time in seconds
  3539.  
  3540. This freezes the model at its current position for the given number of sec-
  3541. onds.
  3542.  
  3543. -- 28h ----- Define initial position (13 bytes)
  3544.  
  3545. 1    4    E coord (fract FSu)
  3546. 1    4    A coord (fract FSu)
  3547. 1    4    N coord (fract FSu)
  3548.  
  3549. Defines the "starting point" for the patter, used at the very beginning of
  3550. the pattern definition.
  3551.  
  3552. -- 29h ----- Sleep (1 byte)
  3553.  
  3554. Puts the pattern in sleep; the model remains at the current position until
  3555. awakened by another pattern.
  3556.  
  3557. -- 2Ah ----- Awaken (3 bytes)
  3558.  
  3559. 1    2    Pattern memory address of the pattern to awaken
  3560.  
  3561. Awaken the pattern owning the given pattern memory.
  3562.  
  3563. -- 2Ch ----- Test FS variable (7 bytes)
  3564.  
  3565. 1    2    Jump absolute address
  3566. 3    2    FS variable
  3567. 5    2    value
  3568.  
  3569. Jumps to the given address, if the given variable is equal to the given
  3570. value.  Used in F1.DYN to test the contents of variables 1AD2 (Airport air-
  3571. craft ground traffic), 1AD4 (Airport service traffic) and 1AD6 (Misc. traf-
  3572. fic).
  3573.  
  3574. -- 2Eh ----- Test FS variable (7 bytes)
  3575.  
  3576. 1    2    Jump absolute address
  3577. 3    2    FS variable
  3578. 5    2    value
  3579.  
  3580. Jumps to the given address, if the given variable is equal to the given
  3581. value.  Used in F1.DYN to test the contents of variables 1AC6 (dynamic
  3582. scenery detail: 0 = sparse, 1 = medium, 2 = complex).  It is not clear how
  3583. this record is different from record 2Ch; one may note that var 1AC6 may have
  3584. three different values, while variables tested with record 2Ch may have only
  3585. two.
  3586.  
  3587. -- 2Fh ----- Branch on area (11 bytes)
  3588.  
  3589. 1    2    Jump absolute address
  3590. 3    2    East min (int FSu)
  3591. 5    2    East max (int FSu)
  3592. 7    2    North min (int FSu)
  3593. 9    2    North max (int FSu)
  3594.  
  3595. Jumps to the given address if outside the given coordinate ranges.  Used in
  3596. F1.DYN to avoid rendering dynamic patterns of non current areas.
  3597.  
  3598. -- 31h ---- Pattern Declaration (13 bytes)
  3599.  
  3600. 1    2    Pattern number
  3601. 3    2    pattern memory absolute address
  3602. 5    2    pattern DDL definition absolute address
  3603. 7    2    pattern first SDL entry point
  3604. 9    2    pattern second SDL entry point
  3605. 11   2    pattern third SDL entry point
  3606.  
  3607. Declares (or perhaps executes) a pattern.  This record is used once for each
  3608. pattern, associating to it a pattern memory area, a DDL routine and 3 (?) SDL
  3609. routines to draw the model.
  3610.  
  3611. -- FFh ----- Exit (1 byte)
  3612.  
  3613. Exits the DDL processor.
  3614.  
  3615.  
  3616. ======================================================================
  3617.  
  3618.                                ADV FILE FORMAT
  3619.                               by John Mechalas
  3620.  
  3621.  
  3622. .ADV files have a very simple structure, being only a successions of ADV
  3623. records, without header or sections of any kind.
  3624.  
  3625. ADV records, compared with SDL's, have the following peculiarities:
  3626. ∙ record codes are 2-byte long; however, since the second byte is always 0,
  3627.   they may considered made of one code byte plus one 0 byte;
  3628. ∙ addresses are always absolute, not relative to the current record as in SDL
  3629. ∙ many records have, right after the code, a 2-byte field with the address of
  3630.   the next record; it as been labelled with "Next" in the reference below.
  3631. ∙ records map quite well to ADV commands; whenever possible ADV commands have
  3632.   been retained as record names.
  3633. ∙ All decimal values are truncated to integer, and are not modified anymore
  3634.   (for instance, FS East and North coordinates are memorized as integer but
  3635.   not shifted by the 4000h factor; degrees are stored in degrees, not in the
  3636.   1/182.04 FS unit, and so on).  Each value is stored in the high word of a
  3637.   4-byte field, possibly to allow future inclusion of real decimal values.
  3638.  
  3639.  
  3640. ADV RECORD CODE REFERENCE
  3641.  
  3642. -- 00h ----- EOF (4 bytes)
  3643.  
  3644. 2    2    Next
  3645.  
  3646. -- 01h ----- IF (length varies according to the condition)
  3647.  
  3648. 2    2    Address to jump to if condition TRUE
  3649. 4    2    Address to jump to if condition FALSE
  3650.  
  3651. The condition is determined by the next word (at offset 6) and may have the
  3652. following structures:
  3653.  
  3654. 6    2    00   KEY
  3655. 8    2         key code
  3656.  
  3657. 6    2    01   BUBBLE
  3658. 8    2         0000
  3659. 10   2         north
  3660. 12   2         0000
  3661. 14   2         east
  3662. 16   2         0000
  3663. 18   2         min
  3664. 20   2         0000
  3665. 22   2         to
  3666.  
  3667. 6    2    02   ALTITUDE
  3668. 8    2         0000
  3669. 10   2         min
  3670. 12   2         0000
  3671. 14   2         to
  3672.  
  3673. 6    2    03   DME
  3674. 8    2         0000
  3675. 10   2         max distance (min distance is ignored)
  3676.  
  3677. 6    2    04   COM
  3678. 8    2         frequency in MHz BCD less 100 (as in SDL frequencies)
  3679.  
  3680. 6    2    05   NAV1
  3681. 8    2         frequency in MHz BCD less 100 (as in SDL frequencies)
  3682.  
  3683. 6    2    06   NAV2
  3684. 8    2         frequency in MHz BCD less 100 (as in SDL frequencies)
  3685.  
  3686. 6    2    07   PITCH
  3687. 8    2         0000
  3688. 10   2         min
  3689. 12   2         0000
  3690. 14   2         to
  3691.  
  3692. 6    2    08   BANK
  3693. 8    2         0000
  3694. 10   2         min
  3695. 12   2         0000
  3696. 14   2         to
  3697.  
  3698. 6    2    09   HEADING
  3699. 8    2         0000
  3700. 10   2         min
  3701. 12   2         0000
  3702. 14   2         max
  3703.  
  3704. 6    2    0A   AIRSPEED
  3705. 8    2         0000
  3706. 10   2         min
  3707. 12   2         0000
  3708. 14   2         max
  3709.  
  3710. 6    2    0B   GROUNDSPEED
  3711. 8    2         0000
  3712. 10   2         min
  3713. 12   2         0000
  3714. 14   2         to
  3715.  
  3716. 6    2    0C   FLAPS
  3717. 8    2         0000
  3718. 10   2         min
  3719. 12   2         0000
  3720. 14   2         to
  3721.  
  3722. 6    2    0D   POWER
  3723. 8    2         0000
  3724. 10   2         min
  3725. 12   2         0000
  3726. 14   2         to
  3727.  
  3728. 6    2    0F   GEARUP
  3729.  
  3730. 6    2    10   GEARDOWN
  3731.  
  3732. 6    2    11   JETENGINE
  3733.  
  3734. 6    2    12   PROPENGINE
  3735.  
  3736. 6    2    13   VARTEST
  3737. 8    2         variable
  3738. 8    2         0000
  3739. 10   2         min
  3740. 12   2         0000
  3741. 14   2         to
  3742.  
  3743. 6    2    14   VARMASK
  3744. 8    2         variable
  3745. 10   2         bit mask
  3746.  
  3747. 6    2    15   RADIAL
  3748. 8    2         0000
  3749. 10   2         north
  3750. 12   2         0000
  3751. 14   2         east
  3752. 16   2         0000
  3753. 18   2         min
  3754. 20   2         0000
  3755. 22   2         to
  3756.  
  3757. 6    2    16   GSLOPE
  3758. 8    2         0000
  3759. 10   2         north
  3760. 12   2         0000
  3761. 14   2         east
  3762. 16   2         0000
  3763. 18   2         min
  3764. 20   2         0000
  3765. 22   2         to
  3766.  
  3767. 6    2    17   COURSE
  3768. 8    2         0000
  3769. 10   2         min
  3770. 12   2         0000
  3771. 14   2         to
  3772.  
  3773. 6    2    18   CYLINDER
  3774. 8    2         0000
  3775. 10   2         north
  3776. 12   2         0000
  3777. 14   2         east
  3778. 16   2         0000
  3779. 18   2         min
  3780. 20   2         0000
  3781. 22   2         to
  3782.  
  3783. 6    2    19   XPNDR
  3784. 8    4         4 digit frequency as text string
  3785.  
  3786. 6    2    1A   ADF
  3787. 8    4         4 digit frequency as text string
  3788.  
  3789. 6    2    1B   ALTAGL
  3790. 8    2         0000
  3791. 10   2         min
  3792. 12   2         0000
  3793. 14   2         to
  3794.  
  3795. -- 02h ----- GOTO (4 bytes)
  3796.  
  3797. 2    2    Address to jump to
  3798.  
  3799. -- 03h ----- PLAY (5 bytes + file name length)
  3800.  
  3801. 2    2    Next
  3802. 4    xx   File name (0-terminated)
  3803.  
  3804. -- 04h ----- PRINT (5 bytes + text length)
  3805.  
  3806. 2    2    Next
  3807. 4    xx   Text string (0-terminated)
  3808.  
  3809. -- 05h ----- SETPOSITION (16 bytes)
  3810.  
  3811. 2    2    Next
  3812. 4    2    0000
  3813. 6    2    North coord (int FSu)
  3814. 8    2    0000
  3815. 10   2    East  coord (int FSu)
  3816. 12   2    0000
  3817. 14   2    Alt.  coord (int FSu)
  3818.  
  3819. -- 06h ----- WAIT (8 bytes)
  3820.  
  3821. 2    2    Next
  3822. 4    2    0000
  3823. 6    2    Time in seconds
  3824.  
  3825. -- 07h ----- ONCRASH (6 bytes)
  3826.  
  3827. 2    2    Next
  3828. 4    2    Address to jump to on crash
  3829.  
  3830. -- 08h ----- GOSUB (6 bytes)
  3831.  
  3832. 2    2    Next
  3833. 4    2    Address of subroutine
  3834.  
  3835. -- 09h ----- RETURN (4 bytes)
  3836.  
  3837. 2    2    Next
  3838.  
  3839. -- 0Ah ----- SETVAR (8 bytes)
  3840.  
  3841. 2    2    Next
  3842. 4    2    Variable (see below for a variable reference)
  3843. 6    2    Value
  3844.  
  3845. -- 0Bh ----- ADDVAR (8 bytes)
  3846.  
  3847. 2    2    Next
  3848. 4    2    Variable
  3849. 6    2    Value to add
  3850.  
  3851. -- 0Dh ----- PRINTVAR (7 bytes + text length)
  3852.  
  3853. 2    2    Next
  3854. 4    2    Variable to print
  3855. 6    xx   Text to print (0-terminated)
  3856.  
  3857. -- 0Eh ----- MOVEVAR (8 bytes)
  3858.  
  3859. 2    2    Next
  3860. 4    2    Destination variable
  3861. 6    2    Source variable
  3862.  
  3863. -- 0Fh ----- RESET (4 bytes)
  3864.  
  3865. 2    2    Next
  3866.  
  3867. -- 10h ----- VIEW (9 bytes + file name length)
  3868.  
  3869. 2    2    Next
  3870. 4    2    0000
  3871. 6    2    Time in seconds
  3872. 8    xx   file name (0-terminated)
  3873.  
  3874. -- 11h ----- ONSTALL (6 bytes)
  3875.  
  3876. 2    2    Next
  3877. 4    2    Address to go to on stall
  3878.  
  3879. -- 12h ----- RETURN2 (4 bytes)
  3880.  
  3881. 2    2    Next
  3882.  
  3883. -- 13h ----- Variable arithmetics (12 bytes + 4 bytes for each operation)
  3884.  
  3885. 2    2    Next
  3886. 4    2    Destination variable
  3887.  
  3888. Operations are described alternating a source variable and an operator:
  3889.  
  3890.      2    Source variable
  3891.      2    Operator:      1    +
  3892.                          2    -
  3893.                          3    *
  3894.                          4    /
  3895.                          5    logical AND
  3896.                          6    logical OR
  3897.                          7    logical XOR
  3898.  
  3899. The last variable has 0000h as 'operator', and the calculation is ended by:
  3900.  
  3901.      4    0013h  0000h
  3902.  
  3903. Example:
  3904.  
  3905. 13 00 6E 00 42 04 10 04 01 00 12 04 03 00 14 04 02 00 16 04 04 00 18 04
  3906. 06 00 1A 04 05 00 1C 04 07 00 1E 04 00 00 13 00 00 00
  3907.  
  3908. is analysed:
  3909.  
  3910. 0013 006E 0442           Math, Next statement at 006E, dest var Z
  3911. 0410 0001                var A, oper. +
  3912. 0412 0003                var B, oper. *
  3913. 0414 0002                var C, oper. -
  3914. 0416 0004                var D, oper. /
  3915. 0418 0006                var E, oper. logical OR
  3916. 041A 0005                var F, oper. logical AND
  3917. 041C 0007                var G, oper. logical XOR
  3918. 041E 0000                var H, no oper.
  3919. 0013 0000                Math end
  3920.  
  3921. and corresponds to the AAF statement:
  3922.  
  3923.      Z := A + B * C - D / E | F & G ^ H
  3924.  
  3925. ----------
  3926.  
  3927. ADV VARIABLES
  3928.  
  3929. Please note that, as clearly stated in AAF documentation, the following vari-
  3930. ables are by no mean reserved or documented; their usage may be subject to
  3931. change in future FS releases.
  3932.  
  3933. 0000   remainder - result               0DA4   rudped_ind
  3934. 0410   A                                0DA6   throtl_ind
  3935. 0412   B                                0DA8   elvtrm_ind
  3936. 0414   C                                0DAA   brake_ind
  3937. 0416   D                                0DB2   elev_pos
  3938. 0418   E                                0DC9   ailer_pos
  3939. 041A   F                                0DE0   rudder_pos
  3940. 041C   G                                0DF7   fuellf
  3941. 041E   H                                0DFA   fuelrt
  3942. 0420   I                                0DFD   oiltmp
  3943. 0422   J                                0DFF   oilprs
  3944. 0424   K                                0E01   dmefrc
  3945. 0426   L                                0E02   dmemil
  3946. 0428   M                                0E03   dmedist
  3947. 042A   N                                0E05   dmespeed
  3948. 042C   O                                0E06   dmeblk
  3949. 042E   P                                0E07   dmesource
  3950. 0430   Q                                0E08   dme_update
  3951. 0432   R                                0E09   ils_dmedist
  3952. 0434   S                                0E0B   vornew
  3953. 0436   T                                0E0C   pornew
  3954. 0438   U                                0E0D   gsnew
  3955. 043A   V                                0E0E   iomact
  3956. 043C   W                                0E0F   tfflag
  3957. 043E   X                                0E10   pfflag
  3958. 0440   Y                                0E11   omiold
  3959. 0442   Z                                0E12   nfvor
  3960.                                         0E14   efvor
  3961. 0280   altmsl                           0E22   date_year
  3962. 028C   tod                              0E24   date_month_day
  3963. 0362   hour                             0E26   time_hours_min
  3964. 0363   minute                           0E28   time_seconds
  3965. 04C6   menu_level                       0E2C   cloud_dev_fract
  3966. 0534   fulltower                        0E2E   cloud2top
  3967. 0536   titles                           0E30   cloud2bot
  3968. 0538   shadflg                          0E32   cloud2cover
  3969. 053C   sysmode                          0E48   cloud2dev
  3970. 053E   sndflg                           0E4A   cloud1top
  3971. 0542   sound2                           0E4C   cloud1bot
  3972. 0544   pauflg                           0E4E   cloud1cover
  3973. 0548   auto_coord                       0E64   cloud1dev
  3974. 054A   smoke_enable                     0E66   cloud3top
  3975. 054C   atc_com                          0E68   cloud3bot
  3976. 054E   smoke_now                        0E6A   cloud3cover
  3977. 055C   smoke_plane_ptr                  0E74   cloud3spd
  3978. 0568   random                           0E76   cloud3dir
  3979. 07AA   season_cycl                      0E78   w9vel
  3980. 07B6   cfpd                             0E79   w9turb
  3981. 07BE   efis_type_cycl                   0E7A   w9dir
  3982. 098E   scenery_cycl                     0E7C   w6vel
  3983. 09C8   cmfreq                           0E7D   w6turb
  3984. 09CC   hederr                           0E7E   w6dir
  3985. 09D0   barom                            0E80   w3vel
  3986. 09D2   trans_ident_flg                  0E81   w3turb
  3987. 09D6   nvfreq                           0E82   w3dir
  3988. 09D8   nav1_vorrad                      0E84   w0vel
  3989. 09DC   pvfreq                           0E85   w0turb
  3990. 09E2   aerflg                           0E86   w0dir
  3991. 09E4   hedlsb                           0E88   w9top
  3992. 09E5   bpupdt                           0E8A   w9bot
  3993. 09E6   sound_rpm                        0E8C   w6top
  3994. 09E7   emrgcy                           0E8E   w6bot
  3995. 09E9   ground                           0E90   w3top
  3996. 09EA   stlwrn                           0E92   w3bot
  3997. 09EB   spdwrn                           0E94   w0depth
  3998. 09F6   plane_height                     0E96   tmpvar
  3999. 0B47   gndbias                          0E97   in_the_clouds
  4000. 0B5D   vely                             0FEF   pause
  4001. 0B60   vel_x                            105C   mouse
  4002. 0B62   vel_y                            105D   mouse_mode
  4003. 0B64   vel_z                            105E   mouse_button
  4004. 0B66   vel_p                            105F   curs_x
  4005. 0B68   vel_b                            1061   curs_y
  4006. 0B6A   vel_h                            106E   mouse_brake
  4007. 0CAB   magcom                           11F8   autop_master
  4008. 0CAD   obi                              11FA   wing_leveler
  4009. 0CAE   oldrpm                           11FC   nav1_lock
  4010. 0CAF   pbi                              11FE   heading_lock
  4011. 0CEA   tod_master                       1200   head_lock_var
  4012. 0D1A   gen_model                        1202   altit_lock
  4013. 0D58   flaps                            1204   altit_lock_var
  4014. 0D5A   gear                             1B32   wind_up_vel
  4015. 0D5B   lights                           1B33   weather_turb
  4016. 0D5C   magno                            1B34   weather_clouds
  4017. 0D5E   carbh                            1B36   weather_fronts
  4018. 0D5F   strobes                          1B38   weather_winds
  4019. 0D60   strobe_flash                     1B3A   weather_turbulence
  4020. 0D7E   pan_active                       1B46   mixture_pos
  4021. 0D80   pan_gen                          1B48   fuel_flow
  4022. 0D81   lear_airspeed                    1B4A   displace
  4023. 0D82   engine_type                      1B4C   prop_leng
  4024. 0D83   retractable                      1B4E   oilamt
  4025. 0D84   adf_flag                         1B50   nrpm
  4026. 0D86   ail_rud_lock                     1B52   bhp
  4027. 0D87   cntr_ail_5key                    1B54   thp
  4028. 0D88   cntr_rud_5key                    1C82   gear_smoke
  4029. 0D89   cntr_elv_5key                    1C84   smoke_cntr
  4030. 0DA0   yoke_ind_y                       1C86   crash_protector
  4031. 0DA2   yoke_ind_x
  4032.  
  4033. ==================== FSSTRUCT END ====================================
  4034.