|
@ -1,34 +1,33 @@ |
|
|
ORG 0x7C00 |
|
|
ORG 0x600 |
|
|
BITS 16 |
|
|
BITS 16 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
; SLRboot |
|
|
; SLRboot |
|
|
; Bootloader for SingOS |
|
|
; Bootloader for SingOS |
|
|
; version 0.2.1.0-exp |
|
|
; version 0.3.0.0 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
cli |
|
|
cli |
|
|
jmp long 0x0000:start |
|
|
;jmp long 0x0000:start |
|
|
|
|
|
|
|
|
start: |
|
|
|
|
|
mov ax, 0x1000 |
|
|
mov ax, 0x1000 |
|
|
mov ss, ax |
|
|
mov ss, ax |
|
|
mov sp, 0xb000 |
|
|
mov sp, 0xb000 |
|
|
mov ax, 0 |
|
|
push dx |
|
|
mov ds, ax |
|
|
|
|
|
mov es, ax |
|
|
mov ax, 0x0 |
|
|
mov [disk_identifier], dl |
|
|
mov ds, ax ; ds is used by si |
|
|
|
|
|
mov es, ax ; es is used by di |
|
|
sti |
|
|
sti |
|
|
mov si, 0x7c00 |
|
|
mov si, 0x7c00 |
|
|
mov di, 0x600 |
|
|
mov di, 0x600 |
|
|
mov cx, 0x100 |
|
|
mov cx, 0x100 |
|
|
rep movsw |
|
|
rep movsw |
|
|
mov bx, relocated |
|
|
jmp 0x0000:relocated |
|
|
sub bx, 0x7600 ; Calculate the offset. |
|
|
|
|
|
push bx |
|
|
|
|
|
ret ; Return far |
|
|
|
|
|
;jmp long 0:bx |
|
|
|
|
|
|
|
|
|
|
|
relocated: |
|
|
relocated: |
|
|
|
|
|
mov ax, 0x0 |
|
|
|
|
|
mov ds, ax |
|
|
|
|
|
mov es, ax |
|
|
|
|
|
pop dx |
|
|
|
|
|
mov [disk_identifier], dl |
|
|
mov si, message ; Put address of the null-terminated string to output into 'si' |
|
|
mov si, message ; Put address of the null-terminated string to output into 'si' |
|
|
call print ; Call our string-printing routine |
|
|
call print ; Call our string-printing routine |
|
|
|
|
|
|
|
@ -91,30 +90,32 @@ mov ax, partition_1 |
|
|
jmp .loop |
|
|
jmp .loop |
|
|
break: |
|
|
break: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add ax, 8 ; This is the offset to fetch the LBA start adress of the partition record |
|
|
add ax, 8 ; This is the offset to fetch the LBA start adress of the partition record |
|
|
mov bx, ax |
|
|
mov bx, ax |
|
|
xor ax, ax |
|
|
xor ax, ax |
|
|
mov ax, [bx] ; first part of LBA |
|
|
mov ax, [bx] ; first part of LBA |
|
|
mov WORD [DAPACK.lba_addr_dw_low], ax |
|
|
mov WORD [DAPACK.lba_addr_dw_low], ax |
|
|
call dumpax |
|
|
;call dumpax |
|
|
add bx, 2 ; next part |
|
|
add bx, 2 ; next part |
|
|
mov ax, [bx] |
|
|
mov ax, [bx] |
|
|
mov WORD [DAPACK.lba_addr_dw_low + 1], ax |
|
|
mov WORD [DAPACK.lba_addr_dw_low + 2], ax |
|
|
call dumpax |
|
|
;call dumpax |
|
|
|
|
|
|
|
|
|
|
|
;mov WORD [DAPACK.lba_addr_dw_low], 2048 |
|
|
|
|
|
|
|
|
mov WORD [DAPACK.blkcnt], 0x01 |
|
|
mov WORD [DAPACK.blkcnt], 0x01 |
|
|
mov WORD [DAPACK.db_addr_segment], 0x0000 |
|
|
|
|
|
mov WORD [DAPACK.db_addr_offset], 0x7c00 |
|
|
mov WORD [DAPACK.db_addr_offset], 0x7c00 |
|
|
|
|
|
mov WORD [DAPACK.db_addr_segment], 0x0000 |
|
|
mov si, DAPACK ; address of "disk address packet" |
|
|
mov si, DAPACK ; address of "disk address packet" |
|
|
xor ax, ax |
|
|
xor ax, ax |
|
|
mov ah, 0x42 ; READ |
|
|
mov ah, 0x42 ; READ |
|
|
mov dl, [disk_identifier] |
|
|
mov dl, [disk_identifier] |
|
|
int 0x13 |
|
|
int 0x13 |
|
|
;call dumpax |
|
|
|
|
|
jc endcarrycheck ; An error ocurred when reading from disk. |
|
|
jc endcarrycheck ; An error ocurred when reading from disk. |
|
|
|
|
|
|
|
|
; If no error then jump to volume boot record |
|
|
; If no error then jump to volume boot record |
|
|
notcarry: |
|
|
notcarry: |
|
|
|
|
|
mov dl, [disk_identifier] |
|
|
jmp long 0x0:0x7c00 |
|
|
jmp long 0x0:0x7c00 |
|
|
|
|
|
|
|
|
cli |
|
|
cli |
|
@ -177,7 +178,7 @@ jmp .printchar ; Repeat for the next character |
|
|
ret |
|
|
ret |
|
|
|
|
|
|
|
|
data: |
|
|
data: |
|
|
message db 'SLRboot for SingOS! v0.2.1.0-exp',13,10,0 |
|
|
message db 'SLRboot for SingOS! v0.3.0.0',13,10,0 |
|
|
enter_debug_mode db 'Press d to enter bootloader debug mode',13,10,0 |
|
|
enter_debug_mode db 'Press d to enter bootloader debug mode',13,10,0 |
|
|
welcome_debug db 'Debug mode v.0.0.1:',13,10,0 |
|
|
welcome_debug db 'Debug mode v.0.0.1:',13,10,0 |
|
|
error_str db 'Error', 0 |
|
|
error_str db 'Error', 0 |
|
|