i used the lowos boot (to the aouthor if you want that i stop use it say it to me)
code:
org 0x7C00 ; Unsere Startadresse
; -----------------------------------------
; Unser Bootloader
; -----------------------------------------
start:
; Erst brauchen wir einen Stack.
cli ; Keine Interrupts!
mov ax, 0x9000 ; Stackadresse
mov ss, ax ; SS = 9000 (unser Stack)
mov sp, 0 ; SP = 0000 (der Stackpointer)
sti ; Interrupts zulassen
; Bootlaufwerk aus DL speichern
mov [bootdrv], dl
;Lade unseren Kernel
call load
;Springe zu diesem Kernel
mov ax, 0x1000 ; Die Adresse des Programms
mov es, ax ; Segmentregister updaten
mov ds, ax
push ax
mov ax, 0
push ax
retf
; ----------------------------------------------
; Funktionen und Variablen
; ----------------------------------------------
bootdrv db 0 ;Das Bootlaufwerk
loadmsg db "Loading...",13,10,0
; Einen String ausgeben:
putstr:
lodsb ; Byte laden
or al,al
jz short putstrd ; 0-Byte? -> Ende!
mov ah,0x0E ; Funktion 0x0E
mov bx,0x0007 ; Attribut-Byte (wird nicht benötigt)
int 0x10 ; schreiben
jmp putstr ; Nächstes Byte
putstrd:
retn
; Lade den Kernel vom Bootlaufwerk
load:
; Diskdrive reset (Interrupt 13h, 0)
push ds ; Sichere DS
mov ax, 0 ; Die gewünschte Funktion (reset)
mov dl, [bootdrv] ; Dieses Laufwerk ist gewünscht
int 13h ; Den Interrupt ausführen
pop ds ; DS wiederherstellen
jc load ; Geht nicht? -> Noch mal!
load1:
mov ax,0x1000 ; ES:BX = 10000
mov es,ax
mov bx, 0
; Sektoren lesen (Interrupt 13h, 2)
mov ah, 2 ; Funktion 2 (Lesen)
mov al, 5 ; Lese 5 Sektoren
mov cx, 2 ; Cylinder=0, Sector=2
mov dx, 0 ; Head=0, Laufwerk=0
int 13h ; ES:BX = Daten vom Laufwerk
jc load1 ; Fehler? Noch mal!
mov si,loadmsg
call putstr ; Meldung ausgeben
retn
times 512-($-$$)-2 db 0 ; Dateilänge: 512 Bytes
dw 0AA55h ; Bootsignatur
and write my own kernel
code:
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;functions
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
outputscr:
odsb
or al,al
jz short ends
mov ah,0x0E
mov bx,0x0007
int 0x10
jmp outputscr
ends:
retn
inputkb:
mov ah, 0
int 016h
ret
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;procedures
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ver:
mov si,msg1
call outputscr
ret
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
main
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mov ax,1000h
mov ds,ax
mov es,ax
start:
mov si,msg
call outputscr
call inputkb
cmp ah,35h
jz ver
jmp start
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;strings and vars
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
msg db "press y to get the ver",13,10,0
msg1 db "woody os ver 0.01a",13,10,0
times 32768-($-$$)-2 db 0
|