home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OS9_6X09 / SYSMODS / Printer_Motor_Patch.lzh / printer.doc < prev    next >
Text File  |  1991-12-28  |  4KB  |  132 lines

  1. A Small fix for the PRINTER driver
  2.  
  3.  
  4.  
  5.      I was experimenting with a way to make use of the cassette motor control
  6. under OS9. It could be used for a variety of reasons. One item I was playing
  7. with was a way to turn the hard drives off and on under program control.
  8. (by using a larger relay to switch the 110V source) so during idle times
  9. when my BBS isn't doing anything to shut the drives off. 
  10.  
  11.      I wrote a small program in assembly that will allow you to toggle the
  12. cassette motor on or off. However one small problem came up was when I went
  13. to use the printer. sending anything to the printer caused the motor to
  14. turn off. So i went to investigate the problem. Using disasm I dissasembled
  15. the printer driver and discovered it clears $FF21 which bit 3 controls the
  16. motor. Clearing this register turns the motor off. So basically the fix is
  17. to check to see what the status of the motor is and not to disturb it.
  18.  
  19.      Well before you go cracking out Ipatch you must check one thing first.
  20. The PRINTER driver has a delay value (set by TunePort) that could be 
  21. different. At offset $0023 is where it is stored. Mine is $18 hex.
  22. an ident of my OLD module will verify 
  23.  
  24.  
  25. Header for:  PRINTER 
  26. Module size: $017A    #378
  27. Module CRC:  $CC3EA4 (Good) 
  28. Hdr parity:  $A0 
  29. Exec. off:   $0024    #36
  30. Data Size:   $0029    #41
  31. Edition:     $0C      #12
  32. Ty/La At/Rv: $E1 $81 
  33. Dev Dvr mod, 6809 obj, re-en, R/O 
  34.  
  35. After the fix the new module will be
  36.  
  37.  
  38. Header for:  PRINTER 
  39. Module size: $0182    #386
  40. Module CRC:  $C55F59 (Good) 
  41. Hdr parity:  $58 
  42. Exec. off:   $0024    #36
  43. Data Size:   $0029    #41
  44. Edition:     $0D      #13
  45. Ty/La At/Rv: $E1 $81 
  46. Dev Dvr mod, 6809 obj, re-en, R/O 
  47.  
  48. to make sure you have the delay set right use:
  49.  
  50.  tuneport /p   to find out what your delay is. then do this:
  51.  
  52. tuneport /p -s=24  to set it to 24 for patching. 
  53.  
  54. Just crank out Ipatch and go to it. 
  55.  
  56. after your done if your delay is not 24 reset it to your value using 
  57. the -s option of tuneport.
  58.  
  59.  
  60. Technical stuff:
  61.  
  62. Ok for those who wonder what I did here it is..
  63.  
  64. taking a clip from the dissassembly with the fixes
  65.  
  66.  
  67. L0036    pshs  cc
  68.          orcc  #$50
  69.          ldx   #$FF20
  70. *
  71. * Patch code not to clear $FF21 This causes the motor
  72. * relay to turn off. this is not desired
  73. * old code shown below
  74. *
  75. *        clr   $01,x
  76. *
  77. * New code starts here
  78. *
  79.          lda   1,x  load PIA register
  80.          anda  #$08   clear all but bit 3
  81.          sta   1,x  store it back
  82. *
  83. * old code resumes
  84. *
  85.          ldd   <$2C,y
  86.          std   <$22,u
  87.          lda   #$FE
  88.          sta   ,x
  89. *
  90. * Another area which it messes with the Motor bit
  91. * Must make sure we leave it alone
  92. * old bit pattern %00110110 or $36
  93. * motor bit -----------|
  94. * old code shown
  95. *
  96. *        lda   #$36
  97. *        sta   $01,x
  98. *
  99. * Add new code here
  100. *
  101.          lda   1,x load a with PIA register
  102.          anda  #$8 zero out all but bit3
  103.          ora   #$36 bit pattern desired plus bit3
  104.          sta   1,x store it back to PIA
  105. *
  106. * old code resumes
  107. *
  108.          lda   ,x
  109.          ldd   <$26,y
  110.          lbsr  L0138
  111.          puls  cc
  112.  
  113.  
  114. Thats all there is to it!
  115.  
  116.  
  117. Also included is the motor command. The assembly language version is a small
  118. version. you only can toggle it on or off. Just read the doc file that goes
  119. with it. The Basic09 version is larger but more descriptive. Only note there
  120. is if your not using shell+ to use the parenthesis. such as:
  121.  
  122. motor ("off")    motor("on")  motor ("?")   motor("h")
  123.  
  124. shell+ can do this:
  125.  
  126. motor off        motor on     motor ?       motor h
  127.  
  128.  
  129. Mike Guzzi - CIS: 76576,2715  
  130. Call the Astral Plane BBS 717-586-2771 300/1200/2400 baud 24hrs 8/N/1
  131.  
  132.