Listings: 02-floppy-load.asm
(10B8–11BD) · 03-type21-helpers.asm · type21-outline.asm
Related: Floppy load
path · Handoff 13A9 → FF4C · Error codes
Entered when after floppy header validate:
(2442) & C0h == 80h
(2442) & 3Fh == 21h
Sector 0 already at 2400h.
Pipeline
10B8 Setup dir LBA / entry count
│
├─ loop CALL 11EE ; next 32-byte dirent @2200
│ skip E5; match 11-char name @241E
│ on match: (201D) = alloc index from dirent+1A
│
├─ 14A8 → 2600h ; allocation map
│
├─ 1231 → 2200h ; file phase 1 (header block)
├─ 1231 → 2200h ; phase 2 (version/'C'/config)
├─ bulk: 0420 + 1231 ; body into mapped pages
│
├─ 12B1 / 12FB ; runtime tables 6600/6660
└─ JP 13A9 → mapper walk → JP FF4C
1. Directory setup
(10B8–10DA)
normalize (2411) entry count (shift with B=08)
dir_start LBA = 2*(2416)+1 → (200C)
(200A) = count + dir_start ; data base related
(201C)=(2015)=0
| Var | Role |
|---|---|
(2411) |
Remaining dir entries (decremented in 11EE) |
(2416) |
Factor for dir LBA and map read count |
(200C) |
Next directory sector LBA |
(200A) |
Base LBA for data blocks |
(201C) |
Entry index 0…15 in current sector |
(201A) |
Pointer to current dirent in 2200 |
2. Directory search —
11EE + name match
Loop (10DD)
CALL 11EE
CF → 11C0 A=7
NZ → 155D
(HL)==E5 → next
compare 11 bytes vs (241E), RES 7,(HL)
match: HL+=000Fh; (201D)=word at +1Ah
Dirent (32 bytes)
| Off | Field |
|---|---|
+00 |
E5=free; else name |
+00…+0A |
11-char name vs 241E |
+1A…+1B |
Initial allocation-map index |
11EE
if (2411)==0 after dec: SCF RET
if (201C)==0: read (200C)++ → 2200, (201A)=2200
inc (201C) mod 16
return HL=current dirent; (201A)+=20h
16 entries × 32 bytes = one 512-byte sector.
Name is not in ROM — only on disk at header offset
+1Eh.
3. Allocation map
@ 2600h
A=(2416), DE=0001, BC=0, HL=2600
CALL 14A8
1272 — next
block (12-bit packed, 2 per 3 bytes)
index = (201D)
byte_off = (index*3)/2 ; CF = odd half
w = word at 2600+byte_off
if odd: w >>= 4
w &= 0FFFh
(201D) = w ; chain next index
if old_index==0 or ==0FF0h: SCF RET ; EOF
DE = old_index - 2 ; disk block number
NC RET
Model: linked chain of 12-bit indices; physical LBA
= block*(240D)+(200A).
1231 — next file sector →
HL
if (2015)==0:
CALL 1272 → DE block
(200F) = DE*(240D)+(200A)
inc (2015); if ==(240D): (2015)=0
read 1 sector at (200F)++ into HL via 14A8
| Var | Role |
|---|---|
(240D) |
Sectors per allocation block |
(2015) |
Sector within block |
(200F) |
Next absolute sector LBA |
(201D) |
Map chain cursor |
4. File body phases
(1119–11B5)
Phase 1 @ 2200
CALL 1231
(2200)==(2442) else #4
(2227)→67F1; (2229)→67F3; (2223)→2018
if (5FDD)==0: require (2223)<00D8h else #7
LDIR 2300→6500, BC=80h
Phase 2 @ 2200
CALL 1231
(2246) ≤ "01" (word); (2248)=='C' else #4
LDIR 224C→244C, BC=B4h
Phase 3 bulk
(2016)=0004
loop:
DE=(2016); CALL 0420 ; map bank
CALL 1231
(2016)+=2; (2018)--
until (2018)==0
CALL 12B1 / CALL 12FB
JP 13A9
5. Config builders
12B1: zero 6600…; for 8
ROM ids @09AA, match 12-byte records in @244C,
copy to table.
12FB: zero 6660…; media
templates @09B9/@09C6 from
(2442)&30h; optional Winchester probe if
(09AA)≠0.
6. Handoff 13A9 →
JP FF4C
Full write-up: Handoff 13A9 → FF4C · 08-handoff-13A9.asm
- Build param block
@67E0(FE00/FE60, bases from5FDD,EA+file words as 8086 far-jump image at67F0). - Copy stub
0573→674C(not executed here). - Optional swap
67F0↔︎77F0if large RAM. - Reprogram mapper port
16h(banks +CE, final3F/7F). JP FF4C— entry outside boot ROM under new map; never returns to menu.
Simple (non-21h) boot uses JP 2400
instead.
7. Errors (type 21h)
| Code | Path | Cause |
|---|---|---|
| HW 1–8 | 155D |
Controller / read |
| Sys 3 | 11C0 |
Unexpected EOF from 1231 |
| Sys 4 | 11C0 |
Incompatible header/version/'C' |
| Sys 7 | 11C0 |
Dir exhaust or size limit |
See Error codes.
8. Memory during load
2400 SYSTEM header (sector 0)
2200 dir / file structure scratch
2600 allocation map
6500 80h copy from first file block
6600 drive config table
6660 media config
67E0 handoff block
… bulk via 0420-mapped windows
FF4C transfer address
9. Open questions
- Exact 11-byte name on real media (
241E)
- Confirm alloc chain semantics with a disk
image
- Code at
FF4Cafter remap (Z80 vs 8086)
- Meaning of
EA/E40Cfields at67EE–67F0