FAT12 Kann nicht im RM Kernel laden



  • Also Hallo erstmal.
    Ich bin neu hier. Ich stell mich mal vor:
    Mein Name ist Jonas, ich bin 12 Jahre alt und verrückt nach Programmierung(allerdings meistens in C++ und VB).

    Naja, zum Thema:
    Ich möchte bei meinem Kernel FAT12 Support impelieren. Ich bin im RM geblieben weil bei mir der C-Kernel nicht funktioniert. Aber ich möchte auch im RM beliben, da mir der genügt. MSDos zeogt ja was man im RM machen kann.

    Also mein Bootloader entspricht dem FAT12 Bootloader aus dem 2. OSDev tutorial bis auf die Tatsache dass ich KERNEL.SYS und nicht BOOT2.SYS lade. Die Datei floppy.inc ist das gleiche wie die Datei Fat12.inc. Der BPB gelicht auch dem aus dem Tut ausser das ich den OSName geändert habe. Genug der Vorrede, hier mein Code:

    ;#########################################################
    ;#Projekt: JSDos - Unit: Kernel - Datei: kernel.asm      #
    ;#########################################################
    ;#Diese Unit impeliert die Grundfunktionalität des OS-   #
    ;#Kernels (z.B. IO). Außerdem enthält sie die Kommandos  #
    ;#für JSDos                                              #
    ;#########################################################
    
      mov ax, 0x1000
      mov ds, ax
      mov es, ax
    
      call clrscr
    
      mov si, welcome
      call print_string
    
    loop:
      mov si, prompt
      call print_string
    
      mov di, buffer
      call get_string
    
      mov si, buffer
      cmp byte [si], 0  ; blank line?
      je loop           ; yes, ignore it
    
      mov si, buffer
      mov di, cmd_help  ; "help" command
      call strcmp
      jz .help
    
      mov si, buffer
      mov di, cmd_testprog  ; "testprog" command
      call strcmp
      jz .prog
    
      mov si, buffer
      mov di, cmd_exit  ; "exit" command
      call strcmp
      jz .exit
    
      mov si,badcommand
      call print_string 
      jmp loop  
    
    .help:
      call clrscr
    
      mov si, msg_help0
      call print_string
    
      mov si, msg_help1
      call print_string
    
      mov si, msg_help2
      call print_string
    
      mov si, msg_helpe
      call print_string
    
      xor ah, ah
      int 0x16
    
      call clrscr
    
      jmp loop
    
    .prog:
        call LoadRoot
        mov ebx, 0x2000
        mov ebp, 0
        mov esi, progfile
        call LoadFile		
        cmp ax, 0
        je .EnterProtectedMode
        mov si, msg_progerr
        call print_string
        xor ah, ah
    	jmp loop
    
    ;*******************************************************
    ;   Switch from Real Mode (RM) to Protected Mode (PM)              
    ;*******************************************************
    .EnterProtectedMode:
        jmp DWORD 0x2000:0x00000     ; far jump to fix CS. Remember that the code selector is 0x8!
    
    .exit:
      jmp 0xffff:0x0000  ; Reboot
    
    badcommand db 'Command unknown.', 13, 10, 0
    prompt db 'JSDos>', 0
    cmd_help db 'help', 0
    cmd_exit db 'exit', 0
    cmd_testprog db 'testprog',0
    msg_help0 db 'Commands:', 13, 10, 0
    msg_help1 db '   help: Zeigt diese Hilfe', 13, 10, 0
    msg_help2 db '   exit: Startet den PC neu', 13, 10, 0
    msg_helpe db 13, 10,  13, 10, 'Press a key', 13, 10, 0
    msg_progerr db 'Programm not find',13,10,0
    welcome db 'Welcome to JSDos 0.1 beta1', 13, 10, 0
    progfile db "KERNEL  SYS"
    
    nl db 13,10,0
    
    buffer times 32 db 0
    
    ; ================
    ; calls start here
    ; ================
    
    print_string:
    
      lodsb        ; grab a byte from SI
    
      or al, al    ; logical or AL by itself
      jz .done     ; if the result is zero, get out
    
      mov ah, 0x0E
      int 0x10       ; otherwise, print out the character!
    
      jmp print_string
    
    .done:
    
      ret
    
    get_string:
      xor cl, cl
    .loop:
      xor ah, ah    ; mov ah, 0
      int 0x16      ; wait for keypress
    
      cmp al, 8     ; backspace pressed?
      je .backspace ; yes, handle it
    
      cmp al, 13    ; enter pressed?
      je .done      ; yes, we're done
    
      cmp cl, 31    ; 31 chars inputted?
      je .loop      ; yes, only let in backspace and enter
    
      mov ah, 0x0E
      int 0x10      ; print out character
    
      stosb  ; put character in buffer
      inc cl
      jmp .loop
    
    .backspace:
      or cl, cl     ; zero? (start of the string)
      jz .loop      ; if yes, ignore the key
    
      dec di
      mov byte [di], 0  ; delete character
      dec cl        ; decrement counter as well
    
      mov ax, 0x0E08
      int 0x10      ; backspace on the screen
    
      mov al, ' '
      int 0x10      ; blank character out
    
      mov al, 8
      int 0x10      ; backspace again
    
      jmp .loop     ; go to the main loop
    
    .done:
      mov al, 0     ; null terminator
      stosb
    
      mov ax, 0x0E0D
      int 0x10
      mov al, 0x0A
      int 0x10      ; newline
    
      ret
    
    strcmp:
    
    .loop:
      mov al, [si]   ; fetch a byte from SI
      cmp al, [di]   ; are SI and DI equal?
      jne .done      ; if no, we're done.
    
      or al, al      ; zero?
      jz .done       ; if yes, we're done.
    
      inc di         ; increment DI
      inc si         ; increment SI
      jmp .loop      ; goto .loop
    
    .done:
    
      ret
    
    clrscr:
    
      mov ax, 0x0600
      xor cx, cx
      mov dx, 0x174F
      mov bh, 0x07
      mov bl, 0x0
      int 0x10
    
      mov ah, 0x02
      xor dx,dx
      xor bx, bx
      int 0x10
    
      ret
    
    %include "floppy.inc" ; doesnt works correctly
    
      times 1400h - ($-$$) db 0 ;10 sektoren
    

    PS: Ich weis das es sinnlos ist den Kernel nochmal zu laden da er dann seine Daten nicht findet. Aber das ist irrelevant, da eh immer Programm not found kommt 😃
    Nochmals PS: Ich muss um 21:15 off gehen. Morgen ist Schule. Plaudert solange weiter, ich geh Morgen mal wieder on.



  • Das ist jetzt offtopic. Der autor da oben und ich sind ein und derselbe. Die Anmeldungs-E-Mail kam später als erwartet und ich hatte Spam sofort löschen an. Ich dachte es hätte nicht geklappt. Falls mir also jemand ne Mail schreiben will, benutzt diese Addrese von diesem Benutzerprofil.


Anmelden zum Antworten