The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Thursday, November 19, 2015

“Sean, how are dogs like children? Their sanity and lunacy are instantly scary.”

When I said that Racter made a valid MS-DOS system call and it was one I was expecting, that didn't mean I was exactly happy Racter was using that particular MS-DOS system call. In fact, it was one of the worst system calls it could make, given what I'm trying to do.

Racter is calling the “direct console I/O” system call of MS-DOS. This system call is a very old system call and comes from CP/M. It's a system call that expects to send data to, and receive data from, an interactive terminal. The call is used for both input and output. If there's no input pending, it returns a “no data pending” status. This wreaks havoc because Eliza isn't a user sitting at a terminal but another program.

Worse, the Racter executable is a compiled BASIC program (given away by the string “Microsoft BASIC Compiler Runtime” buried deep inside the executable) so it's expecting an interactive terminal (which is why it's using that particular system call).

I eventually got it working but it's a horrible hack. I set an “input flag” to false. This means when the “direct console I/O” is called looking for input, it returns “no data yet.” It's only when I see the characters for a carriage return, a line feed, and a “>” being written (which indicates Racter is now expecting input) do I switch the “input flag” to true. It stays true until it sees a carriage return as input (which indicates the user has finished typing their input) and then sets the flag to false. It's gross, but it works, and more importantly, it works when you pipe input from a file or from another process.

The other system calls Racter uses were fairly straightforward to implement with only one slight hiccup (the documented behavior of two calls caused Racter to exit; it was only when I added a feature that the two functions said was not done did it work—go figure Microsoft using undocumented behavior). With only ten system calls used (out of a possible 41 for MS-DOS 1.0) it wasn't that bad.

So now I can connect Racter up with Eliza and let the two talk.

But having gotten this far, I'm not sure if I should even continue. I mean, yeah, I can hook the two up and spend a minute or two spewing out 50,000 words of conversation between the two, but … eh. I mean, yeah, there are some gems that pop out, such as “Sean, how are dogs like children? Their sanity and lunacy are instantly scary,” but even over an extended time, it gets weary.

I thought maybe having Racter conversing with itself might be fun, but alas, the random number generator in Racter is exceedingly deterministic to the point where the output from each was identical and thus, not really worth having two of them converse.

Then again, I haven't even read much past the first page of The Quantum Supposition Of Oz so perhaps I should just have Racter and Eliza duke it out, put it to bed, and think of another idea for next year.

Obligatory Picture

[Here I am, enjoying my vacaton in a rain forest.]

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: http://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

http://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2017 by Sean Conner. All Rights Reserved.