home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / aminet / easylife.lha / EasyLife.doc next >
Text File  |  1993-10-19  |  43KB  |  1,309 lines

  1.  ************************************************************************
  2.  **                                                                    **
  3.  **                      EASY LIFE Extension V1.0                      **
  4.  **                      ------------------------                      **
  5.  **                                                                    **
  6.  **    Written By Paul Hickman ©August 1993 - named after EASY LIFE    **
  7.  **                from  Steve Wright In The Afternoon                 **
  8.  **                                                                    **
  9.  ************************************************************************
  10.  
  11.            Send Bugs / Ideas / YOUR PROGRAMS to ph@doc.ic.ac.uk
  12.  
  13.  
  14.                                  Contents
  15.                                  --------
  16.  
  17.  
  18.                   0.0...........How To Lead An EASY LIFE
  19.  
  20.                   0.1.........Zone / Multi Zone Commands
  21.  
  22.                   0.2....................String Commands
  23.  
  24.                   0.3................Powerpacker Support
  25.  
  26.                   0.4..............Bit test/set Commands
  27.  
  28.                   0.5.....................I / O Commands
  29.  
  30.                   0.6......................Misc Commands
  31.  
  32.                   0.7......................The Workbench
  33.  
  34.  
  35.  
  36.  
  37.                   Section 0.0 - How To Lead An EASY LIFE
  38.                   --------------------------------------
  39.  
  40.         The  EASY  LIFE  extension  is designed to do just that - make life
  41.         easier  -  especially  the  parts  of  said life spent writing AMOS
  42.         programs.  The  commands  included  are  not  designed  to speed up
  43.         graphics  to amazing levels, even on an bog standard A500 which has
  44.         had  the  MC68000 pulled out, and replaced with a lego brick, or to
  45.         put  a  starfield  in  the  background  (Why  is it virtually evrey
  46.         extension  written  has  starfied commands???), but to speed up the
  47.         actual  computing  work done in the background, and to allow you to
  48.         read various internal AMOS variables.
  49.  
  50.  
  51. The EASY LIFE garuntee
  52. ----------------------
  53.  
  54.         EASY LIFE is garunteed to:
  55.  
  56.         a) Not necessarily to what this file says it will
  57.  
  58.         b) Not necessarily do anything
  59.  
  60.         c) Not necessarily load
  61.  
  62.         d) Contain at least 20 spelling mistkes in this file
  63.  
  64.         e) Really get on your nerves, and not really make your life very
  65.            easy at all, if some command decides it's not going to act
  66.            the way it's supposed to an goes and invalidates your hardisk
  67.  
  68.         f) Not to do any washing up
  69.  
  70.         I  do not accept responsibilty if any of these events occur (except
  71.         the  last  one - If you find a way to E-Mail washing up to me, I'll
  72.         do it), or if anything else goes wrong (Or right!)
  73.  
  74.  
  75. How To Get An EASY LIFE
  76. -----------------------
  77.  
  78.         Copy   EasyLife.Lib  into  the  AMOS_System  Drawer  of  your  AMOS
  79.         boot-disk.  Copy  powerpacker.library into the Libs drawer. (Or the
  80.         AMOS_System & Libs drawers of you harddisk)
  81.  
  82.         Then  load AMOS, then load the AMOS1.3_Config program, then Run it,
  83.         then  load  the default configuration, then go and find a theasarus
  84.         (try  looking  in  Jurasic Park), and look up an alternative to the
  85.         word  "then".  NEXT  select  "Loaded Extensions" from the menu, and
  86.         click on the Extension no 16 line, and type
  87.  
  88.         :AMOS_System/EasyLife.Lib
  89.  
  90.         Then  (Here  We  Go  Again) press the quit button, then select save
  91.         default  configuration,  the  Quit to System, and finally load AMOS
  92.         again. (Or if using a floppy, just reboot after saving)
  93.  
  94.  
  95. Making Someone Else's Life Easier
  96. ---------------------------------
  97.  
  98.         EasyLife V1.0 is freeware - feel  free to distribute it to  anyone,
  99.         and use it in your programs.  All I ask is that you mention my name
  100.         in the doc file of any  programs you distribute  that use EasyLife,
  101.         and that you distribute all the files in this archive together.
  102.  
  103.  
  104. EasyLife Upgrades
  105. -----------------
  106.  
  107.         If you would like to know when an upgrade to easy life is available
  108.         E-Mail me (ph@doc.ic.ac.uk) and I'll add your name to the list.
  109.  
  110.  
  111. General Notes
  112. -------------
  113.  
  114.         In  addition  to the list of possible errors from each command, Out
  115.         of memory errors / Variable buffer full may also occur.
  116.  
  117.  
  118.         NOTE: Errn returns 4096+Error number when easylife produces an 
  119.         error
  120.  
  121.         NOTE:  The  El  Error  value is cleared to -1 when it is read. This
  122.         means  that if other extensions produce an error, El Error will not
  123.         contain the number of an EasyLife error you've already handled.
  124.  
  125.  
  126.                     Section 1.0 - Zone Support Commands
  127.                     ===================================
  128.  
  129. 1.1 Finding Zone Co-ordinates
  130. -----------------------------
  131.  
  132.         =Znsx( ZONE )
  133.         =Znsy( ZONE )
  134.         =Znex( ZONE )
  135.         =Zney( ZONE )
  136.  
  137.         These  commands  will return the co-orinates of the chosen zone, of
  138.         of current screen. E.g.
  139.  
  140.         After the command: Set Zone 1,10,20 To 30,40
  141.  
  142.         Znsx(1) will return 10, Znsy(1)=20, Znex(1)=30, and Zney(1)=40
  143.  
  144.         NOTE: These commands return signed integers. (-32768 to 32767)
  145.  
  146.       Errors
  147.       ------
  148.  
  149.         If  the zone number given has not been reserved an illegal function
  150.         call is generated.
  151.  
  152.         If no screen is opened, a "Screen Not Opened" error is returned
  153.  
  154.       Alternative Format
  155.       ------------------
  156.  
  157.         =Znsx( SCREEN, ZONE)
  158.         =Znsy( SCREEN, ZONE)
  159.         =Znex( SCREEN, ZONE)
  160.         =Zney( SCREEN, ZONE)
  161.  
  162.         These  commands  will return the co-ordinates of the given zone, on
  163.         the chosen screen
  164.  
  165.       Errors
  166.       ------
  167.  
  168.         As  above,  and  if  the  given  screen is not opened, a screen not
  169.         opened error occurs.
  170.  
  171.  
  172.  
  173. 1.2 Scrolling Zones
  174. -------------------
  175.  
  176.         Zn Shift SCREEN,DX,DY
  177.         Zn Shift SCREEN,DX,DY,START To FINISH
  178.  
  179.         The  first  instruction  will  scroll  all the zones defined on the
  180.         given  screen  DX  pixels to the right, and DY pixels downwards. To
  181.         scroll to the left, or upwards, make DX/DY negative.
  182.  
  183.         The  second  variation  will  only affect those zones between START
  184.         and FINISH
  185.  
  186.       Errors
  187.       ------
  188.  
  189.         If  the given screen is not open, a Screen not opened error occurs.
  190.         An Illegal function call occurs under the following circumstances:
  191.  
  192.         - No zones are reserved on the given screen
  193.         - START or FINSH is greater than the number of zones reserved
  194.         - START is greater than FINISH
  195.  
  196.         NOTE:  If  you  shift a zone below co-oridinate 0, no error occurs,
  197.         but 65536 is added to the new co-ordinate (modulo 65535 arithmatic)
  198.  
  199.  
  200. 1.3 Multi Zone Commands
  201. -----------------------
  202.  
  203.         What is a multi zone?
  204.  
  205.         A  multi  zone  is  similar  to  a  normal  screen  zone.  It  is a
  206.         rectangular  area  of  the  screen,  and  you  can  detect it given
  207.         co-ordinates fall within it. The diferences are:
  208.  
  209.         - Multi zones  are identified by a GROUP number, and a ZONE number.
  210.           Neither need be  sequential, you can define zones 1,3,10 of group
  211.           1,  then zone  431 of  group 839 if you want - it will still only
  212.           take 4 zones worth of memory.
  213.  
  214.         - Multi zones can be erased one group at a time
  215.  
  216.         - You can detect if co=ordinates lie in any zones, or just zones
  217.           from one group
  218.  
  219.         - You can detect ALL the zones a point lies in, not just the
  220.           first one in the list.
  221.  
  222.     1.3.1 Reserving Space
  223.     ---------------------
  224.  
  225.         Reserve Multi Zone NUM
  226.  
  227.         This  command  is  the  equivilent  of the Reserve Zone command. It
  228.         reserves  memory  for the chosen number of zones. NUM must be even.
  229.         If  the  value  you  supply  is not, it is rounded up. A maximum of
  230.         5460 multi zones can be defined.
  231.  
  232.         The  Multi  zones  take the place of the normal screen zones in the
  233.         screen  data  structure,  so  they cannot be used at the same time.
  234.         Multi  zone  commands  will produce an error message if you attempt
  235.         to  use  them  when  normal screen zones are defined. Normal screen
  236.         zones  will  not  work  with  multi  zones  installed, but will not
  237.         produce error messages, just unreliable results.
  238.  
  239.         NOTE:  When  you  call Reserve Multi Zone, the previously installed
  240.         zones/multi  zones  are  erased  -  you  do not get a Zones already
  241.         reserved error.
  242.  
  243.         Errors
  244.         ------
  245.  
  246.         Out of memory                    No memory for the zone table.
  247.  
  248.  
  249.     1.3.2 Eraseing multi zones
  250.     --------------------------
  251.  
  252.         Reserve zone
  253.  
  254.         This   the  standard  AMOS  reserve  zone  command.  Used  with  no
  255.         parameters,  it  will  erase  all multi zones. They are also erased
  256.         properly when the screen is closed / default command used.
  257.  
  258.  
  259.     1.3.3 Defining multi zones
  260.     --------------------------
  261.  
  262.         Set Multi Zone GROUP,ID,X1,Y1 to X2,Y2
  263.         Set Multi Zone GROUP,ID
  264.  
  265.         This  is  virtually  identical to Set Zone command, except you must
  266.         supply  a  GROUP  number.  GROUP and ID can be any number between 1
  267.         and 65535. X1,Y1,X2,Y2 can be between -32768 and 32767.
  268.  
  269.         X1,Y1  and  X2,Y2  are  automatically sorted so X1 <= X2, and Y1 <=
  270.         Y2, so Mznsx etc. always read the correct values.
  271.  
  272.  
  273.  
  274.         The second form of the instruction erases the selected zone.
  275.  
  276.         NOTE:  If  you  call  Set Multi Zone twice with the same GROUP & ID
  277.         numbers, the old co-ordinates are overwritten.
  278.  
  279.  
  280.         Errors
  281.         ------
  282.  
  283.         Illegal Funciton Call            GROUP & ID cannot be 0
  284.         Zone table full                  You have not reserved enough
  285.                                          multi zones.
  286.         Multi Zones Not Reserved         You have not reserved any multi
  287.                                          zones.
  288.  
  289.  
  290.     1.3.4 Reading multi zone co-ordinates
  291.     -------------------------------------
  292.  
  293.         = Mznsx(GROUP,ID)
  294.         = Mznsy(GROUP,ID)
  295.         = Mznex(GROUP,ID)
  296.         = Mzney(GROUP,ID)
  297.  
  298.         These  are  multi  zone  equvilents of the commands in section 1.1.
  299.         All operate on the current screen.
  300.  
  301.         NOTE: Set Multi Zone sorts X1,X2,Y1,Y2 so mznsx/sy are always <=
  302.         mznex/ey.
  303.  
  304.         NOTE: The values returned are signed. (-32768 to 32767)
  305.  
  306.         Errors
  307.         ------
  308.  
  309.         Multi Zone Not Defined           Zone GROUP,ID does not exist
  310.         Screen Not Opened
  311.  
  312.  
  313.     1.3.5 Detecting points in multi zones
  314.     -------------------------------------
  315.  
  316.         = Mzone(X,Y)
  317.  
  318.         Returns  the  ID of a multi zone set on the current screen that X,Y
  319.         lies in. The zone can be from any group.
  320.  
  321.         = Mzone(X,Y,G)
  322.  
  323.         Same as above, but only zones in group G are checked.
  324.  
  325.         NOTE: These commands return 0 is no zone matches.
  326.  
  327.         = Mzoneg
  328.  
  329.         Returns  the group number of the zone matched by either of the last
  330.         two  commands  (Although  this  is a bit pointless if you specify a
  331.         group to search!). 0 is returned if the last search failed.
  332.  
  333.         = Mzonen
  334.  
  335.         Searches  for  a another zone the contains the point defined in the
  336.         previous  Mzone  command.  If  you  supplied a group, only zones in
  337.         that group are matched.
  338.  
  339.         NOTE: These zones won't be returned in any particular order
  340.  
  341.  
  342.     1.3.6 Clearing a group
  343.     ----------------------
  344.  
  345.         Clear Multi Group G
  346.  
  347.         Erases all zones in group G
  348.  
  349.  
  350.  
  351.  
  352. 1.4 Zone Editor "Zone Bank" Compatibility
  353. -----------------------------------------
  354.  
  355.         Zb Add SCREEN, BANK, GROUP
  356.  
  357.         This  command  installs zones from a zone bank, created by the zone
  358.         editor  program. SCREEN is the screen you wish to set the zones on.
  359.         BANK  is the bank number containing the zones, and GROUP is the set
  360.         of zones within the bank you wish to install.
  361.  
  362.         NOTE: This command clears all previous zones set on the screen.
  363.  
  364.      Errors
  365.      ------
  366.  
  367.         Bank does not exist              Obvious
  368.         Not a Zone Bank                  Bank name must be "Zones   "
  369.         Illegal Function Call            Group does not exist in the bank
  370.         Screen not opened                Obvious
  371.         Out of memory                    8 bytes per zone is required
  372.  
  373.  
  374.  
  375.         Zb Multi Add BANK, GROUP
  376.  
  377.         This  command  install  all  zones  from  the chosen group as multi
  378.         zones.  Unlike  the  previous  instruction, this does not erase the
  379.         current  zones.  This  means  that  you will have to reserve enough
  380.         multi  zones  to contain the group first. The only zones overwriten
  381.         by  the command are those with the same GROUP & ID numbers as those
  382.         in the bank.
  383.  
  384.       Errors
  385.       ------
  386.  
  387.         Bank does not exist              Obvious
  388.         Not a Zone Bank                  Bank name must be "Zones  "
  389.         Illegal Function Call            Group does not exist in the bank
  390.         Screen not opened                You must have a current screen
  391.         Multi Zones Not Reserved         No multi zones are reserved
  392.         Zone Table Full                  Not enough zones are free
  393.  
  394.  
  395.  
  396.         Zb Install BK
  397.  
  398.         This  command  installs all zones in all groups of bank BK as multi
  399.         zones.  Firstly,  it  counts  the  number of zones in the bank, and
  400.         reserves  this many multi-zones. Then it calls the prevoius command
  401.         on each group of the bank
  402.  
  403.         NOTE: The zones are installed on the current screen.
  404.  
  405.       Errors
  406.       ------
  407.  
  408.         Bank does not exist
  409.         Not a Zone Bank
  410.         Screen not opened                Zones installed on current
  411.         Out of memory                    No memory to reserve multi zones
  412.  
  413.  
  414.  
  415.                        Section 2.0 - String Support
  416.                        ============================
  417.  
  418. 2.1 Character Search Functions
  419. ------------------------------
  420.  
  421.         =Find Asc(S$,A)                 =Find Char(S$,A)
  422.         =Find Asc(S$,A,P)               =Find Char(S$,A,P)
  423.         =Find Not Asc(S$,A)             =Find Not Char(S$,A)
  424.         =Find Not Asc(S$,A,P)           =Find Not Char(S$,A$,P)
  425.         =Find Last Asc(S$,A)            =Find Last Char(S$,A$)
  426.         =Find Last Asc(S$,A,P)          =Find Last Char(S$,A$,P)
  427.         =Find Last Not Asc(S$,A)        =Find Last Not Char(S$,A$)
  428.         =Find Last Not Asc(S$,A,P)      =Find Last Not Char(S$,A$,P)
  429.  
  430.         All  sixteen of these commands search for a single character in the
  431.         string S$, returning it's position, or 0 if it was not found.
  432.  
  433.         In  the  Asc  variants,  the  parameter  A is the AscII code of the
  434.         character  to search for. In the Char variants, the first character
  435.         of the string A$ is used as the search character
  436.  
  437.         Those  containing  the word NOT will match any character other than
  438.         the  one  given in A / A$. Those containing the word LAST begin the
  439.         search from the end of the string.
  440.  
  441.  
  442. Find Asc/Find Char
  443. ------------------
  444.  
  445.         These  search from the begining of the string for the character. If
  446.         the  optional  parameter  P  is  supplied,  the  search begins with
  447.         (P+1)th  character  of  the  string.  Therefore  to find the second
  448.         occurance  of  the  character, call Find Asc/Char with the position
  449.         of the first occurance in P.
  450.  
  451.         These  commands  are  similar to the =instr command, but are faster
  452.         as  they  only  match single characters, and instr will search from
  453.         position P, not P+1, if it is supplied.
  454.  
  455.  
  456. Find Not Asc/Find Not Char
  457. --------------------------
  458.  
  459.         These  behave  exactly  like  the  Find Asc/Find Char versions, but
  460.         search  for  any  character that other than the one supplied in the
  461.         second parameter A/A$. This is usefull to skip spaces, just use
  462.  
  463.         A$=Mid$(A$,Find Not Char(A$," "))
  464.  
  465.         Find  Not commands will return 0 if either the string s$ was empty,
  466.         or if s$ only contained the character that wasn't to be found.
  467.  
  468.  
  469. Find Last Asc/Find Last Char
  470. ----------------------------
  471.  
  472.         These  variants  search  from  the end of the string instead of the
  473.         start.  This  means  the if the parameter P is supplied, the search
  474.         begins with the (P-1)th character.
  475.  
  476.  
  477. Find Last Not Asc/Find Last Not Char
  478. ------------------------------------
  479.  
  480.         These  two  search  from  the  end  of the string for any character
  481.         other  than the one contained in A/A$. If P is supplied, the search
  482.         begins from the (P-1)th character
  483.  
  484.       Errors
  485.       ------
  486.  
  487.         An illegal function call occurs in the following circumstances:
  488.  
  489.         - The A$ parameter contained an empty string in any of the Char
  490.           versions
  491.         - The A parameter was greater than 255 or smaller than 0 in any of
  492.           the Asc versions
  493.  
  494.       Note
  495.       ----
  496.  
  497.         These  routines will take any value of P. The value is unsigned, so
  498.         any negative P is taken to be over 200 million!
  499.  
  500.         If  P  is past the end of the string, Find & Find Not will return a
  501.         0. Find Last will just search from the end of the string.
  502.  
  503.  
  504. 2.2 Finding Control Characters
  505. ------------------------------
  506.  
  507.         =Find Control(S$)
  508.         =Find Control(S$,P)
  509.  
  510.         These  special  versions  of  the  above  commands  find  the first
  511.         occurance  of  a  character  with  AscII  below 32 in the string S$
  512.         (Starting  at  position  P+1 if P is supplied). The position of the
  513.         first  control  character  is returned, or 0 if the string contains
  514.         no control characters.
  515.  
  516.         This can also be used to determine if a string is printable:
  517.  
  518.         If Not Find Control(A$) Then Print A$ : Else Print "Unprintable"
  519.  
  520.  
  521. 2.3 Bank name strings
  522. ---------------------
  523.  
  524.         When  you  use  the  ListBank command the first column of the table
  525.         gives  you  the  type  of the bank in an a 8 character string. Easy
  526.         Life gives you commands to read & change these names.
  527.  
  528.         =Bank Name$(NO)
  529.  
  530.         Returns  an  8  character  string  containing the name of the bank.
  531.         Shorter  names  are  padded  with  spaces. NO is the bank number to
  532.         return the name of.
  533.  
  534.         Set Bank Name NO,NAME$
  535.  
  536.         Sets  the  name  of  bank NO to NAME$ (Which must be an 8 character
  537.         string). This change is permanent, and is saved with the bank.
  538.  
  539.         WARNING:  Not  all bank names should be changed, as some extensions
  540.         use  them  to  check the bank type (In fact =message$ does this, so
  541.         don't  change message banks), but it is useful with Sprites, Music,
  542.         Work, and Datas banks.
  543.  
  544.       Errors
  545.       ------
  546.  
  547.         - A "Bank Does Not Exist" error occurs if Bank NO doesn't exist
  548.         - An illegal function call occurs if NO is not a legal bank number
  549.         - An illegal function call occurs if NAME$ is not 8 characters long
  550.  
  551.  
  552. 2.4 Strings & Memory
  553. --------------------
  554.  
  555.         =Mem$(START,LENGTH)
  556.  
  557.         Returns  a  copy of the memory region from START to START+LENGTH in
  558.         a string.
  559.  
  560.         NOTE:  This  is  a  copy  of  the  memory area, put inside the AMOS
  561.         variable  buffer,  so  if  the  memory  area  is later changed, the
  562.         string is not affected.
  563.  
  564.         NOTE:  The  maximum  length  of  a  string  is 65535 characters, so
  565.         length must not be greater than this
  566.  
  567.  
  568.         =Mem$(START,LENGTH,DELIMITER)
  569.  
  570.         This  will  search  the  memory  from  START  to START+LENGTH for a
  571.         character  with  AscII code DELIMITER. Then it will copy the memory
  572.         area  between  START,  and  the  position of the delimiter into the
  573.         string which is returned.
  574.  
  575.         NOTE:  If  the  delimeter character is not found, the entire memory
  576.         segment from START to START+LENGTH is copied.
  577.  
  578.         NOTE: The delimeter itself is not returned on the end of the string.
  579.  
  580.       Errors
  581.       ------
  582.  
  583.         It is easy to get a variable buffer full!
  584.  
  585.         An illegal function call occurs if:
  586.  
  587.         - LENGTH is negative, or 0
  588.  
  589.         - LENGTH is greater than 65535 on the Two parameter function call
  590.  
  591.         - LENGTH is greater than 65535 on the Three paramter call, AND the
  592.           delimeter character is not in the first 65535 bytes of the
  593.           memory area
  594.  
  595.         - The DELIMETER paramter is not between 0 and 255.
  596.  
  597.  
  598.  
  599.  
  600.         Mem START,S$
  601.  
  602.         This  command is the opposite of Mem$. It copies the string S$ into
  603.         memory begining at location START. If S$ is empty, nothing is done.
  604.  
  605.      Errors
  606.      ------
  607.  
  608.         No errors are generated, but you can cause a guru or worse by
  609.         writing strings into memory at random.
  610.  
  611.  
  612.  
  613. 2.5 Message Bank Support
  614. ------------------------
  615.  
  616.         Easy  Life  make  life  much  easier  when you use the Message Bank
  617.         Compiler  Integerated  into  my  PratchED  text  editor.  To  get a
  618.         message, simply use the command:
  619.  
  620.         =message$(BANK,GROUP,NO)
  621.  
  622.         BANK  is  the  number of bank containing the messages. GROUP and NO
  623.         specify which message from within the bank to return.
  624.  
  625.         NOTE:  A  copy  of  the  message  is returned, and it can be edited
  626.         without affecting the original bank.
  627.  
  628.         Messages can also be read from other areas of memory where you have
  629.         loaded a message bank - just replace the BANK parameter in this
  630.         command with the address of the message bank. For example to read
  631.         messages from a powerpacker buffer (See Section 3), use:
  632.  
  633.         =Message$(Pp Buf(BFNO)+20,GROUP,NO)
  634.  
  635.         NOTE: 20 is added to the start of the powepacker buffer as the .Abk
  636.         file which would be loaded into the buffer has a 20 character
  637.         header, and =Message$ must be passed the start of the bank.
  638.         
  639.  
  640.       Errors
  641.       ------
  642.  
  643.         If  the  bank name is not "Message " a Not A Message Bank error
  644.         occurs. An illegal function call occurs when:
  645.  
  646.         - The group given does not exist
  647.         - The message number given does not exist in the given group
  648.  
  649.         A "bank does not exist" error may also occur.
  650.  
  651.  
  652.  
  653. 2.6 Strings and Integers
  654. ------------------------
  655.  
  656.         = Long$(NUM)
  657.  
  658.         This function loads an integer into a string. It is the equivilent
  659.         of:
  660.  
  661.         a$=space$(4) : Copy varptr(NUM),varptr(NUM)+4 To varptr(a$)
  662.  
  663.         It differs from str$, in that the integer is always stored in 4
  664.         bytes, as it is in memory. This makes Print #1,Long$(NUM) a good
  665.         way of writing integers to a file.
  666.  
  667.  
  668.         = Long(S$)
  669.  
  670.         This is the compliment of the = Long function. It takes the first
  671.         4 bytes of a string, and converts them to an integer. It is useful
  672.         to read back numbers stored in strings with long$, or binary data
  673.         stored in a string.
  674.  
  675.         NUM=Long(Input$(1,4)) is a usefull function call to read from a
  676.         file containing data created by Long$.
  677.  
  678.  
  679.         = Word$(NUM)
  680.  
  681.         This is similar to Long$, but only stores the lower word of the 
  682.         number. This means that Word$ should only be used for values
  683.         between -32768, and 32767. Its advantage is that the string
  684.         returned is only 2 bytes long, instead of 4
  685.  
  686.  
  687.         = Word(S$)
  688.  
  689.         This reads back a word stored in a string. The value read from the
  690.         string is sign - extended, which is why it was said only to use
  691.         values between -32768 and 32767 with Word$.
  692.  
  693.         You can, however, use word$ with values between 0 and 65535
  694.         instead, and use the following call to decode them:
  695.  
  696.         NUM = Asc(S$)*256+Asc(mid$(s$,2))
  697.  
  698.     Errors
  699.     ------
  700.  
  701.         Out of Variable Space           No memory to create the string/
  702.                                         integer.
  703.         Illegal Function Call           The S$ parameter was not a long
  704.                                         enough string (it must be at
  705.                                         least 2 bytes for Word, and 4 bytes
  706.                                         for Long).
  707.  
  708.  
  709. 2.7 Character Counting
  710. ----------------------
  711.  
  712.         = Find Num Char(S$,A$)
  713.         = Find Num Asc(S$,A)
  714.  
  715.         The syntax of these commands is very similar to that of the other
  716.         Find Asc/Char commands, but instead of returning the position of
  717.         the character A/A$ in the string S$, it returns the number of
  718.         times it occurs.
  719.         
  720.     Errors
  721.     ------
  722.  
  723.         Illegal Function Call           A is not between 0 and 255.
  724.         
  725.                                         A$ is an empty string.
  726.  
  727.  
  728.  
  729.                       Section 3.0 Powerpacker Support
  730.                       ===============================
  731.  
  732.  
  733.  
  734.         Easy  Life  provides  7  commands  to  allow  you  Load,  and  Save
  735.         powerpacked  files. To use any of these powerpacker.library version
  736.         35 or greater must be in LIBS:
  737.  
  738. 2.8 Multiple Occurances Characters
  739. ----------------------------------
  740.  
  741.         = Find Nth Char(S$,A$,N)
  742.         = Find Nth Asc(S$,A,N)
  743.  
  744.         This varient  of find  char/asc  finds  the  Nth  occurance  of the
  745.         character  A$/A in the  string S$,  or  0 if the string S$ does not
  746.         contain N occurances of A/A$.
  747.         
  748.  
  749. 3.1 Loading Powerpacked Data
  750. ----------------------------
  751.  
  752.         The principle behind loading powerpacked data is:
  753.  
  754.         1 Use PP Load to load & decrunch the data
  755.  
  756.         2 Using PP Buf & PP Len to find the data
  757.  
  758.         3 Perform whatever operations your program requires on the data
  759.  
  760.         4 Use PP Free to return the memory to the system
  761.  
  762.  
  763.  
  764.         Pp Load BUF,FILE$,DECRUNCH
  765.  
  766.         This  command will load a file into memory, then decrunch it, if it
  767.         was  compacted  with  powerpacker. BUF is a number from 0-7 used to
  768.         choose which of the 8 buffers to load the file into.
  769.  
  770.         NOTE:  If  the  chosen  buffer  already contained data, it is freed
  771.         first.
  772.  
  773.         NOTE:  Pp  Load  will load uncrunched data without any problems, so
  774.         you  don't  have to worry about whether the file you are loading is
  775.         crunched  or  not.  The only problem is if it was not crunched with
  776.         powerpacker.
  777.  
  778.         FILE$  is  the  name  of the file to load. It is important that the
  779.         full path be given, and that the file exists. E.g.
  780.  
  781.         If F$<>""
  782.             If Exist(F$)
  783.                 Pp Load 0,F$,2
  784.             Else
  785.                 Print "File Not Found"
  786.             End If
  787.         End If
  788.  
  789.  
  790.         DECRUNCH  must  be  an integer between 0 and 4, and determines what
  791.         happens  when  the file is decrunched. I recommend that option 3 is
  792.         not  used  with  AMOS  screens,  but  it does not generate an error
  793.         message,  as  your  program  may run on an intuition screen, if you
  794.         have an intuition extension.
  795.  
  796.         0 : Flash colour 0 when decrunching
  797.         1 : Flash colour 1 when decrunching
  798.         2 : Flash colour 17 when decrunching (Mouse Pointer)
  799.         3 : Wobble Screen while decrunching (No effect on AMOS screens)
  800.         4 : Do nothing while decrunching
  801.  
  802.     Errors
  803.     ------
  804.  
  805.  
  806. 3.2 Reading the loaded data
  807. ---------------------------
  808.  
  809.         Once  data  is loaded and decrunched with PP Load, you will need to
  810.         read  it.  The  data  is  decrunched  into one of 8 areas of memory
  811.         (buffers), numbered from 0 - 7.
  812.  
  813.         =Pp Buf(NO)
  814.  
  815.         Will return the address of the start of buffer NO
  816.  
  817.         =Pp Len(NO)
  818.  
  819.         Will return the address of buffer NO
  820.  
  821.  
  822.         You  can  used  Peek / Poke / Deek / Doke / Leek / Loke to read the
  823.         buffer,  and  write to it (But don't write past pp Buf + pp len, as
  824.         this memory could be anything).
  825.  
  826.         The buffer can be written back with either Bsave, or PP crunch.
  827.  
  828.         You  can  also use mem$ to transfer the buffer contents to the AMOS
  829.         variable  buffer.  If  the file is a text file, you can read it one
  830.         line at a time with:
  831.  
  832.         Pp Load 0,file$,2
  833.         POS=0
  834.         While POS<Pp Len(0)
  835.             A$=Mem$(Pp Buf(0)+POS,Pp Len(0)-POS,10)
  836.             POS=POS+Len(A$)+1
  837.             '
  838.             'Now do whatever your going to do with A$
  839.             '
  840.         Wend
  841.         pp free 0
  842.  
  843.         This  segment  of code will read the buffer up to asc code 10 (Line
  844.         Feed)  into  the  string  A$, and point POS to the next line. If no
  845.         Line Feed is found, the remainder of the buffer is next into A$
  846.  
  847.     Errors
  848.     ------
  849.  
  850.         Pp  Buf  & Pp Len will cause an illegal function call if the buffer
  851.         no  parameter  is  not between 0 and 7. If the chosen buffer is not
  852.         in use, both will return a 0.
  853.  
  854.  
  855. 3.3 Disposing of buffers
  856. ------------------------
  857.  
  858.         When you've finish with a buffer, it must be returned to the system.
  859.  
  860.         Pp Free NO
  861.  
  862.         will  return  buffer NO (0-7) to the system. Future calls to Pp Buf
  863.         and  Pp  Len  will  return  0, until Pp Load is used to reserve the
  864.         buffer again.
  865.  
  866.         NOTE:  Under  any  of  the following circumstances, ALL buffers are
  867.         Freed.
  868.  
  869.         - You choose the Quit option from the AMOS editor
  870.  
  871.         - Your compiled program (Run outside of AMOS) ends
  872.  
  873.         - You use the System command
  874.  
  875.         - You use the Default command
  876.  
  877.         - You  perform  some  other action  (Such as running a program from
  878.           the editor) which causes AMOS to automatically do a Default.
  879.  
  880.         Memory  buffers  are NOT freed, when your program ends, and returns
  881.         to  amos, or an error occurs, and you return to amos. You can still
  882.         use  Pp  Buf & Pp Len, even after editing the program (Which clears
  883.         the AMOS variable buffer).
  884.  
  885.       Errors
  886.       ------
  887.  
  888.         An illegal function call occurs if NO is not between 0 and 7.
  889.  
  890.         No  error  occurs  if  you  attempt to free an already free buffer.
  891.         This  is  perfectly  OK to do, and won't cause a memory freed twice
  892.         guru (anymore!).
  893.  
  894.  
  895.  
  896. 3.4 Saving Powerpacked Data
  897. ---------------------------
  898.  
  899.         = Pp Crunch(FILE$,START<LENGTH),EFFICIENCY,BUFFER)
  900.  
  901.         Easy  life  also  allows  you  to  save  any block of memory, after
  902.         crunching  it  with  the powerpacker routine. This does not use the
  903.         buffer  system  used  by  the other PP commands, but you can use Pp
  904.         Buf & Pp Len as the START and LENGTH parameters.
  905.  
  906.         FILE$  = The name to save the crunched file to. It must have a full
  907.         path, and the directory must exist.
  908.  
  909.         START, and LENGTH define the block of memory to save.
  910.  
  911.         EFFICIENCY  is  an  integer  between  0  and  4  setting the crunch
  912.         effeciecy (0 = Fast, 4 = Best)
  913.  
  914.         BUFFER  is  the  size  of speedup buffer to use. 0=Large, 1=Medium,
  915.         2=Small.  If  there is not enough memory for the buffer you choose,
  916.         a smaller one will be used
  917.  
  918.         Pp  Crunch  will  crunch  & save the file, and return the length of
  919.         the crunched file.
  920.  
  921.  
  922.     Errors
  923.     ------
  924.  
  925.         "Out  of  memory"  may  occur  if  there  if no memory for even the
  926.         smallest  crunch  buffer.  An  illegal  function call occurs if you
  927.         pass  an  illegal  EFFICIENCY  /  BUFFER  value, or a 0 or negative
  928.         LENGTH.
  929.  
  930.         Various I/O errors can also occur when saving the file.
  931.  
  932.  
  933. 3.5 Loading the library
  934. -----------------------
  935.  
  936.         PP  Load  &  PP  Crunch both require the powerpacker.libarary file.
  937.         However,  to  save  memory,  this  file  is not loaded until one of
  938.         these  commands  is  used,  and  after the command is complete, the
  939.         library  could  be  disposed  of  by the system if the memory it is
  940.         using  is  required. If the LIBS: directory will not be permanently
  941.         available,  this  may be inconvinent, so EasyLife provides a way of
  942.         keeping the library in memory.
  943.  
  944.         PP Keep On
  945.  
  946.         The  command  will load the library if it is not already in memory,
  947.         and  then keep it there until you quit AMOS, or use the PP Keep Off
  948.         command.
  949.  
  950.         PP Keep Off
  951.  
  952.         This  command  informs the system that it is free to dispose of the
  953.         powerpacker library at its leisure.
  954.  
  955.         NOTE:  PP  Keep  Off  does not remove the library, it just lets the
  956.         system remove it if it is necessary.
  957.  
  958.  
  959.                        Section 4.0 - BITS and Pieces
  960.                        =============================
  961.  
  962.  
  963.  
  964. 4.1 Testing and setting
  965. -----------------------
  966.  
  967.         AMOS  provides  you  with  Btst,Bset,Bclr and Bchg instructions for
  968.         testing   /  setting  individual  bits.  However,  unless  you  are
  969.         changing  the  bits of an AMOS integer variable, these only work on
  970.         bytes.  Easy  Life provides coresponding commands for use with long
  971.         words & words.
  972.  
  973.  
  974.         NOTE:  With  all these commands, the second parameter is ALWAYS the
  975.         address  to  test/set, even if it is a variable name. The AMOS Bxxx
  976.         commands  do  not  treat the second parameter as an address, unless
  977.         it is an expresion.
  978.  
  979.  
  980.         =Wtst(BIT,ADDR)
  981.         =Ltst(BIT,ADDR)
  982.  
  983.         Both  return  TRUE  if bit BIT of the Word/LongWord in address ADDR
  984.         is set, and FALSE if it is clear.
  985.  
  986.  
  987.         Wset BIT,ADDR
  988.         Lset BIT,ADDR
  989.  
  990.         Set bit BIT of the Word/LongWord in address ADDR
  991.  
  992.  
  993.         Wclr BIT,ADDR
  994.         Lclr BIT,ADDR
  995.  
  996.         Clear bit BIT of the Word/LongWord in address ADDR
  997.  
  998.  
  999.         Wchg BIT,ADDR
  1000.         Lchg BIT,ADDR
  1001.  
  1002.         Change  bit BIT of the Word/LongWord in address ADDR. I.E. If it is
  1003.         set, clear it, and vice versa.
  1004.  
  1005.  
  1006.  
  1007. 4.2 Extension Extenders
  1008. -----------------------
  1009.  
  1010.         = Extb(N)
  1011.         = Extw(N)
  1012.  
  1013.         These  commands  will  sign extend numbers from bytes/words to long
  1014.         words.  To  see  what  this  means, imagine AMOS integers as 32 bit
  1015.         binary numbers e.g. 42 is:
  1016.  
  1017.         00000000 00000000 00000000 00101010
  1018.                                    *
  1019.  
  1020.         Sign  extending  from  a  byte (extb) looks at bit 7 (*) and copies
  1021.         it's  value  into  all the bits to it's left. This has no effect on
  1022.         the number 42, but 139 is changed:
  1023.  
  1024.         00000000 00000000 00000000 10001011
  1025.                                    *
  1026.         becomes:
  1027.  
  1028.         11111111 11111111 11111111 10001011
  1029.  
  1030.  
  1031.         AMOS  will  interpret  the  bit pattern as -117, as 10001011 is the
  1032.         bit  pattern  for  -117 in signed 8 bit arithmatic, but for 139, in
  1033.         unsigned 8 bit arithmatic.
  1034.  
  1035.         Extw  copies  bit  15 into all the places to it's left. Extb & Extw
  1036.         can be used to translate signed bytes & words into AMOS integers.
  1037.  
  1038.  
  1039.  
  1040.  
  1041.                         Section 5.0 - I/O Commands
  1042.                         ==========================
  1043.  
  1044.  
  1045. 5.1 Protection
  1046. --------------
  1047.  
  1048.         Easy  life  gives  you  two  commands  to reading, and changing the
  1049.         protection bits of files and directories.
  1050.         
  1051.         =Protect(FILE$)
  1052.         This  command  returns  the protection bits of FILE$ as an integer.
  1053.         
  1054.         Set  Protection  FILE$,P
  1055.         
  1056.         This command sets the protection bits of FILE$ from the integer P.
  1057.         
  1058.     Interpreting the value of P
  1059.     ---------------------------
  1060.     
  1061.  
  1062.         The  protection  bits  are returned in the lower 8 bits of P. Their
  1063.         meanings  are  given  below.  When using Set Protection, you should
  1064.         only  set  these  bits  of P.
  1065.         
  1066.         Bit             Meaning Clear           Meaning Set         
  1067.         0               Can be deleted          Can't be deleted     
  1068.         1               Can be executed         Can't be executed  
  1069.         2               Can be read from        Can't be read from 
  1070.         3               Can be writen to        Can't be writen to  
  1071.         4               File not an archive     File is an archived 
  1072.         5               File not pure           File Pure          
  1073.         6               File  not a DOS script  File is a DOS script 
  1074.         7               File visible in lists   File hidden is lists
  1075.                         
  1076.  
  1077.         NOTE:  Only  bits  0-3  should be set on a directory NOTE: Bits 0-3
  1078.         are  the  opposite of the ----rwed in directory lists. Bits 4-7 are
  1079.         the  same as hSpa----. This is so the default protection setting is
  1080.         0. 
  1081.         
  1082.                         Section 6.0 - Miscelanous Commands
  1083.                         ==================================
  1084.         
  1085.         
  1086. 6.1 The AMOS Data zone 
  1087. ----------------------
  1088.         
  1089.         = AMOS Data
  1090.  
  1091.         Returns  the  base  address of the internal AMOS data zone. See the
  1092.         file  _equ.s  in  the  extension  folder  of you AMOS Extras / AMOS
  1093.         Updater disk. 
  1094.  
  1095.  
  1096.         = Easy Base(N)
  1097.  
  1098.         This command is mainly for debugging EasyLife. The value returned
  1099.         depends on the value of N.
  1100.  
  1101.         N=0     Returns the base address of the EasyLife Data Zone. See
  1102.                 the source code for the structure of the data zone - it's
  1103.                 just after the first section of code.
  1104.  
  1105.         N>0     Returns the RastPort AMOS is currently using.
  1106.  
  1107.         N<0     Returns the address of the locked fonts structure
  1108.  
  1109.  
  1110.         NOTE: The funciton of this command for N=0 will remain the same
  1111.         in the future, but for other N, it's purpose may change - depending
  1112.         on what part of the extension I have last been trying to debug!
  1113.  
  1114.  
  1115. 6.2 Font Handling
  1116. -----------------
  1117.  
  1118.         AMOS does not provide any way of ensuring a font is in memory, and
  1119.         sometimes removes one from memory when you don't want it to.
  1120.         Easylife can prevent this from happening.
  1121.  
  1122.     Section 6.2.1 Locking Fonts
  1123.     ---------------------------
  1124.  
  1125.         REALSIZE = Lock Font(FONTNAME$,FONTSIZE)
  1126.  
  1127.         The lock font command checks if a font is in memory, and if it is
  1128.         not attempts to load it from disk. If the font is now available, it
  1129.         is locked, so it cannot be removed from memory by AMOS (Or anything
  1130.         else).
  1131.  
  1132.         FONTNAME$ is the name of the font to lock, and must end in ".font".
  1133.         FONTSIZE is the size of the font to load from the disk, but with
  1134.         some fonts, the size of the font listed in the FONTS: directory is
  1135.         not the same as the actual size of the font, which appears in the
  1136.         AMOS Get Fonts list. Therefore, Lock Font returns the actual size
  1137.         of the font locked, so it can be looked up on the AMOS list.
  1138.  
  1139.         Example
  1140.         -------
  1141.  
  1142.         The following procedure locks & returns the AMOS font number of
  1143.         the given font:
  1144.  
  1145.         Procedure FONT_NUM[N$,SIZE]
  1146.         '
  1147.         RS$=Mid$(" "+Str$(Lock Font(N$,SIZE)),1,3)
  1148.         Get Rom Fonts : A=0
  1149.         Repeat
  1150.            Inc A
  1151.         Until (Mid$(Font$(A),1,Len(N$))=N$) and (Mid$(Font$(A),30,3)=RS$)
  1152.         '
  1153.         End Proc[A]
  1154.  
  1155.         NOTE: I Use Mid$(X$,1,L) instead of Left$(X$,L), because there
  1156.               appears to be a bug in using Left$ with the compiler in some
  1157.               situations.
  1158.  
  1159.  
  1160.         Errors
  1161.         ------
  1162.  
  1163.         An Unable to lock font error will occur if:
  1164.  
  1165.         - You give a non-existant name/size of font
  1166.  
  1167.         - The font is not in the directory assigned to FONTS:
  1168.  
  1169.         - You have already locked 32 fonts
  1170.  
  1171.  
  1172.     6.2.2 Unlocking Fonts
  1173.     ---------------------
  1174.  
  1175.         Unlock Fonts
  1176.  
  1177.         This command takes no parameters and unlocks all fonts that have
  1178.         previously been locked. All fonts are also unlocked when:
  1179.  
  1180.         - You use a Default Command
  1181.  
  1182.         - You quit AMOS / A Compiled program
  1183.  
  1184.         - You run a program within AMOS
  1185.  
  1186.         NOTE: Unlocking a font does not remove it from memory, it just
  1187.         permits other programs / commands to remove it.
  1188.  
  1189.  
  1190.                       Section 7 - Intuition Functions
  1191.                       ===============================
  1192.  
  1193. 7.1 - The Workbench
  1194. -------------------
  1195.  
  1196.         AMOS provides a Close Workbench command, but does not provide a
  1197.         way to check if it did actually close, or a way to open it again.
  1198.         EasyLife to the rescue.....
  1199.  
  1200.  
  1201.         = I Close Workbench
  1202.  
  1203.         This function does exactly the same thing as the AMOS Close
  1204.         Workbench command - closes the workbench screen, if not other
  1205.         tasks are using it - but returns either:
  1206.  
  1207.                 0 - the workbench screen could not be closed
  1208.  
  1209.                -1 - the workbnech screen was either closed sucessfully,
  1210.                     or was already closed.
  1211.  
  1212.  
  1213.         = I Open Workbench
  1214.  
  1215.         This command re-opens the workbench screen, and restarts the
  1216.         workbench program, using the following algorythm:
  1217.  
  1218.         If the workbench screen is already open, nothing happens, and
  1219.         a value of -1 is returned.
  1220.  
  1221.         EasyLife then attempts to open the Workbench screen.
  1222.  
  1223.         If this fails, a value of 0 is returned
  1224.  
  1225.         If the screen opened, and the LoadWb command has been used, the
  1226.         workbench is restarted.
  1227.  
  1228.         If the screen opened, -1 is returned
  1229.  
  1230.  
  1231.         = I Test Workbench
  1232.  
  1233.         This function returns -1, if the workbench screen is open, or 0
  1234.         if it is closed.
  1235.  
  1236.  
  1237.     Side Effect
  1238.     -----------
  1239.  
  1240.         I Close Workbench & I Test Workbench have the side effect of
  1241.         bringing the workbench screen to the front of all other intuition
  1242.         screens (But not in front of AMOS Screens). This means:
  1243.         
  1244.         - If I Close Workbench fails, the workbench screen will be put in
  1245.         front of other screens.
  1246.         
  1247.         - After an I Test Workbench, the workbench screen is brought to
  1248.         the front if it is open. You may like to call I Test Workbench
  1249.         simply for this purpose after an I Open Workbench.
  1250.         
  1251.  
  1252. 7.2 Iconifying AMOS        
  1253. -------------------
  1254.  
  1255.         A = Iconify Amos(X,Y,TITLE$)
  1256.  
  1257.         This  command  opens the workbench screen, and opens a small window
  1258.         on it at co-ordinates  (X,Y)  with  the name TITLE$. It has a close
  1259.         window gadget, and depth gadget(s), and is moveable. 
  1260.         
  1261.         If  you  activate the window, then press the right mouse button, or
  1262.         you press  the  close  window gadget, the window is closed, and the
  1263.         following value is returned.
  1264.         
  1265.         -1 = The close window gadget was pressed
  1266.         
  1267.         0  = Then right mouse button was pressed with the window active
  1268.         
  1269.         1  = Couldn't open workbench screen (Usually no chipmem)
  1270.         
  1271.         2  = Couldn't open window (Usually illegal co-ordinates)
  1272.         
  1273.         NOTE:  This  command suspends your AMOS program until the window is
  1274.         closed
  1275.         
  1276.     Using Iconify AMOS      
  1277.     ------------------
  1278.          
  1279.         It  is  recommended  that you always use the following procedure to
  1280.         call iconify amos:
  1281.         
  1282.         Procedure ICONIFY[X,Y,TITLE$]
  1283.             Amos Lock
  1284.             Amos To Back
  1285.             A=Iconify Amos[X,Y,TITLE$]
  1286.             Amos To Front
  1287.             Amos Unlock
  1288.         End Proc[A]
  1289.  
  1290.         The Lock/Unlock disable Left-Amiga-A switching, as the program is
  1291.         frozen while the window is displayed. An alternative method is to
  1292.         lock amos at the start of your program, and leave it locked, and
  1293.         remove the lock/unlock commands from this procedure.
  1294.         
  1295.         Is possible you should close your AMOS screens when iconifing, as
  1296.         this saves some memory.
  1297.         
  1298.           
  1299.          
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.