From d102366e6808f74ef98044374d744e453efdbefa Mon Sep 17 00:00:00 2001 From: user Date: Fri, 17 Jul 2026 12:15:09 +0200 Subject: 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. --- src/programs.asm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/programs.asm') 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 >/ 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 -- cgit v1.3.1-sl0p