|
@ -36,9 +36,6 @@ call print ; Call our string-printing routine |
|
|
xor bx, bx |
|
|
xor bx, bx |
|
|
xor cx, cx |
|
|
xor cx, cx |
|
|
mov ax, [partition_1.active_partition] |
|
|
mov ax, [partition_1.active_partition] |
|
|
call dumpax |
|
|
|
|
|
cli |
|
|
|
|
|
hlt |
|
|
|
|
|
cmp ax, 0x80 |
|
|
cmp ax, 0x80 |
|
|
jne check_p_2 |
|
|
jne check_p_2 |
|
|
mov bx, 0x01 ; Partion 1 active |
|
|
mov bx, 0x01 ; Partion 1 active |
|
@ -67,7 +64,7 @@ mov bx, 0x04 ; Partion 4 active |
|
|
|
|
|
|
|
|
eval_active_partion_number: |
|
|
eval_active_partion_number: |
|
|
cmp cx, 1 |
|
|
cmp cx, 1 |
|
|
je boot_partition: |
|
|
je boot_partition |
|
|
; here goes wait call, for the user to enter debug mode. |
|
|
; here goes wait call, for the user to enter debug mode. |
|
|
; Wating for 2 seconds: |
|
|
; Wating for 2 seconds: |
|
|
mov ah, 0x86 ; code for waiting interupt call |
|
|
mov ah, 0x86 ; code for waiting interupt call |
|
@ -79,34 +76,34 @@ xor ax, ax |
|
|
mov ah, 0x01 ; BIOS call to wait for key |
|
|
mov ah, 0x01 ; BIOS call to wait for key |
|
|
int 0x16 |
|
|
int 0x16 |
|
|
|
|
|
|
|
|
mov bx, 1 |
|
|
|
|
|
|
|
|
|
|
|
boot_partition: |
|
|
boot_partition: |
|
|
; IMPORTANT bx, has to hold the value 1-4 for the partiotion that wanted to be booted. |
|
|
; IMPORTANT bx, has to hold the value 1-4 for the partiotion that wanted to be booted. |
|
|
|
|
|
|
|
|
|
|
|
mov bx, 2 |
|
|
|
|
|
|
|
|
mov ax, partition_1 |
|
|
mov ax, partition_1 |
|
|
.loop: |
|
|
.loop: |
|
|
cmp bx, 1 |
|
|
cmp bx, 1 |
|
|
je break |
|
|
je break |
|
|
add ax, 0x10 |
|
|
add ax, 0x10 |
|
|
|
|
|
;call dumpax |
|
|
dec bx |
|
|
dec bx |
|
|
jmp .loop |
|
|
jmp .loop |
|
|
break: |
|
|
break: |
|
|
|
|
|
|
|
|
add ax, 7 ; 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] ; first part of LBA |
|
|
xor ax, ax |
|
|
mov WORD [DAPACK.lba_addr_dw_low], bx |
|
|
mov ax, [bx] ; first part of LBA |
|
|
inc ax ; next part |
|
|
mov WORD [DAPACK.lba_addr_dw_low], ax |
|
|
mov bx, [ax] |
|
|
call dumpax |
|
|
mov WORD [DAPACK.lba_addr_dw_low + 1], bx |
|
|
add bx, 2 ; next part |
|
|
inc ax ; next part |
|
|
mov ax, [bx] |
|
|
mov bx, [ax] |
|
|
mov WORD [DAPACK.lba_addr_dw_low + 1], ax |
|
|
mov WORD [DAPACK.lba_addr_dw_low + 2], bx |
|
|
call dumpax |
|
|
inc ax ; next part |
|
|
cli |
|
|
mov bx, [ax] |
|
|
hlt |
|
|
mov WORD [DAPACK.lba_addr_dw_low + 3], bx |
|
|
|
|
|
mov WORD [DAPACK.blkcnt], 0x01 |
|
|
mov WORD [DAPACK.blkcnt], 0x01 |
|
|
mov WORD [DAPACK.db_addr_segment], 0x0000 |
|
|
mov WORD [DAPACK.db_addr_segment], 0x0000 |
|
|
mov WORD [DAPACK.db_addr_offset], 0x7c00 |
|
|
mov WORD [DAPACK.db_addr_offset], 0x7c00 |
|
|