|
|
@ -22,35 +22,71 @@ start: |
|
|
|
call printWordHex |
|
|
|
mov ax, 89ABh |
|
|
|
call printWordHex |
|
|
|
mov ax, 0CDEFh |
|
|
|
call printWordHex |
|
|
|
cli ; Clear the Interrupt Flag (disable external interrupts) |
|
|
|
hlt ; Halt the CPU (until the next external interrupt) |
|
|
|
call printCRLF |
|
|
|
mov ax, message |
|
|
|
call printWordHex |
|
|
|
|
|
|
|
|
|
|
|
;This goes first as to now overwrite %ah and %al. |
|
|
|
mov ax, 0h |
|
|
|
mov es, ax ;Section to write into |
|
|
|
mov ah, 02h ;Read sectors from drive |
|
|
|
mov al, 01h ;Number of sectors to read |
|
|
|
mov ch, 00h ;Low 8 bits of cylinder |
|
|
|
mov cl, 02h ;First sector to read (bits 0-5), upper bits of cylinder (bits 6-7) |
|
|
|
mov dh, 00h ;Head number |
|
|
|
mov dl, 00h ;Drive number |
|
|
|
mov bx, 0200h ;Offset into section |
|
|
|
int 13h ;Low level disk services |
|
|
|
; |
|
|
|
jnc notcarry |
|
|
|
mov si, error_str |
|
|
|
call print |
|
|
|
jmp endcarrycheck |
|
|
|
; |
|
|
|
notcarry: |
|
|
|
mov si, success_str |
|
|
|
call print |
|
|
|
jmp 0200h |
|
|
|
; |
|
|
|
endcarrycheck: |
|
|
|
cli ; Clear the Interrupt Flag (disable external interrupts) |
|
|
|
hlt ; Halt the CPU (until the next external interrupt) |
|
|
|
|
|
|
|
data: |
|
|
|
message db 'SingOS!',13,10,0 |
|
|
|
message db 'Boot SingOS!',13,10,0 |
|
|
|
error_str db 'Error', 0 |
|
|
|
success_str db 'Success', 0 |
|
|
|
|
|
|
|
; Routine for printing a 'ax' as hex |
|
|
|
printWordHex: |
|
|
|
mov bx, ax |
|
|
|
mov al, bh |
|
|
|
shr al, 4 |
|
|
|
add al, 48 |
|
|
|
mov ah, 0Eh |
|
|
|
int 10h |
|
|
|
mov al, bh |
|
|
|
and al, 0Fh |
|
|
|
add al, 48 |
|
|
|
int 10h |
|
|
|
mov al, bl |
|
|
|
shr al, 4 |
|
|
|
add al, 48 |
|
|
|
int 10h |
|
|
|
mov al, bl |
|
|
|
and al, 0Fh |
|
|
|
add al, 48 |
|
|
|
int 10h |
|
|
|
ret |
|
|
|
mov bx, ax |
|
|
|
mov al, bh |
|
|
|
shr al, 4 |
|
|
|
add al, 48 |
|
|
|
mov ah, 0Eh |
|
|
|
int 10h |
|
|
|
mov al, bh |
|
|
|
and al, 0Fh |
|
|
|
add al, 48 |
|
|
|
int 10h |
|
|
|
mov al, bl |
|
|
|
shr al, 4 |
|
|
|
add al, 48 |
|
|
|
int 10h |
|
|
|
mov al, bl |
|
|
|
and al, 0Fh |
|
|
|
add al, 48 |
|
|
|
int 10h |
|
|
|
ret |
|
|
|
|
|
|
|
printCRLF: |
|
|
|
mov ah, 0Eh |
|
|
|
mov al, 13 |
|
|
|
int 10h |
|
|
|
mov al, 10 |
|
|
|
int 10h |
|
|
|
ret |
|
|
|
|
|
|
|
; Routine for outputting string in 'si' register to screen |
|
|
|
print: |
|
|
@ -70,6 +106,9 @@ print: |
|
|
|
times 510-($-$$) db 0 |
|
|
|
dw 0xAA55 ; => 0x55 0xAA (little endian byte order) |
|
|
|
|
|
|
|
;define_byte: |
|
|
|
; dw 1234h |
|
|
|
|
|
|
|
start_sing_os: |
|
|
|
mov si, welcome ; Put address of the null-terminated string to output into 'si' |
|
|
|
call print_os ; Call our string-printing routine |
|
|
@ -90,4 +129,5 @@ print_os: |
|
|
|
ret |
|
|
|
|
|
|
|
data_os: |
|
|
|
welcome db 'This is SingOS!', 0 |
|
|
|
welcome db 'This is SingOS!', 0 |
|
|
|
times 510 db 0 |