[racket] Keyboard polling and user packages

From: J Arcane (jarcane at gmail.com)
Date: Sun Aug 10 18:46:49 EDT 2014

Well, thanks to CharTerm, I have made it work. However, in adding some
error handling routines for the runtime I've run into a weird bug.

You can see the full code here:
https://github.com/jarcane/MicroMini/blob/master/main.rkt

The relevant bit, however, is the (crash-handler) function. For some reason
that utterly escapes my notice or discovery, the (format "~X" ...) call
there does not actually spit out a hexadecimal number at runtime.

The weirdest part is: I can't repeat the bug anywhere but when actually
running main.rkt. I've even tried hand-entering all the relevant bits into
the commandline REPL and calling the crash-handler inside a
(with-crashterm), and it doesn't do it there: It properly gives me a
hexadecimal number.

Other than that it works great so far. Now I need to write at least a basic
assembler.


On Sun, Aug 10, 2014 at 6:09 PM, Neil Van Dyke <neil at neilvandyke.org> wrote:

> If you haven't already, you can try the following to disable any port
> buffering within Racket, but that doesn't help you if the OS (Windows and
> Posix-ish console stuff it's doing from the console window) isn't giving
> Racket raw, unbuffered access to keyboard input through stdin:
>
>     (file-stream-buffer-mode my-port 'none)
>
> If you were using almost anything other than Windows, you could just use "
> http://www.neilvandyke.org/racket-charterm/".
>
> Other than that, you or someone could make a portable Racket text-terminal
> package that does stuff like uses the console API on Windows and tty on
> almost everything else.
>
> BTW, you mention getting random bytes with variations on "read-bytes".
>  That simply shouldn't happen with "read-bytes", but, when using variations
> on "read-bytes-avail!", only the first N count bytes it says it read will
> be valid in the bytestring.
>
> Neil V.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140811/1f523ae6/attachment.html>

Posted on the users mailing list.