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 >
Wrap
Text File
|
1991-12-28
|
4KB
|
132 lines
A Small fix for the PRINTER driver
I was experimenting with a way to make use of the cassette motor control
under OS9. It could be used for a variety of reasons. One item I was playing
with was a way to turn the hard drives off and on under program control.
(by using a larger relay to switch the 110V source) so during idle times
when my BBS isn't doing anything to shut the drives off.
I wrote a small program in assembly that will allow you to toggle the
cassette motor on or off. However one small problem came up was when I went
to use the printer. sending anything to the printer caused the motor to
turn off. So i went to investigate the problem. Using disasm I dissasembled
the printer driver and discovered it clears $FF21 which bit 3 controls the
motor. Clearing this register turns the motor off. So basically the fix is
to check to see what the status of the motor is and not to disturb it.
Well before you go cracking out Ipatch you must check one thing first.
The PRINTER driver has a delay value (set by TunePort) that could be
different. At offset $0023 is where it is stored. Mine is $18 hex.
an ident of my OLD module will verify
Header for: PRINTER
Module size: $017A #378
Module CRC: $CC3EA4 (Good)
Hdr parity: $A0
Exec. off: $0024 #36
Data Size: $0029 #41
Edition: $0C #12
Ty/La At/Rv: $E1 $81
Dev Dvr mod, 6809 obj, re-en, R/O
After the fix the new module will be
Header for: PRINTER
Module size: $0182 #386
Module CRC: $C55F59 (Good)
Hdr parity: $58
Exec. off: $0024 #36
Data Size: $0029 #41
Edition: $0D #13
Ty/La At/Rv: $E1 $81
Dev Dvr mod, 6809 obj, re-en, R/O
to make sure you have the delay set right use:
tuneport /p to find out what your delay is. then do this:
tuneport /p -s=24 to set it to 24 for patching.
Just crank out Ipatch and go to it.
after your done if your delay is not 24 reset it to your value using
the -s option of tuneport.
Technical stuff:
Ok for those who wonder what I did here it is..
taking a clip from the dissassembly with the fixes
L0036 pshs cc
orcc #$50
ldx #$FF20
*
* Patch code not to clear $FF21 This causes the motor
* relay to turn off. this is not desired
* old code shown below
*
* clr $01,x
*
* New code starts here
*
lda 1,x load PIA register
anda #$08 clear all but bit 3
sta 1,x store it back
*
* old code resumes
*
ldd <$2C,y
std <$22,u
lda #$FE
sta ,x
*
* Another area which it messes with the Motor bit
* Must make sure we leave it alone
* old bit pattern %00110110 or $36
* motor bit -----------|
* old code shown
*
* lda #$36
* sta $01,x
*
* Add new code here
*
lda 1,x load a with PIA register
anda #$8 zero out all but bit3
ora #$36 bit pattern desired plus bit3
sta 1,x store it back to PIA
*
* old code resumes
*
lda ,x
ldd <$26,y
lbsr L0138
puls cc
Thats all there is to it!
Also included is the motor command. The assembly language version is a small
version. you only can toggle it on or off. Just read the doc file that goes
with it. The Basic09 version is larger but more descriptive. Only note there
is if your not using shell+ to use the parenthesis. such as:
motor ("off") motor("on") motor ("?") motor("h")
shell+ can do this:
motor off motor on motor ? motor h
Mike Guzzi - CIS: 76576,2715
Call the Astral Plane BBS 717-586-2771 300/1200/2400 baud 24hrs 8/N/1