diff options
| author | user <user@clank> | 2026-09-22 16:02:55 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-09-22 16:02:55 +0200 |
| commit | 43e43b6dcec29e2b008d20135f5d02523b62fbcf (patch) | |
| tree | d647acd07596e290c70a9884c1dc5d8c20a31067 /README.md | |
| parent | net: three TCP receive bugs - caller corruption, data loss, early EOF (diff) | |
| download | gbos-43e43b6dcec29e2b008d20135f5d02523b62fbcf.tar.gz gbos-43e43b6dcec29e2b008d20135f5d02523b62fbcf.tar.xz gbos-43e43b6dcec29e2b008d20135f5d02523b62fbcf.zip | |
usr: grep, more, cp, nc - and make pollcon pump the link
The shell has had pipes for a while with nothing to pipe *through*, and
an 18-row screen with no way to stop output scrolling off it.
- grep [-vin] PAT [file]: substring match (no regex), stdin or a file,
grep(1)'s exit convention. The other end of the pipe, at last.
- more [file]: pages 17 lines at a time, --More-- bar in white-on-blue,
any key pages, q quits. Counts *screen* rows, so wrapped lines pay
their real cost. Keys come from pollin/pollcon, not stdin, so
`cat big | more` still has a keyboard.
- cp SRC DST: the fs has rm/mkdir but no way to duplicate a file. mv is
this plus rm (there is no rename). Rejects SRC == DST, which would
otherwise truncate the source via O_WRITE before reading a byte.
- nc [-s] HOST PORT: raw TCP. Interactive (START sends the line with a
CRLF, /q quits) or -s to pump stdin and print the reply with its own
wall-clock idle timeout, because the kernel's blocking recv counts
pumps, not seconds. Generalizes what chat/irc hardcode:
`nc towel.blinkenlights.nl 23` works.
sys_pollcon now pumps the link before draining the console ring. The
ring is filled *by* net_pump, so a program that never touches the
network polled a ring nothing would ever fill: host-injected keys
(gbtype/gbdemo) hung `more` forever, and the Game Boy stopped answering
pings for as long as it ran. KGetc already pumps for this reason.
New tools take banks 35-38. Locals over statics in all four: a program's
_DATA starts at $A000, where the shell leaves the command line.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -17,12 +17,15 @@ into the on-screen console. Regenerate it anytime with `tools/gbdemo` (below).* background jobs (`spin &`), `ps`, `kill` — round-robin cooperative scheduling across banked memory with an HRAM context switch. - **A shell** (written in C, running *on* the GB) with I/O redirection - (`>` `<`) and pipes (`|`), argument passing, and a cwd-aware prompt. + (`>` `<`) and pipes (`|`), argument passing, and a cwd-aware prompt — with + `grep` to put on the other end of the pipe, and `more` to page anything + longer than the 18-row screen. - **Networking, for real**: the kernel owns SLIP over the link port, IPv4, ICMP, UDP and TCP; userland gets BSD-ish sockets via one syscall. On top: `dhcp` (boot-time lease), `ping`, `nslookup` (real DNS), `wget` (HTTP), - `chat`, and a colorized **IRC client** (`irc HOST [NICK]`, `/join` and - friends, SELECT for the keyboard). + `nc` (netcat: `nc HOST PORT` interactively, or `nc -s HOST PORT < file` to + pipe a request in and print the reply), `chat`, and a colorized **IRC + client** (`irc HOST [NICK]`, `/join` and friends, SELECT for the keyboard). - **A network to plug into**: `tools/gbhub` is a virtual switch + DHCP server + NAT gateway — spawn a fleet of Game Boys that ping *each other* and reach the real internet; `tools/gbjoin` attaches an interactive GB to it, and @@ -31,9 +34,9 @@ into the on-screen console. Regenerate it anytime with `tools/gbdemo` (below).* colors) + an **on-screen keyboard** on the window layer (SELECT toggles it). - **Persistent filesystem** on battery-backed cart RAM: inodes, nested directories, per-process cwd — survives power-off. -- **A C toolchain**: userland is plain C compiled with SDCC (`sm83`); ~30 - tools ship in `usr/` (`cat`, `wc`, `head`, `ls`, `uptime`, …). Adding a - program is one `.c` file + a table entry. +- **A C toolchain**: userland is plain C compiled with SDCC (`sm83`); ~35 + tools ship in `usr/` (`cat`, `wc`, `head`, `grep`, `cp`, `more`, `ls`, + `uptime`, …). Adding a program is one `.c` file + a table entry. ## Quick start |
