home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / cpm68k / syshacks.lbr / BIOSBUG.DQC / BIOSBUG.DOC
Encoding:
Text File  |  1986-05-22  |  4.6 KB  |  223 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.                              CPMBIOS.S Bug Report
  18.                              CPMBIOS.S Bug Report
  19.                              CPMBIOS.S Bug Report
  20.  
  21.  
  22.  
  23.  
  24.                                  Robert Heller
  25.                                  Robert Heller
  26.                                  Robert Heller
  27.  
  28.  
  29.                                Fri May 16, 1986
  30.                                Fri May 16, 1986
  31.                                Fri May 16, 1986
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.                             Chapter 1: The Problem
  92.  
  93.  
  94.  
  95.                I  encountered  the  problem  while  working  with  the
  96.  
  97.  
  98.           Special BIOS  function  (number  17)  to  change  the  shell
  99.           Special
  100.           Special
  101.  
  102.  
  103.           address.   The  problem  was, the shell address would not be
  104.  
  105.  
  106.           set to the address  I  passed  in  (via  A0).  Instead,  the
  107.  
  108.  
  109.           system would   effectively   crash.     I  checked  my  code
  110.  
  111.  
  112.           carefully  and  after  being  satisfied  that  my  code  was
  113.  
  114.  
  115.           correct,  I  looked  at  CPMBIOS.S  to  see  if  there was a
  116.  
  117.  
  118.           problem there.  There was.  Here is the code at the  special
  119.                                                                special
  120.                                                                special
  121.  
  122.  
  123.           label:
  124.  
  125.  
  126.  
  127. ******************************************************************************
  128.  
  129.  
  130. *
  131.  
  132.  
  133. *       Special Entry Point.
  134.  
  135.  
  136. *
  137.  
  138.  
  139. *       This BIOS function performs special functions.  Register D1 is
  140.  
  141.  
  142. *       further decoded into additional functions.
  143.  
  144.  
  145. *
  146.  
  147.  
  148. *       Function codes:
  149.  
  150.  
  151. *
  152.  
  153.  
  154. *               0       set terminal control characters
  155.  
  156.  
  157. *               1       set shell entry address
  158.  
  159.  
  160. *               2       unused
  161.  
  162.  
  163. *               3       turn on BIOS Xon/Xoff stalling
  164.  
  165.  
  166. *               4       turn off BIOS Xon/Xoff stalling
  167.  
  168.  
  169. *               5       return pointer to environment space
  170.  
  171.  
  172. *
  173.  
  174.  
  175.  
  176. special:
  177.  
  178.  
  179.         cmp.w   #5,d1           ; check the range of the BIOS function code
  180.  
  181.  
  182.         bhi     badcode         ; jump if the code is out of range
  183.  
  184.  
  185.         lsl.w   #2,d1           ; convert the code to a table offset
  186.  
  187.  
  188.         lea     spectbl,a0      ; point to the base of the special table
  189.  
  190.  
  191.         move.l  0(a0,d1.w),a0   ; fetch the address of the routine
  192.  
  193.  
  194.         jsr     (a0)            ; go execute the routine
  195.  
  196.  
  197.  
  198. badcode:
  199.  
  200.  
  201.         rts                     ; return to caller
  202.  
  203.  
  204.  
  205.  
  206. spectbl:
  207.  
  208.  
  209.         .dc.l   setterm         ; set the terminal control characters
  210.  
  211.  
  212.         .dc.l   setshell        ; set the shell entry address
  213.  
  214.  
  215.         .dc.l   badcode         ; unused
  216.  
  217.  
  218.         .dc.l   stallon         ; turn on BIOS Xon/Xoff stalling
  219.  
  220.  
  221.         .dc.l   stalloff        ; turn off BIOS Xon/Xoff stalling
  222.  
  223.  
  224.         .dc.l   getenvp         ; return a pointer to the environment space
  225.  
  226.  
  227.  
  228.  
  229.                This   code   uses   a   jump   table   to  decode  the
  230.  
  231.  
  232.           sub-functions.  Register A0  is  used  to  access  the  jump
  233.  
  234.  
  235.           table.  Thus  any  shell  address passed in A0 is invariably
  236.  
  237.  
  238.           clobbered.
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.                               Chapter 2: The Fix
  258.  
  259.  
  260.  
  261.                To fix this bug, I modified CPMBIOS.S to  use  register
  262.  
  263.  
  264.           D2 to  pass  in  the  new  shell address instead of A0.  The
  265.  
  266.  
  267.           code is as follows:
  268.  
  269.  
  270.  
  271. ******************************************************************************
  272.  
  273.  
  274. *
  275.  
  276.  
  277. *       Set Shell Entry Address.
  278.  
  279.  
  280. *
  281.  
  282.  
  283. *       This is a Special Function.  It allows you to set the entry
  284.  
  285.  
  286. *       address of a shell.  The entry address is jumped to on warm boot.
  287.  
  288.  
  289. *       The default shell entry address is _ccp.
  290.  
  291.  
  292. *
  293.  
  294.  
  295. ********This is wrong.  it must never have been tested.
  296.  
  297.  
  298. *       A0 contains the new shell entry address.  The old shell entry
  299.  
  300.  
  301. *       address is returned in D0.
  302.  
  303.  
  304. ********
  305.  
  306.  
  307. **      changed to use D2 to hold new shell address. RPH Thr Feb 6, 1986
  308.  
  309.  
  310. *
  311.  
  312.  
  313.  
  314. setshell:
  315.  
  316.  
  317.         move.l  shell,d0        ; return the old shell address in D0
  318.  
  319.  
  320. *       move.l  a0,shell        ; set the new shell entry address
  321.  
  322.  
  323.         move.l  D2,shell        ; set the new shell entry address (patch RPH)
  324.  
  325.  
  326.         rts                     ; return to caller
  327.  
  328.  
  329.  
  330.  
  331.                After making this change to  CPMBIOS.S  and  rebuilding
  332.  
  333.  
  334.           and  reinstalling  CPM.SYS,  my  program  which  changed the
  335.  
  336.  
  337.           shell address worked.
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373. gram  which  changed the
  374.  
  375.  
  376.           shell address worked.
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.