diff options
| author | user <user@clank> | 2026-07-17 12:15:09 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-17 12:15:09 +0200 |
| commit | d102366e6808f74ef98044374d744e453efdbefa (patch) | |
| tree | 6f35b79e4e0fb01c432262fbb5254f39331717ad /src/programs.asm | |
| parent | net: real routed IP via SLIP<->TUN bridge (you can *ping* a Game Boy) (diff) | |
| download | gbos-d102366e6808f74ef98044374d744e453efdbefa.tar.gz gbos-d102366e6808f74ef98044374d744e453efdbefa.tar.xz gbos-d102366e6808f74ef98044374d744e453efdbefa.zip | |
net: ping - GB-originated ICMP echo (a Game Boy pings the real internet)
New `ping [A.B.C.D]` program (PROG_PING=27, bank 29): builds and sends ICMP
echo requests from 10.0.0.2, then reads replies off the link port. It keeps
reading SLIP frames until it finds *our* echo reply, skipping the IGMP/mDNS/
SSDP multicast noise that shares 10.0.0.0/24. Reply wait uses a generous
srecv_nb spin budget since the emulator runs uncapped (no timer syscall yet).
Verified over the tunbridge (with NAT):
/# ping 10.0.0.1 -> 4/4 received, ttl=64 (the SLIP peer/host)
/# ping 1.1.1.1 -> 4/4 received, ttl=56 (Cloudflare, real net!)
ttl=56 is a real internet round trip (64 minus the hops). Combined with the
host being able to ping the GB, the Game Boy is now a full two-way ICMP host.
Diffstat (limited to 'src/programs.asm')
| -rw-r--r-- | src/programs.asm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/programs.asm b/src/programs.asm index 7a01abc..854b2d2 100644 --- a/src/programs.asm +++ b/src/programs.asm @@ -121,6 +121,9 @@ ProgChat: SECTION "prog_netd", ROMX[$4000], BANK[28] ProgNetd: INCBIN "c/netd.bin" +SECTION "prog_ping", ROMX[$4000], BANK[29] +ProgPing: + INCBIN "c/ping.bin" ; ----------------------------------------------------------------------------- ; PROG_SH (bank 3) - the shell, now written in C (c/sh.c): parses >/</| and @@ -217,6 +220,8 @@ ProgramTable:: dw ProgChat db LOW(BANK(ProgNetd)), HIGH(BANK(ProgNetd)) dw ProgNetd + db LOW(BANK(ProgPing)), HIGH(BANK(ProgPing)) + dw ProgPing ; ----------------------------------------------------------------------------- ; NameTable (ROM0) - command name -> program id, searched by sys_lookup. @@ -277,4 +282,6 @@ NameTable:: db PROG_CHAT db "netd", 0 db PROG_NETD + db "ping", 0 + db PROG_PING db 0 |
