Skip to content

Commit 8cab241

Browse files
committed
fix cd bios calling doc
Signed-off-by: Joseph Mattiello <[email protected]>
1 parent e1edfe4 commit 8cab241

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

docs/cd-bios-calling-convention.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,22 @@ None.
9090
| Register | Meaning |
9191
|----------|---------|
9292
| A0 | Current RAM write position (GPU ISR advances this as data arrives) |
93-
| A1 | Bytes transferred so far (from GPU data area [+8]) |
93+
| A1 | Error status: 0 = OK (transfer in progress or complete), non-zero = error |
9494

95-
Boot stubs typically save the end address in A6 before calling CD_read, then poll:
95+
Boot stubs save the end address in A6 before calling CD_read, then poll:
9696
```
97-
.poll: JSR ($304E).w
98-
CMPA.L A6, A0 ; current position >= end?
99-
BLT .poll
97+
.poll: JSR ($304E).w ; CD_poll
98+
CMPA.L #0, A1 ; error?
99+
BNE .error ; A1 != 0 → error/retry
100+
CMPA.L A6, A0 ; current position >= end?
101+
BLT .poll ; not done yet
102+
; success — transfer complete
100103
```
101104

105+
**Note:** A1 is NOT "bytes transferred" — it is an error flag. The Primal Rage boot stub
106+
at $0803A4 explicitly checks `CMPA.L #0,A1; BNE .error`. This was confirmed by
107+
disassembly of the retail boot stub and verified against BIOS behavior.
108+
102109
## CDBYPASS Boot Sequence (Reference)
103110

104111
1. `JSR $3048` — hardware reset

0 commit comments

Comments
 (0)