[comp.sys.ibm.pc] Turbo mode from software

ccastgw@pyr.gatech.EDU (GREG WILLIAMS) (03/22/89)

I have a turbo XT clone that has a maximum clock speed of 9.54 MHz.
Every time I boot up, I put it in turbo mode by pressing <alt><ctrl>f 
and it goes to turbo.  (I usually do this after it checks memory, though
it can be done anytime after that.)  What I would like to know if it is
possible to send this keystroke from software inside the autoexec.bat
instead of having to manually type it in every time.  I don't know the
internals of what happens when I do this, but I am assuming it sends
an interrupt.   Its called a Pepper-10 mainboard, so if you've heard
of it you may know more than I do.  Could somebody help me figure out
how to do it from a short program (preferable MS-C 5.1)?  I appreciate
it.
-- 
"I don't have to be reasonable.  I'm a genius!"
ccastgw@pyr.gatech.edu
GREG WILLIAMS "Barbaric Penguin"
Disclaimer: The usual stuff.                          

wales@valeria.cs.ucla.edu (Rich Wales) (03/23/89)

In article <7677@pyr.gatech.EDU>
ccastgw@pyr.gatech.edu.UUCP (GREG WILLIAMS) writes:

	I have a turbo XT clone that has a maximum clock speed of 9.54
	MHz.  Every time I boot up, I put it in turbo mode by pressing
	<alt><ctrl>f and it goes to turbo.  (I usually do this after it
	checks memory, though it can be done anytime after that.)

	What I would like to know if it is possible to send this key-
	stroke from software inside the autoexec.bat instead of having
	to manually type it in every time.  I don't know the internals
	of what happens when I do this, but I am assuming it sends an
	interrupt.

	It's called a Pepper-10 mainboard, so if you've heard of it you
	may know more than I do.  Could somebody help me figure out how
	to do it from a short program (preferably MS-C 5.1)?

I am not familiar with this particular clone, but many (maybe even most)
turbo XT clones change speeds by toggling an otherwise unused bit in one
of the I/O ports -- specifically, bit 04h of I/O port 061h.  Setting
this bit to 1 enables "turbo" speed; setting it to 0 gives normal speed.

Speed switching via a "hot key" is accomplished either via special code
in your system's ROM BIOS keyboard interrupt handler, or else via a TSR
program that hooks itself onto the keyboard interrupt and inspects every
keystroke.  My turbo XT clone, for instance (made by a Taiwanese company
named Wugo, and called the "PC-II-AD"), came with a TSR utility called
TURBOPC.COM; this uses Alt-LeftShift as its "hot key" combo, toggling
bit 04h of I/O port 061h each time.

After discovering the above (by using DEBUG to disassemble TURBOPC.COM),
I wrote my own "fast" and "slow" programs (again, with DEBUG):

	    FASTCLK.COM              SLOWCLK.COM
		mov  dx,0061             mov  dx,0061
		in   al,dx               in   al,dx
		or   al,04               and  al,0fb
		out  dx,al               out  dx,al
		xor  ah,ah               xor  ah,ah
		int  21                  int  21

Note that these programs differ only in the third line:  FASTCLK turns
the bit in question on, while SLOWCLK turns it off.

I can't guarantee, of course, that these will work for your system.
(For that matter, I disclaim any responsibility if they *damage* your
system -- though I consider the probability of this happening to be
vanishingly minute.)  If they don't work, and if you are using a TSR
(like my system's TURBOPC.COM) to look for the "turbo key" combo, try
using DEBUG or a "real" disassembler on it.  DEBUG's "u 100" command
(disassemble starting at location 100H) will probably show a "jump" to
some initialization code, followed by some space for holding an inter-
rupt handler address (for chaining interrupts), followed by 40-50 bytes
of interrupt handler code.  This code will probably read some I/O port,
reverse (toggle) the state of some bit, and write it back out.  You can
then use this information to write your own programs to set "high" or
"low" speed.

-- Rich Wales // UCLA Computer Science Department // +1 (213) 825-5683
   3531 Boelter Hall // Los Angeles, California 90024-1596 // USA
   wales@CS.UCLA.EDU      ...!(uunet,ucbvax,rutgers)!cs.ucla.edu!wales
"Now, drop your weapons, or I'll kill him with this deadly jelly baby."