home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / club100 / bus / lucid.do < prev    next >
Text File  |  2006-10-19  |  4KB  |  128 lines

  1. LUCID FILE FORMATS (VER 1.5)
  2.  
  3.  
  4. This is information gleaned by trial and error and many RAM dumps regarding 
  5. the file structure for Lucid.  It is the basis for the program LUCNV which 
  6. was written to convert Lucid files for use with Lotus.  There are bound to be 
  7. errors in this, but I think it's pretty close.
  8.  
  9.      byte             contents
  10.      ----    --------------------------
  11.      0,1     65535
  12.      2,3     LSB,MSB of length, last byte at start+length+2
  13.      4       36  ?
  14.      5       246 ?
  15.      6       64  ?
  16.      7       192 ?
  17.      8       255 ?
  18.      9       Output file: RAM=0, MDM=249, LPT=250, WAN=251,
  19.              COM=252, CAS=253, CRT=254, LCD=255
  20.      10-16   Output file name, ending in 13
  21.      17      Left Margin
  22.      18      Line Width
  23.      19      Bottom Margin
  24.      20      Top Margin
  25.      21      Page Length
  26.      22      Print Range - start col
  27.      23      Print Range - end col
  28.      24      Print Range - start row
  29.      25      Print Range - end row
  30.      26      Insert col width (9)
  31.      27-152  Col widths by col
  32.      153     9 ?
  33.      154     0 ?
  34.      155     0 ?
  35.      156     3 ?
  36.      157+    Cell Contents (see below)
  37.      last 3  255,128,0
  38.  
  39.  
  40. CELL FORMATS:
  41.  
  42.  
  43.      byte             contents
  44.      ----    --------------------------
  45.      1       Row (row 1=1)
  46.      2       Col (col A=1)
  47.      3       Length of block from byte 1
  48.              If OR'd with $80, formula or numeric
  49.              If OR'd with $40, protected
  50.              Else character string
  51.      4       a) If character, ASCII string ended by length of block
  52.              b) If numeric or formula, # of decimal places in format:
  53.              0=0 places, $20=1, $40=2, $60=3, $80=4, $A0=5, $C0=6, $E0=7
  54.  
  55.              NUMERIC AND FORMULA ONLY:
  56.      5       Display format $80 OR'd with:
  57.              $04="###-", $10="$###", $40=",###"
  58.      6       If numeric, number in ASCII:
  59.              "+123.456..." ended with 13 and block length
  60.              If formula, numeric value of cell in BCD.
  61.              1st byte=decimal place ie 10^n, offset by $40, followed
  62.              by 14 place value ".xxxxxxx etc." (ie floating point)
  63.      14      Start of cell formula, see format below.
  64.      end     Block ended with 13 and block length
  65.  
  66.  
  67. CELL FORMULAS:
  68.  
  69.  
  70. Cell formulas are stored pretty much as written, except for tokens.  Each 
  71. starts with a formula code, giving an operator and what type of reference 
  72. follows.  For example, $A5 means "divide by the function that follows".
  73. The table below shows the "system" used.
  74.  
  75.              Cell    Number    Function
  76. Operator     Ref      Ref        Ref
  77. --------     ----    ------    --------
  78. Ref follows  89        91        **
  79.     +        8A        92        A2
  80.     -        8B        93        A3
  81.     *        8C        94        A4
  82.     /        8D        95        A5
  83.     ^        8E        96        A6
  84.  
  85.       **There is no simple "function follows", Lucid uses $A2, 
  86.         there is however, $E1 "negative function follows" code.
  87.  
  88. NOTES:  All codes are in HEX.
  89.  
  90.         A cell reference is given in two bytes, row then col.
  91.         The reference is absolute if the column is OR'd $80.
  92.         The operator followed by a negative is indicated by 
  93.         the code above OR'd with $40.
  94.  
  95.  
  96. FUNCTION CODES:
  97.  
  98.  
  99. Functions are referenced with tokens and certain arguments are expected.
  100. For the list below "N" indicates a numeric or formula with numeric result 
  101. is expected, RC means cell ref, Row/Col.  All argument lists end with a ")"
  102.  
  103. Code
  104. (hex)   Function      Arguments
  105. ----    --------      -----------------
  106. 80      (parentheses  N
  107. 81      RND(          N
  108. 82      SQR(          N
  109. 83      LOG(          N
  110. 84      EXP(          N
  111. 85      COS(          N
  112. 86      SIN(          N
  113. 87      TAN(          N
  114. 88      ATN(          N
  115. 89      INT(          N
  116. 8A      REF(          "FILE NAME",RC
  117. 8B      SUM(          RC:RC
  118. 8C      CNT(          RC:RC
  119. 8D      TBL(          RC,RC,RC:RC
  120. 8E      MIN(          RC:RC
  121. 8F      MAX(          RC:RC
  122.  
  123.  
  124. That's it, I hope you find this helpful and can use it
  125. to create better utilities for Lucid.
  126.  
  127. Dave Lapinski
  128.