1 fn load-sectors disk: (addr disk), lba: int, n: int, out: (addr stream byte) {
2 var curr-lba/ebx: int <- copy lba
3 var remaining/edx: int <- copy n
7 # sectors = min(remaining, 0x100)
8 var sectors/eax: int <- copy remaining
15 read-ata-disk disk, curr-lba, sectors, out
17 remaining <- subtract sectors
18 curr-lba <- add sectors
23 fn store-sectors disk: (addr disk), lba: int, n: int, in: (addr stream byte) {
24 var curr-lba/ebx: int <- copy lba
25 var remaining/edx: int <- copy n
29 # sectors = min(remaining, 0x100)
30 var sectors/eax: int <- copy remaining
31 compare sectors, 0x100
37 write-ata-disk disk, curr-lba, sectors, in
39 remaining <- subtract sectors
40 curr-lba <- add sectors