diff --git a/bootsect.asm b/bootsect.asm index 2cb6333..dd72fa6 100644 --- a/bootsect.asm +++ b/bootsect.asm @@ -141,11 +141,12 @@ found_file: ;ds:si points to root dir entry of kernel file mov bx, FAT_SEG mov ds, bx ;ds points to beginning of FAT xor bx, bx + xor di, di readkernel_loop: cmp ax, 0xff7 jg readkernel_done - ;inc word [k_count] + inc di push ax push bx call getCHSfromCluster @@ -183,20 +184,24 @@ got_cluster: jmp readkernel_loop readkernel_done: ;now copy kernel to final location in KERNEL_ADD! + xor ecx, ecx + mov cx, di ;cx=# of 512byte sectors loaded + shl ecx, 9 ;ecx=ecx*512 -; mov ax, KERNEL_SEG -; mov ds, ax -; xor esi, esi -; xor ax, ax -; mov es, ax -; mov edi, KERNEL_ADD -; xor ecx, ecx -; mov cx, [k_count] ;cx=# of 512byte sectors loaded -; shl ecx, 9 ;ecx=ecx*512 -;movekernel_loop: -; o32 lodsb ;mov al, [ds:esi] -; o32 stosb ;mov [es:edi], al -; o32 loop movekernel_loop + mov ax, KERNEL_SEG + mov ds, ax + xor esi, esi + xor ax, ax + mov es, ax + mov edi, KERNEL_ADD +movekernel_loop: + mov al, [ds:esi] + inc esi + mov [es:edi], al + inc edi + dec ecx + cmp ecx, 0 + jne movekernel_loop jmp $