|
|
|
@ -50,20 +50,24 @@ start:
|
|
|
|
|
|
|
|
|
|
mov si, boot_system ; Put address of the null-terminated string to output into 'si' |
|
|
|
|
call print ; Call our string-printing routine |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;This goes first as to now overwrite %ah and %al. |
|
|
|
|
mov ax, 0x0 |
|
|
|
|
mov es, ax ;Section to write into |
|
|
|
|
mov ah, 0x2 ;Read sectors from drive |
|
|
|
|
mov al, 0x8 ;Number of sectors to read |
|
|
|
|
mov al, 0x08 ;Number of sectors to read |
|
|
|
|
mov ch, 0x0 ;Low 8 bits of cylinder |
|
|
|
|
mov cl, 0x2 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7) |
|
|
|
|
mov cl, 0x5 ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7) |
|
|
|
|
mov dh, 0x0 ;Head number |
|
|
|
|
mov dl, 0x0 ;Drive number |
|
|
|
|
mov bx, 0x7e00 ;Offset into section |
|
|
|
|
int 0x13 ;Low level disk services |
|
|
|
|
;mov [0x7000], es ; saving retult of read |
|
|
|
|
; |
|
|
|
|
; |
|
|
|
|
mov si, 500 |
|
|
|
|
mov cx, 512 |
|
|
|
|
call b_dumpmem |
|
|
|
|
|
|
|
|
|
jnc notcarry |
|
|
|
|
mov si, error_str |
|
|
|
|
call print |
|
|
|
@ -143,10 +147,29 @@ print:
|
|
|
|
|
.done: |
|
|
|
|
ret |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
b_dumpmem: |
|
|
|
|
push ax |
|
|
|
|
push dx |
|
|
|
|
call printCRLF |
|
|
|
|
shr cx, 1 |
|
|
|
|
xor dx, dx ; zero dx |
|
|
|
|
.loop: |
|
|
|
|
cmp dx, cx |
|
|
|
|
jae .end |
|
|
|
|
mov ax, word [esi + 2*edx] |
|
|
|
|
call dumpax |
|
|
|
|
mov ax, 0xe20 |
|
|
|
|
int 0x10 |
|
|
|
|
inc dx |
|
|
|
|
jmp .loop |
|
|
|
|
.end: |
|
|
|
|
pop dx |
|
|
|
|
pop ax |
|
|
|
|
ret |
|
|
|
|
; Pad to 510 bytes (boot sector size minus 2) with 0s, and finish with the two-byte standard boot signature |
|
|
|
|
times 510-($-$$) db 0 |
|
|
|
|
dw 0xAA55 ; => 0x55 0xAA (little endian byte order) |
|
|
|
|
times 2048-($-$$) db 0 |
|
|
|
|
|
|
|
|
|
%include "kernel.nasm" |
|
|
|
|
|
|
|
|
|