home *** CD-ROM | disk | FTP | other *** search
/ Old Hackers Atari User Group Newsletter / Old_Hackers_Atari_User_Group_Newsletter_OHMJ95B.atr / hbinbas.txt < prev    next >
Text File  |  2023-02-26  |  9KB  |  1 lines

  1.  **************************************¢ *                                    *¢ *    BINARY  &  BASIC  MENU/LOADER   *¢ *                                    *¢ *        Copyright  (c)   1987       *¢ *        By  Mike Apocourastos,      *¢ *           UNISOFT  Systems         *¢                  **¢   NOTE # 1 'BINBASME.OBJ' IS ON THIS  ¢           OL' HACKERS NEWSLETTR DISK! ¢                   *¢   NOTE # 2: The files which are to  be¢ displayed must be protected-Supporting¢ files like Character Sets, Screens and¢ other data files as well as DOS &  DUP¢ may clutter the display unnecessarily.¢ By locking the main files the unwanted¢ unlocked files stay hidden.  Go to DOS¢ and use  [ F ] key to LOCK programs so¢ that they will show up when program is¢ run!¢    Pressing  the 1-8 keys will display¢ the files on the  drive  corresponding¢ to  the  appropriate   drive   number.¢ Reading  the  directory  of  a drive a¢ SECOND   TIME,   will    REMOVE    the¢ restriction  of  the locked files, and¢ display the whole directory until  the¢ directory  of  another  drive is read.¢ **************************************¢ *                                    *¢ *    This  program is the property of*¢ *the author, and  it may not  b  sold*¢ *without  his  written consent.      *¢ *    However,  it  may  be duplicated*¢ *and freely exchanged, providing that*¢ *all notices are  left intact.       *¢ *                                    *¢ **************************************¢ *                                    *¢ *    Donations  (not  mandatory)  are*¢ *most welcomed.  For complete  source*¢ *listings,  donations,  comments  and*¢ *recommendations,  write  to:        *¢ *                                    *¢ *     Mike  Apocourastos             *¢ *    84 Lissington  Drive,  S.W.     *¢ *     Calgary,  Alberta.             *¢ *    T3E-5E3  -  CANADA              *¢ *     >>>>or  call<<<<               *¢ *                                    *¢ *     CALTARI  Users Group BBS       *¢ *     (403)  285-3382                *¢ *                                    *¢ **************************************¢¢ LONG AGO¢¢    In the older  days  of  ATARI,  the¢ closest  thing  to  an  automatic load¢ were these handy little programs which¢ could run a basic or binary file.¢¢ STEP 2¢    The next step, was to add a routine¢ to offer the user a choice of programs¢ to  run.  Useful  as  they were, these¢ programs had a  major  drawback.  They¢ could  only  load  one  type  of files¢ only. Basic or binary.¢¢ IMPROVEMENTS¢    This program is a further extension¢ of  these utilities. Its major feature¢ is the capability of  running  a  file¢ regardless  of  type.  There  are also¢ additional features to make its use as¢ easy as possible.¢¢ FAST MACHINE LANGUAGE¢    The   utility   is   100%   machine¢ language,  and it may be binary loaded¢ or   renamed   to   AUTORUN.SYS    for¢ automatic  execution. The state of the¢ internal   cartridge    is    of    no¢ importance,  meaning that the computer¢ may be  booted  without  pressing  the¢ [OPTION] key.¢¢ The MENU¢    The files which are to be displayed¢ must be  protected.  Supporting  files¢ like character sets, screens and other¢ data files as well as DOS and DUP  may¢ clutter  the display unnecessarily. By¢ locking the main  files  the  unwanted¢ files stay hidden.¢    Pressing  the 1-8 keys will display¢ the files on the  drive  corresponding¢ to  the  appropriate   drive   number.¢ Reading  the  directory  of  a drive a¢ second   time,   will    remove    the¢ restriction  of  the locked files, and¢ display the whole directory until  the¢ directory  of  another  drive is read.¢ This is not as confusing as it sounds.¢ In  short, every time the directory of¢ a new drive is read, only  the  locked¢ files will show.¢¢ DISPLAY¢    Twenty  six  files may be displayed¢ at the  same  time,  each  assigned  a¢ letter  from  A  to  Z. When there are¢ more than 26 files in  the  directory,¢ the  program prompts the user to press¢ the space bar for 26 more.¢¢ SpartaDos¢    SpartaDos   users   may   use   the¢ underline  [_]  character  to separate¢ words in a filename. This character is¢ displayed  as  a  space  on  the menu,¢ providing   the  user  with  a  better¢ looking   directory.   Users   without¢ SpartaDos may use the [?] character to¢ accomplish the same. However,  a  disk¢ utility  will  have  to  be  used   in¢ renaming a file with this character.¢¢ BACK TO DOS¢    Finally,  the escape key will cause¢ the program to return  to  DOS,  where¢ DUP.SYS may be loaded.¢¢ FILE SELECTION¢    Selection of a file is accomplished¢ by pressing the corresponding  letter.¢ Detection  of  the file type (Basic or¢ binary) turns the cartridge on or off,¢ and the loading process is continued.¢    Certain  programs  are hybrid. They¢ consist of a machine language program,¢ which  in  turn loads and runs a basic¢ file. To keep BASIC from being  turned¢ off when such files are loaded, one of¢ the console keys must be pressed  when¢ the selection is being made.¢¢ The LOADING process.¢    There  are  two independent loaders¢ in this program. A binary loader,  and¢ a basic loader.¢¢ BASIC LOAD¢    The  principal  behind  the   basic¢ loading  process  is  a little tricky.¢ The BASIC editor works  by  GETting  a¢ user  input,  and  acting  upon it. To¢ make it do the same thing without user¢ interaction,  the   GET   routine   is¢ changed  and the input is aquired from¢ the buffer instead of the keyboard.¢¢ BINARY LOAD¢    Unlike other utilities which depend¢ on  DOS for loading binary files, this¢ has its  own.  It  enables  it  to  be¢ operational  regardless  of the DOS in¢ use.   And  since  this  part  of  the¢ routine occupies memory normally  left¢ alone  by  others,  it   should   load¢ virtually any binary file.¢                **¢ TECHNICAL INFORMATION¢    This  program  is   actually   four¢ utilities  in  one.  Each of the parts¢ may be used independently, and may  be¢ used in other programs.¢    When  the  menu  is  entered,   the¢ contents of the accumulator are saved.¢ A non-zero number signifies  that  the¢ locked  file  option  is to be used. A¢ zero enables the  program  to  display¢ all files.¢    The  cartridge  is  controlled   by¢ manipulating  memory  location   54017¢ ($D301),  as well as the basic flag at¢ 1016 ($03F8) and the  cartridge  state¢ at  location  6.  A  problem   however¢ arises  when  the routine is used with¢ version 2.x  of  SpartaDos.  It  seems¢ that  due to its nature, this DOS does¢ not allow outside interference.  Every¢ time  the cartridge state is reversed,¢ DOS resets it. Therefore, the  routine¢ also  modifies the locations where the¢ state of the  cartridge  is  saved  in¢ SpartaDos 2.x.¢    In  using  the  basic  and   binary¢ loaders,  the  file must be closed and¢ the name  buffer  must  hold  a  legal¢ filename.  The  files must be have the¢ legal headers. ($00 $00 for basic, $FF¢ $FF  for  binary)  It  does not matter¢ where these routines reside,  but  the¢ binary  loader  may  conflict  with  a¢ loading  file.  An  answer   to   this¢ problem,  is  to  place the utility in¢ the stack, at $0100 providing that the¢ pointer doesn't venture too low.¢    When  a  basic  file is about to be¢ loaded, the GET pointer of the  editor¢ is  forced to point to a routine which¢ simulates a keyboard input. The string¢ RUN  "Dx:FILENAME.EXT"  is passed over¢ to the editor  one  character  at  the¢ time, and a carriage return causes the¢ original GET address to be reinstated.¢ With  a  command  in  its  buffer, the¢ editor will proceed to execute it.¢    The binary file load is  completely¢ different.  Each  segment  is   loaded¢ separately,  while  the INIT vector is¢ monitored. When this vector contains a¢ valid  address,  (anything  over  $00)¢ control  of  the  processor  is passed¢ over to the routine  pointed  by  this¢ vector  for another program execution.¢ When the  routine  exits,  control  is¢ passed  back  to  this  here,  and the¢ loading process is continued until the¢ vector  is  loaded again, or there are¢ no more segments to load. At this time¢ the  RUN  vector  is   examined,   and¢ control  is  once again passed. At the¢ absence of valid contents,  the  first¢ memory    location    loaded   assumes¢ control.¢¢ SHORT AND SWEET¢    The utility uses 10 single  density¢ sectors  on  the  disk,  making  it an¢ efficient alternative  to  DUP.SYS  or¢ typing whole filenames.¢ **************************************¢