[comp.sources.wanted] PCcurses charget.c and conio.h

cpp90221@dcscg1.UUCP (Duane L. Rezac) (11/09/88)

I am working on porting the PCcurses package to the Computer Innovations 
C86 Optimizing Compiler (No flames please, That's what I'm stuck with :-( )

I have been sucsessful so far with one minor problem. The charget.c function 
references a file conio.h, which apparently contains a definition of a macro
kbhit(). Can anyone provide information on what kbhit() is and how I could 
code a substitute for the C86 compiler? 

Thanks in Advance

-- 
+-----------------------+---------------------------------------------------+
| Duane L. Rezac        |These views are my own, and NOT representitive of  |
| dsacg1!dcscg1!cpp90221|my place of Employment.                            |
+-----------------------+---------------------------------------------------+

stevev@uoregon.uoregon.edu (Steve VanDevender) (11/10/88)

In article <406@dcscg1.UUCP> cpp90221@dcscg1.UUCP (Duane L. Rezac) writes:
>I am working on porting the PCcurses package to the Computer Innovations 
>C86 Optimizing Compiler (No flames please, That's what I'm stuck with :-( )
>
>I have been sucsessful so far with one minor problem. The charget.c function 
>references a file conio.h, which apparently contains a definition of a macro
>kbhit(). Can anyone provide information on what kbhit() is and how I could 
>code a substitute for the C86 compiler? 
>
>Thanks in Advance
>
>-- 
>+-----------------------+---------------------------------------------------+
>| Duane L. Rezac        |These views are my own, and NOT representitive of  |
>| dsacg1!dcscg1!cpp90221|my place of Employment.                            |
>+-----------------------+---------------------------------------------------+


The kbhit() function returns true if input is waiting in the keyboard buffer.

Probably the easiest substitute you can code is to use MS-DOS function call
6 by calling the C86 library function bdos() like this:

	c = bdos(6, 255);

On return c will be 0 if no key was available, or will contain the next 
character from the keyboard.  This has the disadvantage that you will have
to pass the returned character back.

A slightly better, but more difficult, solution is to use MS-DOS call 44h
(I/O control for devices) to check the input status of the keyboard, by
using the sysint21 call.  Check file handle 0 (stdin) using subfunction
6 of the DOS call.

(As you might guess, I use C86 too.  Could you send me the changes you
made to port PC-Curses?  I'll still have to port the screen I/O stuff to
my HP 150 but it would be nice to have the compiler porting out of the
way.)


-- 
Steve VanDevender 	stevev@drizzle.cs.uoregon.edu	stevev@oregon.BITNET
"Bipedalism--an unrecognized disease affecting over 99% of the population.
Symptoms include lack of traffic sense, slow rate of travel, and the
classic, easily recognized behavior known as walking."

nts0302@dsacg3.UUCP (Bob Fisher) (11/10/88)

In article <406@dcscg1.UUCP>, cpp90221@dcscg1.UUCP (Duane L. Rezac) writes:
> I am working on porting the PCcurses package to the Computer Innovations 
> C86 Optimizing Compiler.  I have been sucsessful so far with one minor
> problem. The charget.c function references a file conio.h, which apparently
> contains a definition of a macro > kbhit(). Can anyone provide information
> on what kbhit() is and how I could code a substitute for the C86 compiler? 
> 
I ported an earlier version of this PC Curses to C86 about a year ago.  I
have picked up the latest version but haven't worked with it yet.  I plan
to work on it during the Thanksgiving holidays.  Having done it once and
keeping complete notes on what I did, it should be relatively easy to do
it again.

If anyone (USA only) wants a copy, send me a 360K floppy (formatted please)
and $1.00 to cover postage and handling.  Don't forget a return address.

I will include the complete modified source, a list of modifications made
to the source, a modified MAKEFILE to compile Curses, a .BAT file to use
to compile using the Curses library and an execution library for the small
model.

Robert Fisher
6900 Prior Place
Reynoldsburg OH 43068
Email: osu-cis!dsacg1!bfisher
Phone: Home 614-864-1189  Office 614-238-9071

-- 
Bob Fisher (osu-cis!dsacg1!bfisher) 614-238-9071 (Autovon 850-9071)
From the Internet: bfisher%dsacg1.uucp@daitc.arpa
US Defense Logistics Agency Systems Automation Center
DSAC-TSX, Box 1605, Columbus, OH 43216-5002

bl@infovax.UUCP (Bj|rn Larsson) (11/12/88)

In article <406@dcscg1.UUCP>, cpp90221@dcscg1.UUCP (Duane L. Rezac) writes:
> I am working on porting the PCcurses package to the Computer Innovations 
> C86 
> references a file conio.h, which apparently contains a definition of a macro
> kbhit(). Can anyone provide information on what kbhit() is and how I could 

kbhit() in MicroSoft 'C' and Turbo'C' returns 0 if there is no character to
read from the keyboard, and 1 if there is. This could be simulated by using
one of the BIOS interrupts (INT 16 with AH = 1) or some appropriate INT 21
DOS function. It is better to use the direct calls to the BIOS PROM's, since
calling via DOS means that raw input (if you use it) is partly risky - DOS
calls check for CTRL-BREAK, CTRL-C, CTRL-P, CTRL-S and CTRL-Q, which you
dont want if you go raw. The BIOS routine does no such checks.

Also, I would like those of you who port PCcurses to other compilers to
send diff listings to me and/or Steve Creps (creps@silver.bacs.indiana.edu)
so we can have ONE reference version.
							-- Bjorn
[And... Hi Steve! I can post now (I think)!]

   _ __                       ._                             : Bjorn Larsson
    )  )   . ..              /      "SPEECH TECHNOLOGY"      : INFOVOX AB
   /--<     _   _  __       /    __.  _  _   _   _   __      : Box 2503
 _/___)__/_(_)_/(_/ <_    (/\___(_/l_/(_/ )_/ )_(_)_/ <_     : S-171 02 Solna
======= / ===============================================    : SWEDEN
       ' (...seismo!mcvax!enea!infovax!bl - bl@infovax.UUCP) :