in Side Projects

BourakOS – Stable, Simple, Secure!

Πρόκειται για το πιο σταθερό, απλό και ασφαλές Λειτουργικό Σύστημα που έχει κατασκευαστεί. Το είχα δημιουργήσει πριν μερικές δεκαετίες όταν ήμουν φοιτητής στην Αγγλία και συγκεκριμένα στην υπέροχη πόλη του Cambridge. Είναι γραμμένο στην γλώσσα προγραμματισμού Assembly, τον καιρό που ήθελα να μάθω πως λειτουργούν τα πάντα και να κατασκευάσω τα πάντα. Όποιος είναι μάγκας ας το τρέξει 😉

[BITS 16] ; Tells the compiler to make this into 16bit code generation.

[ORG 0x7C00] ; Tells the compiler where the code is going to be in memory
; after it has been loaded.

jmp start

;::::
;: Data used in the boot-loading process
;::::::::::::::::::::::::::::::::::::::::

welcomeMsg db 'BourakOS - Ver 0.0.1',13,13,10,0
pressKey db 'Press any key to Reboot... ',13,10,0

;::::
;: Macros and functions we are going to use
;::::::::::::::::::::::::::::::::::::::::

%macro print 1
mov si, %1 ; get the 1st parameter of print which is the
; address of the printing message
call printAgain
%endmacro
printAgain:
lodsb ; load byte at ds:si into al
or al,al ; test if character is 0 (which means END).
jz done ; jump if zero to 'done' address.
mov ah, 0Eh ; put character.
mov bx, 0007h ; attribute
int 10h ; Call BIOS.
jmp printAgain
done:
ret

; **********************************************************************

getKey:
mov ah, 0 ; wait for a key
int 016h
ret

; **********************************************************************

reboot:
db 0EAh ; Machine language to jump to FFFF:0000 (reboot);
dw 0000h
dw 0FFFFh
; No ret required because we are rebooting now!!!
;::::
;: Main part
;::::::::::::::::::::::::::::::::::::::::

start:
mov ax, 0x0000 ; setup the data segment register.
mov ds, ax ; This can not be loaded directly it has to be in two steps.
; mov ds, 0x0000 will not work due to limitations of CPU.

print welcomeMsg ; Call the print macro.
print pressKey
call getKey
call reboot

times 510-($-$) db 0 ; Fill the rest of the sector with zero's
dw 55AAh ; Add the boot loader signature.

Write your comment

Comment