home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / BEEHIVE / UTILITYS / CORK10.ARC / CORK.DOC < prev    next >
Text File  |  1991-08-11  |  10KB  |  179 lines

  1.  
  2.    [Enter Andy Roony]
  3.  
  4.    Did you ever call a *DOS BOARD* with a *CP/M MACHINE* and get screen
  5.    full of *GIBBERISH* that looked something like *THIS*?:
  6.  
  7.  
  8.    ZZDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD??
  9.    33 NEW DOORS AND AN RLE CONFERENCE HAVE BEEN SET UP.... 33
  10.    @@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDYY
  11.                             ZZDDDDDDDDDDDDDDDDDDD?DD??
  12.    ZDOOR......              33TRY THEM OUT.......3  33    ZDOOR...
  13.       BATCH transfers       @@DDDDDDDDDDDDDDDDDDDYDDYY
  14.    ZZDDDDDDDDDDDDDDDDDDDD??DD????DD??
  15.    33THEY NEED USER INPUT33  3333  33  ADVENTURES!!! *   -QWIKMAIL>>>>>
  16.    @@DDDDDDDDDDDDDDDDDDDDYYDDYYYYDDYY
  17.  
  18.    [Exit A.R]
  19.  
  20.    Well, those screens look OK with the IBM extended character set, but
  21.    what about the rest of us?  Well, no miracles, but surely the situa-
  22.    tion could be improved somewhat:
  23.  
  24.    ++------------------------------------------------------++
  25.    || NEW DOORS AND AN RLE CONFERENCE HAVE BEEN SET UP.... ||
  26.    ++------------------------------------------------------++
  27.                             ++-------------------+--++
  28.    ZDOOR......              ||TRY THEM OUT.......|  ||    ZDOOR...
  29.       BATCH transfers       ++-------------------+--++
  30.    ++--------------------++--++++--++
  31.    ||THEY NEED USER INPUT||  ||||  ||  ADVENTURES!!! *   -QWIKMAIL>>>>>
  32.    ++--------------------++--++++--++
  33.  
  34.  
  35.    ----
  36.    Those  aren't  really "D"'s, etc. coming thru in  the  first  example-
  37.    they just appear that way after stripping the valuable 8th bit identi-
  38.    fying  it as a deviant graphic character.  Contained herein is a  tiny
  39.    (1/2k) program that will sit in the top of your memory and remap these
  40.    characters into more useful ones.  It turns out that a fairly  aesthe-
  41.    tic  approximation  of the originally desired effect can  be  achieved
  42.    with  a combination of only three standard characters: "-",  "|",  and
  43.    "+".  As supplied, the program does exactly such an remapping of char-
  44.    acters.  All codes intercepted with values higher than 128 decimal are
  45.    instantly remapped into an appropriate substitute, in real time.
  46.  
  47.    The  RUN-DMC, uh, RUN-ZMP program provided will quietly locate  itself
  48.    in high memory and then automatically load the ZMP modem program  (the
  49.    specifics can be changed, as described later).  You may then call  DOS
  50.    boards   and  enjoy  a  much,  er,  somewhat   healthier   experience.
  51.    [Note: You must configure ZMP *not* to remove the parity bit for  this
  52.    to work.  This is done by setting the (P)arity selection to NO in  the
  53.    (S)ystem  submenu of the (C)onfiguration menu]. Fortunately,  ZMP  has
  54.    this option and it thus works quite nicely with this program.
  55.  
  56.    In  theory,  the concept can be extended to work with MEX  or  IMP  as
  57.    well.  Unfortunately, experiments seem to indicate that both of  those
  58.    communication  programs  strip the high bit before sending it  to  the
  59.    console,  regardless of the setting of the their  respective  'control
  60.    character filter' switches, so someone will have to find a byte  some-
  61.    where to patch preventing this if successful operation is expected.
  62.  
  63.    Technical details:
  64.  
  65.    The  resident  portion of CORK is written  as  'position  independent'
  66.    code; it will run *anywhere* in memory (no page boundarys even requir-
  67.    ed).  When initiated, the CORK loader section moves the resident  part
  68.    to a position 1/2k below BDOS, reducing your TPA by that small amount.
  69.    It  then  patches several vectors (details below).   Control  is  then
  70.    transferred to the high memory code, which then searches for a  speci-
  71.    fied file (eg ZMP.COM). The current drive/user is searched first; then
  72.    a  user defined alternate drive and user.  When the target program  is
  73.    found, it is loaded at 100H and control is transferred to it, where it
  74.    runs  normally  - 'unaware' that CORK is intercepting  and  converting
  75.    console  characters on their way out.  CORK also  intercepts  whatever
  76.    method  the program chooses to exit with; when this occurs,  CORK  re-
  77.    stores all vectors to their original values ('releasing' memory in the
  78.    process) and then actually does exit back to the operating system.
  79.  
  80.    CORK patches the BDOS jump vector at 0005, both to enable it to inter-
  81.    cept BDOS console output calls and to properly reflect the reduced TPA
  82.    size.   The program will intercept both BDOS calls 2 (Console  Output)
  83.    and  6  (Direct Console I/O).  It will also intercept  console  output
  84.    made  via  the BIOS jump table.  For exit purposes, the  program  will
  85.    intercept a plain RET, a jump to zero or BIOS+3, or a BDOS call 0,  in
  86.    case anyone does that.
  87.  
  88.    One other thing: Immediately after it is initiated, CORK copies all of
  89.    the low memory area containing the 'command tail' information  (FCB's,
  90.    command  tail itself, etc.) to the page of memory just below where  it
  91.    is about relocate itself.  Later, just before handing control over  to
  92.    the  'target' program, this information is restored.  Thus the  target
  93.    program will be supplied with any filenames or other information spec-
  94.    ified  on  the command line when CORK was initiated, just  as  if  the
  95.    program had been initiated normally.
  96.  
  97.    This LBR contains the CORK source and two assembled COM files,  subse-
  98.    quently  renamed.  The COM files are identical except that  one  (RUN-
  99.    ZMP)  was assembled from CORK.Z80 with "ZMP.COM" filled in as  the  as
  100.    the target program, and the other (TIPE) was assembled with "TYPE.COM"
  101.    as  the  target (both were assembled with "A0" as  the  alternate  DU,
  102.    btw). Typing RUN-ZMP (perhaps rename it ZM or something) will bring up
  103.    the  ZMP  modem program ('available separately' -:) but  allow  easier
  104.    communication with DOS boards.  The other program is really more of  a
  105.    demo,  but could actually be used in to type files with DOS  character
  106.    graphics (a small section of one such file I ran across is  included).
  107.    The  TYPE.COM  included is simply C. Falconer's LT28,  though  a  line
  108.    which strips the high bit was removed before assembly.  TIPE will call
  109.    TYPE, and makes use of the command tail transfer described above.  Try
  110.    "TYPE DEMO.TXT" and then "TIPE DEMO.TXT" and notice the difference.
  111.  
  112.    Disclaimer:  This program was written partly as a solution for  myself
  113.    to a specific problem and partly just as a seed for the idea of remap-
  114.    ping  graphics characters.  While I have every reason to  believe  the
  115.    program  should run on any standard CP/M system and it has been  tried
  116.    by  a  number of people, keep in mind that it is  'messing  with  your
  117.    system' a bit so, as they say, "Standard disclaimers apply"...
  118.  
  119.    If it doesn't work, figure out why and let me know....
  120.  
  121.    NOTE: The program will not even *come close* to running without a Z80;
  122.    for  one thing it is inherently based on relative jumps.  The  program
  123.    *will*  check the Z80 condition, and abort gracefully with no  message
  124.    if  running on an 8080/8085. (In fact, it will abort quietly  with  no
  125.    message if almost anything else is wrong also, but there isn't much to
  126.    go wrong.  Most likely it can't find the target program to run).
  127.    
  128.    Assembly: If you want to change the alternate DU's or the name of  the
  129.    target program to be loaded or the character remapping table, you will
  130.    need  to reassemble the source code provided.  Also note  an  assembly
  131.    option that should be set to TRUE if your terminal will display the 7F
  132.    character  ('rubout') as a solid grey or white box.  This will  result
  133.    in  improved performance, and is *not* assumed in the COM  files  con-
  134.    tained here.  First edit any changes desired into CORK.Z80; it's pret-
  135.    ty self explanatory.  Then assemble.  The nature of the position inde-
  136.    pendent  code  makes this a snap; no PRL's,  ZRL's,  RSX's,  GENSYS's,
  137.    weird linker commands, debuggers, special programs, etc.  With SLR:
  138.  
  139.    Z80ASM CORK
  140.  
  141.    That's it; wait 2 seconds for the resulting COM file.  For M80:
  142.  
  143.    M80 =CORK.Z80
  144.  
  145.    and then, with either L80 or LINK
  146.  
  147.    L80 CORK/N,CORK/E    or:
  148.    LINK CORK
  149.  
  150.    You may want to rename the resulting CORK.COM to something convenient.
  151.  
  152.    Obvious  enhancement:  While "+", "-", and "|" do an adequate job,  my
  153.    console, like many others, does have some character graphic  capabili-
  154.    ties.   The program as it stands now cannot make use of these  because
  155.    of it's limitation of one-to-one character mapping (I was also  inter-
  156.    ested  in  keeping the initial version generic).  For  a  system  that
  157.    requires a 'go into graphics mode' escape sequence, the program  could
  158.    be modified to put out that sequence when necessary.  A flag  internal
  159.    to  the  remapping program could keep track of the current  mode,  and
  160.    only  inject  the extra characters when necessary to switch  back  and
  161.    forth.
  162.  
  163.    Obvious dumbness: Thanks to Ross Pressser who pointed out that my code
  164.    was  organized in a dumb way.  While the program must relocate  itself
  165.    to get "out of the way" before loading the target program, there is no
  166.    reason for the 'target program loader' code to hang out after it's job
  167.    is  done.   If it were at the bottom of the  relocated  section,  this
  168.    would  be easy.  But alas, for the current version anyway, I added  up
  169.    the  bytes and could not quite save a full page (ie make the  resident
  170.    portion  1/4k) and I did not want to change the BDOS jump by some  odd
  171.    amount  and I really hope no one needs TPA *that* badly and  mostly  I
  172.    was  too lazy to rearrange the code at this point... But  if  enhance-
  173.    ments  get made by myself or anyone else, that's where the extra  room
  174.    can come from.
  175.  
  176.                                                 - Steven Greenberg
  177.                                                   14 December 1988
  178.  
  179.