Wiznet makers

scott

Published June 12, 2026 ©

129 UCC

20 WCC

47 VAR

0 Contests

0 Followers

0 Following

Original Link

cpnet-z80

Networking a Z80 Without a TCP/IP Stack — CP/NET Meets the W5500's Hardwired TCP/IP

COMPONENTS
PROJECT DESCRIPTION

요약

cpnet-z80은 1980년대 Digital Research의 네트워크 OS CP/NET을 Heathkit H8/H89, RC2014 등 Z80 레트로 컴퓨터에 이식한 오픈소스 프로젝트입니다. W5500이 TCP/IP 스택 전체를 칩 내부에서 처리하기 때문에, 수 MHz·64KB 메모리의 Z80에서도 현대 이더넷 LAN에 접속해 호스트 PC의 디스크를 네트워크 드라이브로 사용할 수 있습니다.

개요

CP/M 시절의 컴퓨터를 현대 네트워크에 연결하려면 큰 난관이 있습니다. 소프트웨어 TCP/IP 스택은 Z80급 자원으로는 사실상 운용이 불가능하다는 점입니다. 실제로 z88dk 기반 Z80용 인터넷 도구들은 프로그램 하나가 30~45KB에 달해 Z80에서는 지나치게 크다는 한계가 보고되어 있습니다.

→ 참고: https://github.com/jayacotton/inettools-z80

cpnet-z80은 발상을 바꿉니다. 네트워크 OS는 당대의 CP/NET을 그대로 쓰고, 전송 계층만 W5500의 하드웨어 TCP/IP로 대체하는 것입니다. 원 저장소는 Douglas Miller(durgadas311)가 관리하며, RC2014 커뮤니티에서 CP/NET 클라이언트·서버 구현의 표준 레퍼런스로 참조됩니다. 본 글의 분석 대상은 GiR-Zippo의 변형 저장소입니다.

→ 분석 저장소: https://github.com/GiR-Zippo/cpnet-z80

 → 원 저장소: https://github.com/durgadas311/cpnet-z80

아키텍처

전체 구조는 CP/M 클라이언트(Z80) ↔ W5500 ↔ 현대 호스트 서버의 클라이언트-서버 모델입니다. 호스트에서 동작하는 Java/C 서버(CpnetSocketServer, unix-server)가 호스트 파일시스템을 CP/M 가상 드라이브로 노출하고, Z80 쪽에서는 network k:=c:[0] 한 줄로 드라이브를 매핑합니다.

기술 배경

CP/NET — 1980년대의 네트워크 드라이브

CP/NET은 Digital Research가 CP/M용으로 만든 네트워크 OS로, 클라이언트의 BDOS 호출을 가로채 서버로 전달하는 NDOS와, 실제 전송을 담당하는 SNIOS(네트워크 BIOS) 로 구성됩니다. 원격 디스크를 로컬 드라이브 문자처럼 쓰는 "네트워크 드라이브" 개념을 이미 구현했으며, 전송 매체는 SNIOS만 교체하면 바뀝니다. 이 분리 구조 덕분에 40년 뒤 이더넷 이식이 가능했습니다.

W5500 하드웨어 TCP/IP 소켓 구조

W5500은 TCP/IP 스택을 하드웨어 로직으로 내장한 컨트롤러로, 10/100 이더넷 MAC·PHY를 포함하고 8개의 독립 소켓과 32KB 내부 버퍼를 제공하며, 최대 80MHz SPI로 외부 MCU와 연결됩니다. 호스트는 연결 수립·재전송·체크섬을 전혀 다루지 않고, 소켓 레지스터에 IP·포트를 쓰고 명령 레지스터를 치는 것만으로 TCP 통신이 성립합니다. 이 프로젝트에서는 그 호스트가 Z80 어셈블리 코드라는 점이 핵심입니다.

NIC/HBA 분리 드라이버 설계

cpnet-z80의 SNIOS는 NIC(전송 방식)HBA(버스 인터페이스) 두 계층으로 분리되어, make NIC=w5500 HBA=mt011처럼 조합만 바꿔 빌드합니다. 같은 w5500 NIC 코드가 Heathkit의 H8xSPI, RC2014의 MT011, SC126의 Z180 CSIO 위에서 그대로 동작하는 이식성의 비결입니다.

기술 특징

W5500 레지스터를 CP/NET 의미론에 맞게 전용한 설계가 돋보입니다.

  • 소켓-노드 매핑: 소켓 소스 포트 상위 바이트를 0x31로, 하위 바이트를 CP/NET 서버 노드 ID로 설정해 8개 소켓을 서버 매핑으로 지정하고, Sn_DIPR/Sn_DPORT로 해당 서버에 TCP 연결
  • PMAGIC 전용: 클라이언트 노드 ID를 W5500의 PMAGIC 레지스터에 저장 — PPPoE용 레지스터를 비휘발 설정 공간처럼 활용한 창의적 사례
  • 오류 처리 위임: CP/NET 메시지는 CRC·체크섬 없이 바이너리로 전송하며, 오류와 재전송은 TCP/IP가 담당 → Z80 코드가 극단적으로 단순해짐
  • 인터넷 구간 운용: 라우터/ISP 경유 연결을 위해 Sn_KPALVTR로 약 45초 keep-alive 설정 — LAN을 넘어 원격지 CP/NET 서버 접속까지 고려

Where WIZnet Fits

이 프로젝트에서 W5500은 흔히 말하는 "TCP/IP 오프로딩"을 넘어, OS에 스택이 0바이트인 시스템의 TCP/IP 전부를 대행합니다. W5500의 하드와이어드 스택 가치가 가장 순수하게 드러나는 구성입니다.

플랫폼WIZnet 통합 형태비고
Heathkit H8/H89WIZ850io 모듈 + H8xSPI 보드NVRAM으로 설정 보존, RESET 핀 연결
RC2014W5500 Featherwing + MT011 SPI 어댑터RomWBW 연동, FRAM 권장
SC126 (Z180)W5500 브레이크아웃 + Z180 CSIO 직결별도 어댑터 최소화

대조 데이터도 있습니다. 같은 저장소의 시리얼 전송 경로는 SC131에서 모뎀 제어 신호 부재로 57600bps에 머무는 반면, W5500 경로는 SPI 대역폭과 100Mbps PHY를 활용합니다. 커뮤니티에서도 "직접 만든다면 W5500 이전 칩은 권하지 않는다. 구형 칩은 제약이 크고 더 복잡한 Z80 소프트웨어가 필요하다"는 평가가 나옵니다.

→ 커뮤니티 논의: https://groups.google.com/g/rc2014-z80/c/4YLveFTNMbI

WIZnet Makers 유사 사례

  • MT011 — RC2014 호환 W5500 이더넷 컨트롤러: 본 프로젝트가 지원하는 하드웨어 그 자체로, W5500 + Featherwing 기반 보드와 CP/NET 운용 절차(ifconfig → wizcfg → cpnetldr → network)를 소개합니다. 하드웨어 관점의 글이라면, 본 글은 그 위에서 도는 소프트웨어 스택의 관점입니다.
  • RC2014 Wiznet 5300: 동일 플랫폼에 W5300을 병렬 버스로 직결한 사례입니다. 다만 CP/M 측 소프트웨어 지원은 W5500에만 존재해, SPI + W5500 조합이 소프트웨어 생태계에서 우위임을 보여주는 대조 사례입니다.

두 사례 모두 결론은 같습니다. 레트로 Z80 생태계에서 이더넷이 필요할 때 커뮤니티가 도달한 답은 W5500의 하드웨어 스택이었습니다.

→ MT011: https://oldmaker.wiznet.io/2022/02/28/mt011-is-an-rc2014-compaitible-ethernet-controller-based-on-the-w5500/

→ RC2014 Wiznet 5300: https://maker.wiznet.io/2021/11/30/rc2014-wiznet-5300/

비즈니스 가치

외부 가치: "수 MHz MCU + 어셈블리 수준 드라이버"로 TCP/IP가 성립한다는 검증 사례는 W5500 적용 하한선을 보여줍니다. 적용 시나리오:

  • 레거시 산업장비 retrofit: Z80/8051급 컨트롤러가 든 구형 설비에 펌웨어 대수술 없이 이더넷 추가
  • 초저가 MCU IoT 노드: 스택 메모리 부담 없이 소형 MCU로 네트워크 센서 구성
  • 교육·메이커 키트: 레지스터 수준에서 TCP 동작을 들여다보는 네트워크 교육 교재
  • 시리얼 → 이더넷 전환: 기존 UART 기반 장비의 전송 계층 교체

내부 가치: 어셈블리 기반 최소 footprint 드라이버 레퍼런스이자, PMAGIC 전용·포트 기반 노드 매핑 등 레지스터 맵 유연성을 입증하는 설계 패턴 자료입니다.

한계 및 개선 방향

원 프로젝트는 레트로 환경에서 가능한 최선에 가깝지만, 개선 기회도 보입니다.

  • 8소켓 공유 제약: inettools-z80과 병행 시 소켓 0~6을 인터넷 도구가 점유해 CP/NET은 소켓 7 하나만 사용 가능합니다. 동시 서버 연결이 많은 구성에서는 소켓 배분 설계가 필요합니다.
  • 설정 휘발성: W5500은 전원 차단 시 설정을 유지하지 않아 부팅마다 재설정이 필요하며, 프로젝트는 NVRAM(H8xSPI)·FRAM(MT011, 별도 배선 어댑터 필요)으로 보완합니다.
  • 보안: CP/NET 페이로드는 평문·무인증입니다. 인터넷 구간 운용 시 VPN 터널 병용이 현실적인 보완책입니다.
  • 개선 방향: [추정] 듀얼스택 W6100을 적용하면 동일한 SPI 드라이버 구조로 IPv6 환경까지 수명을 연장할 수 있고, W55RP20·W6300 같은 후속 제품군은 호스트 부담을 더 줄일 수 있습니다. NIC/HBA 분리 구조 덕분에 칩 교체 시 수정 범위가 NIC 계층에 국한된다는 점도 유리합니다.

FAQ

Q1. 도입 난이도는 어느 정도인가요? RC2014 기준 RomWBW v3.0.1 이상과 MT011 보드가 필요하며, 빌드는 make NIC=w5500 HBA=mt011 한 줄입니다. 서버는 Java 실행 환경이면 충분합니다.

Q2. 서버는 무엇으로 구성하나요? Java 기반 CpnetSocketServer 또는 C 기반 unix-server를 호스트 PC에서 실행하면, 지정 디렉터리가 CP/M 드라이브로 노출됩니다.

Q3. CPU 클럭 제약이 있나요? MT011은 18.432MHz Z180에서 동작이 확인되었으며, 그 이상은 부품 선별이나 재설계가 필요할 수 있다는 커뮤니티 보고가 있습니다.

Q4. 시리얼 전송 대신 W5500을 쓰는 이유는? 시리얼 경로는 57600bps 수준에 머무는 반면, W5500은 SPI 대역폭과 하드웨어 스택으로 속도·안정성 모두 우위입니다. 오류 처리도 TCP가 대행합니다.

Q5. 다른 WIZnet 칩으로도 가능한가요? 현재 지원은 W5500 계열입니다. [추정] 레지스터 구조가 유사한 W6100 등은 NIC 드라이버 수정으로 이식 가능하나, 검증된 빌드는 없습니다.


Networking a Z80 Without a TCP/IP Stack — CP/NET Meets the W5500's Hardwired TCP/IP

Summary

cpnet-z80 is an open-source port of CP/NET, Digital Research's 1980s network operating system, to Z80 retro computers such as the Heathkit H8/H89 and RC2014. Because the W5500 handles the entire TCP/IP stack in hardware, even a Z80 with a few MHz and 64KB of memory can join a modern Ethernet LAN and mount a host PC's disk as a network drive.

Overview

Connecting a CP/M-era computer to a modern network runs into one hard wall: a software TCP/IP stack is practically unusable on Z80-class resources. Real-world data backs this up — z88dk-based internet tools for the Z80 ship as programs of 30–45KB each, which is enormous on this platform.

→ Reference: https://github.com/jayacotton/inettools-z80

cpnet-z80 flips the problem. It keeps the period-correct network OS, CP/NET, and replaces only the transport layer with the W5500's hardwired TCP/IP. The upstream repository is maintained by Douglas Miller (durgadas311) and serves as the standard reference for CP/NET client and server implementations in the RC2014 community. This article analyzes the GiR-Zippo variant of that repository.

→ Analyzed repository: https://github.com/GiR-Zippo/cpnet-z80

→ Upstream repository: https://github.com/durgadas311/cpnet-z80

Architecture

The overall design is a client-server model: CP/M client (Z80) ↔ W5500 ↔ modern host server. A Java or C server on the host (CpnetSocketServer, unix-server) exposes the host filesystem as CP/M virtual drives, and on the Z80 side a single command — network k:=c:[0] — maps the drive.

Technology Background

CP/NET — Network Drives in the 1980s

CP/NET is Digital Research's network OS for CP/M. It consists of NDOS, which intercepts the client's BDOS calls and forwards them to a server, and SNIOS (the network BIOS), which handles the actual transport. It already implemented the "network drive" concept — using a remote disk as a local drive letter — and swapping the transport only requires replacing the SNIOS. That separation is exactly what made an Ethernet port possible 40 years later.

The W5500's Hardwired TCP/IP Socket Architecture

The W5500 is a controller with the TCP/IP stack implemented in hardware logic. It integrates a 10/100 Ethernet MAC and PHY, provides 8 independent sockets with a 32KB internal buffer, and connects to an external MCU over SPI at up to 80MHz. The host never touches connection setup, retransmission, or checksums — writing the IP and port into socket registers and issuing a command register write is enough to establish TCP communication. In this project, that "host" is hand-written Z80 assembly, which is the whole point.

→ Reference: https://docs.wiznet.io/Product/Chip/Ethernet/W5500

The NIC/HBA Split Driver Design

The SNIOS in cpnet-z80 is split into two layers — NIC (transport type) and HBA (bus interface) — and builds are just combinations, e.g. make NIC=w5500 HBA=mt011. The same w5500 NIC code runs unchanged on the Heathkit's H8xSPI, the RC2014's MT011, and the SC126's Z180 CSIO. That is the secret behind its portability.

Technical Highlights

The project repurposes W5500 registers to carry CP/NET semantics, and the design choices are worth studying.

  • Socket-to-node mapping: The high byte of a socket's source port is set to 0x31 and the low byte to the CP/NET server node ID, marking that socket as a server mapping; Sn_DIPR/Sn_DPORT then point the TCP connection at that server.
  • PMAGIC repurposed: The client node ID is stored in the W5500's PMAGIC register — a creative reuse of a PPPoE-related register as configuration space.
  • Error handling delegated: CP/NET messages travel as raw binary with no CRC or checksum; TCP/IP handles errors and retries. This keeps the Z80 code radically simple.
  • Internet-grade operation: For connections through routers or ISPs, a keep-alive of about 45 seconds is configured via Sn_KPALVTR — the design anticipates reaching CP/NET servers beyond the local LAN.

Where WIZnet Fits

In this project the W5500 goes beyond what we usually call "TCP/IP offloading" — it performs all of TCP/IP for a system whose OS contains zero bytes of network stack. Few setups show the value of the hardwired stack in such pure form.

PlatformWIZnet integrationNotes
Heathkit H8/H89WIZ850io module + H8xSPI boardNVRAM for config retention, RESET pin wired
RC2014W5500 Featherwing + MT011 SPI adapterRomWBW integration, FRAM recommended
SC126 (Z180)W5500 breakout + Z180 CSIO directMinimal extra hardware

There is also contrast data within the same repository: the serial transport path tops out at 57600bps on the SC131 due to missing modem control signals, while the W5500 path leverages SPI bandwidth and a 100Mbps PHY. The community's verdict aligns: if you are building your own, nothing older than the W5500 is recommended — earlier chips carry significant limitations and demand more complex Z80 software.

→ Community discussion: https://groups.google.com/g/rc2014-z80/c/4YLveFTNMbI

Similar Projects on WIZnet Makers

  • MT011 — RC2014-compatible W5500 Ethernet controller: This is the very hardware cpnet-z80 supports. The post covers the W5500 + Featherwing board and the CP/NET workflow (ifconfig → wizcfg → cpnetldr → network). That article takes the hardware view; this one covers the software stack running on top of it.
  • RC2014 Wiznet 5300: The same platform, but with a W5300 wired directly to the parallel bus. Notably, CP/M-side software support exists only for the W5500 — a contrast case showing that the SPI + W5500 combination wins on software ecosystem.

Both cases point to the same conclusion: when the retro Z80 community needed Ethernet, the answer it converged on was the W5500's hardwired stack.

→ MT011: https://oldmaker.wiznet.io/2022/02/28/mt011-is-an-rc2014-compaitible-ethernet-controller-based-on-the-w5500/

→ RC2014 Wiznet 5300: https://maker.wiznet.io/2021/11/30/rc2014-wiznet-5300/

Business Value

External value: A verified case of TCP/IP working with "a few-MHz MCU plus an assembly-level driver" defines the lower bound of where the W5500 applies. Practical scenarios:

  • Legacy industrial retrofit: Add Ethernet to aging equipment with Z80/8051-class controllers without major firmware surgery
  • Ultra-low-cost IoT nodes: Build networked sensors on tiny MCUs with no stack memory burden
  • Education and maker kits: Teach networking by watching TCP work at the register level
  • Serial-to-Ethernet migration: Replace the transport layer of existing UART-based equipment

Internal value: The assembly-based driver is a minimal-footprint reference implementation, and patterns like the PMAGIC reuse and port-based node mapping document the flexibility of the W5500 register map.

Limitations and Future Improvements

The project is close to the best achievable in a retro environment, but improvement opportunities remain.

  • Shared 8-socket budget: When run alongside inettools-z80, sockets 0–6 are claimed by the internet tools, leaving CP/NET only socket 7. Configurations with many simultaneous servers need deliberate socket allocation.
  • Volatile configuration: The W5500 does not retain settings across power-off, requiring reconfiguration at every boot; the project compensates with NVRAM (H8xSPI) and FRAM (MT011, which needs a separate wiring adapter).
  • Security: CP/NET payloads are plaintext and unauthenticated. For internet-spanning links, a VPN tunnel is the realistic mitigation.
  • Improvement direction: [Inferred] Adopting the dual-stack W6100 would extend the same SPI driver structure into IPv6 environments, and newer parts such as the W55RP20 and W6300 could further reduce host burden. Thanks to the NIC/HBA split, a chip swap confines changes to the NIC layer.

FAQ

Q1. How hard is it to set up? On the RC2014, you need RomWBW v3.0.1 or newer plus the MT011 board; the build is a single line, make NIC=w5500 HBA=mt011. The server only needs a Java runtime.

Q2. What runs on the server side? Run the Java-based CpnetSocketServer or the C-based unix-server on a host PC, and a chosen directory is exposed as CP/M drives.

Q3. Are there CPU clock constraints? Community reports confirm the MT011 working on a Z180 at 18.432MHz, with anything faster likely requiring part selection or a redesign.

Q4. Why the W5500 instead of serial transport? The serial path stalls around 57600bps, while the W5500 wins on both speed and reliability through SPI bandwidth and the hardwired stack. TCP also takes over error handling.

Q5. Can other WIZnet chips be used? Current support targets the W5500 family. [Inferred] Chips with similar register layouts such as the W6100 could be ported by modifying the NIC driver, but no verified build exists.

Documents
Comments Write