projects
/
ld45_start_nothing
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
converted to protected mode, not done
[ld45_start_nothing]
/
src
/
boot
/
boot.asm
diff --git
a/src/boot/boot.asm
b/src/boot/boot.asm
index
80a92a9
..
693bba3
100644
(file)
--- a/
src/boot/boot.asm
+++ b/
src/boot/boot.asm
@@
-1,10
+1,13
@@
; vi:filetype=nasm ts=8 sts=8 sw=8:
bits 16
; vi:filetype=nasm ts=8 sts=8 sw=8:
bits 16
- org 7c00h
+ section .boot
-STACKTOP equ 7c00h
+STACKTOP equ 7b00h
+DRIVENO_ADDR equ 7bf0h
LOADADDR equ 7e00h
LOADADDR equ 7e00h
+ extern _boot2_size
+
start:
cli
; setup stack and the rest of the segment registers
start:
cli
; setup stack and the rest of the segment registers
@@
-17,15
+20,15
@@
start:
mov gs, ax
; dl: drive number, save it
mov gs, ax
; dl: drive number, save it
- mov [driveno], dl
+ mov [DRIVENO_ADDR], dl
call get_drive_chs
mov si, newline_str
call putstr
call get_drive_chs
mov si, newline_str
call putstr
- ; load main program
+ ; load the second stage boot loader and jump there
mov bx, LOADADDR ; es:bx <- destination
mov bx, LOADADDR ; es:bx <- destination
- mov cx, BINSIZE
+ mov cx, _boot2_size
add cx, 511
shr cx, 9 ; cx <- binsize in sectors
mov [binsize_sect], cx
add cx, 511
shr cx, 9 ; cx <- binsize in sectors
mov [binsize_sect], cx
@@
-56,7
+59,7
@@
start:
get_drive_chs:
push es
mov ah, 8
get_drive_chs:
push es
mov ah, 8
- mov dl, [driveno]
+ mov dl, [DRIVENO_ADDR]
xor di, di
int 13h
pop es
xor di, di
int 13h
pop es
@@
-115,7
+118,7
@@
read_sector:
; ah = 2 (read), al = 1 sectors
mov ax, 0201h
; ah = 2 (read), al = 1 sectors
mov ax, 0201h
- mov byte dl, [driveno]
+ mov byte dl, [DRIVENO_ADDR]
int 13h
jnc .success
int 13h
jnc .success
@@
-159,14
+162,17
@@
putchar:
ret
ret
+ global sect_per_track
sect_per_track: dw 18
sect_per_track: dw 18
+ global num_cylinders
num_cylinders: dw 80
num_cylinders: dw 80
+ global num_heads
num_heads: dw 2
num_heads: dw 2
+ global heads_mask
heads_mask: db 1
read_retries: db 0
heads_mask: db 1
read_retries: db 0
-driveno: db 0
binsize_sect: dw 0
rderr_str: db 'read error',13,10,0
binsize_sect: dw 0
rderr_str: db 'read error',13,10,0