<div dir="ltr"><div><div><div><div><div><div><div>Hello,<br><br></div>I've been working on a learning project, a simple 8-bit virtual stack machine, (code so far is here: <a href="https://github.com/jarcane/MicroMini/blob/master/main.rkt">https://github.com/jarcane/MicroMini/blob/master/main.rkt</a>) and I've run into a bit of a snag when it comes to getting input.<br>
<br></div>I'm trying to set up basic character terminal I/O. The spec I've written defines two instructions:<br><br></div>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)))<br>
<br></div>TRMI, which polls the terminal bus line for a key press and pushes the resulting byte to the stack. <br><br></div>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.<br>
<br></div>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.<br>
<br></div><div>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).<br>
<br></div><div>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. <br>
<br></div><div>Is there seriously no crossplatform, non-GUI means of polling a key event for Racket?<br><br></div><div>Getting frustrated, <br></div><div>John<br></div><div><div><br><br></div></div></div>