Path: ns-mx!hobbes.physics.uiowa.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!bronze!newshost.cs.rose-hulman.edu!news From: moorera@HYDRA.ROSE-HULMAN.EDU (Ryan A Moore) Newsgroups: comp.sys.apple2 Subject: ORCA/Pascal Key Routines Message-ID: <1992Mar23.235610.6338@cs.rose-hulman.edu> Date: 23 Mar 92 23:56:10 GMT Sender: news@cs.rose-hulman.edu (The News Administrator) Reply-To: moorera@HYDRA.ROSE-HULMAN.EDU Organization: Rose-Hulman Institute of Technology Lines: 61 Nntp-Posting-Host: rosevc.rose-hulman.edu The following are routines that work in ORCA that I copied out of some source, but I don't remember where it was... procedure ClearStrobe; var strobe : ^byte; begin strobe := pointer($00C010); strobe^ := 0; end; {ClearStrobe} procedure WaitKey; var keyboard: ^byte; KeyPress:boolean; begin KeyPress := false; while not KeyPress do begin keyboard := pointer($00C000); KeyPress := keyboard^ & $80 <> 0; end; ClearStrobe; end; {WaitKey} function GetKey:char; var keyboard: ^byte; KeyPress:boolean; begin KeyPress := false; while not KeyPress do begin keyboard := pointer($00C000); KeyPress := keyboard^ & $80 <> 0; end; write (chr(keyboard^ & $7F)); GetKey := chr(keyboard^ & $7F); ClearStrobe; writeln; end; {GetKey} ClearStrobe is necessary to reset the strobe after a keystroke. WaitKey will pause the program until a key is pressed, and GetKey will wait for a keypress, print the character to the screen, and return the ASCII value of the key pressed. This works in text mode, but I'm not sure what it would do with the Event Manger running... but it probably wouldn't be good! Ryan Moore Rose-Hulman Institute of Technology moorera@rosevc.rose-hulman.edu