Article View: comp.sys.ibm.pc
Article #43871Re: 2 problems
From: Paul Caskey
Date: Sat, 10 Mar 1990 20:14
Date: Sat, 10 Mar 1990 20:14
68 lines
3862 bytes
3862 bytes
On 9 Mar 90 18:31:00 GMT,
consp06@bingsung.cc.binghamton.edu (Robert Konigsberg) said:
Robert> 1) I am working on a game in Turbo Pascal 5.5. I would like
Robert> to set and read the keyboard rates so that I can speed the
Robert> keyboard. I want to eliminate the wait before a key's
Robert> 'repeat-mode' steps in. As well, I want to restore the
Robert> original values of whatever settings are needed. Anyone out
Robert> there on this one?
Boy does this sound familiar. I spent quite a few hours trying to do
exacly that. Are you trying to modify the sample Breakout program by
any chance? In any case, after digging into this problem all the way
down to inline assembly code, I came up empty-handed. The problem
lies in the fact that DOS will tell you if a key was just pressed or
just released. But nothing in between, until the key starts
repeating. On the AT, there is a way to change the time it takes for
a key to start repeating...but I don't think you can cut it to zero.
And I don't have an AT, so that wasn't a solution for me.
I figured if I dug deep enough, there would have to be some way to ask
the computer to go look at the space bar and tell me if it was up or
down at any given instant. But I really don't think you can. If you
do come up with a solution for this, I'd be really curious to see it.
Robert> ... but I am still stuck as to how to actually start a
Robert> secondary process. ...
Robert> All I know is that in TURBO PASCAL 5.5,
Robert> exec(getenv('COMSPEC'),'WHAT GOES HERE?');
Put any does command ('dir *.pas') for 'WHAT GOES HERE'. '' will just
give you the shell.
Robert> Is this right? I doubt it because it isn't working.. what
Robert> should I do? Also, is it important to know if I have enough
Robert> memory to spawn this secondary command process? How would I
Robert> do that? What other side effects am I not thinking about?
First of all, in TP5+ you have to call SwapVectors immediately before
and after every call to Exec. But the main problem is that you need
to change memory allocation with the $M directive to allow enough
memory for DOS to run. The examples in the manual use {$M 8192,0,0}
which leaves the max. amount of memory for things like Exec, but
leaves you with no heap for your program to use. I don't know enough
about memory allocation to say what would be a good compromise.
The solution I found to this is a program by TurboPower software
called ExecSwap. This program dumps the current state of the program
to a disk file, then calls Exec and you have almost all of your
computer's memory available in your DOS shell. Then when you exit
back, ExexSwap reads the "snapshot" of your program back off of disk
and into memory, and program execution continues as if nothing
happened. This program is "free to use as long as due credit is
given" and I got it off a local BBS. It comes with .pas and .asm
source code and a demo program. It's probably available on an ftp
site like wuarchive.wustle.edu or cheops.cis.ohio-state.edu, or I can
upload it somewhere as long it's free. :-)
Happy .PAS-ing...
--
/*********/
Paul Caskey
pcaskey@ariel.unm.edu
Only lawyers represent anyone's ideas but their own.
/*********/
Technical Details
Message-ID:
<SORC.90Mar10131459@carina.unm.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!tut.cis.ohio-state.edu!unmvax!ariel!ariel.unm.edu!sorcReferences:
<3123@bingvaxu.cc.binghamton.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!tut.cis.ohio-state.edu!unmvax!ariel!ariel.unm.edu!sorc From: sorc@carina.unm.edu (Paul Caskey) Newsgroups: comp.sys.ibm.pc Subject: Re: 2 problems Message-ID: <SORC.90Mar10131459@carina.unm.edu> Date: 10 Mar 90 20:14:59 GMT References: <3123@bingvaxu.cc.binghamton.edu> Sender: news@ariel.unm.edu Distribution: comp Organization: The Village Lines: 68 In-reply-to: consp06@bingsung.cc.binghamton.edu's message of 9 Mar 90 18:31:00 GMT