[racket] Keyboard polling and user packages
Hello,
I've been working on a learning project, a simple 8-bit virtual stack
machine, (code so far is here:
https://github.com/jarcane/MicroMini/blob/master/main.rkt) and I've run
into a bit of a snag when it comes to getting input.
I'm trying to set up basic character terminal I/O. The spec I've written
defines two instructions:
TRMO, which pops the byte at the top of the stack to the terminal bus line
(currently emulated in Racket with a simple (write-byte (pop)))
TRMI, which polls the terminal bus line for a key press and pushes the
resulting byte to the stack.
I can't for the life of me figure out how to do this. I've been reading
docs for hours, exhausting my google fu, and attempting any number of
failed experiments involving the built-ins, and I've got nothing.
The various incantations of (read-bytes) seem to produce finicky and
unpredictable results, either spitting out random values or else taking
input in the form of a \n terminated prompt. This is kind of unoptimal when
all I need is a single-byte.
I've looked at various libraries and bits of sample code, but all the
command-line solutions are Unix specific (requiring stty), and everything
else involves building a GUI (which wasn't really the intent, I was meaning
to keep it as a simple CL app I could feed binary files to).
I also ran into problems with installing libraries anyway, because unless I
just called them from Planet, they install to user-scope by default, and I
have no clue at all where user packages go on Windows or how to (require)
them.
Is there seriously no crossplatform, non-GUI means of polling a key event
for Racket?
Getting frustrated,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140810/f641dd1c/attachment.html>