diff --git a/bootsect.asm b/bootsect.asm index 6847bd6..146d86b 100644 --- a/bootsect.asm +++ b/bootsect.asm @@ -282,35 +282,21 @@ loadsectors: and al, 0xC0 or cl, al - ; Copy number of sectors to still read to ax and cap at 127 - pop ax - push ax - cmp al, 127 - jbe .read - mov al, 127 + mov ah, 2 + mov al, 1 + mov dl, [drivenumber] + int 0x13 + ; TODO: Handle reset & retry + jnc .noerror + .noerror: - .read: - mov ah, 2 - mov dl, [drivenumber] - int 0x13 - - ; Decrement cx by the number of sectors read pop cx - xor ah, ah - sub cx, ax + pop ax - ; Increment bx by the number of sectors read times 512 - xor dx, dx - mov dh, al - shl dx, 1 - add bx, dx + inc ax + add bx, 512 - ; Increment ax by the number of sectors read - pop dx - add ax, dx - - test cx, cx - jnz .loop + loop .loop pop dx pop cx