home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !MAGS / ICTARI / ICTARI24.ZIP / ICTARI.TXT < prev    next >
Text File  |  1995-07-14  |  37KB  |  656 lines

  1.  
  2.      ICTARI USER GROUP             ISSUE 24                     July 1995
  3.  
  4.          ___   ______     ___       _________   _________   ___
  5.          \__\  \   __\    \  \__    \______  \  \   _____\  \__\
  6.            ___  \  \       \  __\     _____\  \  \  \         ___
  7.            \  \  \  \       \  \      \  ____  \  \  \        \  \
  8.             \  \  \  \_____  \  \____  \  \__\  \  \  \        \  \
  9.              \  \  \       \  \      \  \        \  \  \        \  \
  10.               \__\  \_______\  \______\  \________\  \__\        \__\
  11.  
  12.                      *   m   a   g   a   z   i   n   e   *
  13.  
  14.      =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15.                        I C T A R I   U S E R   G R O U P
  16.       63 Woolsbridge Road, Ringwood, Hants, BH24 2LX   Tel. 01425-474415
  17.      =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  18.  
  19.                               INDEX FOR ISSUE 24
  20.                               ==================
  21.  
  22.      ASSEMBLY        Floating Point routines (needs fixing, see below).
  23.                      Picture conversion package (PICPAC) update.
  24.  
  25.      C               Bouncing Ball demo program.
  26.                      Tim Oren GEM Tutorial. Part 13. A new form manager.
  27.  
  28.      GFA             Naval Battle Game program.
  29.  
  30.      STOS            Variable to string converter code.
  31.  
  32.      MISC            Chain program.
  33.                      Using the Atari clipboard.
  34.                      Current membership list.
  35.                      Index for issues 1-23.
  36.  
  37.      In next months issue of ICTARI (this may change) :-
  38.  
  39.      ASSEMBLY
  40.  
  41.      C               Tim Oren GEM Tutorial. Part 14. User interfaces.
  42.  
  43.      GFA             Weller Tools utilities.
  44.  
  45.      STOS            Print examples using M Cubitts STOS extension.
  46.                      STOS loader program, etc for Missing Link Extn.
  47.  
  48.      MISC            Mårten Lindström, GEM Guide. Part 1.
  49.                      How GDOS works.
  50.  
  51.      ----------------------------------------------------------------------
  52.                                    EDITORIAL
  53.                                    =========
  54.      TEAM GAME
  55.      ---------
  56.      Congratulations to Ralph Lovesy  on  the  good  reviews  that his Team
  57.      football game is getting in the  glossy magazines, perhaps he will now
  58.      write a decent cricket game for  the  ST, the existing ones are pretty
  59.      pathetic. It would also be interesting to know the problems of getting
  60.      a program on the  market,  perhaps  Ralph  would  write an article for
  61.      ICTARI  about  the  processes  involved,  i.e.  programming,  artwork,
  62.      advertising, packaging, etc, etc.
  63.  
  64.      PUBLICITY
  65.      ---------
  66.      This month we have been in contact  with Atari World magazine who have
  67.  
  68.      promised to publish  an  article  about  ICTARI,  probably  in issue 5
  69.      (August 95). Hopefully this will bring in a few more members.
  70.  
  71.      Thanks also to a couple of  members  who have sent in MicroMart advert
  72.      pages. We send one advert  to  MicroMart  each month when the magazine
  73.      disks are sent out. If you buy the MicroMart magazine, please save the
  74.      advert pages for us and send them in when you have a few.
  75.  
  76.      PICPAC UPDATE
  77.      -------------
  78.      In ICTARI issue 16  we  published  a  set of picture packing/unpacking
  79.      routines by Mårten Lindström. Mårten  has  now  sent  in an update for
  80.      these routines which now includes  code  for  GIF  and TIFF formats as
  81.      well as GFA routines and  advice  on  using them with other languages.
  82.      All the articles and source code can  be found in the ASSEMBLY folder.
  83.      We would also like to  hear  from  anyone  who  uses these routines in
  84.      another language such as C, Pascal, etc. Also in the same folder is an
  85.      article and code  for  converting  GEM  colour  palettes  when loading
  86.      picture files.
  87.  
  88.      NAVAL GAME
  89.      ----------
  90.      In the GFA folder is a PD  Naval Game program which has an interesting
  91.      speech synthesis option. Since I  don't  know  much about GFA Basic it
  92.      would be useful if a  GFA  expert  could  provide some example code in
  93.      another language (C or Assembler perhaps) on using the speech program.
  94.      The speech generator itself appears to  be a separate .TOS program and
  95.      so could presumably be used  from  any  language  and even as a stand-
  96.      alone program.
  97.  
  98.      FOR ASSEMBLER PROGRAMMERS
  99.      -------------------------
  100.      In the ASSEMBLY folder is some  source  code  of a package of floating
  101.      point arithmetic routines  which  were  taken  from  the November 1985
  102.      issue of Personal Computer  World  magazine.  Unfortunately I have not
  103.      been able to get them to work and  I hope that someone will be able to
  104.      do this for us as they could be quite useful. The code has been copied
  105.      exactly as it appeared in the magazine with all the comments that were
  106.      published and it has  been  checked  over  for mistakes several times.
  107.      Also, as far as I know, there were no subsequent articles published in
  108.      later magazines to correct any errors.
  109.  
  110.      The author does  not  give  enough  detailed  information  on  how the
  111.      floating point numbers are represented in  binary format and also does
  112.      not provide any routines to  convert  from  normal  ASCII format to or
  113.      from the floating point  format  which  would  also  be necessary in a
  114.      practical program.  If  anyone  can  get  these  routines  working and
  115.      perhaps write some  ASCII-FP  conversion  routines,  we  would be very
  116.      grateful.
  117.      ----------------------------------------------------------------------
  118.                                 CORRESPONDENCE
  119.                                 ==============
  120.      To: ICTARI
  121.      From: Steve Gale
  122.  
  123.      Does anyone know of any 'legal' way to stop 'overshoot' when scrolling
  124.      through a document, i.e.  stopping  the scrolling sequence immediately
  125.      when the up or down arrow  key  is released. Presumably this is caused
  126.      by the keyboard buffer storing keypresses  even after the key has been
  127.      released.
  128.      ----------------------------------------------------------------------
  129.      To: *.*
  130.      From: Terry King
  131.  
  132.      Does anyone know much about  the  Falcon  hardware  ?  In particular I
  133.      would like to know how to use  the  sound,  I believe that the STE DMA
  134.      sound commands are  not supported on  the Falcon which means STE games
  135.      run in  silence, is this true ?
  136.  
  137.      I  tried  out  a game  I  am  writing  on  a Falcon and  although  the
  138.      game played,  the   display   seemed  to  give  quadruple vision  with
  139.      messed  up colours.  I  was   using  an  STE  to  write it and it  was
  140.      using  hardware scrolling and writing  to the video address registers.
  141.      Should I put the Falcon in some specific mode for it to work ? (Please
  142.      no "use backward"  answers  as  I  want  the  game  to  work directly,
  143.      without the need for  any patch programs).
  144.  
  145.      Also,  what's the best way  to  check  whether the machine the program
  146.      is running  on  is a Falcon ?   Would it be something like the  cookie
  147.      jar variable _MCH containing the value 30 ?
  148.  
  149.      */ The Falcon has the same DMA sound  chip  as the STE (as well as the
  150.      DSP) and the hardware  addresses  are  the  same.  I  suspect that the
  151.      Falcon has to have  additional  initialisation  before  it can be used
  152.      (which  is  probably  what   'Backward'   does.   Perhaps  our  Falcon
  153.      programmers can give us more  info.  In  ICTARI  issue 15 Paul Brookes
  154.      published some code using the DSP in C which may also be of interest.
  155.  
  156.      In ICTARI issue 5 Simon  Rigby  published  an assembler routine called
  157.      WHATTOS2 which detects which TOS is  being used, what type of computer
  158.      the program is running on  as  well  as  a number of other parameters.
  159.      Perhaps you could modify  this  routine  to  do  what  you want, if it
  160.      doesn't do the job, let us know.  ICTARI /*
  161.      ----------------------------------------------------------------------
  162.      To: *.*
  163.      From: Dick Teuber
  164.  
  165.      Can anyone help me on how to use  machine code in Lattice C. I want to
  166.      include a small block of machine  code  within  the source code of a C
  167.      program and not link in  with  an  Object  file.  I  also need to pass
  168.      parameters from C  to  the  CPU  registers  and  stack.  The Lattice C
  169.      manuals seem to be very unhelpful on how to do any of this.
  170.      ----------------------------------------------------------------------
  171.      To: Ictari
  172.      From: Mårten Lindström
  173.  
  174.      PRINTER DRIVERS
  175.      ===============
  176.      Like Simon Rigby I think  that  any  printer  driver  system has to be
  177.      viewed in relation to  GDOS,  since  GDOS  (allowing  standard GEM VDI
  178.      operations to work on the printer  as  well  as on the screen) already
  179.      constitutes a 'universal  printer  driver'  system  for TOS computers,
  180.      conveniently usable by the application programmer.
  181.  
  182.      I think standards  should  be  stuck  to  unless  there  are very good
  183.      reasons against it, but GDOS  does  have  a  number of drawbacks which
  184.      might motivate an alternative system. On the other hand I can see some
  185.      solutions too.
  186.  
  187.      The drawbacks to GDOS first :-
  188.      ------------------------------
  189.       1)     No GDOS version is freeware,  as  far  as  I know, which means
  190.              that  some  licensing  agreement  with   Atari  is  needed  to
  191.              distribute programs with GDOS included.  Many or most ST users
  192.              probably  already  have   some   GDOS   version  lying  around
  193.              somewhere, got with a magazine  cover  disk  or with a program
  194.              bundled with the computer.  But  you  would  of course like to
  195.              guarantee some basic printing capabilities to any user, and if
  196.              your own program is  shareware  or  even freeware you wouldn't
  197.              want to pay Atari much or anything for distributing the stone-
  198.              age old GDOS 1. On the other hand Atari may be reasonable with
  199.              this (The $500 mentioned by D N  Wheeler in his text from 1988
  200.              must be history long since).  Does  anyone have any experience
  201.              or knowledge?
  202.  
  203.       2)     I have found no documentation  on  writing GDOS drivers in TOS
  204.              books of mine (though  gained  some insight from disassembly),
  205.              and writing a GDOS driver  from  scratch  is probably no small
  206.              task in any case.
  207.  
  208.       3)     The VDI/GDOS  offers  rather  limited  support  for  character
  209.              oriented "alphanumeric" output.  Graphic  output  is of course
  210.              much more flexible,  but  simple  character  output  is  a lot
  211.              faster and potentially could give  as good-looking results for
  212.              plain text. On the other hand  there  DOES exist a VDI command
  213.              V_ALPHA_TEXT, unknown to me until I read the Compendium, which
  214.              allows character output to a  printer including the setting of
  215.              all common printer styles and  densities, though most of these
  216.              features are apparently unsupported  by current drivers. There
  217.              are no definitions for  font  changes  or support of justified
  218.              text, however.
  219.  
  220.      And some solutions :-
  221.      ---------------------
  222.       1)     In worst case, it may not  be  an insurmountable task to write
  223.              our own GDOS replacement. The basic  GDOS release 1.1 is not a
  224.              very big program (and  not particularly effectively programmed
  225.              either). I have disassembled it  and think I understand almost
  226.              completely everything done by this program.
  227.  
  228.       2)     Regarding the programming of the GDOS  driver itself I think I
  229.              have deduced, from the disassembly  of GDOS, what rules should
  230.              apply (see below) though, official documentation would be most
  231.              helpful.
  232.  
  233.              While the complete programming from  scratch  of a GDOS driver
  234.              isn't a days work I think  that  it might be possible to split
  235.              it  up  in  stages.  I  haven't  disassembled  (at  least  not
  236.              completely) a GDOS driver yet, but I would imagine its various
  237.              VDI graphic routines draw their  output  on an internal bitmap
  238.              (this may be done in 'strips'  to  save memory), which is then
  239.              sent to the printer,  translated  into the appropriate printer
  240.              codes.
  241.  
  242.              It thus may be possible to  write  the core code for sending a
  243.              bitmap (and character output) to printers in one step, and add
  244.              the complete  GDOS  'driver  shell'  later.  Furthermore  this
  245.              shell, once written, may conceivably  be used with any printer
  246.              driver.
  247.  
  248.       3)     A solution to the  limited  support for alphanumeric character
  249.              output, is  of  course  to  introduce  our  own  extensions to
  250.              V_ALPHA_TEXT (extra escape  codes)  or  possibly  even add new
  251.              calls. This would not be ideal  but better than not supporting
  252.              GDOS at all.
  253.  
  254.              If needed, a driver could  perhaps  also make some information
  255.              on  e.g.  accessible  fonts,   character   width  tables  etc.
  256.              available to the program  outside  of  the  VDI  system (via a
  257.              cookie in the jar).
  258.  
  259.      The UPD system of Peter Hibbs in relation to this :-
  260.      ----------------------------------------------------
  261.       1)     Until we have a freeware  GDOS (replacement) this is obviously
  262.              a strong point in favour of UPD as a separate system.
  263.  
  264.       2)     Likewise the simple configuration  commands  envisaged in your
  265.              UPD specification, would be a vast improvement to the gruesome
  266.              task of writing a complete  GDOS  driver for each new printer.
  267.              If, on the  other  hand,  this  flexibility  was  built into a
  268.              'Universal _GDOS_ Printer Driver'  it  might  possibly be even
  269.              better.
  270.  
  271.       3)     Had UPD been  aiming  at  making  universal  the advanced non-
  272.              graphic capabilities of  e.g.  Protext  printer  drivers (font
  273.              changes and justified  text),  this  would  have  been another
  274.              argument for UPD as a separate  alternative to GDOS. As it is,
  275.              many or most of  the  UPD  style  commands  seem to have their
  276.              counterpart in escape codes defined  with the VDI/GDOS command
  277.              V_ALPHA_TEXT. Which instead speaks  in  favour of adapting UPD
  278.              to support GDOS.
  279.  
  280.              The ability with UPD to select a lower-than-maximum resolution
  281.              for graphics output is a nice (speed-gaining) feature that may
  282.              be difficult  to  make  general  use  of  within  the VDI/GDOS
  283.              context where  each  workstation  is  supposed  to  have fixed
  284.              resolution and dimensions. On  the  other  hand  it would with
  285.              some commands - for instance with  V_BIT_IMAGE to print an IMG
  286.              file (scaled) - be possible  to  let  a GDOS driver internally
  287.              decide on a lower resolution.
  288.  
  289.  
  290.                  ≈≈≈≈≈≈≈≈≈≈≈ PROPOSITION: GDOS UPD ≈≈≈≈≈≈≈≈≈≈≈
  291.  
  292.      - To everybody: How  about  expanding  the  UPD  into the joint Ictari
  293.      project of creating a 'universal _GDOS_  printer driver' ?  I would be
  294.      prepared to help with writing a  freeware GDOS replacement (if needed)
  295.      or with the GDOS driver itself. Regarding the driver I think it may be
  296.      possible to split this up  in  one  part responsible for outputting to
  297.      the printer (essentially the UPD  of  Peter Hibbs), and other routines
  298.      converting the VDI commands  into  drawing  on  a bitmap, though there
  299.      must of course be some main routines  too, keeping it all together. If
  300.      anyone has any documentation on GDOS  driver programming this would be
  301.      most welcome. I will continue to  disassemble an existing GDOS printer
  302.      driver to see what I can find out.
  303.  
  304.      - To Peter Hibbs: Would you be willing to adapt UPD to support GDOS?
  305.      I do think this would  increase  its potential usability even further,
  306.      though I appreciate the amount of  work you have already invested into
  307.      UPD (and, regarded on their own or  in  relation to BIOS, I found your
  308.      function definitions  and  calling  interface  very  well  thought out
  309.      indeed).
  310.  
  311.      Adaptation to GDOS would partly mean making UPD mimic VDI/GDOS calling
  312.      procedures  more  closely   (to   simplify   things   for  application
  313.      programmers changing between 'non-GEM UPD' and GDOS). But the ultimate
  314.      aim would be to prepare it to  execute  VDI commands as part of a GDOS
  315.      driver.
  316.  
  317.                  ≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈
  318.  
  319.      If you are at all interested, this would lead to the following remarks
  320.      on the specific UPD functions described in Ictari 23 :-
  321.  
  322.      UPD_INIT
  323.      This is the trickiest one and you may  possibly let it remain as it is
  324.      for the time being. If  and  when  UPD  is  to  become  part of a GDOS
  325.      driver, however, it  must  already  be  initialized  when anyone first
  326.      sends VDI output to the printer or  else  be able to initialize at the
  327.      first call of V_OPNWK.
  328.  
  329.      I would then envisage UPD as a separate program, UPD.PRG, to rest side
  330.      by side with GDOS on the disk,  reading and converting into tables the
  331.      ascii text driver file  during  bootup,  exactly  like GDOS is reading
  332.      ASSIGN.SYS (from the current drive  and  path  =  the root of the boot
  333.      disk). Like GDOS the UPD  program  would afterwards copy the extracted
  334.      data down  over  the  now  redundant  ascii  text,  shrink  its memory
  335.      accordingly  and  terminate  with  PTERMRES   to  make  itself  memory
  336.      resident. Before this it  would  however  install  a  cookie, with the
  337.      address to a routine or parameter block within itself, in the jar.
  338.  
  339.      The GDOS 'driver shell' - UPD.SYS  -  would, at the first V_OPNWK call
  340.      it gets, seek contact with the - UPD.PRG - core via the cookie jar.
  341.  
  342.      UPD_TEXT
  343.      Let this command deal  with  a  whole  string  (like V_ALPHA_TEXT) and
  344.      internally take care  of  the  error  checking  after  each character.
  345.      Furthermore, instead of your attribute  word  with each character, use
  346.      the escapes defined with  V_ALPHA_TEXT  for  styles  changes as far as
  347.      possible. Though for attributes not  defined with V_ALPHA_TEXT I guess
  348.      you will have to define  your  own.  I  would  suggest that you try to
  349.      support ALL of the DEFINED codes (in the Atari Compendium) AS defined,
  350.      which I'm afraid would,  as  neat  as  they  are,  require you to skip
  351.      explicit definitions of 5, 6,  17  and  20  CPI (the results of 2-mode
  352.      combinations). Remember that both  widened  and condensed printing are
  353.      also possible to combine with  proportional  printing (on my NEC P2200
  354.      anyway).
  355.  
  356.      NOTE: Multiple copies on lasers  is  set  with  a separate VDI command
  357.      V_PGCOUNT.
  358.      Also, the reset  printer  and  clear  printer  buffer attributes would
  359.      perhaps be  better  replaced  by  internal  handling  in  the  V_OPNWK
  360.      routine.
  361.  
  362.      GRAPHICS
  363.      Analogically to the character  output,  I  would  suggest the graphics
  364.      output routine print the whole bitmap  in  one go, and internally take
  365.      care of error checking after each  line. Thus merging UPD_SGM, UPD_SGD
  366.      and UPD_EGM into a single  bitmap  output command. This would simplify
  367.      things for the application  programmer  and  is  how  it  must be done
  368.      within a GDOS driver anyway.
  369.  
  370.      To make the UPD command completely mimic the VDI raster copy functions
  371.      would perhaps not be worth the trouble (and not necessary once working
  372.      within the GDOS driver), but I think  it  should be prepared to take a
  373.      width specification IN PIXELS, not necessarily divisible by 16 or even
  374.      8 (any unused end bits to be cleared or whatever by the UPD function).
  375.      Each new line should on the other hand  be required to begin on a word
  376.      boundary.
  377.  
  378.      UPD_DELAY
  379.      I would suggest this  command  be  replaced  with  a definition in the
  380.      ASCII text file for the driver. I  also think that VSYNC calls for the
  381.      measurement of time  would  be  better  replaced  with  polling of the
  382.      _HZ_200 count (example routine  given  below) or alternatively polling
  383.      of the GEMDOS time with TGETTIME. These methods would make delay times
  384.      independent of the monitor hardware.
  385.  
  386.      Dimensions  of  the  workstation  (paper  sheet),  as  well  as  pixel
  387.      dimensions (in microns),  and  any  colour  capacity,  should  also be
  388.      possible to define  within  the  driver  text  file,  in  some form or
  389.      another. (Since they need to be written  by the driver into the output
  390.      arrays during calls of V_OPNWK.)
  391.  
  392.      One final suggestion, and not related to GDOS in any way:
  393.  
  394.      Allowing characters to be  redefined  into  any  byte sequences before
  395.      output to the  printer,  would  be  worth  a  lot  to many non-English
  396.      speaking people, I think. All Swedish letters should in principle come
  397.      out right if the printer  is  set  to  IBM  mode,  but there are (old)
  398.      printers lacking this mode (Is  the  British pound sign really printed
  399.      correctly by all printers  without  re-definition?). And other letters
  400.      (the O slash of Danish/Norwegian  and  the German double s) definitely
  401.      need to be redefined before being sent to the printer.
  402.  
  403.      Programming a GDOS driver
  404.      -------------------------
  405.      Regarding the workings of a  GDOS  driver  I think the following rules
  406.      apply (deduced purely from disassembly  - official documentation would
  407.      be most helpful) :-
  408.  
  409.      A GDOS driver is,  as  Simon  Rigby  said,  basically  a program file,
  410.      complete with program file header and  a relocation table. (I actually
  411.      discovered a bug, when disassembling  GDOS  release  1.1, that I think
  412.      will make a driver crash if there is NOT any relocation data - i.e. if
  413.      the driver is written to be completely PC-relative.)
  414.  
  415.      The driver  should  not  shrink  its  memory,  since  GDOS  will  have
  416.      allocated space only for its TEXT,  DATA  and BSS segments, and should
  417.      not terminate with  a  GEMDOS  call  (PTERM)  but  simply  with an RTS
  418.      instruction (it is called as a subroutine from GDOS).
  419.  
  420.      The driver will be called for each  and every VDI call directed to the
  421.      device with which it is associated. And the sole input is a pointer in
  422.      register D1 to the VDI  parameter  block  (as  with  any low level VDI
  423.      call).
  424.  
  425.      The driver is apparently supposed to  return  a value in D0: seemingly
  426.      just a flag determining whether or  not  the Y-axis should be reversed
  427.      by GDOS in the case that NDC coordinates are being used. (The driver I
  428.      studied seemed to always return a 1 - preventing GDOS interfering with
  429.      the Y axis direction in any case.)
  430.  
  431.      All other registers are saved on the stack by the driver I have looked
  432.      into. The stack itself is a  system  stack,  so should probably not be
  433.      too heavily used.
  434.  
  435.      Apart from this, I think  that  the  GDOS  driver is free to implement
  436.      each  VDI  call  in  whatever  fashion   it   likes  as  long  as  the
  437.      specifications for the call are met with. Input and output are handled
  438.      via the standard VDI arrays: contrl, intin, intout, ptsin and ptsout.
  439.  
  440.      The driver is apparently free to  pick  any number for the V_HANDLE to
  441.      return when opening a workstation  (except  that  0 indicates error as
  442.      usual). GDOS will store this handle and  use it in future calls to the
  443.      driver, translating between this 'internal' handle and the handle used
  444.      in communication with calling programs.
  445.  
  446.      GDOS will take care of  any  font  loading,  as  well as sorting fonts
  447.      according to ID and point size (lowest font ID's - and within fonts of
  448.      same ID, smallest sizes - first).  Or  at  least GDOS release 1.1 will
  449.      have done this sorting, though older GDOS versions perhaps never did.
  450.  
  451.      But GDOS after this also passes the VST_LOAD_FONTS call to the driver,
  452.      like with any other VDI call,  only  this  time with some extra values
  453.      supplied in the CONTRL array:-
  454.  
  455.      contrl[7-8]  : Pointer to a buffer for character manipulations.
  456.      contrl[9]    : Length of this buffer
  457.      contrl[10-11]: Pointer to the (header of the) first font
  458.  
  459.      The driver should save these for  future  use. It is apparently solely
  460.      the responsibility of the driver to manage text output from these data
  461.      given. No further help will be offered by the GDOS program.
  462.  
  463.  
  464.      (Note: The above applies to the  basic  GDOS 1.1. I suppose that later
  465.      GDOS versions - FontGDOS, FSM and  SpeedoGDOS - will do more, possibly
  466.      even take fully  care  of  any  Bezier  curves  and  outline fonts and
  467.      somehow send them to  the  driver  as  bitmaps  (perhaps  via calls of
  468.      raster copy operations or  via  fill  pattern operations). Can someone
  469.      tell?)
  470.  
  471.  
  472.      * ASSEMBLER ROUTINE TO WAIT A GIVEN NUMBER OF HUNDREDTHS OF SECONDS:-
  473.      * -------------------------
  474.      * Number of hundredths of seconds given on stack as a LONGWORD.
  475.      * E.g.  pea    100.W  ;to wait 1 second
  476.      *       bsr    delay
  477.      *       addq.l #4,SP
  478.  
  479.      delay    movem.l D0-D3/A0-A2,-(SP)
  480.               move.l  32(SP),D3
  481.               add.l   D3,D3     ;Convert hundredths of s into 200Hz ticks
  482.               bsr.s   gethz200
  483.               add.l   D0,D3
  484.      .delay   bsr.s   gethz200
  485.               cmp.l   D3,D0
  486.               bls.s   .delay
  487.               movem.l (SP)+,D0-D3/A0-A2
  488.               rts
  489.  
  490.      gethz200 bsr.s   .supexec  ;Push next address on stack and jump
  491.               move.l  $4BA.W,D0
  492.               rts
  493.  
  494.      .supexec move.w  #38,-(SP)
  495.               trap    #14
  496.               addq.l  #6,SP
  497.               rts
  498.  
  499.      */ In response to Mårtens letter  above  and  Simon Rigby last month I
  500.      have to disagree  with  their  suggestion  that  a  new Printer Driver
  501.      program should try and emulate or tie into the existing GDOS system. I
  502.      have several reasons for this view -
  503.  
  504.      Firstly, while I accept that  a  'serious'  program should use the GEM
  505.      system for maximum compatibility  with  all  ST  versions, I know that
  506.      there are some programmers  who  prefer  not  to  use  GEM for various
  507.      reasons (games programs, for example)  and  also some languages do not
  508.      allow the use of GEM (STOS being one example). The proposed UPD system
  509.      would allow ANY programmer to use a printer whether under GEM or not.
  510.  
  511.      Secondly, any GDOS equivalent program  would  have to cater for vector
  512.      fonts  (as  I  cannot  see  a  bit  mapped  font  version  having  any
  513.      credibility among Atari programmers) and  this  would  be a huge task.
  514.      Look how long SPEEDO-GDOS has taken to arrive along with all the other
  515.      aborted versions on the way. And, in any case, what would be the point
  516.      in copying a program that has already been written, not to mention the
  517.      legal aspects of copyright.
  518.  
  519.      Thirdly, GDOS is essentially a graphics system and would not cater for
  520.      sending text data and text attributes  to  the printer. While this may
  521.      be a relatively trivial problem  for  a  program  to overcome, the UPD
  522.      system still has the advantage of  rationalising the printer output so
  523.      that the programmer does not  have  to  worry  about all the different
  524.      control code sequences for the various attribute functions. Admittedly
  525.      the available attribute codes have  to  be  limited  to those that are
  526.      available on most printers but this  is  still better than having none
  527.      at all.
  528.  
  529.  
  530.      Fourthly, using the GDOS system, a (machine code) printer driver would
  531.      have to be written for  each  printer  to  print graphics images. This
  532.      would make it very difficult, if  not  impossible, for the end user to
  533.      write a printer  driver  for  his/her  printer  if  there  was not one
  534.      already available. With the UPD  system,  writing  a printer driver is
  535.      relatively easy with the help  of  the  printer  manual and a suitable
  536.      test program. Of course, the  graphics  printing  code must already be
  537.      built into the UPD program itself but as Simon pointed out last month,
  538.      there are only a small  number  of different graphics printing methods
  539.      used in most printers. I have identified a number of methods, most use
  540.      the Epson system (ESC, K, No_of_bytes, data) while the Canon system is
  541.      slightly different (ESC, [, g, No_of_bytes,  mode, data). HP Laser and
  542.      DeskJet are basically the same and 9  pin,  16  pin, 24 pin and 48 pin
  543.      modes are virtually  the  same  except  for  the  number  of bytes per
  544.      vertical slice. If any  other  methods  of  printing graphics data are
  545.      discovered, then these can be added  later,  the code has been written
  546.      in such a way  as  to  facilitate  additional graphics drivers easily.
  547.      Colour printing will have to wait until  someone tells me how it works
  548.      but hopefully that can be incorporated later.
  549.  
  550.      Regarding some of the specific points raised in the letter above :-
  551.  
  552.      I agree that the UPD program is  best  stored as a separate program on
  553.      disk and loaded in by the application although I don't think it should
  554.      be defined as a .PRG program since  it  cannot be run as a stand alone
  555.      program which the .PRG extension implies. Using the title UPD_V100.BIN
  556.      indicates that it is a  binary  file  (version  1.00 in this case) and
  557.      implies that it has to be loaded into an application at run time.
  558.  
  559.      Creating an  entry  in  the  'cookie  jar'  is  an  option  I  had not
  560.      considered. As I understand this  system,  it  is for situations where
  561.      one program can determine  whether  another  program (or some hardware
  562.      device) has been installed and could  be used by accessory programs or
  563.      other applications programs in  a  multi-tasking environment. The only
  564.      reason I can see for the UPD to install a cookie jar entry would be to
  565.      allow several programs to use  the  same  program.  In other words, an
  566.      application loads in the UPD program and then stores its start address
  567.      in the 'cookie jar' so that  a second application (or accessory) could
  568.      use the same program without  having  to  load the program code again.
  569.      This would save some memory (although  the  code is only about 4K long
  570.      anyway) but I think  it  could  cause  other  problems. The programmer
  571.      would have to assume the same printer  was being used by both programs
  572.      (probable but not absolutely definite)  since  the printer driver will
  573.      also be loaded by the original program. Another major problem would be
  574.      that, since printing can take some time, the variable stores set up by
  575.      the first program could be  corrupted  by  the second if both programs
  576.      try to print at the  same  time.  We  would  need  some form of memory
  577.      allocation and print spooling to  allow  stacking  of printer calls. I
  578.      will have to think about this one but  I suspect it would not be worth
  579.      the extra complications !
  580.  
  581.      Sending text characters as a  complete  string instead of individually
  582.      would be possible, I suppose, but  I  think  it would be less flexible
  583.      since the program would need another control code to define the end of
  584.      the string and the  UPD  would  need  more  buffer  space to store the
  585.      string before sending it on  to  the  printer.  The proposed system is
  586.      easy enough to use  and  the  programmer  can  always implement such a
  587.      system if he wants to. It would be possible to use just the attributes
  588.      defined by the v_alpha_text function  but  since  we don't want to use
  589.      GEM anyway we may as  well  use  the  extra codes. The attribute codes
  590.      that I have defined ($0200, $0400, etc) were designed to make the code
  591.      simple and run as quickly as possible.
  592.  
  593.      I had considered sending a complete  bit  map to the printer using one
  594.      command but decided against  it  because  the  command itself would be
  595.      rather involved as it  would  have  to  incorporate image width, image
  596.      length, graphics mode, image address  and possibly colour information.
  597.      Also sending one  raster  line  at  a  time  allows  the programmer to
  598.      provide a method of aborting the printout with a keypress at any time.
  599.      The current system is very easy  to  implement  with a simple loop and
  600.      image address pointer.  I  suppose  the  width  specification could be
  601.      defined in pixels rather than bytes if there is any advantage in this.
  602.  
  603.      Regarding the delay period, I did consider using the 200Hz counter but
  604.      this would mean going  into  Supervisor  mode  within  the UPD program
  605.      which causes complications on  return.  However,  using the 'Tgettime'
  606.      GEMDOS function to generate the delay is  a good idea which I have now
  607.      implemented although  the  delay  does  not  really  need  to  be very
  608.      accurate. I am not sure about including  the delay period value in the
  609.      Printer Driver file itself since the  reason  for the delay could vary
  610.      even in the same printer depending on  the size of the printer buffer,
  611.      whether single sheets or fanfold is being used, etc. In fact, I am not
  612.      even sure if a delay is needed anyway, my own experience with printers
  613.      has not shown any problems. I  only  included  the option just in case
  614.      someone somewhere needed it, perhaps  some  other members could let me
  615.      know if it is really required.
  616.  
  617.      I don't think the paper size should  be included in the Printer Driver
  618.      text file since that  could  vary  for  each  print-out but the colour
  619.      options will certainly need to be defined, I will sort that out when I
  620.      have more information on colour printing.
  621.  
  622.      Allowing a character to be redefined into  a series of byte codes is a
  623.      lot more  complicated  than  it  first  seems,  however,  changing one
  624.      character into another one is  relatively  simple  and  that is what I
  625.      propose to implement first. However,  even  this  opens up a whole new
  626.      can of worms. The  character  set  from  $20  to  $7F  seems to be (in
  627.      English anyway) fairly standard, assuming,  that  is, that code $23 is
  628.      defined as the #  character  (and  not  the  English  pound sign). The
  629.      problem is that some printers can  be  configured to print a different
  630.      character for some codes  (i.e.  $,  #,  £,  etc) and the applications
  631.      program or the UPD program cannot know  what is being printed for each
  632.      character code. For  the  codes  from  $80  to  $FF  it  is  even more
  633.      difficult. Again, depending on  how  the  printer is configured, these
  634.      codes can print  as  IBM  graphics  characters,  italics, or sometimes
  635.      nothing at all. My  HP  Laser  printer  prints  a completely different
  636.      character set from my 24  pin  Panasonic,  most  of the characters are
  637.      there but in different positions. It  would probably be useful to have
  638.      the IBM ProPrinter character set as standard since these have the line
  639.      drawing characters available  but  some  printers  cannot emulate this
  640.      mode. Perhaps we  need  a  complete  character  set  defined which all
  641.      printers can print and  which  could  then  be  defined in the Printer
  642.      Driver text file. The problem  is  that,  apart from the English pound
  643.      sign at code $9C (usually), all  the other characters are non-English.
  644.      Perhaps our European members  could  advise  us  on  the characters or
  645.      symbols required.
  646.  
  647.      I think it would be very  useful  to  know more about how GDOS drivers
  648.      work as we may be able to  use  some  of  the ideas. I would also like
  649.      more information on colour printing, if  anyone can provide this info,
  650.      please let me know.
  651.  
  652.      I would also like to hear more comments on the UPD from other members,
  653.      especially any that are writing programs that use print-outs.  PDH /*
  654.  
  655.      ------------------------------ End of file ---------------------------
  656.