X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Ffd_boot.asm;h=1250665d891944eadfadb128ac365289517f2c1e;hb=4f7c3b759e3889870c5b5e7d09b3ffcc168e5632;hp=223fccdb0ec9b8c528a5628cd7936ca3c5f1467f;hpb=c6ae41adef1bd7d54bc7e74abc4a5438e203d754;p=palacios.git diff --git a/palacios/src/geekos/fd_boot.asm b/palacios/src/geekos/fd_boot.asm index 223fccd..1250665 100644 --- a/palacios/src/geekos/fd_boot.asm +++ b/palacios/src/geekos/fd_boot.asm @@ -1,7 +1,9 @@ ; Boot sector for GeekOS ; Copyright (c) 2001,2004 David H. Hovemeyer ; Copyright (c) 2003, Jeffrey K. Hollingsworth -; $Revision: 1.2 $ +; Copyright (c) 2008, Jack Lange high copy table for the bios +; mov ax, word [bootsect_src_base] ; +; add ax, 512 +; mov dx,ax; +; call PrintHex +; adc byte [bootsect_src_base+2], 0 +; mov word [bootsect_src_base],ax + + mov ax, word [bootsect_dst_base] ; + add ax, 512 + adc byte [bootsect_dst_base+2], 0 + mov word [bootsect_dst_base],ax + ; have we loaded all of the sectors? + mov bx, word [max_sector] cmp word [sec_count], bx - jl .again + +.stall +; jmp .skip + jl .again2 + +.skip ; Now we've loaded the setup code and the kernel image. ; Jump to setup code. jmp SETUPSEG:0 @@ -205,10 +281,9 @@ ReadSector: xor dl, dl ; hard code drive=0 mov bx, [bp+4] ; offset goes in bx ; (es:bx points to buffer) - ; Call the BIOS Read Diskette Sectors service int 0x13 - + ; If the carry flag is NOT set, then there was no error ; and we're done. jnc .done @@ -230,8 +305,36 @@ ReadSector: pop bp ; leave stack frame ret -; Include utility routines -%include "util.asm" +; Include utility routines: +;%include "util.asm" +; REPLACED WITH FOLLOWING WHICH MUST BE COMPILED 16 FOR USE IN THIS CODE +PrintHex: + pusha + mov cx, 4 ; 4 hex digits +.PrintDigit: + rol dx, 4 ; rotate so that lowest 4 bits are used + mov ax, 0E0Fh ; ah = request, al = mask for nybble + and al, dl + add al, 90h ; convert al to ascii hex (four instructions) + daa ; I've spent 1 hour to understand how it works.. + adc al, 40h + daa + int 10h + loop .PrintDigit + popa + ret + +; Print a newline. +PrintNL: ; print CR and NL + push ax + mov ax, 0E0Dh ; CR + int 10h + mov al, 0Ah ; LF + int 10h + pop ax + ret + + ; ---------------------------------------------------------------------- ; Variables @@ -247,8 +350,30 @@ num_retries: db 0 sec_count: dw 0 max_sector: dw 0 + + + +bootsect_gdt: + dw 0,0,0,0 + dw 0,0,0,0 +bootsect_src: + dw 0xffff +bootsect_src_base: + db 0,0x20,0x08 ; ! base = 0x082000 + db 0x93 ; ! typbyte + dw 0 ; ! limit16,base24 =0 +bootsect_dst: + dw 0xffff +bootsect_dst_base: + db 0,0,0x10 ; ! base = 0x100000 + db 0x93 ; ! typbyte + dw 0 ; ! limit16,base24 =0 + dw 0,0,0,0 ; ! BIOS CS + dw 0,0,0,0 ; ! BIOS DS + + ; Padding to make the PFAT Boot Record sit just before the BIOS signature. -Pad_From_Symbol PFAT_BOOT_RECORD_OFFSET, BeginText +;Pad_From_Symbol PFAT_BOOT_RECORD_OFFSET, BeginText ; PFAT boot record ; Describes how to load the setup program and kernel. @@ -286,10 +411,12 @@ kernelStart: ;; part of pfat boot record kernelSize: - dw NUM_KERN_SECTORS+NUM_VM_KERNEL_SECTORS + dw NUM_KERN_SECTORS + + -; Finish by writing the BIOS signature to mark this as + ; Finish by writing the BIOS signature to mark this as ; a valid boot sector. Pad_From_Symbol BIOS_SIGNATURE_OFFSET, BeginText Signature dw 0xAA55 ; BIOS controls this to ensure this is a boot sector