Listing: 06-winchester-load.asm ·
driver 05-helpers-disk.asm
Related: Floppy load
path · Winchester
parameters · How to boot hard
disk
Entries:
| Path | How reached |
|---|---|
1066 |
Menu key W (07F4 table) or vector
0012 → JP 1066 |
1072 |
Core helper: called by 1066, and by auto-boot
@0140 |
Auto-boot @012B |
If (09AA)≠0: print LOADING → 15AA →
CALL 1072 → success
CALL 2400 |
Unit: A = 00h (Winchester / fixed
disk)
First sector: LBA 0 → RAM
2400h via
1638 (not 14A8)
High-level flow
Menu [W] / vector 0012
│
▼
1066 CALL 1072
│
├─ NZ → JP 155D ; hardware error (A = code 1..8)
├─ C → JP 11C0 ; system error (A = 2 or 5)
└─ OK → JP 2400h ; run SYSTEM image (no return)
1072 (helper — also used by auto-boot)
│
├─ (67F6)=0
├─ A=0, CALL 1600 ; select unit 0, wait ready
├─ A=0, C=1, CALL 15DE ; restore / home
├─ HL=2400, A=0, B=1, DE=0, C=0
│ CALL 1638 ; read 512 bytes → 2400h
│
├─ (2402)==02h ?
│ no → A=2, SCF, RET ; #2 UNRECOGNIZED MEDIA FORMAT
│
├─ (09AA)==(240B) ?
│ no → A=5, SCF, RET ; #5 CONFIGURATION MISMATCH
│
└─ A=0, HL still @240B area
CALL 1434 ; geometry FROM HEADER (A<3 path)
OR A / RET ; NZ = HW error from restore
Auto-boot success differs only in transfer:
CALL 1072 success → putchar 18h → CALL 2400h ; not JP
(Menu W uses JP 2400.)
Step detail — 1072
1. Clear load flag
1072 XOR A
1073 LD (67F6h), A
Same flag floppy clears at 104D before type
dispatch.
2. Select unit 0 —
CALL 1600
1076 LD A, 00h
1078 CALL 1600h
107B OR A / RET NZ ; HW error → caller
1600 unit differences (A=0 vs A=3
floppy):
Winchester A=0 |
Floppy A=3 |
|
|---|---|---|
| Ready mask L | D0h |
F0h |
| Timeout DE | 1388h |
7530h |
| Error H seed | H starts 2 then INC H → 3 |
H=2 |
168B A6 pattern |
A*8 \| A0h \| (C&7) (A<3 branch) |
(A-3)*2 \| 38h \| (C&1) |
Winchester uses the shorter ready timeout path
(OR A is Z → 161B).
3. Restore — CALL 15DE
107D LD A, 00h
107F LD C, 01h
1081 CALL 15DEh
1084 OR A / RET NZ
15DE with unit 0 and C bit0 set:
CALL 168B
A = 10h
if unit≥3: … else if C bit0: A |= 06h → OUT (A7), 16h
wait 16BC; fail → error #5 DRIVE RESTORE
4. Read LBA 0 —
CALL 1638 (direct)
1086 LD HL, 2400h
1089 LD A, 00h ; unit 0 (passed through 168B)
108B LD B, 01h ; address reg B → OUT (A3)
108D LD DE, 0000h ; LBA / sector address D,E → A5,A4
1090 LD C, 00h
1092 CALL 1638h
1095 OR A / RET NZ
Important: Floppy first sector uses
14A8 (geometry-aware multi-sector).
Winchester first sector uses 1638 directly
(controller INIR path, 512 bytes to HL).
1638 for unit 0:
- Ready mask
D0h(same as select) OUT (A7), 20hread command- On success:
INIR×2 from portA0→ 512 bytes at2400h
5. Header checks
Format id
1097 LD A, (2402h)
109A CP 02h
109C JR Z, 10A3h
109E XOR A
109F LD A, 02h
10A1 SCF
10A2 RET ; CF=1, A=2 → 11C0 UNRECOGNIZED MEDIA FORMAT
Configuration match (Winchester-specific)
10A3 LD A, (09AAh) ; ROM config id (dump: C8h)
10A6 LD HL, 240Bh
10A9 CP (HL) ; must match header +0Bh
10AA JR Z, 10B1h
10AC XOR A
10AD SCF
10AE LD A, 05h
10B0 RET ; CF=1, A=5 → 11C0 CONFIGURATION MISMATCH
Floppy path does not compare (09AA) to
(240B) on the simple boot branch. Winchester
requires ROM config byte == disk header config id.
6. Geometry from header
— CALL 1434 with A=0
10B1 LD A, 00h
10B3 CALL 1434h ; HL still 240Bh after CP
10B6 OR A
10B7 RET
Because A < 3, 1434 takes the
header geometry branch at 1481 (not ROM
table @0831):
; HL entered as 240B
INC HL × 5 ; → 2410
(2006) = (2410) ; shift / block param
(2003) = word (2411) ; geometry word (SPT-related, etc.)
(2008) = (2413)
(2007) = 0 or 1 from (2414)
C = (2007)
A = (2009) = 0
JP 15DE ; second restore with new geometry
So after a successful Winchester load helper, driver vars are
programmed from the SYSTEM header, not from the floppy
media table FA–FF.
Step detail — menu wrapper
1066
1066 CALL 1072h
1069 JP NZ, 155Dh ; A = HW code, print hardware error
106C JP C, 11C0h ; A = 2 or 5, print system error
106F JP 2400h ; run image at 2400 (never returns)
No type field test, no directory search, no JP FF4C.
Header fields used (Winchester)
| Off | Addr | Check / use |
|---|---|---|
+02 |
2402 |
Must be 02h (else error
#2) |
+0B |
240B |
Must equal ROM (09AA) (else error
#5) |
+10…+14 |
2410… |
Geometry loaded into 2003–2008 via
1434 A<3 |
+00 |
2400 |
Execution entry:
JP/CALL 2400 (code starts
here) |
Not checked on Winchester path: (2442)
flags, type 21h, simple-boot nonzero word test (execution
is unconditional after helper OK).
Differences from floppy
(1000)
| Item | Floppy 1000 |
Winchester 1066/1072 |
|---|---|---|
| Unit | A=3 |
A=0 |
| Menu key | F |
W |
| First select | 1600 A=3 |
1600 A=0 |
| Geometry before read | 1434 B=FEh, table @0831 |
None before first read |
| First sector API | 14A8 (1 sector) |
1638 direct |
| Format fail code | #1 UNRECOGNIZED SYSTEM DISKETTE | #2 UNRECOGNIZED MEDIA FORMAT |
Config (09AA) vs (240B) |
Not on simple path | Required (#5 on mismatch) |
(2442) flags / type |
Required; type 21h → full file load |
Not used |
| Success transfer | JP 2400 or type21 → FF4C |
Always JP 2400 (menu) /
CALL 2400 (auto-boot) |
| Multi-sector SYSTEM FILE | Type 21h path 10B8 |
No — single sector then run |
Second 1434 |
From (2415)/(2442) with A=3 |
From header with A=0 after validate |
| Auto-boot | Not via 1000 |
CALL 1072 from 0140 if
(09AA)≠0 |
Shared helpers
| Addr | Role | Winchester use | Floppy use |
|---|---|---|---|
1600 |
Select unit / ready wait | Unit 0 | Unit 3 |
15DE |
Restore / seek-class cmd | After select; again from 1434 |
From 1434 after geometry |
1638 |
Low-level 512B read | First sector | Via 14A8 only |
14A8 |
Geometry-aware multi-read | Not in 1072 |
First sector + type21 |
1434 |
Geometry + restore | A<3 header path | A≥3 table @0831 |
168B |
Program A2–A6 | Both | Both |
16BC |
Wait controller ready | Both | Both |
15CE |
Status return / cleanup | Both | Both |
155D |
HW error print | From 1066 if NZ |
Throughout 1000 |
11C0 |
Sys error print | From 1066 if CF |
Format/type failures |
15AA |
Controller probe | Auto-boot before 1072 |
Menu start; not required by 1000 itself |
Controller ports (same family)
| Port | Use |
|---|---|
A0 |
Data INIR |
A1 |
Sense (probe 15AA) |
A2–A5 |
Address |
A6 |
Unit control |
A7 |
Command / status |
A8 |
Gate (15AA) |
Error summary (Winchester)
| Condition | Flags | A | Printer | Message |
|---|---|---|---|---|
| Select/restore/read fail | NZ, NC | 1–8 | 155D |
Hardware table |
(2402)≠02 |
CF | 2 | 11C0 |
UNRECOGNIZED MEDIA FORMAT |
(240B)≠(09AA) |
CF | 5 | 11C0 |
CONFIGURATION MISMATCH |
Related:
12FB Winchester touch (type 21h finish only)
After a floppy type-21h bulk load, 12FB
may optionally:
- If
(09AA)≠0, match drive records,CALL 1434A=0
- Read Winchester LBA 0 →
2200via14A8
- Verify
(2202)==02and config ids
- Scan sectors from LBA
36hfor type match to(2442)
- Copy 13 bytes from
222B→6723
That is not part of menu [W] /
1072; it only enriches the floppy type-21h handoff
workspace.
Annotated outline
; --- menu / vector ---
1066 CALL 1072
JP NZ,155D / JP C,11C0 / JP 2400
; --- helper (menu + auto-boot) ---
1072 (67F6)=0
A=0 / CALL 1600 ; unit 0
A=0,C=1 / CALL 15DE ; restore
HL=2400, A=0,B=1,DE=0,C=0 / CALL 1638
require (2402)=02 else A=2 SCF RET
require (09AA)=(240B) else A=5 SCF RET
A=0 / CALL 1434 ; geometry from header @2410+
RET ; Z = success
Open questions
- Exact CHS/LBA layout of Winchester sector 0 beyond the fields above
(need media dump).
- Whether any Winchester media uses type-
21h-style multi-sector SYSTEM (current code path does not).
- Meaning of
B=01on the initial1638call (address byte toA3) vs floppy geometry conversion.