mirror of
https://github.com/alfishe/amiga-bootcamp.git
synced 2026-06-13 00:26:28 +00:00
docs(amiga): complete AmigaOS 3.1/3.2 developer reference — 172 files across 17 sections
Comprehensive technical documentation covering: - Hardware: OCS/ECS/AGA custom chip registers, Copper & Blitter deep dives - Boot sequence: cold boot through startup-sequence - Binary format: HUNK executable spec, relocation, debug info - Linking & ABI: .fd files, LVO tables, register calling conventions - Exec kernel: tasks, interrupts, memory, signals, semaphores - AmigaDOS: file I/O, FFS/OFS layout, CLI/Shell scripting - Graphics: planar bitmaps, Copper programming, HAM/EHB modes - Intuition: screens, windows, IDCMP, BOOPSI - Devices: trackdisk, SCSI, serial, timer, audio, keyboard - Libraries: utility, expansion, IFFParse, locale, ARexx - Networking: bsdsocket API, SANA-II, TCP/IP stack comparison - Toolchain: GCC, vasm/vlink, SAS/C, NDK, debugging - Reverse engineering: IDA/Ghidra setup, compiler fingerprints, case studies - CPU & MMU: 68040/060 emulation libs, PMMU, cache management - Driver development: SANA-II, Picasso96/RTG, AHI audio All files include breadcrumb navigation. No local paths or proprietary content.
This commit is contained in:
parent
f07a368bf1
commit
21751c0025
172 changed files with 19701 additions and 0 deletions
12
12_networking/README.md
Normal file
12
12_networking/README.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[← Home](../README.md)
|
||||
|
||||
# Networking — Overview
|
||||
|
||||
## Section Index
|
||||
|
||||
| File | Description |
|
||||
|---|---|
|
||||
| [bsdsocket.md](bsdsocket.md) | bsdsocket.library — BSD socket API |
|
||||
| [sana2.md](sana2.md) | SANA-II — standard network device driver interface |
|
||||
| [tcp_ip_stacks.md](tcp_ip_stacks.md) | Stack comparison: AmiTCP, Miami, Roadshow |
|
||||
| [protocols.md](protocols.md) | Protocol implementation: DHCP, DNS, HTTP |
|
||||
93
12_networking/bsdsocket.md
Normal file
93
12_networking/bsdsocket.md
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
[← Home](../README.md) · [Networking](README.md)
|
||||
|
||||
# bsdsocket.library — BSD Socket API
|
||||
|
||||
## Overview
|
||||
|
||||
`bsdsocket.library` is the AmigaOS implementation of the BSD socket API. It is provided by the active TCP/IP stack (AmiTCP, Miami, Roadshow) and presents a POSIX-like socket interface adapted to the Amiga's library-based architecture.
|
||||
|
||||
---
|
||||
|
||||
## Opening
|
||||
|
||||
```c
|
||||
struct Library *SocketBase = OpenLibrary("bsdsocket.library", 4);
|
||||
if (!SocketBase) { /* no TCP/IP stack running */ }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Core Functions (LVO Mapping)
|
||||
|
||||
| LVO | Function | BSD Equivalent |
|
||||
|---|---|---|
|
||||
| −30 | `socket(domain, type, protocol)` | `socket()` |
|
||||
| −36 | `bind(sock, name, namelen)` | `bind()` |
|
||||
| −42 | `listen(sock, backlog)` | `listen()` |
|
||||
| −48 | `accept(sock, addr, addrlen)` | `accept()` |
|
||||
| −54 | `connect(sock, name, namelen)` | `connect()` |
|
||||
| −60 | `sendto(sock, buf, len, flags, to, tolen)` | `sendto()` |
|
||||
| −66 | `send(sock, buf, len, flags)` | `send()` |
|
||||
| −72 | `recvfrom(sock, buf, len, flags, from, fromlen)` | `recvfrom()` |
|
||||
| −78 | `recv(sock, buf, len, flags)` | `recv()` |
|
||||
| −84 | `shutdown(sock, how)` | `shutdown()` |
|
||||
| −90 | `setsockopt(...)` | `setsockopt()` |
|
||||
| −96 | `getsockopt(...)` | `getsockopt()` |
|
||||
| −102 | `gethostbyname(name)` | `gethostbyname()` |
|
||||
| −108 | `gethostbyaddr(addr, len, type)` | `gethostbyaddr()` |
|
||||
| −114 | `getnetbyname(name)` | `getnetbyname()` |
|
||||
| −168 | `Errno()` | `errno` (returns last error) |
|
||||
| −174 | `CloseSocket(sock)` | `close()` |
|
||||
| −180 | `WaitSelect(nfds, rd, wr, ex, timeout, sigmask)` | `select()` + signals |
|
||||
| −210 | `inet_addr(cp)` | `inet_addr()` |
|
||||
| −216 | `Inet_NtoA(in)` | `inet_ntoa()` |
|
||||
| −222 | `inet_makeaddr(net, host)` | `inet_makeaddr()` |
|
||||
| −252 | `getservbyname(name, proto)` | `getservbyname()` |
|
||||
|
||||
---
|
||||
|
||||
## WaitSelect — Amiga-Enhanced select()
|
||||
|
||||
Unlike BSD `select()`, `WaitSelect` integrates with Exec signals:
|
||||
|
||||
```c
|
||||
fd_set rdset;
|
||||
FD_ZERO(&rdset);
|
||||
FD_SET(sock, &rdset);
|
||||
|
||||
ULONG sigmask = SIGBREAKF_CTRL_C; /* also wait for Ctrl-C */
|
||||
struct timeval tv = { 5, 0 }; /* 5 second timeout */
|
||||
|
||||
LONG n = WaitSelect(sock + 1, &rdset, NULL, NULL, &tv, &sigmask);
|
||||
if (n > 0 && FD_ISSET(sock, &rdset)) { /* data ready */ }
|
||||
if (sigmask & SIGBREAKF_CTRL_C) { /* user pressed Ctrl-C */ }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Simple TCP Client
|
||||
|
||||
```c
|
||||
LONG sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
struct sockaddr_in addr;
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(80);
|
||||
addr.sin_addr.s_addr = inet_addr("93.184.216.34");
|
||||
|
||||
if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
|
||||
send(sock, "GET / HTTP/1.0\r\nHost: example.com\r\n\r\n", 38, 0);
|
||||
char buf[4096];
|
||||
LONG n = recv(sock, buf, sizeof(buf) - 1, 0);
|
||||
buf[n] = 0;
|
||||
Printf("%s\n", buf);
|
||||
}
|
||||
CloseSocket(sock);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## References
|
||||
|
||||
- NDK39: `libraries/bsdsocket.h` (stack-specific)
|
||||
- Roadshow SDK documentation
|
||||
- `12_networking/sana2.md` — network device driver layer
|
||||
67
12_networking/protocols.md
Normal file
67
12_networking/protocols.md
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
[← Home](../README.md) · [Networking](README.md)
|
||||
|
||||
# Protocol Implementation — DHCP, DNS, HTTP
|
||||
|
||||
## Overview
|
||||
|
||||
With `bsdsocket.library` providing a BSD-compatible API, standard network protocols can be implemented using familiar patterns adapted for the Amiga's single-address-space, library-based architecture.
|
||||
|
||||
---
|
||||
|
||||
## DNS Resolution
|
||||
|
||||
```c
|
||||
/* gethostbyname — provided by bsdsocket.library: */
|
||||
struct hostent *he = gethostbyname("www.amiga.org");
|
||||
if (he) {
|
||||
struct in_addr addr = *(struct in_addr *)he->h_addr;
|
||||
Printf("IP: %s\n", Inet_NtoA(addr.s_addr));
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## HTTP Client (Minimal)
|
||||
|
||||
```c
|
||||
LONG sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
struct hostent *he = gethostbyname("www.example.com");
|
||||
struct sockaddr_in sa;
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(80);
|
||||
CopyMem(he->h_addr, &sa.sin_addr, he->h_length);
|
||||
|
||||
connect(sock, (struct sockaddr *)&sa, sizeof(sa));
|
||||
|
||||
char req[] = "GET / HTTP/1.0\r\nHost: www.example.com\r\n\r\n";
|
||||
send(sock, req, strlen(req), 0);
|
||||
|
||||
char buf[8192];
|
||||
LONG total = 0, n;
|
||||
while ((n = recv(sock, buf + total, sizeof(buf) - total - 1, 0)) > 0)
|
||||
total += n;
|
||||
buf[total] = 0;
|
||||
Printf("%s\n", buf);
|
||||
|
||||
CloseSocket(sock);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## DHCP Overview
|
||||
|
||||
DHCP on Amiga is typically handled by the TCP/IP stack itself (Roadshow, Miami) or an external client (AmiTCP + `dhclient`). The sequence is standard:
|
||||
|
||||
1. `DHCPDISCOVER` — broadcast on port 67
|
||||
2. `DHCPOFFER` — server responds with IP offer
|
||||
3. `DHCPREQUEST` — client accepts
|
||||
4. `DHCPACK` — server confirms; lease begins
|
||||
|
||||
For MiSTer/FPGA cores with custom SANA-II drivers, DHCP is handled automatically once the SANA-II driver is online and the stack is configured for `IPTYPE=DHCP`.
|
||||
|
||||
---
|
||||
|
||||
## References
|
||||
|
||||
- `12_networking/bsdsocket.md` — socket API reference
|
||||
- `12_networking/tcp_ip_stacks.md` — stack configuration
|
||||
78
12_networking/sana2.md
Normal file
78
12_networking/sana2.md
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
[← Home](../README.md) · [Networking](README.md)
|
||||
|
||||
# SANA-II — Standard Amiga Network Architecture
|
||||
|
||||
## Overview
|
||||
|
||||
SANA-II is the standard device driver interface for network hardware on AmigaOS. It defines a uniform API that TCP/IP stacks use to communicate with any network card (Ethernet, WiFi, PPP, etc.).
|
||||
|
||||
---
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Application
|
||||
↓
|
||||
bsdsocket.library (TCP/IP stack)
|
||||
↓
|
||||
SANA-II device driver (e.g., prism2.device, a2065.device)
|
||||
↓
|
||||
Network hardware
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Opening a SANA-II Device
|
||||
|
||||
```c
|
||||
struct IOSana2Req *s2req = (struct IOSana2Req *)
|
||||
CreateIORequest(port, sizeof(struct IOSana2Req));
|
||||
|
||||
/* Provide buffer management hooks: */
|
||||
static struct TagItem s2tags[] = {
|
||||
{ S2_CopyToBuff, (ULONG)CopyToBuff },
|
||||
{ S2_CopyFromBuff, (ULONG)CopyFromBuff },
|
||||
{ TAG_DONE, 0 }
|
||||
};
|
||||
s2req->ios2_BufferManagement = s2tags;
|
||||
|
||||
OpenDevice("a2065.device", 0, (struct IORequest *)s2req, 0);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Commands
|
||||
|
||||
| Code | Constant | Description |
|
||||
|---|---|---|
|
||||
| 2 | `CMD_READ` | Read a packet |
|
||||
| 3 | `CMD_WRITE` | Send a packet |
|
||||
| 9 | `S2_DEVICEQUERY` | Query hardware capabilities |
|
||||
| 10 | `S2_GETSTATIONADDRESS` | Get MAC address |
|
||||
| 11 | `S2_CONFIGINTERFACE` | Configure interface (set MAC) |
|
||||
| 14 | `S2_ONLINE` | Bring interface online |
|
||||
| 15 | `S2_OFFLINE` | Take interface offline |
|
||||
| 21 | `S2_GETGLOBALSTATS` | Get packet statistics |
|
||||
| 16 | `S2_ADDMULTICASTADDRESS` | Add multicast address |
|
||||
| 17 | `S2_DELMULTICASTADDRESS` | Remove multicast address |
|
||||
|
||||
---
|
||||
|
||||
## Packet Reading
|
||||
|
||||
```c
|
||||
s2req->ios2_Req.io_Command = CMD_READ;
|
||||
s2req->ios2_WireError = 0;
|
||||
s2req->ios2_PacketType = 0x0800; /* IPv4 */
|
||||
SendIO((struct IORequest *)s2req);
|
||||
/* wait for packet... */
|
||||
WaitIO((struct IORequest *)s2req);
|
||||
/* s2req->ios2_Data* contains the received packet */
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## References
|
||||
|
||||
- SANA-II Network Device Driver Specification (Commodore)
|
||||
- NDK39: `devices/sana2.h`
|
||||
66
12_networking/tcp_ip_stacks.md
Normal file
66
12_networking/tcp_ip_stacks.md
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
[← Home](../README.md) · [Networking](README.md)
|
||||
|
||||
# TCP/IP Stacks — AmiTCP, Miami, Roadshow
|
||||
|
||||
## Overview
|
||||
|
||||
AmigaOS has no built-in TCP/IP stack. Third-party stacks provide `bsdsocket.library`. All stacks present the same API to applications — only configuration and driver support differ.
|
||||
|
||||
---
|
||||
|
||||
## Stack Comparison
|
||||
|
||||
| Feature | AmiTCP 3.0b2 | Miami 3.2 | Roadshow 1.15 |
|
||||
|---|---|---|---|
|
||||
| License | Free (Genesis fork) | Commercial | Commercial (demo available) |
|
||||
| API version | bsdsocket.library v3 | v4 | v4 |
|
||||
| IPv6 | No | No | No |
|
||||
| PPP | Via serial | Built-in | Via driver |
|
||||
| DHCP | External (dhclient) | Built-in | Built-in |
|
||||
| DNS cache | No | Yes | Yes |
|
||||
| SANA-II | Yes | Yes | Yes |
|
||||
| GUI config | MUI prefs | Miami prefs | Roadshow prefs |
|
||||
| Active development | No | No | Yes (Olaf Barthel) |
|
||||
| MiSTer recommended | ✅ (free) | — | ✅ (most capable) |
|
||||
|
||||
---
|
||||
|
||||
## Configuration (Roadshow)
|
||||
|
||||
```
|
||||
; DEVS:NetInterfaces/prism2
|
||||
DEVICE=prism2.device
|
||||
UNIT=0
|
||||
IPTYPE=DHCP
|
||||
; or:
|
||||
; ADDRESS=192.168.1.100
|
||||
; NETMASK=255.255.255.0
|
||||
; GATEWAY=192.168.1.1
|
||||
|
||||
; DEVS:NetInterfaces/lo0
|
||||
DEVICE=lo0.device
|
||||
UNIT=0
|
||||
ADDRESS=127.0.0.1
|
||||
NETMASK=255.0.0.0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration (AmiTCP)
|
||||
|
||||
```
|
||||
; AmiTCP:db/interfaces
|
||||
prism2 DEV=DEVS:Networks/prism2.device UNIT=0 IP=DHCP
|
||||
|
||||
; AmiTCP:db/netdb-myhost
|
||||
HOST 127.0.0.1 localhost
|
||||
NAMESERVER 8.8.8.8
|
||||
DOMAIN local
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## References
|
||||
|
||||
- Roadshow SDK: http://roadshow.apc-tcp.de/
|
||||
- AmiTCP SDK: Aminet `comm/tcp/AmiTCP-SDK-4.3.lha`
|
||||
Loading…
Add table
Add a link
Reference in a new issue