Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBetter Documentation of stdio? #64
Comments
|
I agree that things are a bit fuzzy in that regard. The reason is that the serial console was initially set up to be plugged into blockdevs. That quickly caused problems, as you can imagine, with blocking and nonblocking expectations. Therefore, I created Therefore, stdio's This split happened rather recently and there are many inconsistencies left. So yes, a bit of a cleanup is needed in that regard. Maybe rename blockdev's routines Same with your other questions: cleanup needed. So far, this has been done in a "whatever works" fashion. |
|
Oh no, now I remember: |
|
Shell Hook? I only had a quick look at the code, and it looks like some "screen keyboard" or "IME UI", and I don't see why the shell should update that but Sorry if I misunderstood the code, I don't have a Sega Master System to test :) |
|
It's for pad-driven character selection. It's true, userspace also needs it, so it doesn't belong in the shell. A refactoring is needed. |
|
Yeah, this whole shell loop thing was a bad idea (I originally mistyped "bad" as "pad", which I find funny...). Rather than having the shell optionally polling the pad for input, it's Yup, bad idea. I'll undo this soon and make stdioGetC blocking. Good point about HALT. Regarding "smarter terminal": I chose ed because it's an efficient line editor. If possible, I'd like to avoid having to implement smart terminals. |
|
The situation is now, I think, much clearer. There still the open question of how special characters are handled. I guess we should aim towards VT-100 compatibility, but I'm not sure it's worth it. |
|
Vt100 is DEC extended ANSI so it works with a lot of terminals that can Most systems put that in termcap for flexibility. Allison |
I think stdio calls (getC, putC) could need some documentation what userspace can expect from drivers and what not. Of course, it can always happen that a certain device cannot fulfill those expectations, but in that cases you at least know that you may have to update every userspace tool too, and not only make a
glue.asmfor the kernel.Examples/Questions:
What character set is every stdin implementation expected to be able to produce? Some examples in the documentation assume e.g. it can produce nullbytes, and some Z80 software assumes that there can be for example Ctrl+C or Ctrl+O. I think a sensible minimal character set is printable ASCII (0x20-0x7E) in addition to backspace (0x08) and return (0x0a). But that means that userspace applications are responsible that they can work with that character set only. Maybe escape (0x1B) or Tab (0x09) should also be added?
Should the return key produce 0x0a (LF) or 0x0d (CR) or both? TinyBasic assumes 0x0d, yet the emulator produces 0x0a.
should
stdinGetCbe blocking or nonblocking? The code in the shell currently assumes it is nonblocking, yet the emulator's implementation is blocking. It may be useful for userspace to decide whether it needs a nonblocking stdinGetC (which may be a no-op if not supported), e.g. to be able to interrupt something with the keyboard if the keyboard supports it. Making it nonblocking by default is maybe a bad idea, as blocking implementations may require lower energy consumption (important in case you have to produce your energy on the treadmill :D) as it can use the HALT instruction to wait for interrupts.similarly for output, what characters can userspace expect output drivers to handle? The current shell requires backspace, LF and printable ASCII, which seems to be a sane option for me. On the other hand, maybe somebody expects to have more convenient editors than "ed" that need a smarter terminal.