; =============================================================================
; Type 21h SYSTEM FILE load — annotated outline (Z80)
; ROM: VECTOR 4/8086 - V2_AC_Interleaved_XHE_XHO.bin  base 0000
; Entered from 1000 path when (2442)&3Fh == 21h
; Full linear listings: 02-floppy-load.asm, 03-type21-helpers.asm
; =============================================================================

; --- 10B8: directory parameters ---------------------------------------------
; B=8; HL=(2411) entry count; shift-normalize with B
; DE = 2*(2416)+1  → (200C) dir LBA cursor
; (200A) = HL+DE   data base
; (201C)=(2015)=0

; --- 10DD: find file --------------------------------------------------------
; CALL 11EE          ; HL -> 32-byte dirent in 2200 buffer
; CF → error #7; NZ → 155D
; (HL)==E5 → next
; compare 11 bytes to (241E), RES 7,(HL) each
; match: HL+=0F; (201D)=word at dirent+1A

; 11EE:
;   dec (2411); if was 0 → SCF RET
;   if (201C)==0: read sector (200C)++ → 2200, (201A)=2200
;   inc (201C) mod 16
;   return HL=(201A), advance (201A)+=20h

; --- 1107: allocation map ---------------------------------------------------
; A=(2416), DE=1, BC=0, HL=2600, CALL 14A8

; --- 1272: next block from map @2600 ----------------------------------------
; index=(201D)
; byte_off = (index*3)/2 ; CF=odd
; w = word at 2600+byte_off; if odd w>>=4; w&=0FFF
; (201D)=w                ; chain next
; if index==0 or index==0FF0h → SCF RET (EOF)
; DE=index-2; NC RET      ; disk block number

; --- 1231: next file sector to HL -------------------------------------------
; if (2015)==0:
;   CALL 1272 → DE block
;   LBA = DE*(240D)+(200A) → (200F)
; inc (2015); if ==(240D): (2015)=0
; read 1 sector at (200F)++ into HL via 14A8

; --- 1119: phase1 header block @2200 ----------------------------------------
; CALL 1231
; (2200)==(2442); (2227)→67F1; (2229)→67F3; (2223)→2018
; small RAM: (2223)<00D8h
; LDIR 2300→6500, 80h

; --- 115E: phase2 @2200 -----------------------------------------------------
; CALL 1231
; (2246) ≤ "01"; (2248)=='C'
; LDIR 224C→244C, B4h

; --- 118E: bulk -------------------------------------------------------------
; (2016)=4
; loop: DE=(2016); CALL 0420; CALL 1231; (2016)+=2; dec (2018)

; --- 11B7 -------------------------------------------------------------------
; CALL 12B1   ; 6600 drive table from 09AA + 244C
; CALL 12FB   ; 6660 media table
; JP 13A9

; --- 13A9: handoff ----------------------------------------------------------
; fill 67E0..67F5; copy stub 0573→674C
; optional swap 67F0↔77F0 if (5FDD)
; program mapper port 16h over banks
; JP FF4C
