Simplify and fix Print function
This commit is contained in:
@@ -41,8 +41,8 @@ RealStart:
|
|||||||
movw %ax, %ss
|
movw %ax, %ss
|
||||||
|
|
||||||
/* Print welcome message */
|
/* Print welcome message */
|
||||||
|
leaw msgXtosBoot, %si
|
||||||
call Print
|
call Print
|
||||||
.asciz "Starting XTOS boot loader...\r\n"
|
|
||||||
|
|
||||||
/* Get BIOS boot drive and partition table offset */
|
/* Get BIOS boot drive and partition table offset */
|
||||||
lea 0x1BE(%bp), %si
|
lea 0x1BE(%bp), %si
|
||||||
@@ -90,20 +90,20 @@ PartitionFound:
|
|||||||
|
|
||||||
InvalidSignature:
|
InvalidSignature:
|
||||||
/* Invalid signature error */
|
/* Invalid signature error */
|
||||||
|
leaw msgInvalidSignature, %si
|
||||||
call Print
|
call Print
|
||||||
.asciz "Invalid partition signature!"
|
|
||||||
jmp HaltSystem
|
jmp HaltSystem
|
||||||
|
|
||||||
PartitionNotFound:
|
PartitionNotFound:
|
||||||
/* Active partition not found error */
|
/* Active partition not found error */
|
||||||
|
leaw msgPartitionNotFound, %si
|
||||||
call Print
|
call Print
|
||||||
.asciz "Bootable partition not found!"
|
|
||||||
jmp HaltSystem
|
jmp HaltSystem
|
||||||
|
|
||||||
VbrReadFail:
|
VbrReadFail:
|
||||||
/* VBR read failed error */
|
/* VBR read failed error */
|
||||||
|
leaw msgVbrReadFail, %si
|
||||||
call Print
|
call Print
|
||||||
.asciz "VBR read failed!"
|
|
||||||
jmp HaltSystem
|
jmp HaltSystem
|
||||||
|
|
||||||
HaltSystem:
|
HaltSystem:
|
||||||
@@ -112,18 +112,17 @@ HaltSystem:
|
|||||||
hlt
|
hlt
|
||||||
jmp HaltSystem
|
jmp HaltSystem
|
||||||
|
|
||||||
PutChar:
|
|
||||||
/* Simple routine to print error messages */
|
|
||||||
xor %bx, %bx
|
|
||||||
movb $0x0E, %ah
|
|
||||||
int $0x10
|
|
||||||
Print:
|
Print:
|
||||||
pop %si
|
/* Simple routine to print messages */
|
||||||
lodsb
|
lodsb
|
||||||
push %si
|
orb %al, %al
|
||||||
cmp $0, %al
|
jz DonePrint
|
||||||
jne PutChar
|
movb $0x0E, %ah
|
||||||
ret
|
movw $0x07, %bx
|
||||||
|
int $0x10
|
||||||
|
jmp Print
|
||||||
|
DonePrint:
|
||||||
|
retw
|
||||||
|
|
||||||
.BootDrive:
|
.BootDrive:
|
||||||
/* Storage for the boot drive number */
|
/* Storage for the boot drive number */
|
||||||
@@ -137,6 +136,18 @@ Print:
|
|||||||
/* Storage for the LBA start */
|
/* Storage for the LBA start */
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
|
msgInvalidSignature:
|
||||||
|
.asciz "Invalid partition signature!"
|
||||||
|
|
||||||
|
msgPartitionNotFound:
|
||||||
|
.asciz "Bootable partition not found!"
|
||||||
|
|
||||||
|
msgVbrReadFail:
|
||||||
|
.asciz "VBR read failed!"
|
||||||
|
|
||||||
|
msgXtosBoot:
|
||||||
|
.asciz "Starting XTOS boot loader...\r\n"
|
||||||
|
|
||||||
/* Fill the rest of the MBR with zeros and add MBR signature at the end */
|
/* Fill the rest of the MBR with zeros and add MBR signature at the end */
|
||||||
.fill (510 - (. - Start)), 1, 0
|
.fill (510 - (. - Start)), 1, 0
|
||||||
.word 0xAA55
|
.word 0xAA55
|
||||||
|
Reference in New Issue
Block a user