Browse Source

More SLRboot work

SLRboot
Jørn Guldberg 7 years ago
parent
commit
3e4add100f
  1. 51
      bootloader.nasm

51
bootloader.nasm

@ -6,6 +6,9 @@ BITS 16
; version 0.2.0.0-exp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cli
jmp long 0x0000:start
start:
mov [disk_identifier], dl
mov ax, 0x1000
mov ss, ax
@ -39,24 +42,27 @@ call print ; Call our string-printing routine
;mov dl, [disk_identifier] ;Drive number
;mov bx, 0x0000 ;Offset into section
;int 0x13 ;Low level disk services
mov ah, 2
mov al, 0x08
mov ah, 0x02
mov al, 0x01
mov bx, 0x7c00
mov BYTE dl, [disk_identifier]
mov BYTE dl, 0x80
mov BYTE dh, [partition_1.start_CHS + 1] ;byte [si + 1]
mov BYTE cl, [partition_1.start_CHS + 2]
mov BYTE ch, [partition_1.start_CHS] ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7)
int 0x13
;mov ax, 0x0
;mov ds, ax
mov ax, 89 ; lba adress
;mov ax, 89 ; lba adress
call dumpax
jmp long 0x0:0x7c00
cli
hlt
%IF 1
%IF 0
cli
jmp long 0x0000:start
@ -144,6 +150,15 @@ hlt
.welcome_debug db 'This is debug mode', 0
printCRLF:
mov ah, 0xE
mov al, 13
int 0x10
mov al, 10
int 0x10
ret
%ENDIF
;Routine for printing a 'ax' as hex
dumpax:
pusha ; save registers
@ -166,14 +181,6 @@ loop .loop
popa ; restore registers
ret
printCRLF:
mov ah, 0xE
mov al, 13
int 0x10
mov al, 10
int 0x10
ret
%ENDIF
; Routine for outputting string in 'si' register to screen
print:
mov ah, 0xE ; Specify 'int 0x10' 'teletype output' function
@ -189,26 +196,26 @@ ret
data:
message db 'SLRboot for SingOS! v0.2.0.0-exp',13,10,0
enter_debug_mode db 'Press d to enter bootloader debug mode',13,10,0
enter_system_check db 'Performing system check:',13,10,0
sys_check_ok db 'System check ok', 13, 10, 0
boot_system db 'Read SingOS from disk', 13, 10, 0
error_str db 'Error', 0
success_str db 'Success', 0
;enter_debug_mode db 'Press d to enter bootloader debug mode',13,10,0
;enter_system_check db 'Performing system check:',13,10,0
;sys_check_ok db 'System check ok', 13, 10, 0
;boot_system db 'Read SingOS from disk', 13, 10, 0
;error_str db 'Error', 0
;success_str db 'Success', 0
disk_identifier db 0
; Pad to 510 bytes (boot sector size minus 2) with 0s, and finish with the two-byte standard boot signature
times 446-($-$$) db 0 ; First partion entry
partition_1:
.active_partition db 0x00
.active_partition db 0x80
.start_CHS db 0x00, 0x00, 0x11;0x20, 0x21, 0x00
.disk_type db 0x83
.end_CHS db 0x8C, 0x3D, 0x0F
.start_LBA db 0x00, 0x08, 0x00, 0x00
.start_LBA db 0x10, 0x00, 0x00, 0x00
.size db 0x00, 0xC8, 0x03, 0x00
partition_2:
.active_partition db 0x80
.active_partition db 0x00
.start_CHS db 0x8C, 0x3E, 0x0F
.disk_type db 0x83
.end_CHS db 0xFF, 0xFF, 0xFF

Loading…
Cancel
Save