;-------------------------------------------------------;
;                   MiniDos  kernel                     ;
;             Coded by Dex(Craig Bamford)               ;
;-------------------------------------------------------;
;    MiniDos kernel, expects to be loaded at 60h        ;
;  Assemble with fasm C:\fasm MiniDOS.asm MiniDOS.com   ;
;                                                       ;
;    Thank go to anyone who has helped me including     ;
;   Tomasz Grysztar(fasm),Alexei A. Frounze(bootprog)   ;
;                  Team Dex4u including                 ;
;  bubach,crc,jas2o,tonyMac,smiddy,solidus117,redaman.  ;
;     also Pype.Clicker and all Dex4u forum members.    ;
;                                                       ;
;                    www.dex4u.com                      ;
;-------------------------------------------------------;
use16                                       ; 16bit addressing
org 0x100                                   ; Com file stuff
;====================================================;
;  Code starts here.                                 ;
;====================================================; 
        jmp   start                         ; Jump to label start
 
DOS4U_VERSION_HI  =  1                      ; Set hi part of version
DOS4U_VERSION_LO  =  0                      ; Set lo part of version

start:
        mov   [SaveNameAddress],dx          ; Save the address of file to load from bootloader
        mov   [SaveCS],ax                   ; Save its CS
        push  cs                            ; Push CS on stack
	pop   ds                            ; Move CS into DS
        push  ds                            ; Push DS
        pop   es                            ; Move DS into ES
        cld                                 ; Make movs prosess from left to right.
        mov   [DriveNumber],00              ; Make the drive number 00 (A:) for now
        call  Installints                   ; Install in21
        call  SetRet                        ; This set incase some users ret in com file.
Start2:
;====================================================;
;  Clear screen.                                     ;
;====================================================;
        call  Cls                           ; Call our clear screen function
;====================================================;
;  Set cursor.                                       ;
;====================================================;
        call  Cursor                        ; Call our cursor function
;====================================================;
;  Print mesage.                                     ;
;====================================================;
        call  Welcome                       ; Print the welcome message
        call  Aprompt                       ; Print the prompt
;====================================================;
;  MainLoop.                                         ;
;====================================================;
MainLoop:                                   ; Main loop
        hlt                                 ; Save cpu geting hot
        call  GetCommand                    ; Call the get command function
        jmp   ProcessCMD                    ; Process it
        jmp   MainLoop                      ; Not used, but i left itin
;====================================================;
;  Include files.                                    ;
;====================================================; 
        include 'Cli.inc'                   ; Cli include files
        include 'DosInt.inc'                ; DosInt include files
        include 'Functions.inc'             ; Functions include files
        include 'Fat.inc'                   ; Fat include files
;====================================================;
;  Data.                                             ;
;====================================================; 
DriveNumber     db 0                        ; Some vars
top_memory      dw 0
end_memory      dw 0

SaveNameAddress dw 0
SaveCS          dw 0
SaveCS2         dw 0

include 'Data.inc'                          ; Data include files



