From 5a24ceb9b85b4071bcd2a4e9dc31a44eb6094e57 Mon Sep 17 00:00:00 2001 From: Nero <41307858+nero@users.noreply.github.com> Date: Sat, 28 Mar 2020 17:36:52 +0000 Subject: [PATCH] Implement cluster chaining for FAT --- fat32.asm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/fat32.asm b/fat32.asm index 8ca23b8..78e9ca7 100644 --- a/fat32.asm +++ b/fat32.asm @@ -172,11 +172,22 @@ floop: add ax, [sf] cmp cl, [sc] jne err + xchg bx, cx + mov cl, 5 + sal bx, cl + add [dest], bx + add sp, 12 ret -main: call readc +loadf: call readc + call next + cmp word [clus+2], 0x0FFF + jne loadf + ret +main: call loadf + mov ax, [dest] int 3 xor ah,ah @@ -187,12 +198,13 @@ main: call readc ; the packing is so that it looks nice in a hexdump times (0x1E0 - ($-$$)) db 0 ; directory the kernel is in -tdir: db "RDOS " +tdir: db "RDOS ", 0 ; current cluster number clus: dd 2 + times (0x1F0 - ($-$$)) db 0 - ; filename for hte kernel -tfile: db "KERNEL BS " + ; filename for the kernel +tfile: db "KERNEL BS ", 0 ; segment register for data dest: dw 0x07c0