diff --git a/Graphisme/logo.png b/Graphisme/logo.png
new file mode 100644
index 0000000..029ae7c
Binary files /dev/null and b/Graphisme/logo.png differ
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..7e5358d
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,167 @@
+## GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+![logo](https://www.gnu.org/graphics/lgplv3-with-text-154x68.png)
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..33b9b4f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,60 @@
+![logo](https://github.com/dahut87/cos2000v2/raw/master/Graphisme/logo.png)
+
+## Présentation du projet
+
+### Qu'est ce que COS2000 ?
+
+COS2000 est un système d'exploitation minimaliste qui vise essentiellement un objectif pédagogique.
+Il s'agit avant tout du travail d'un passionné de programmation système.
+
+Le système est développé essentiellement en langage C mais il comporte aussi un peu d'assembleur X86.
+
+#### Qu'est ce qu'un système d'exploitation ?
+
+Il s'agit du logiciel principal qui anime votre ordinateur. Il a pour fonctions principales :
+
+* Piloter des périphériques tels que souris, clavier, écran, imprimante...etc;
+* Gérer des fichiers qui sont produit et exploités par des applications;
+* Coordonner l'accès aux ressources par plusieurs utilisateurs;
+* Détection et récupération des dysfonctionnements;
+* Surveiller les performances et assurer une gestion optimale des ressources systèmes.
+
+Sans système d'exploitation votre ordinateur est inopérant: c'est une boite vide !
+
+#### Comment utiliser COS2000 ?
+
+COS2000 n'a pas pour but d'être utilisé en production. Il s'agit d'un système en cours de
+développement que vous pouvez néanmoins tester sur un ordinateur physique ou de préférence sur une machine virtuelle.
+Il est nécessaire de compiler le système avant de démarrer celui-ci à partir d'un périphérique amovible (clé usb).
+
+#### Sur quel ordinateur fonctionne t'il ?
+
+COS2000 est compatible avec tout ordinateur compatible PC comprenant un processeur avec FPU intégré,
+gestion de la mémoire paginée et mode protégé : Intel Pentium et supérieur.
+
+#### Ai-je le droit de le copier, de le modifier, de le réutiliser, de le vendre ?
+
+COS2000 est sous licence LGPL v3.0, en simplifiant un peu :
+
+* COPIER - OUI
+* MODIFIER - OUI
+* REUTILISER - OUI en citant l'auteur
+* VENDRE - NON
+
+Les détails se trouvent dans le fichier `LICENSE.md`
+
+![logo](https://www.gnu.org/graphics/lgplv3-with-text-154x68.png)
+
+### En savoir plus...
+
+#### Historique du projet
+* Version 2.2fr - C en mode protégé Reprise du projet
+* Version 2.1fr - C en mode protégé Abandon du projet
+* Version 2.0 - C en mode protégé VGA text+pmode
+* Version 1.x - Assembleur en mode réel
+
+> “La connaissance s'acquiert par l'expérience,
+> tout le reste n'est que de l'information..
+>
+> ― Albert Einstein
+> ― Mathématicien, Physicien
\ No newline at end of file
diff --git a/boot/boot12.asm b/boot/boot12.asm
new file mode 100644
index 0000000..6a68b40
--- /dev/null
+++ b/boot/boot12.asm
@@ -0,0 +1,274 @@
+[BITS 16]
+[ORG 0x7C00]
+
+section .text
+
+start:
+ jmp near Boot
+
+Disk_ID db "COS2000A" ;Fabricant + n° de série Formatage
+Sectors_Size dw 512 ;Nombre d'octets/secteur
+Sectors_Per_Cluster db 1 ;Nombre de secteurs/cluster
+Reserved_Sectors dw 1 ;Nombre de secteurs réservé
+Fats_Number db 2 ;Nombre de copies de la FAT
+Fits_Number dw 224 ;Taille du répertoire racine
+Sectors_Per_Disk dw 2880 ;Nombre secteurs du volume si < 32 Mo
+Media_Descriptor db 0xF0 ;Descripteur de média
+Sectors_Per_Fat dw 9 ;Nombre secteurs/FAT
+Sectors_Per_Track dw 18 ;Nombre secteurs/piste
+Heads_Number dw 2 ;Nombre de tete de lecture/écriture
+Sectors_Hidden dd 0 ;Nombre de secteurs cachés
+Sectors_Per_Disk2 dd 0 ;Nombre secteurs du volume si > 32 Mo
+Boot_Drive db 0 ;Lecteur de démarrage
+Reserved db 0 ;NA (pour NT seulement)
+Extended_Boot_ID db 0x29 ;Signature Boot étendu 29h
+Serial_Number dd 0x01020304 ;N° de série
+Disk_Name db "COS2000 " ;Nom de volume
+Fat_Type db "FAT12 " ;Type de système de fichiers
+
+;Cpu_Message db "CPU test",0
+Boot_Message db "Booting ",0
+Finding_Message db "System ",0
+Loading_Message db "Loading ",0
+System_File db "SYSTEM SYS"
+Is_Ok db "[ OK ]",0x0A,0x0D,0
+Is_Failed db "[Failed]",0x0A,0x0D,"Press a key",0x0A,0x0D,0
+The_Dot db '.',0
+
+Boot_Error:
+ mov si,Is_Failed
+ call ShowString
+ mov ah,0
+ int 0x16
+ int 0x19
+
+Boot_Ok:
+ mov al,[Stage]
+ cmp al,0
+ jz No_Ok
+ mov si,Is_Ok
+ call ShowString
+No_Ok:
+ xor ah,ah
+ mov si,ax
+ add si,Boot_Message ;Cpu_Message
+ call ShowString
+ add byte [Stage],0x09
+ ret
+
+Stage db 0
+
+Boot:
+ push cs
+ push cs
+ pop es
+ pop ds
+ mov [Boot_Drive],dl
+ cli
+ mov ax,0x9000
+ mov ss,ax
+ mov sp,0xFFFF
+ sti
+; call Detect_Cpu
+; jc Boot_Error
+ call Boot_Ok
+ xor ax,ax
+ int 0x13
+ jc Boot_Error
+ mov cx,[Reserved_Sectors]
+ add cx,[Sectors_Hidden]
+ adc cx,[Sectors_Hidden+2]
+ mov di,Fat_Buffer
+ call ReadSector
+ jc Boot_Error
+ xor ax,ax
+ mov al,[Fats_Number]
+ mov bx,[Sectors_Per_Fat]
+ mul bx
+ add cx,ax
+ mov ax,32
+ mul word [Fits_Number]
+ div word [Sectors_Size]
+ add ax,cx
+ sub ax,2
+ mov word [Serial_Number],ax
+ xor dx,dx
+ call Boot_Ok
+Find_System:
+ mov di,Buffer
+ call ReadSector
+ jc Near Boot_Error
+ xor bx,bx
+Next_Root_Entrie:
+ cmp byte [di],0
+ je near Boot_Error
+ push di
+ push cx
+ mov si,System_File
+ mov cx,11
+ rep cmpsb
+ pop cx
+ pop di
+ je System_Found
+ add di,32
+ add bx,32
+ inc dx
+ cmp dx,[Fits_Number]
+ ja near Boot_Error
+ cmp bx,[Sectors_Size]
+ jb Next_Root_Entrie
+ inc cx
+ jmp Find_System
+System_Found:
+ mov cx,[di+26]
+ mov ax,0x0071
+ mov es,ax
+ push es
+ mov di,0x100
+ push di
+ call Boot_Ok
+ mov si,The_Dot
+Resume_Loading:
+ cmp cx,0x0FF0
+ jae Finish_Loading
+ push cx
+ add cx,word [Serial_Number]
+ call ReadSector
+ pop cx
+ jc near Boot_Error
+ call ShowString
+ add di,[Sectors_Size]
+ call NextFatGroup
+ jc near Boot_Error
+ jmp Resume_Loading
+Finish_Loading:
+ call Boot_Ok
+ retf
+
+;====================READSECTOR=======================
+;Lit le secteur logique LBA CX et le met en es:di
+;-> CX (limité à 65536 secteurs, soit 32 Mo avec secteur 512 octets)
+;<- Flag Carry si erreur
+;=====================================================
+ReadSector:
+ pusha
+ mov ax,cx
+ xor dx,dx
+ div word [Sectors_Per_Track]
+ inc dl
+ mov bl,dl
+ xor dx,dx
+ div word [Heads_Number]
+ mov dh, [Boot_Drive]
+ xchg dl,dh
+ mov cx,ax
+ xchg cl,ch
+ shl cl,6
+ or cl, bl
+ mov bx,di
+ mov si, 4
+ mov al, 1
+Read_Again:
+ mov ah, 2
+ int 0x13
+ jnc Read_Done
+ dec si
+ jnz Read_Again
+Read_Done:
+ popa
+ ret
+
+;===================NEXTFATGROUP======================
+;Renvoie en CX le groupe qui succède dans la FAT le groupe CX
+;-> CX
+;<-
+;=====================================================
+NextFatGroup:
+ push bx
+ push dx
+ push di
+ mov ax,cx
+ mov bx,ax
+ and bx,0000000000000001b
+ shr ax,1
+ mov cx,3
+ mul cx
+ mov di,Fat_Buffer
+ add di,ax
+ cmp bx,0
+ jnz Even_Group
+Odd_Group:
+ mov dx,[di]
+ and dx,0x0FFF
+ mov cx,dx
+ jmp Next_Group_Found
+Even_Group:
+ mov dx,[di+1]
+ and dx,0xFFF0
+ shr dx,4
+ mov cx,dx
+Next_Group_Found:
+ pop di
+ pop dx
+ pop bx
+ ret
+
+;======================SHOWSTR========================
+;Affiche la chaine de caractère pointé par ds:si à l'écran
+;-> DS, SI
+;<- Flag Carry si erreur
+;=====================================================
+ShowString:
+ pusha
+Next_Char:
+ lodsb
+ or al,al
+ jz End_Show
+ mov ah,0x0E
+ mov bx,0x07
+ int 0x10
+ jmp Next_Char
+End_Show:
+ popa
+ ret
+
+;======================DETECTCPU======================
+;Detecte si le processeur est un 386 au mini
+;->
+;<- Flag Carry si erreur
+;=====================================================
+;Detect_Cpu:
+; push ax ; test if 8088/8086 is present (flag bits 12-15 will be set)
+; xor ah,ah ; ah = 0
+; push ax ; copy ax into the flags
+; popf ; with bits 12-15 clear
+; pushf ; Read flags back into ax
+; pop ax
+; and ah,0xF0 ; check if bits 12-15 are set
+; cmp ah,0xF0
+; je No_386 ; no 386 detected (8088/8086 present)
+; ; check for a 286 (bits 12-15 are clear)
+; mov ah,0xF0 ; set bits 12-15
+; push ax ; copy ax onto the flags
+; popf
+; pushf ; copy the flags into ax
+; pop ax
+; and ah,0xF0 ; check if bits 12-15 are clear
+; jz No_386 ; no 386 detected (80286 present)
+; clc
+; ret
+;No_386:
+; stc
+; ret
+
+times 510-($-$$) db ' '
+
+dw 0xAA55
+
+Buffer equ $
+Fat_Buffer equ $+512
+
+section .bss
+
+;Buffer resb 512
+;Fat_Buffer resb 10000
\ No newline at end of file
diff --git a/boot/boot16.asm b/boot/boot16.asm
new file mode 100644
index 0000000..813f14c
--- /dev/null
+++ b/boot/boot16.asm
@@ -0,0 +1,270 @@
+[BITS 16]
+[ORG 0x7C00]
+
+section .text
+
+start:
+ jmp near Boot
+
+Disk_ID db "COS2000A" ;Fabricant + n° de série Formatage
+Sectors_Size dw 512 ;Nombre d'octets/secteur
+Sectors_Per_Cluster db 4 ;Nombre de secteurs/cluster
+Reserved_Sectors dw 1 ;Nombre de secteurs réservé
+Fats_Number db 2 ;Nombre de copies de la FAT
+Fits_Number dw 512 ;Taille du répertoire racine
+Sectors_Per_Disk dw 2880 ;Nombre secteurs du volume si < 32 Mo
+Media_Descriptor db 0xF8 ;Descripteur de média
+Sectors_Per_Fat dw 207 ;Nombre secteurs/FAT
+Sectors_Per_Track dw 18 ;Nombre secteurs/piste
+Heads_Number dw 38 ;Nombre de tete de lecture/écriture
+Sectors_Hidden dd 16 ;Nombre de secteurs cachés
+Sectors_Per_Disk2 dd 39 ;Nombre secteurs du volume si > 32 Mo
+Boot_Drive db 0x80 ;Lecteur de démarrage
+Reserved db 0 ;NA (pour NT seulement)
+Extended_Boot_ID db 0x29 ;Signature Boot étendu 29h
+Serial_Number dd 0x01020304 ;N° de série
+Disk_Name db "COS2000 " ;Nom de volume
+Fat_Type db "FAT16 " ;Type de système de fichiers
+
+;Cpu_Message db "CPU test",0
+;Boot_Message db "Booting ",0
+;Finding_Message db "System ",0
+;Loading_Message db "Loading ",0
+System_File db "SYSTEM SYS"
+Is_Ok db "[ OK ]",0x0A,0x0D,0
+Is_Failed db "[Failed]",0x0A,0x0D,"Press a key",0x0A,0x0D,0
+The_Dot db '.',0
+
+Boot_Error:
+ mov si,Is_Failed
+ call ShowString
+ mov ah,0
+ int 0x16
+ int 0x19
+
+Boot_Ok:
+; mov al,[Stage]
+; cmp al,0
+; jz No_Ok
+ mov si,Is_Ok
+ call ShowString
+;No_Ok:
+; xor ah,ah
+; mov si,ax
+; add si,Boot_Message ;Cpu_Message
+; call ShowString
+; add byte [Stage],0x09
+ ret
+;
+;Stage db 0
+
+Boot:
+ push cs
+ push cs
+ pop es
+ pop ds
+ mov [Boot_Drive],dl
+ cli
+ mov ax,0x9000
+ mov ss,ax
+ mov sp,0xFFFF
+ sti
+; call Detect_Cpu
+; jc Boot_Error
+; call Boot_Ok
+ xor ax,ax
+ int 0x13
+; jc Boot_Error
+ xor eax,eax
+ add ax,[Reserved_Sectors]
+ add ecx,eax
+ mov di,Fat_Buffer
+ call ReadSector
+ jc Boot_Error
+ xor eax,eax
+ mov al,[Fats_Number]
+ mov bx,[Sectors_Per_Fat]
+ mul bx
+ add ecx,eax
+ mov ax,32
+ mul word [Fits_Number]
+ div word [Sectors_Size]
+ add eax,ecx
+ mov dword [Serial_Number],eax
+ xor dx,dx
+; call Boot_Ok
+Find_System:
+ mov di,Buffer
+ call ReadSector
+ jc near Boot_Error
+ xor bx,bx
+Next_Root_Entrie:
+ cmp byte [di],0
+ je near Boot_Error
+ push di
+ push cx
+ mov si,System_File
+ mov cx,11
+ rep cmpsb
+ pop cx
+ pop di
+ je System_Found
+ add di,32
+ add bx,32
+ inc dx
+ cmp dx,[Fits_Number]
+ ja near Boot_Error
+ cmp bx,[Sectors_Size]
+ jb Next_Root_Entrie
+ inc ecx
+ jmp Find_System
+System_Found:
+ xor ecx,ecx
+ mov cx,[di+26]
+ mov ax,0x0071
+ mov es,ax
+ push es
+ mov di,0x100
+ push di
+; call Boot_Ok
+ mov si,The_Dot
+Resume_Loading:
+ cmp cx,0x0FFF0
+ jae Finish_Loading
+ call ReadGroup
+ jc near Boot_Error
+ call ShowString
+ mov bx,cx
+ shl bx,1
+ mov cx,[bx+Fat_Buffer]
+ jmp Resume_Loading
+Finish_Loading:
+ call Boot_Ok
+ retf
+
+;====================READSECTOR=======================
+;Lit le secteur logique LBA ECX et le met en es:di
+;-> ECX (limité à 2^32 secteurs, soit 2 To avec secteur 512 octets)
+;<- Flag Carry si erreur
+;=====================================================
+ReadSector:
+ pushad
+ mov ax, cx
+ ror ecx,16
+ mov dx,cx
+ rol ecx,16
+ cmp ecx,4128705
+ ja Extended_CHS
+ div word [Sectors_Per_Track]
+ inc dl
+ mov bl, dl
+ xor dx,dx
+ div word [Heads_Number]
+ mov dh, [Boot_Drive]
+ xchg dl, dh
+ mov cx, ax
+ xchg cl, ch
+ shl cl, 6
+ or cl, bl
+ mov bx, di
+ mov si, 4
+ mov al, 1
+Read_Again:
+ mov ah, 2
+ int 0x13
+ jnc Read_Done
+ dec si
+ jnz Read_Again
+Read_Done:
+ popad
+ ret
+Extended_CHS:
+ mov si,ECHS_Block
+ mov byte [si+Sizes],0x10
+ mov byte [si+Reserve],0x01
+ mov byte [si+NumSectors],0x01
+ mov [si+Adressseg],es
+ mov [si+Adressoff],di
+ mov [si+SectorLow],ax
+ mov [si+SectorHigh],dx
+ mov di,4
+ mov dl,[Boot_Drive]
+Read_AgainX:
+ mov ah, 42h
+ int 13h
+ jnc Read_Done
+ dec di
+ jnz Read_AgainX
+
+;======================READGROUP======================
+;lit le groupe cx en es:di et incr‚mente DI
+;-> cx, es:di
+;<- di, Flag Carry si erreur
+;=====================================================
+ReadGroup:
+ push ax
+ push cx
+ push dx
+ mov al,[Sectors_Per_Cluster]
+ sub cx,2
+ xor ah,ah
+ mul cx
+ mov cx,dx
+ shl ecx,16
+ mov cx,ax
+ add ecx,dword [Serial_Number]
+ mov al,[Sectors_Per_Cluster]
+read:
+ call ReadSector
+ jc errors
+ inc ecx
+ add di,[Sectors_Size]
+ dec al
+ jnz read
+ clc
+errors:
+ pop dx
+ pop cx
+ pop ax
+ ret
+
+;======================SHOWSTR========================
+;Affiche la chaine de caractère pointé par ds:si à l'écran
+;-> DS, SI
+;<- Flag Carry si erreur
+;=====================================================
+ShowString:
+ ;push ax
+ ;push bx
+ ;push si
+ pusha
+Next_Char:
+ lodsb
+ or al,al
+ jz End_Show
+ mov ah,0x0E
+ mov bx,0x07
+ int 0x10
+ jmp Next_Char
+End_Show:
+ ;pop si
+ ;pop bx
+ ;pop ax
+ popa
+ ret
+
+times 510-($-$$) db ' '
+
+dw 0xAA55
+
+ECHS_Block equ $
+Buffer equ $+26
+Fat_Buffer equ $+26+512
+
+section .bss
+
+%include "echs.h"
+
+;ECHS_Block resb 24
+;Buffer resb 512
+;Fat_Buffer resb 10000
\ No newline at end of file
diff --git a/boot/bootcp.asm b/boot/bootcp.asm
new file mode 100644
index 0000000..6a32fa9
--- /dev/null
+++ b/boot/bootcp.asm
@@ -0,0 +1,88 @@
+[BITS 16]
+[ORG 0x100]
+
+section .text
+
+start:
+ mov ah,09
+ mov dx,msg
+ int 0x21
+ cmp byte [0x80],2
+ jne near error
+ mov ax,0x3D02
+ mov dx,name
+ int 0x21
+ jc near error
+ mov bx,ax
+ mov ax,0x4202
+ xor cx,cx
+ xor dx,dx
+ int 0x21
+ jc error
+ cmp dx,0
+ jne error
+ cmp ax,512
+ jne error
+ mov ax,0x4200
+ xor cx,cx
+ xor dx,dx
+ int 0x21
+ jc error
+ mov ah,0x3F
+ mov cx,512
+ mov dx,buffer2
+ int 0x21
+ jc error
+ cmp word [buffer2+510],0xAA55
+ jne error
+ mov al,[0x82]
+ cmp al,'z'
+ ja error
+ cmp al,'a'
+ jb verif
+ sub al,'a'-'A'
+verif:
+ cmp al,'Z'
+ ja error
+ cmp al,'A'
+ jb error
+ sub al,'A'
+ mov bp,ax
+ mov [segs],cs
+ mov cx,0xFFFF
+ mov bx,packet
+ int 0x25
+ pop ax
+ mov si,buffer+3
+ mov di,buffer2+3
+ mov cx,59
+ rep movsb
+ mov ax,bp
+ mov word [offs],buffer2
+ mov cx,0xFFFF
+ mov bx,packet
+ int 0x26
+ pop ax
+ jc error
+ mov ah,09
+ mov dx,msgok
+ int 0x21
+ ret
+
+error:
+ mov ah,09
+ mov dx,msgerror
+ int 0x21
+ ret
+
+
+packet dd 0
+ dw 1
+offs dw buffer
+segs dw 0
+name db "boot.bin",0
+msg db 0x0D,0x0A,"CopyBoot V1.0 by nico",0x0D,0x0A,"Copyright 2002",0x0D,0x0A,'$'
+msgok db "Installation of bootsector realized",0x0D,0x0A,'$'
+msgerror db "Installation of bootsector failed",0x0D,0x0A,'$'
+buffer equ $
+buffer2 equ $+512
\ No newline at end of file
diff --git a/boot/boottest.asm b/boot/boottest.asm
new file mode 100644
index 0000000..3e61ceb
--- /dev/null
+++ b/boot/boottest.asm
@@ -0,0 +1,217 @@
+[BITS 16]
+[ORG 0x7C00]
+
+section .text
+
+start:
+ jmp near boot
+
+Disk_ID db "COS2000A" ;Fabricant + n° de série Formatage
+Sectors_Size dw 512 ;Nombre d"octets/secteur
+Sectors_Per_Cluster db 1 ;Nombre de secteurs/cluster
+Reserved_Sectors dw 1 ;Nombre de secteurs réservé
+Fats_Number db 2 ;Nombre de copies de la FAT
+Fits_Number dw 224 ;Taille du répertoire racine
+Sectors_Per_Disk dw 2880 ;Nombre secteurs du volume si < 32 Mo
+Media_Descriptor db 0xF0 ;Descripteur de média
+Sectors_Per_Fat dw 9 ;Nombre secteurs/FAT
+Sectors_Per_Track dw 18 ;Nombre secteurs/piste
+Heads_Number dw 2 ;Nombre de tete de lecture/écriture
+Sectors_Hidden dd 0 ;Nombre de secteurs cachés
+Sectors_Per_Disk2 dd 0 ;Nombre secteurs du volume si > 32 Mo
+Boot_Drive db 0 ;Lecteur de démarrage
+Reserved db 0 ;NA (pour NT seulement)
+Extended_Boot_ID db 0x29 ;Signature Boot étendu 29h
+Serial_Number dd 0x01020304 ;N° de série
+Disk_Name db "COS2000 " ;Nom de volume
+Fat_Type db "FAT12 " ;Type de système de fichiers
+
+Loading_Ok db "Secteur en execution",0x0A,0x0D,0
+Reg_Names db "cs ",0
+ db "ds ",0
+ db "es ",0
+ db "fs ",0
+ db "gs ",0
+ db "ss ",0
+ db "eax",0
+ db "ebx",0
+ db "ecx",0
+ db "edx",0
+ db "esi",0
+ db "edi",0
+ db "esp",0
+ db "ebp",0
+ db "eip",0
+ db "FLG",0
+ db "cr0",0
+ db "cr1",0
+ db "cr2",0
+ db "cr3",0
+
+Return db 0x0A,0x0D,0
+
+Numbers equ 20
+
+boot:
+ mov [cs:segms],cs
+ mov [cs:segms+4],ds
+ mov [cs:segms+8],es
+ mov [cs:segms+12],fs
+ mov [cs:segms+16],gs
+ mov [cs:segms+20],ss
+ mov [cs:segms+24],eax
+ mov [cs:segms+28],ebx
+ mov [cs:segms+32],ecx
+ mov [cs:segms+36],edx
+ mov [cs:segms+40],esi
+ mov [cs:segms+44],edi
+ mov [cs:segms+48],esp
+ mov [cs:segms+52],ebp
+IP:
+ mov word [cs:segms+56],IP
+ mov word [cs:segms+58],0
+ pushfd
+ pop dword [cs:segms+60]
+ mov eax,cr0
+ mov [cs:segms+64],eax
+ mov eax,cr0
+ mov [cs:segms+68],eax
+ mov eax,cr2
+ mov [cs:segms+72],eax
+ mov eax,cr3
+ mov [cs:segms+76],eax
+ cli
+ mov ax,0x9000
+ mov ss,ax
+ mov sp,0xFFFF
+ sti
+ push cs
+ push cs
+ pop es
+ pop ds
+ mov si,Loading_Ok
+ call ShowString
+ xor bx,bx
+Show_All_Regs:
+ mov si,Reg_Names
+ shl bx,2
+ add si,bx
+ call ShowString
+ mov al,":"
+ call ShowChar
+ mov si,segms
+ mov edx,[bx+si]
+ shr bx,2
+ mov cx,32
+ cmp bx,6
+ jae Reg_Size_32
+ mov cx,16
+Reg_Size_32:
+ call ShowHex
+ mov si,Return
+ call ShowString
+ inc bx
+ cmp bx,Numbers
+ jb Show_All_Regs
+Halting_Cpu:
+ jmp Halting_Cpu
+
+;==================SHOWHEX==================
+;Affiche un nombre hexadécimal EDX de taille CX aprés le curseur
+;-> EDX un entier, CX la taille
+;<-
+;===========================================
+ShowHex:
+ push ax
+ push bx
+ push cx
+ push edx
+ mov ax,cx
+ shr ax,2
+ sub cx,32
+ neg cx
+ shl edx,cl
+ xchg ax,cx
+Hex_Decompose:
+ rol edx,4
+ mov bx,dx
+ and bx,0x0F
+ mov al,[cs:bx+Hex_Table]
+ call ShowChar
+ dec cl
+ jnz Hex_Decompose
+ pop edx
+ pop cx
+ pop bx
+ pop ax
+ ret
+Hex_Table db "0123456789ABCDEF"
+
+;===================CLS====================
+;Efface l"écran
+;->
+;<-
+;==========================================
+Cls:
+ push ax
+ mov ax,0x0003
+ int 0x10
+ pop ax
+ ret
+
+;================SHOWCHAR==================
+;Affiche un caractère pointé dans AL
+;-> AL
+;<-
+;==========================================
+ShowChar:
+ push ax
+ push bx
+ mov ah,0x0E
+ mov bx,0x07
+ int 0x10
+ pop bx
+ pop ax
+ ret
+
+;===================SHOWSTR================
+;Affiche une chaine de caractère pointé par SI
+;-> SI pointe une chaine
+;<-
+;==========================================
+ShowString:
+ push ax
+ push bx
+ push si
+ cld
+Show_Next_Char:
+ lodsb
+ or al,al
+ jz String_Showed
+ call ShowChar
+ jmp Show_Next_Char
+String_Showed:
+ pop si
+ pop bx
+ pop ax
+ ret
+
+;=================WAITKEY=================
+;Attend l"appuie d"une touche et
+;renvoie en AL la touche appuyée
+;->
+;<- AL
+;=========================================
+WaitKey:
+ mov ax,0x00
+ int 0x16
+ ret
+
+times 510-($-$$) db ' '
+
+dw 0xAA55
+
+section .bss
+
+segms resb 10000
+
diff --git a/boot/echs.h b/boot/echs.h
new file mode 100644
index 0000000..fc1bba9
--- /dev/null
+++ b/boot/echs.h
@@ -0,0 +1,10 @@
+struc echs
+Sizes resb 1
+Reserve resb 1
+NumSectors resw 1
+Adressoff resw 1
+Adressseg resw 1
+SectorLow resw 1
+SectorHigh resw 1
+Dummy resq 1
+endstuc
diff --git a/boot/makefile b/boot/makefile
new file mode 100644
index 0000000..10cbc4f
--- /dev/null
+++ b/boot/makefile
@@ -0,0 +1,24 @@
+all: makall
+
+makall: boot12.bin boot16.bin boottest.bin bootcp.com
+ sync
+
+boot12.bin:
+ nasm -f bin -o boot12.bin boot12.asm
+
+boot16.bin:
+ nasm -f bin -o boot16.bin boot16.asm
+
+boottest.bin:
+ nasm -f bin -o boottest.bin boottest.asm
+
+bootcp.com:
+ nasm -f bin -o bootcp.com bootcp.asm
+
+clean:
+ rm -f *.o
+ rm -f *.bin
+ rm -f *.sys
+ rm -f *.com
+
+
diff --git a/drivers/makefile b/drivers/makefile
new file mode 100644
index 0000000..8b186b2
--- /dev/null
+++ b/drivers/makefile
@@ -0,0 +1,13 @@
+all: makall
+
+makall: vga/vga.o
+ sync
+
+clean:
+ (cd vga; make clean)
+
+vga/vga.o:
+ (cd vga; make)
+
+
+
diff --git a/drivers/vga/makefile b/drivers/vga/makefile
new file mode 100644
index 0000000..75edc00
--- /dev/null
+++ b/drivers/vga/makefile
@@ -0,0 +1,17 @@
+FREEC=gcc -O4 -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -I ../../Include -c -o
+PARTIAL=-r
+OBJS= vgahard.o \
+ vgatxt.o
+
+all:
+ nasm -f elf -o vgahard.o vgahard.asm
+
+ $(FREEC) vgatxt.o vgatxt.c
+
+ ld $(PARTIAL) -o vga.o $(OBJS)
+
+clean:
+ rm -f *.o
+ rm -f *.bin
+
+
diff --git a/drivers/vga/vgahard.asm b/drivers/vga/vgahard.asm
new file mode 100644
index 0000000..e990554
--- /dev/null
+++ b/drivers/vga/vgahard.asm
@@ -0,0 +1,5 @@
+[BITS 32]
+
+
+ SECTION .text
+
\ No newline at end of file
diff --git a/drivers/vga/vgatxt.c b/drivers/vga/vgatxt.c
new file mode 100644
index 0000000..959ed06
--- /dev/null
+++ b/drivers/vga/vgatxt.c
@@ -0,0 +1 @@
+#include
\ No newline at end of file
diff --git a/include/asm.h b/include/asm.h
new file mode 100644
index 0000000..cc8ccf7
--- /dev/null
+++ b/include/asm.h
@@ -0,0 +1,23 @@
+#include "types.h"
+#define sti() __asm__ ("sti"::)
+#define cli() __asm__ ("cli"::)
+#define nop() __asm__ ("nop"::)
+#define iret() __asm__ ("iret"::)
+
+#define outb(port,value) \
+ asm volatile ("outb %%al,%%dx"::"d" (port), "a" (value));
+
+#define outw(port,value) \
+ asm volatile ("outb %%ax,%%dx"::"d" (port), "a" (value));
+
+#define inb(port) ({ \
+ u8 _v; \
+ asm volatile ("inb %%dx,%%al" : "=a" (_v) : "d" (port)); \
+ _v; \
+})
+
+#define inw(port) ({ \
+ u16 _v; \
+ asm volatile ("inw %%dx,%%ax" : "=a" (_v) : "d"(port)); \
+ _v; \
+})
\ No newline at end of file
diff --git a/include/string.h b/include/string.h
new file mode 100644
index 0000000..ec199fb
--- /dev/null
+++ b/include/string.h
@@ -0,0 +1,3 @@
+#include "types.h"
+
+void memset(void *dst, u8 val, u16 count,u32 size);
diff --git a/include/types.h b/include/types.h
new file mode 100644
index 0000000..451dbd8
--- /dev/null
+++ b/include/types.h
@@ -0,0 +1,11 @@
+#ifndef I386_TYPE
+#define I386_TYPE
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+typedef unsigned char uchar;
+typedef int bool;
+#define true 1;
+#define false 0;
+#endif
+
diff --git a/include/vga.h b/include/vga.h
new file mode 100644
index 0000000..38bfae4
--- /dev/null
+++ b/include/vga.h
@@ -0,0 +1,10 @@
+#include "types.h"
+
+#define TEXTSCREEN 0xB8000 /* debut de la memoire video texte*/
+#define GRPHSCREEN 0xA0000 /* debut de la memoire video graphique*/
+
+typedef u8 mode_def[64];
+
+void print (u8* string);
+void cls (void);
+u16 setvmode(u8);
diff --git a/install/iflop/iflop.asm b/install/iflop/iflop.asm
new file mode 100644
index 0000000..d01f2e9
--- /dev/null
+++ b/install/iflop/iflop.asm
@@ -0,0 +1,375 @@
+;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
+;³ COS 2000 ³
+;³ http://www.multimania.com/cos2000 ³
+;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
+;³ D I S K I M A G E ³
+;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
+;³ Fonction : Programme permettant de r‚aliser des images dique dur d'³
+;³ une disquettes. ³
+;³ ³
+;³ Appel : Diskimge [Nom du fichier][/r][/s][/h] ³
+;³ /r restaure l'image /s sauve l'image /h aide ³
+;³ ³
+;³ Compilation : TASM boot /m4 /x ³
+;³ TLINK boot /t /x ³
+;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
+;³ Programmeur : Nico ³
+;³ Con‡us le : 15/07/2001 ³
+;³ Modifi‚ le : 15/07/2001 ³
+;³ Site Web : http://www.multimania.com/cos2000 ³
+;³ Copyright : libre distribution ³
+;³ E-Mail : COS2000@multimania.com ³
+;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
+
+;==========================Directive d'assemblages============================
+[BITS 16] ;Directive qui autorise la g‚n‚ration de code 16 bits
+[ORG 0x100] ;Directive pour indiquer le d‚but du code
+
+section .text
+
+
+;=============================Debut du programmes=============================
+
+start: ;Label du d‚but.
+ mov ah,0x09
+ mov dx,msg ;
+ int 0x21
+ mov ah,'r'
+ call Check
+ jnc restitute
+ mov ah,'s'
+ call Check
+ jnc save
+help:
+ mov ah,0x09
+ mov dx,helpmsg
+ int 0x21
+ mov ax,0
+ int 0x16
+ ret
+restitute:
+ mov ah,'n'
+ call Check
+ jnc nospl
+ mov ah,0x09
+ mov dx,msg2
+ int 21h
+ mov ax,0x00
+ int 16h
+nospl:
+ mov ah,0x09
+ mov dx,res
+ int 0x21
+ call OpenCmdLine
+ jc error
+ mov si,buffer
+ mov di,si
+ xor cx,cx
+restoring:
+ call Read18432
+ jc error
+ call WriteTrack ;Ecrit la piste CX sur les 2 tˆtes depuis ds:di
+ jc error
+ call ShowDot
+ inc cx
+ cmp cx,80
+ jb restoring
+ mov ah,0x09
+ mov dx,msgok
+ int 0x21
+ ret
+save:
+ mov ah,'n'
+ call Check
+ jnc nospl2
+ mov ah,0x09
+ mov dx,msg2
+ int 0x21
+ mov ax,0
+ int 0x16
+nospl2:
+ mov ah,0x09
+ mov dx,sav
+ int 0x21
+ call CreateCmdLine
+ jc error
+ mov si,buffer
+ mov di,si
+ xor cx,cx
+saving:
+ call ReadTrack ;Lit la piste CX sur 2 tˆte en es:di
+ jc error
+ call Write18432
+ jc error
+ call ShowDot
+ inc cx
+ cmp cx,80
+ jb saving
+ mov ah,09
+ mov dx,msgok
+ int 0x21
+ ret
+error:
+ push cs
+ pop ds
+ call CloseCmdLine
+ mov ah,09
+ mov dx,errormsg
+ int 0x21
+ ret
+
+;Affiche un point
+ShowDot:
+ push ax
+ push bx
+ push cx
+ mov bx,cx
+ shr bx,4
+ mov al,[bx+dot]
+ mov ah,0x0E
+ mov bx,0x07
+ int 0x10
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;Ecrit une piste CX 2 Tˆte, depuis le buffer DS:SI
+ReadTrack:
+ push ax
+ push bx
+ push cx
+ push dx
+ push si
+ push es
+ push ds
+ pop es
+ xchg ch,cl
+ xor dx,dx
+ xor cl,cl
+ inc cl
+ mov bx,si
+ mov si,3
+retry:
+ mov ax,0x0212
+ int 13h
+ jnc done
+ dec si
+ jnz retry
+ jmp dead
+done:
+ add bx,9216
+ inc dh
+ cmp dh,1
+ je retry
+dead:
+ pop es
+ pop si
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;Lit une piste CX sur deux tˆte dans le buffer ES:DI
+WriteTrack:
+ push ax
+ push bx
+ push cx
+ push dx
+ push si
+ xchg ch,cl
+ xor dx,dx
+ xor cl,cl
+ inc cl
+ mov bx,di
+ mov si,3
+retry2:
+ mov ax,0x0312
+ int 0x13
+ jnc done2
+ dec si
+ jnz retry2
+done2:
+ add bx,9216
+ inc dh
+ cmp dh,1
+ je retry2
+dead2:
+ pop si
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;Ecrit 18432 octets depuis DS:SI dans le fichier ouvert par OpenCmdline
+Write18432:
+ push ax
+ push bx
+ push cx
+ push dx
+ mov ah,0x40
+ mov cx,18432
+ mov bx,[handle]
+ mov dx,si
+ int 0x21
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;Lit 18432 octets vers ES:DI depuis le fichier ouvert par OpenCmdline
+Read18432:
+ push ax
+ push bx
+ push cx
+ push dx
+ mov ah,0x3F
+ mov cx,18432
+ mov bx,[handle]
+ mov dx,si
+ int 0x21
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;Ouvre la ligne de commande
+OpenCmdLine:
+ push ax
+ push bx
+ push dx
+ mov bl,[0x80]
+ xor bh,bh
+ add bx,0x80
+ mov byte [bx],0
+ mov ax,0x3D00
+ mov dx,0x82
+ int 0x21
+ mov [handle],ax
+ pop dx
+ pop bx
+ pop ax
+ ret
+
+;Cr‚e un fichier du nom de la ligne de commande
+CreateCmdLine:
+ push ax
+ push bx
+ push cx
+ push dx
+ mov bl,[0x80]
+ xor bh,bh
+ add bx,0x80
+ mov byte [bx],0
+ mov ah,0x3C
+ xor cx,cx
+ mov dx,0x82
+ int 0x21
+ mov [handle],ax
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;Ferme le fichier pr‚c‚damment ouvert avec OpenCmdline
+CloseCmdLine:
+ push ax
+ push bx
+ mov bx,[handle]
+ mov ah,0x3E
+ int 0x21
+ pop bx
+ pop ax
+ ret
+
+;Recherche le commutateur AH dans la ligne de commande si existant retourne FC=True.
+Check:
+ push ax
+ push cx
+ push di
+ mov di,0x80
+ mov cl,[di]
+ cmp cl,0
+ je notfound2
+ xor ch,ch
+ mov al,'/'
+search:
+ cmp cx,0
+ je notfound
+ repne scasb
+ cmp [di],ah
+ jnz search
+ jmp okfound
+notfound:
+ sub ah,'a'-'A'
+ mov di,0x80
+ mov cl,[di]
+search2:
+ cmp cx,0
+ je notfound2
+ repne scasb
+ cmp [di],ah
+ jnz search2
+okfound:
+ mov word [di-2],0
+ clc
+ pop di
+ pop cx
+ pop ax
+ ret
+notfound2:
+ stc
+ pop di
+ pop cx
+ pop ax
+ ret
+
+res db "Restauration en cours",0x0A,0x0D,0x0A,0x0D,'$'
+sav db "Sauvegarde en cours",0x0A,0x0D,0x0A,0x0D,'$'
+dot db " °±²Û"
+handle dw 0
+msg db 0x0A,0x0D,"IFlop V1.0",0x0A,0x0D
+ db "Ecrit par Nico",0x0A,0x0D
+ db "http://www.multimania.com/cos2000",0Ah,0Dh
+ db "Copyright 2000",0Ah,0Dh,'$'
+msg2 db "Ins‚rez une disquette de 1.44 Mo dans le lecteur et appuyez sur une touche...",0x0A,0x0D,'$'
+errormsg db 0Ah,0Dh,"Une erreur est apparue lors de la copie !",0x0A,0x0D,'$'
+msgok db 0Ah,0Dh,"La copie de l'image a ‚t‚ correctement r‚alis‚e",0x0A,0x0D,'$'
+
+SectorsPerTrack dw 18 ;Nombre de secteur par pistes.
+HeadsPerDrive dw 2 ;Nombre de t‚tes par disque.
+
+helpmsg:
+db "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
+db "³ COS 2000 ³"
+db "³ http://www.multimania.com/cos2000 ³"
+db "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´"
+db "³ I F L O P ³"
+db "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´"
+db "³ Fonction : Programme permettant de r‚aliser des images disque dur ³"
+db "³ d'une disquettes. ³"
+db "³ ³"
+db "³ Appel : Iflop [Nom du fichier][/r][/s][/h] ³"
+db "³ /r restaure l'image /s sauve l'image /h aide ³"
+db "³ ³"
+db "³ Compilation : TASM boot /m4 /x ³"
+db "³ TLINK boot /t /x ³"
+db "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´"
+db "³ Programmeur : Nico ³"
+db "³ Con‡us le : 15/07/2001 ³"
+db "³ Modifi‚ le : 15/07/2001 ³"
+db "³ Site Web : http://www.multimania.com/cos2000 ³"
+db "³ Copyright : libre distribution ³"
+db "³ E-Mail : COS2000@multimania.com ³"
+db "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ$"
+
+section .bss
+
+[org 0x5000]
+
+buffer resb 512 ;Allocation de 512 octets pour contenir le secteur lu.
\ No newline at end of file
diff --git a/install/iflop/makefile b/install/iflop/makefile
new file mode 100644
index 0000000..84d3c6c
--- /dev/null
+++ b/install/iflop/makefile
@@ -0,0 +1,16 @@
+all: makall
+
+makall: iflop.com
+
+
+iflop.com:
+ nasm -f bin -o iflop.com iflop.asm
+
+clean:
+ rm -f *.o
+ rm -f *.bin
+ rm -f *.sys
+ rm -f *.com
+
+
+
diff --git a/install/makefile b/install/makefile
new file mode 100644
index 0000000..b1fb2d2
--- /dev/null
+++ b/install/makefile
@@ -0,0 +1,19 @@
+all: makall
+
+makall:
+ sync
+
+clean:
+ (cd iflop; make clean)
+ (cd mbrol; make clean)
+
+iflop/iflop.com:
+ (cd iflop; make)
+
+mbrol/mbrol.com:
+ (cd mbrol; make)
+
+
+
+
+
diff --git a/install/mbrol/echs.h b/install/mbrol/echs.h
new file mode 100644
index 0000000..fc1bba9
--- /dev/null
+++ b/install/mbrol/echs.h
@@ -0,0 +1,10 @@
+struc echs
+Sizes resb 1
+Reserve resb 1
+NumSectors resw 1
+Adressoff resw 1
+Adressseg resw 1
+SectorLow resw 1
+SectorHigh resw 1
+Dummy resq 1
+endstuc
diff --git a/install/mbrol/loader.asm b/install/mbrol/loader.asm
new file mode 100644
index 0000000..de1af90
--- /dev/null
+++ b/install/mbrol/loader.asm
@@ -0,0 +1,897 @@
+[BITS 16]
+[ORG 0x0100]
+
+section .text
+
+start:
+ push eax
+ push ebx
+ push edi
+ push ebp
+ mov di, disk
+ call detectdisk
+ call cls
+ mov si,di
+ mov di, thepart
+ call getdriveinfos
+ mov [numbers],cx
+ mov si,di
+ call showdriveinfos
+ mov al,3
+ call selection
+ mov word [sel],0
+waitafter:
+ call waitkey
+ cmp ah,0x50
+ jne tre1
+ mov ax,[sel]
+ inc al
+ cmp ax,[numbers]
+ jz waitafter
+ mov [sel],ax
+ add al,3
+ call selection
+ jmp waitafter
+tre1:
+ cmp ah,0x48
+ jne tre2
+ mov ax,[sel]
+ cmp ax,0
+ jz waitafter
+ dec al
+ mov [sel],ax
+ add al,3
+ call selection
+ jmp waitafter
+tre2:
+ cmp al,0x0D
+ jne waitafter
+ mov bx,[sel]
+ shl bx,6
+ add bx,thepart
+ mov si,mmp
+ call showstr
+ mov si,bx
+ add si,28
+ call showstr
+ mov bp,[bx+26]
+ call initdisk
+ xor ax,ax
+ mov es,ax
+ mov ds,ax
+ mov di,0x0600
+ mov ecx,[cs:bx+16]
+ call readsector
+ mov di,0x7C00
+ mov ecx,[cs:bx+22]
+ call readsector
+ mov dx,bp
+ mov si,[cs:bx+20]
+ add si,0x0600
+ pop ebp
+ pop edi
+ pop ebx
+ pop eax
+ jmp 0x0000:0x7C00
+
+;=============================================================================
+
+; DONNEES FIXES
+
+;=============================================================================
+mmp db "Chargement du disque ",0
+msg db "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
+ db "³ Letter:Name ³ Type ³ Boot ³ Statut ³ Size MByte ³ StartSector ³"
+ db "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´",0
+tab db "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÙ",0
+sep db " ³ ",0
+
+partkind db 001h,"FAT12 ",0
+ db 004h,"FAT16 ",0
+ db 005h,"Extended ",0
+ db 006h,"FAT16B ",0
+ db 007h,"IFS ",0
+ db 00Bh,"FAT32 ",0
+ db 00Ch,"FAT32X ",0
+ db 00Eh,"FAT16X ",0
+ db 00Fh,"ExtendedX ",0
+ db 081h,"Linux 1.4b",0
+ db 082h,"Linux SWAP",0
+ db 083h,"Linux EXT2",0
+ db 011h,"FAT12 Hid ",0
+ db 014h,"FAT16 Hid",0
+ db 016h,"FAT16B Hid",0
+ db 017h,"IFS Hid ",0
+ db 01Bh,"FAT32 Hid ",0
+ db 01Ch,"FAT32X Hid",0
+ db 01Eh,"FAT16X Hid",0
+ db 0FFh,"Unknowed ",0
+
+noname db "Unknowed ","Unkowned ",0
+unknowed db "Movable ",0
+primary db "Primary ",0
+secondary db "Secondary",0
+yes db "Yes ",0
+no db "No ",0
+mo db " MB",0
+
+;=============================================================================
+
+; ROUTINES PARTICULIERES
+
+;=============================================================================
+;Affiche des infos sur le volume
+showdriveinfos:
+ push ax
+ push bx
+ push cx
+ push edx
+ push si
+ mov si, msg
+ call showstr
+ mov bx,thepart
+ mov cx,[numbers]
+showall:
+ mov al,'³'
+ call showchar
+ mov al,' '
+ call showchar
+ mov al,[bx+51]
+ call showchar
+ mov al,':'
+ call showchar
+ mov si,bx
+ add si,28
+ call showstr
+ mov si, sep
+ call showstr
+ mov al,[bx+4]
+ cmp al,0xFF
+ je useboot
+ mov si, partkind+1
+search:
+ cmp byte[si-1],0x0FF
+ je notboot
+ cmp [si-1],al
+ je notboot
+ add si,12
+ jmp search
+useboot:
+ mov si,bx
+ add si,40
+notboot:
+ call showstr
+ mov si, sep
+ call showstr
+ mov si, yes
+ cmp byte [bx],0x80
+ je okboot
+ mov si, no
+okboot:
+ call showstr
+ mov si, sep
+ call showstr
+ mov si, primary
+ cmp dword [bx+16],0
+ je okprimary
+ mov si, secondary
+okprimary:
+ cmp byte [bx+4],0x0FF
+ jne wasno
+ mov si, unknowed
+wasno:
+ call showstr
+ mov si, sep
+ call showstr
+ mov edx,[bx+12]
+ shr edx,11
+ call showint
+ mov si, mo
+ call showstr
+ mov si, sep
+ call showstr
+ mov edx,[bx+22]
+ call showint
+ mov al,' '
+ call showchar
+ mov al,'³'
+ call showchar
+ add bx,64
+ dec cx
+ jnz near showall
+ mov si, tab
+ call showstr
+ pop si
+ pop edx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;met en surlign‚e la ligne al et seulement al
+selection:
+ push cx
+ mov ch,0x70
+ call selectline
+ xchg al,[cs:old]
+ mov ch,0x07
+ call selectline
+ pop cx
+ ret
+
+old db 20
+
+;selectionne la ligne al de couleur ch
+selectline:
+ push ax
+ push bx
+ push cx
+ push ds
+ mov bh,160
+ mul bh
+ mov bx,ax
+ mov ax,0xB800
+ mov ds,ax
+ inc bx
+ mov cl,80
+select:
+ mov [bx],ch
+ add bx,2
+ dec cl
+ jnz select
+ pop ds
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;=============================================================================
+
+; ROUTINES UNIVERSELLES INSPIREE DE COS2000
+
+;=============================================================================
+
+
+;=========GETDRIVEINFOS==============
+;Envoie en es:di les lecteurs logiques sur les volumes point‚ par ds:si
+;-> BP, ES:DI
+;<- CX leur nombre
+;====================================
+getdriveinfos:
+ push ax
+ push bx
+ push dx
+ push si
+ push di
+ push bp
+ push di
+ xor bx,bx
+show:
+ xor dh,dh
+ mov dl,[si]
+ inc si
+ cmp dl,0xFF
+ je endofshow
+ mov bp,dx
+ call initdisk
+ call IsMbr
+ je okmbr
+ call getvolume
+ inc bx
+ add di,64
+ jmp show
+okmbr:
+ call getpartitions
+ mov ax,cx
+ shl ax,6
+ add di,ax
+ add bx,cx
+ jmp show
+endofshow:
+ pop si
+ mov al,'C'
+ mov cx,bx
+ push cx
+ push si
+checkp:
+ cmp byte [si+4],5
+ je notprim
+ cmp byte [si+4],0x0F
+ je notprim
+ cmp byte [si+16],0
+ jnz notprim
+ cmp byte [si+26],0x80
+ jb notprim
+ mov [si+51],al
+ inc al
+notprim:
+ add si,64
+ dec cx
+ jnz checkp
+ pop si
+ pop cx
+ push cx
+ push si
+checkl:
+ cmp byte [si+4],5
+ je notext
+ cmp byte [si+4],0x0F
+ je notext
+ cmp byte [si+16],0x00
+ jz notext
+ cmp byte [si+26],0x80
+ jb notext
+ mov [si+51],al
+ inc al
+notext:
+ add si,64
+ dec cx
+ jnz checkl
+ pop si
+ pop cx
+ mov al,'A'
+ push cx
+ push si
+checkn:
+ cmp byte [si+26],0x80
+ jae notlec
+ mov [si+51],al
+ inc al
+notlec:
+ add si,64
+ dec cx
+ jnz checkn
+ pop si
+ pop cx
+ mov al,'*'
+ push cx
+ push si
+checko:
+ cmp byte [si+4],5
+ je ext2
+ cmp byte [si+4],0x0F
+ jne notext2
+ext2:
+ mov [si+51],al
+notext2:
+ add si,64
+ dec cx
+ jnz checko
+ pop si
+ pop cx
+ pop bp
+ pop di
+ pop si
+ pop dx
+ pop bx
+ pop ax
+ ret
+
+;=============GETVOLUME==============
+;Envoie en es:di les infos disque EBP
+;-> BP, ES:DI
+;<-
+;====================================
+getvolume:
+ push ax
+ push ecx
+ push edx
+ push di
+ push di
+ mov cx,64
+ mov al,0
+ cld
+ rep stosb
+ pop di
+ mov byte [es:di+4],0xFF
+ mov ecx,0
+ mov [di+26],bp
+ push di
+ add di,28
+ call getbootinfos
+ pop di
+ mov [di+12],edx
+ pop di
+ pop edx
+ pop ecx
+ pop ax
+ ret
+
+;==========GETBOOTINFOS==============
+;Envoie en es:di le nom du volume & le FS d'adresse LBA ECX sur disque EBP
+;-> BP, ES:DI, ECX
+;<-
+;====================================
+getbootinfos:
+ push ax
+ push cx
+ push si
+ push di
+ push di
+ push es
+ push cs
+ pop es
+ mov di,buffer
+ mov si,di
+ call readsector
+ pop es
+ pop di
+ cmp byte [si+0x13],0
+ je more32
+ xor edx,edx
+ mov dx,[si+0x13]
+ jmp more16
+more32:
+ mov edx,[si+0x20]
+more16:
+ cmp byte [si+0x42],0x29
+ je fat32
+ cmp byte [si+0x26],0x29
+ je fat16
+unk:
+ mov si,noname
+ jmp rel
+fat32:
+ add si,0x47
+ jmp rel
+fat16:
+ add si,0x2B
+rel:
+ mov cx,11
+ cld
+ rep movsb
+ mov al,0
+ stosb
+ mov cx,8
+ rep movsb
+ mov ax,' '
+ stosw
+ mov al,0
+ stosb
+ pop di
+ pop si
+ pop cx
+ pop ax
+ ret
+
+;==========GETPARTITION==============
+;Envoie en es:di la liste des partitions du disque BP
+;-> BP, ES:DI
+;<- renvoie leur nombre en CX
+;====================================
+getpartitions:
+ push eax
+ push ebx
+ push edx
+ push si
+ push di
+ mov ecx,0
+ mov word [wheres],0
+ mov [theprimary],ecx
+againpart:
+ xor eax,eax
+ mov ebx,ecx
+ push di
+ mov di,partition
+ CALL readsector
+ mov si, di
+ pop di
+ add si,0x01BE
+ mov cl,4
+showevery:
+ cmp dword [si+NumSector],0x00000000
+ je nothings
+ mov edx,[si+StartSector]
+ cmp byte [si+Kind],0x05
+ je is
+ cmp byte [si+Kind],0x0F
+ jne isnot
+is:
+ mov eax,[theprimary]
+ add eax,edx
+ cmp dword [theprimary],0
+ jne nothings
+isnot:
+ push ecx
+ push di
+ push si
+ mov cx,[wheres]
+ shl cx,6
+ add di,cx
+ mov ecx,16/4
+ rep movsd
+ pop si
+ mov [di],ebx
+ mov [di+4],si
+ sub word [di+4],partition
+ mov [di+6],ebx
+ add [di+6],edx
+ mov ecx,[di+6]
+ mov [di+10],bp
+ add di,12
+ push edx
+ call getbootinfos
+ pop edx
+ pop di
+ pop ecx
+ inc word [wheres]
+nothings:
+ add si,16
+ dec cl
+ jnz showevery
+ mov ecx,eax
+ cmp dword [theprimary],0x00000000
+ jne noth
+ mov [theprimary],eax
+noth:
+ cmp ecx,0
+ jnz near againpart
+ mov cx,[wheres]
+ pop di
+ pop si
+ pop edx
+ pop ebx
+ pop eax
+ ret
+
+;==============ISMBR=================
+;Zero si Mbr sur le premier secteur du support BP
+;-> BP
+;<-
+;====================================
+IsMbr:
+ push ax
+ push ecx
+ push di
+ push es
+ mov ecx,0
+ mov di,buffer
+ push cs
+ pop es
+ call readsector
+ add di,0x01BE
+ mov cl,4
+isgood:
+ mov al,[cs:di]
+ and al,0x7F
+ cmp al,0
+ jne noMbr
+ add di,16
+ dec cl
+ jne isgood
+ cmp word [cs:di],0xAA55
+noMbr:
+ pop es
+ pop di
+ pop ecx
+ pop ax
+ ret
+
+;=============DETECTDISK=============
+;Renvoie en ES:DI les disques d‚tect‚s fini par 0FFh
+;-> ES:DI
+;<-
+;====================================
+detectdisk:
+ push ax
+ push bx
+ push cx
+ push dx
+ push si
+ push di
+ mov si,PossibleDisks
+DetectAllDisk:
+ mov dl,[cs:si]
+ inc si
+ cmp dl,0xFF
+ je EndOfDetection
+ mov cl,4
+retry:
+ push cx
+ mov ax,0x0201
+ mov cx,0x0101
+ mov dh,0x00
+ mov bx,buffer
+ int 0x13
+ pop cx
+ jnc isdetected
+ dec cl
+ jnz retry
+ jmp DetectAllDisk
+isdetected:
+ mov [es:di],dl
+ inc di
+ jmp DetectAllDisk
+EndOfDetection:
+ mov byte [di],0xFF
+ pop di
+ pop si
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+PossibleDisks db 0x00,0x01,0x02,0x03,0x04,0x05,0x80,0x81,0x82,0x83,0x84,0x85,0xFF
+
+;=============INITDISK===============
+;Initialise le p‚riph‚rique BP pour une utilisation ult‚rieure
+;-> BP
+;<-
+;====================================
+initdisk:
+ push ax
+ push bx
+ push cx
+ push dx
+ push di
+ push es
+ mov dx,bp
+ mov ah,8
+ int 0x13
+ and cx,0x3F
+ mov [cs:sectorspertrack],cx
+ mov cl,dh
+ inc cl
+ mov [cs:headsperdrive],cx
+ pop es
+ pop di
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;=============READSECTOR===============
+;Lit le secteur ECX du disque BP et le met en es:di
+;->
+;<-
+;======================================
+readsector:
+ push ax
+ push bx
+ push ecx
+ push dx
+ push si
+ mov ax,bp
+ mov [cs:temp],al
+ mov ax, cx
+ ror ecx, 16
+ mov dx, cx
+ rol ecx,16
+ cmp ecx,4128705
+ ja extended
+ div word [cs:sectorspertrack]
+ inc dl
+ mov bl, dl
+ xor dx,dx
+ div word [cs:headsperdrive]
+ mov dh, [cs:temp]
+ xchg dl, dh
+ mov cx, ax
+ xchg cl, ch
+ shl cl, 6
+ or cl, bl
+ mov bx, di
+ mov si, 4
+ mov al, 1
+TryAgain:
+ mov ah, 2
+ int 0x13
+ jnc Done
+ dec si
+ jnz TryAgain
+Done:
+ pop si
+ pop dx
+ pop ecx
+ pop bx
+ pop ax
+ ret
+extended:
+ push di
+ push ds
+ push cs
+ pop ds
+ mov si,block
+ mov byte [si+Sizes],0x10
+ mov byte [si+Reserve],0x01
+ mov word [si+NumSectors],0x0001
+ mov [si+Adressseg],es
+ mov [si+Adressoff],di
+ mov [si+SectorLow],ax
+ mov [si+SectorHigh],dx
+ mov di,4
+ mov dl,[temp]
+TryAgainX:
+ mov ah, 0x42
+ int 0x13
+ jnc DoneX
+ dec di
+ jnz TryAgainX
+DoneX:
+ pop ds
+ pop di
+ pop si
+ pop dx
+ pop ecx
+ pop bx
+ pop ax
+ ret
+
+headsperdrive dw 16
+sectorspertrack dw 38
+block times 24 db 0
+temp db 0
+
+;============CLS==============
+;Efface l'‚cran
+;->
+;<-
+;=============================
+cls:
+ push ax
+ mov ax,0x0003
+ int 0x10
+ pop ax
+ ret
+
+;==========SHOWSTR============
+;Affiche une chaine de caractŠre point‚ par SI
+;-> SI pointe une chaine
+;<-
+;=============================
+showstr:
+ push ax
+ push bx
+ push si
+ cld
+again:
+ lodsb
+ or al,al
+ jz fin
+ call showchar
+ jmp again
+fin:
+ pop si
+ pop bx
+ pop ax
+ ret
+
+;==========SHOWPASSTR============
+;Affiche une chaine de caractŠre point‚ par SI
+;-> SI pointe une chaine
+;<-
+;=============================
+showpasstr:
+ push ax
+ push bx
+ push cx
+ push si
+ mov cl,[si]
+ inc si
+ cld
+again2:
+ lodsb
+ call showchar
+ dec cl
+ jnz again2
+fin2:
+ pop si
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;==========WAITKEY=============
+;Attend l'appuie d'une toouche et
+;renvoie en AL la touche appuyer
+;->
+;<- AL
+;==============================
+waitkey:
+ mov ax,0
+ int 0x16
+ ret
+
+;==========SHOWCHAR============
+;Affiche un caractŠre point‚ dans AL
+;-> AL
+;<-
+;==============================
+showchar:
+ push ax
+ push bx
+ mov ah,0x0E
+ mov bx,0x07
+ int 0x10
+ pop bx
+ pop ax
+ ret
+
+;==========SHOWINT============
+;Affiche un entier EDX apr‚s le curseur
+;-> EDX un entier
+;<-
+;=============================
+showint:
+ push eax
+ push bx
+ push cx
+ push edx
+ push esi
+ push di
+ push ds
+ push es
+
+ push cs
+ push cs
+ pop ds
+ pop es
+ mov cx,10
+ mov di, showbuffer
+ mov al,' '
+ cld
+ rep stosb
+ xor cx,cx
+ mov eax, edx
+ mov esi, 10
+ mov bx,di
+ mov byte [cs:di+1],0
+decint:
+ xor edx,edx
+ div esi
+ add dl,'0'
+ inc cx
+ mov [cs:bx],dl
+ dec bx
+ cmp ax, 0
+ jne decint
+showinteger:
+ mov si, showbuffer
+ call showstr
+ pop es
+ pop ds
+ pop di
+ pop esi
+ pop edx
+ pop cx
+ pop bx
+ pop eax
+ ret
+
+;=============================================================================
+
+; VARIABLES INITIALISEE
+
+;=============================================================================
+
+sel dw 0
+wheres dw 0
+numbers dw 0
+
+;=============================================================================
+
+; VARIABLES NON INITIALISEE
+
+;=============================================================================
+
+theprimary equ $
+showbuffer equ $+1
+disk equ $+1+12
+partition equ $+1+12+26
+buffer equ $+1+12+26+512
+thepart equ $+1+12+26+512+512
+
+section .bss
+
+%include "partition.h"
+%include "echs.h"
+
+;theprimary resd 1
+;showbuffer resb 12
+;disk resb 26
+;partition resb 512
+;buffer resb 512
+;thepart resb 10000
+
diff --git a/install/mbrol/makefile b/install/mbrol/makefile
new file mode 100644
index 0000000..21ce4c0
--- /dev/null
+++ b/install/mbrol/makefile
@@ -0,0 +1,17 @@
+all: makall
+
+makall: mbrol.com
+
+mbrol.com:
+ nasm -f bin -o mbr.bin mbr.asm
+ nasm -f bin -o loader.bin loader.asm
+ sync
+ nasm -f bin -o mbrol.com mbrol.asm
+
+clean:
+ rm -f *.o
+ rm -f *.bin
+ rm -f *.sys
+ rm -f *.com
+
+
diff --git a/install/mbrol/mbr.asm b/install/mbrol/mbr.asm
new file mode 100644
index 0000000..ef31b01
--- /dev/null
+++ b/install/mbrol/mbr.asm
@@ -0,0 +1,214 @@
+[BITS 16]
+[ORG 0x7C00]
+
+start:
+ jmp short falsereal ;vers debut programme
+ db "MBROL" ;Signature MBROL
+falsereal:
+ cli ;inhibation interruptions
+ xor ax,ax
+ mov ss,ax ;Reloge pile en 0000h:9000h
+ mov sp,0x9000
+ push ax
+ pop ds ;DS=0000h
+ add ah,0x10
+ push ax
+ pop es ;ES=1000h
+ sti ;Reactivation des interruptions
+ cld
+ mov [sitemp],si ;sauvegarde si (adresse partition active)
+ mov di,0x7C00
+ mov si,di
+ mov cx,512/4
+ rep movsd ;On reloge le programme en 1000h:7C00h
+ push es
+ pop ds ;DS=1000h
+ jmp 0x1000:RealStart
+
+RealStart:
+ xor dh,dh
+ mov bp,dx ;R‚cupŠre en BP le nølecteur de d‚marrage
+ call initdisk ;Initialisation du p‚riph‚rique
+ ;call cls ;Efface l'‚cran
+ mov si, msg
+ call showstr ;Affiche le splatch de boot
+ call getkey ;R‚cupŠre la touche press‚ par l'utilisateur
+ cmp al,' ' ;touche = espace
+ jne normal ;si autre touche on démarre normalement
+ mov si, msgmbrol
+ call showstr ;Message de chargement de Cos loader
+ xor ecx,ecx
+ inc ecx
+ mov di,0x0100
+readload:
+ inc ecx
+ call readsector ;Charge le secteur LBA ecx en es:di
+ add di,512
+ cmp ecx,7
+ jb readload ;Charge les secteurs LBA 2 … 6 en 1000h:0100h
+
+ jmp 0x1000:0x0100 ;Execute Cos loader
+ ;saut FAR vers 1000h:0100h
+
+normal:
+ mov si,msgnorm
+ call showstr ;Affiche le d‚marrage normal
+ mov ecx,1
+ xor ax,ax
+ mov es,ax
+ mov ds,ax
+ mov di,0x7C00 ;Charge le secteur LBA 1 en 0000h:7C00h
+ call readsector ;qui est le MBR d'origine sauvegard‚ par MBROL
+ mov dx,bp ;Renvoie dans DL le lecteur de d‚marrage
+ mov si,[sitemp] ;restaure si (adresse de la partition)
+ jmp 0x0000:0x7C00 ;Une op‚ration normalement r‚alis‚e par le BIOS
+ ;Saut vers le MBR en 0000h:7C00h
+
+temp db 0
+sitemp dw 0
+HeadsPerDrive dw 16
+SectorsPerTrack dw 38
+msg db "Cos2000 MBROL V1.0",0x0A,0x0D,"Press [SPACE] to execute Cos Loader",0x0A,0x0D,0
+point db '.',0
+msgmbrol db "Cos Loader is loading",0
+msgnorm db "Booting...",0
+
+;=============INITDISK===============
+;Initialise le p‚riph‚rique BP pour une utilisation ult‚rieure
+;-> BP
+;<-
+;====================================
+initdisk:
+ push ax
+ push bx
+ push cx
+ push dx
+ push di
+ push es
+ mov dx,bp
+ mov ah,8
+ int 0x13
+ and cx,111111b
+ mov [cs:SectorsPerTrack],cx
+ mov cl,dh
+ inc cl
+ mov [cs:HeadsPerDrive],cx
+ pop es
+ pop di
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;=============READSECTOR (Fonction 01H)===============
+;Lit le secteur ECX du disque BP et le met en es:di
+;-> AH=1
+;<- Flag Carry si erreur
+;=====================================================
+readsector:
+ push ax
+ push bx
+ push ecx
+ push dx
+ push si
+ mov ax,bp
+ mov [cs:temp],al
+ mov ax, cx
+ ror ecx, 16
+ mov dx, cx
+ rol ecx,16
+ div word [cs: SectorsPerTrack]
+ inc dl
+ mov bl, dl
+ xor dx,dx
+ div word [cs: HeadsPerDrive]
+ mov dh, [cs:temp]
+ xchg dl, dh
+ mov cx, ax
+ xchg cl, ch
+ shl cl, 6
+ or cl, bl
+ mov bx, di
+ mov si, 4
+ mov al, 1
+TryAgain:
+ mov ah, 2
+ int 13h
+ push si
+ mov si,point
+ call showstr
+ pop si
+ jnc Done
+ dec si
+ jnz TryAgain
+Done:
+ pop si
+ pop dx
+ pop ecx
+ pop bx
+ pop ax
+ ret
+
+;============CLS==============
+;Efface l'‚cran
+;->
+;<-
+;=============================
+cls:
+ push ax
+ mov ax,0x0003
+ int 0x10
+ pop ax
+ ret
+
+;==========SHOWSTR============
+;Affiche une chaine de caractŠre point‚ par SI
+;-> SI pointe une chaine
+;<-
+;=============================
+showstr:
+ push ax
+ push bx
+ push si
+again:
+ lodsb
+ or al,al
+ jz fin
+ CALL showchar
+ jmp again
+fin:
+ pop si
+ pop bx
+ pop ax
+ ret
+
+;===========GETKEY=============
+;N'Attend l'appuie d'une touche et
+;renvoie en AL la touche appuyer
+;->
+;<- AL
+;==============================
+getkey:
+ mov ah,0x01
+ int 0x16
+ ret
+
+;==========SHOWCHAR============
+;Affiche un caractŠre point‚ dans AL
+;-> AL
+;<-
+;==============================
+showchar:
+ push ax
+ push bx
+ mov ah,0x0E
+ mov bx,0x07
+ int 0x10
+ pop bx
+ pop ax
+ ret
+
+times 510-($-$$) db 0
+
+ dw 0xAA55
\ No newline at end of file
diff --git a/install/mbrol/mbrol.asm b/install/mbrol/mbrol.asm
new file mode 100644
index 0000000..8cec9bd
--- /dev/null
+++ b/install/mbrol/mbrol.asm
@@ -0,0 +1,1343 @@
+[BITS 16]
+[ORG 0x0100]
+
+section .text
+
+start:
+ mov di,disk
+ call detectdisk
+ mov si,di
+ mov di,thedrive
+ call getalldriveinfos
+ mov [numbers],cx
+ mov al,3
+ mov word [sel],0
+main:
+ call cls
+ mov si,thedrive
+ call showalldriveinfos
+ call selection
+waitafter:
+ call waitkey
+ call lower
+ cmp ah,0x50
+ jne tre1
+ mov ax,[sel]
+ inc al
+ cmp ax,[numbers]
+ jz waitafter
+ mov [sel],ax
+ add al,3
+ call selection
+ jmp waitafter
+tre1:
+ cmp ah,0x48
+ jne tre2
+ mov ax,[sel]
+ cmp ax,0
+ jz waitafter
+ dec al
+ mov [sel],ax
+ add al,3
+ call selection
+ jmp waitafter
+tre2:
+ cmp al,0x0D
+ jne tre3
+ mov bx,[sel]
+ shl bx,4
+ add bx,thedrive
+ mov bp,[bx]
+ call initdisk
+ mov di,thepart
+ call IsMbr
+ je okmbr2
+ call getvolume
+ mov cx,1
+ jmp nombr2
+okmbr2:
+ call getpartitions
+nombr2:
+ call cls
+ mov si,di
+ call showdriveinfos
+ call waitkey
+ call lower
+ mov al,[cs:old]
+ jmp main
+tre3:
+ cmp al,'i'
+ jne tre4
+ mov bx,[sel]
+ shl bx,4
+ add bx,thedrive
+ mov bp,[bx]
+ call initdisk
+ mov al,[cs:old]
+ cmp byte [bx+1],1
+ je noerase
+ mov si,erasing
+ call showstr
+ call choice
+ jnz near main
+noerase:
+ cmp byte [bx+2],1
+ jne noreinst
+ mov si,remplacing
+ call showstr
+ call choice
+ jnz near main
+noreinst:
+ cmp byte [bx+3],0
+ jne nolbas
+ cmp dword [bx+4],8300
+ jb nolbas
+ mov si,nowereLBA
+ call showstr
+ call choice
+ jnz near main
+nolbas:
+ mov si,really
+ call showstr
+ call choice
+ jnz near main
+ call install
+ mov si,installed
+ call showstr
+ mov si,disk
+ mov di,thedrive
+ call getalldriveinfos
+ push ax
+ call waitkey
+ pop ax
+ jmp main
+tre4:
+ cmp al,0x1B
+ jne tre5
+ call cls
+ ret
+tre5:
+ cmp al,'u'
+ jne tre6
+ mov bx,[sel]
+ shl bx,4
+ add bx,thedrive
+ mov bp,[bx]
+ mov al,[cs:old]
+ cmp byte [bx+2],1
+ je letsgo
+ mov si,noinst
+ call showstr
+ push ax
+ call waitkey
+ pop ax
+ jmp main
+letsgo:
+ mov si,uninst
+ call showstr
+ call choice
+ jnz near main
+ call uninstall
+ mov si,uninstalled
+ call showstr
+ mov si,disk
+ mov di,thedrive
+ call getalldriveinfos
+ push ax
+ call waitkey
+ pop ax
+ jmp main
+tre6:
+ cmp al,'r'
+ jne near waitafter
+ call reboot
+
+;=============================================================================
+
+; DONNEES FIXES
+
+;=============================================================================
+msg2 db "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
+ db "³ Volume ³ Type ³ Installed ³ LBA ³ Size MByte ³ Partitions ³"
+ db "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´",0
+tab2 db "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÙ"
+ db "[ENTER] informations [ESC] quit [R] reboot [I] install MBROL [U] uninstall MBROL",0
+noinst db 0x0A,0x0D,"MBROL is not yet installed, press a key...",0
+really db 0x0A,0x0D,"Do you really want to install MBROL ?",0
+erasing db 0x0A,0x0D,"Mbrol need a partionned disk, on this disk data will be erased, do it ?",0
+remplacing db 0x0A,0x0D,"Mbrol is already installed, do you want to replace old installation ?",0
+nowereLBA db 0x0A,0x0D,"BIOS or this drive don''t support LBA and it necessite LBA adressing, install ?",0
+installed db 0x0A,0x0D,"MBROL is installed, press a key to continue...",0
+uninstalled db 0x0A,0x0D,"MBROL is uninstalled, press a key to continue...",0
+uninst db 0x0A,0x0D,"Do you really want to uninstall MBROL ?",0
+processing db 0x0A,0x0D,"Processing",0
+
+floppy db "Floppy Disk",0
+hard db "Hard Disk",0
+boot db " Boot ",0
+mbr db " Mbr ",0
+yes1 db " Yes ",0
+no1 db " No ",0
+yes2 db " Yes ",0
+no2 db " No ",0
+choiced db 0x0A,0x0D,"[y/n]:",0
+
+msg db "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
+ db "³ Name ³ Type ³ Boot ³ Statut ³ Size MByte ³ StartSector ³"
+ db "ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´",0
+tab db "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÙ"
+ db "Press any key to close...",0
+sep db " ³ ",0
+
+partkind db 0x01,"FAT12 ",0
+ db 0x04,"FAT16 ",0
+ db 0x05,"Extended ",0
+ db 0x06,"FAT16B ",0
+ db 0x07,"IFS ",0
+ db 0x0B,"FAT32 ",0
+ db 0x0C,"FAT32X ",0
+ db 0x0E,"FAT16X ",0
+ db 0x0F,"ExtendedX ",0
+ db 0x81,"Linux 1.4b",0
+ db 0x82,"Linux SWAP",0
+ db 0x83,"Linux EXT2",0
+ db 0x11,"FAT12 Hid ",0
+ db 0x14,"FAT16 Hid",0
+ db 0x16,"FAT16B Hid",0
+ db 0x17,"IFS Hid ",0
+ db 0x1B,"FAT32 Hid ",0
+ db 0x1C,"FAT32X Hid",0
+ db 0x1E,"FAT16X Hid",0
+ db 0xFF,"Unknowed ",0
+
+noname db "Unknowed ","Unkowned ",0
+unknowed db "Movable ",0
+primary db "Primary ",0
+secondary db "Secondary",0
+yes db "Yes ",0
+no db "No ",0
+mo db " MB",0
+
+;=============================================================================
+
+; ROUTINES PARTICULIERES
+
+;=============================================================================
+;converti al en lowercase
+lower:
+ cmp al,'A'
+ jb noupper
+ cmp al,'Z'
+ ja noupper
+ add al,'a'-'A'
+noupper:
+ ret
+
+;redemarrage … chaud
+reboot:
+ mov ax,0x40
+ mov ds,ax
+ mov bx,0x1234
+ mov [ds:0x0072],bx
+ jmp 0xFFFF:0x0000
+
+;Dialogue qui demande si Yes or No et Renvoie zero si YES et
+choice:
+ push ax
+ push si
+ mov si,choiced
+ call showstr
+waiter:
+ call waitkey
+ call lower
+ cmp al,'y'
+ je iyes
+ cmp al,'n'
+ je ino
+ jmp waiter
+iyes:
+ call showchar
+ cmp al,al
+ jmp endof
+ino:
+ call showchar
+ cmp al,' '
+ jmp endof
+endof:
+ pop si
+ pop ax
+ ret
+
+;install MBROL sur le disque BP
+install:
+ push ax
+ push ecx
+ push si
+ push di
+ mov si,processing
+ call showstr
+ call initdisk
+ mov ecx,0
+ mov di,buffer
+ call readsector
+ inc ecx
+ mov si,di
+ cmp dword [di+2],"MBRO"
+ je nosave
+ call writesector
+nosave:
+ add si,0x01BE
+ mov di,prog+0x01BE
+ mov cx,16*4/4
+ cld
+ rep movsd
+ mov ecx,0
+ mov si,prog
+ call writesector
+ inc ecx
+copying:
+ inc ecx
+ add si,512
+ call writesector
+ mov al,'.'
+ call showchar
+ cmp ecx,7
+ jb copying
+ pop di
+ pop si
+ pop ecx
+ pop ax
+ ret
+
+;desinstalle MBROL sur le disque BP
+uninstall:
+ push ecx
+ push si
+ push di
+ call initdisk
+ mov ecx,1
+ mov di,buffer
+ call readsector
+ dec ecx
+ mov si,di
+ call writesector
+ pop di
+ pop si
+ pop ecx
+ ret
+
+;Affiche des infos sur le volume
+showalldriveinfos:
+ push ax
+ push bx
+ push cx
+ push edx
+ push si
+ mov si,msg2
+ call showstr
+ mov bx,thedrive
+ mov cx,[numbers]
+showall:
+ mov al,'³'
+ call showchar
+ mov al,' '
+ call showchar
+ mov al,[bx]
+ mov si,floppy
+ cmp al,0x80
+ jb disks
+ mov si,hard
+disks:
+ call showstr
+ and al,0xF
+ push ax
+ mov al,' '
+ call showchar
+ mov al,'0'
+ call showchar
+ pop ax
+ add al,'0'
+ call showchar
+ mov si,sep
+ call showstr
+ mov si,boot
+ cmp byte [bx+1],1
+ jne booter
+ mov si,mbr
+booter:
+ call showstr
+ mov si,sep
+ call showstr
+ mov si,no1
+ cmp byte [bx+2],1
+ jne noinsts
+ mov si,yes1
+noinsts:
+ call showstr
+ mov si,sep
+ call showstr
+ mov si,no2
+ cmp byte [bx+3],1
+ jne lbas
+ mov si,yes2
+lbas:
+ call showstr
+ mov si,sep
+ call showstr
+ mov edx,[bx+4]
+ call showint
+ mov si,mo
+ call showstr
+ mov si,sep
+ call showstr
+ mov dx,[bx+8]
+ call showint
+ mov al,' '
+ call showchar
+ mov al,'³'
+ call showchar
+ add bx,16
+ dec cx
+ jnz near showall
+ mov si,tab2
+ call showstr
+ pop di
+ pop edx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;renvoie en ES:DI les infos sur les disques DS:SI et Nb dans CX
+getalldriveinfos:
+ push ax
+ push bx
+ push dx
+ push si
+ push di
+ push bp
+ xor bx,bx
+ xor cx,cx
+show2:
+ xor dh,dh
+ mov dl,[si]
+ inc si
+ cmp dl,0xFF
+ je endofshow2
+ inc cx
+ mov bp,dx
+ call initdisk
+ mov [es:di],dl
+ call IsMbr
+ sete [es:di+1]
+ call IsInstalled
+ sete [es:di+2]
+ call IsLBA
+ setnc [es:di+3]
+ push cx
+ call getcapacity
+ mov [es:di+4],ecx
+ mov cx,1
+ cmp byte [si-1],0x80
+ jb noone
+ push es
+ push di
+ push cs
+ pop es
+ mov di,dummys
+ call getpartitions
+ pop di
+ pop es
+noone:
+ mov [es:di+8],cx
+ add di,16
+ pop cx
+ jmp show2
+endofshow2:
+ pop bp
+ pop di
+ pop si
+ pop dx
+ pop bx
+ pop ax
+ ret
+
+;===========ISInstalled==============
+;Zero si Mbr sur le premier secteur du support BP
+;-> BP
+;<-
+;====================================
+IsInstalled:
+ push ax
+ push ecx
+ push di
+ push es
+ mov ecx,0
+ mov di,buffer
+ push cs
+ pop es
+ call readsector
+ cmp dword [di+2],"MBRO"
+ pop es
+ pop di
+ pop ecx
+ pop ax
+ ret
+
+;Affiche des infos sur le volume
+showdriveinfos:
+ push ax
+ push bx
+ push cx
+ push edx
+ push si
+ mov si,msg
+ call showstr
+ mov bx,thepart
+showall2:
+ mov al,'³'
+ call showchar
+ mov al,' '
+ call showchar
+ mov al,'-'
+ call showchar
+ mov al,'>'
+ call showchar
+ mov si,bx
+ add si,28
+ call showstr
+ mov si,sep
+ call showstr
+ mov al,[bx+4]
+ cmp al,0xFF
+ je useboot
+ mov si,partkind+1
+search:
+ cmp byte [si-1],0xFF
+ je notboot
+ cmp [si-1],al
+ je notboot
+ add si,12
+ jmp search
+useboot:
+ mov si,bx
+ add si,40
+notboot:
+ call showstr
+ mov si,sep
+ call showstr
+ mov si,yes
+ cmp byte [bx],0x80
+ je okboot
+ mov si,no
+okboot:
+ call showstr
+ mov si,sep
+ call showstr
+ mov si,primary
+ cmp dword [bx+16],0
+ je okprimary
+ mov si,secondary
+okprimary:
+ cmp byte [bx+4],0xFF
+ jne wasno
+ mov si,unknowed
+wasno:
+ call showstr
+ mov si,sep
+ call showstr
+ mov edx,[bx+12]
+ shr edx,11
+ call showint
+ mov si,mo
+ call showstr
+ mov si,sep
+ call showstr
+ mov edx,[bx+22]
+ call showint
+ mov al,' '
+ call showchar
+ mov al,'³'
+ call showchar
+ add bx,64
+ dec cx
+ jnz near showall2
+ mov si,tab
+ call showstr
+ pop si
+ pop edx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;met en surlign‚e la ligne al et seulement al
+selection:
+ push cx
+ mov ch,0x70
+ call selectline
+ xchg al,[cs:old]
+ cmp al,[cs:old]
+ je nochange
+ mov ch,0x07
+ call selectline
+nochange:
+ pop cx
+ ret
+
+old db 20
+
+;selectionne la ligne al de couleur ch
+selectline:
+ push ax
+ push bx
+ push cx
+ push ds
+ mov bh,160
+ mul bh
+ mov bx,ax
+ mov ax,0xb800
+ mov ds,ax
+ inc bx
+ mov cl,80
+select:
+ mov [bx],ch
+ add bx,2
+ dec cl
+ jnz select
+ pop ds
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;=============================================================================
+
+; ROUTINES UNIVERSELLES INSPIREE DE COS2000
+
+;=============================================================================
+
+;============Getcapacity=============
+;Renvoie la capacit‚ du disque Bp dans ECX
+;-> BP
+;<-
+;====================================
+getcapacity:
+ mov ecx,0
+ ret
+
+;===============IsLBA================
+;Renvoie zero = 1 si LBA
+;-> BP
+;<-
+;====================================
+IsLBA:
+ push ax
+ push bx
+ push cx
+ push dx
+ mov dx,bp
+ mov ah,0x41
+ mov bx,0x55AA
+ int 0x13
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;=========GETDRIVEINFOS==============
+;Envoie en es:di les lecteurs logiques sur les volumes point‚ par ds:si
+;-> BP, ES:DI
+;<- CX leur nombre
+;====================================
+getdriveinfos:
+ push ax
+ push bx
+ push dx
+ push si
+ push di
+ push bp
+ push di
+ xor bx,bx
+show:
+ xor dh,dh
+ mov dl,[si]
+ inc si
+ cmp dl,0xFF
+ je endofshow
+ mov bp,dx
+ call initdisk
+ call IsMbr
+ je okmbr
+ call getvolume
+ inc bx
+ add di,64
+ jmp show
+okmbr:
+ call getpartitions
+ mov ax,cx
+ shl ax,6
+ add di,ax
+ add bx,cx
+ jmp show
+endofshow:
+ pop si
+ mov al,'C'
+ mov cx,bx
+ push cx
+ push si
+checkp:
+ cmp byte [si+4],5
+ je notprim
+ cmp byte [si+4],0x0F
+ je notprim
+ cmp byte [si+16],0
+ jnz notprim
+ cmp byte [si+26],0x80
+ jb notprim
+ mov [si+51],al
+ inc al
+notprim:
+ add si,64
+ dec cx
+ jnz checkp
+ pop si
+ pop cx
+ push cx
+ push si
+checkl:
+ cmp byte [si+4],5
+ je notext
+ cmp byte [si+4],0x0F
+ je notext
+ cmp byte [si+16],0x00
+ jz notext
+ cmp byte [si+26],0x80
+ jb notext
+ mov [si+51],al
+ inc al
+notext:
+ add si,64
+ dec cx
+ jnz checkl
+ pop si
+ pop cx
+ mov al,'A'
+ push cx
+ push si
+checkn:
+ cmp byte [si+26],0x80
+ jae notlec
+ mov [si+51],al
+ inc al
+notlec:
+ add si,64
+ dec cx
+ jnz checkn
+ pop si
+ pop cx
+ mov al,'*'
+ push cx
+ push si
+checko:
+ cmp byte [si+4],5
+ je ext2
+ cmp byte [si+4],0x0F
+ jne notext2
+ext2:
+ mov [si+51],al
+notext2:
+ add si,64
+ dec cx
+ jnz checko
+ pop si
+ pop cx
+ pop bp
+ pop di
+ pop si
+ pop dx
+ pop bx
+ pop ax
+ ret
+
+;=============GETVOLUME==============
+;Envoie en es:di les infos disque EBP
+;-> BP, ES:DI
+;<-
+;====================================
+getvolume:
+ push ax
+ push ecx
+ push edx
+ push di
+ push di
+ mov cx,64
+ mov al,0
+ cld
+ rep stosb
+ pop di
+ mov byte [es:di+4],0xFF
+ mov ecx,0
+ mov [di+26],bp
+ push di
+ add di,28
+ call getbootinfos
+ pop di
+ mov [di+12],edx
+ pop di
+ pop edx
+ pop ecx
+ pop ax
+ ret
+
+;==========GETBOOTINFOS==============
+;Envoie en es:di le nom du volume & le FS d'adresse LBA ECX sur disque EBP
+;-> BP, ES:DI, ECX
+;<-
+;====================================
+getbootinfos:
+ push ax
+ push cx
+ push si
+ push di
+ push di
+ push es
+ push cs
+ pop es
+ mov di,buffer
+ mov si,di
+ call readsector
+ pop es
+ pop di
+ cmp byte [si+0x13],0
+ je more32
+ xor edx,edx
+ mov dx,[si+0x13]
+ jmp more16
+more32:
+ mov edx,[si+0x20]
+more16:
+ cmp byte [si+0x42],0x29
+ je fat32
+ cmp byte [si+0x26],0x29
+ je fat16
+unk:
+ mov si,noname
+ jmp rel
+fat32:
+ add si,0x47
+ jmp rel
+fat16:
+ add si,0x2B
+rel:
+ mov cx,11
+ cld
+ rep movsb
+ mov al,0
+ stosb
+ mov cx,8
+ rep movsb
+ mov ax,' '
+ stosw
+ mov al,0
+ stosb
+ pop di
+ pop si
+ pop cx
+ pop ax
+ ret
+
+;==========GETPARTITION==============
+;Envoie en es:di la liste des partitions du disque BP
+;-> BP, ES:DI
+;<- renvoie leur nombre en CX
+;====================================
+getpartitions:
+ push eax
+ push ebx
+ push edx
+ push si
+ push di
+ mov ecx,0
+ mov word [wheres],0
+ mov [theprimary],ecx
+againpart:
+ xor eax,eax
+ mov ebx,ecx
+ push di
+ mov di,partition
+ CALL readsector
+ mov si, di
+ pop di
+ add si,0x01BE
+ mov cl,4
+showevery:
+ cmp dword [si+NumSector],0x00000000
+ je nothings
+ mov edx,[si+StartSector]
+ cmp byte [si+Kind],0x05
+ je is
+ cmp byte [si+Kind],0x0F
+ jne isnot
+is:
+ mov eax,[theprimary]
+ add eax,edx
+ cmp dword [theprimary],0
+ jne nothings
+isnot:
+ push ecx
+ push di
+ push si
+ mov cx,[wheres]
+ shl cx,6
+ add di,cx
+ mov ecx,16/4
+ rep movsd
+ pop si
+ mov [di],ebx
+ mov [di+4],si
+ sub word [di+4],partition
+ mov [di+6],ebx
+ add [di+6],edx
+ mov ecx,[di+6]
+ mov [di+10],bp
+ add di,12
+ push edx
+ call getbootinfos
+ pop edx
+ pop di
+ pop ecx
+ inc word [wheres]
+nothings:
+ add si,16
+ dec cl
+ jnz showevery
+ mov ecx,eax
+ cmp dword [theprimary],0x00000000
+ jne noth
+ mov [theprimary],eax
+noth:
+ cmp ecx,0
+ jnz near againpart
+ mov cx,[wheres]
+ pop di
+ pop si
+ pop edx
+ pop ebx
+ pop eax
+ ret
+
+;==============ISMBR=================
+;Zero si Mbr sur le premier secteur du support BP
+;-> BP
+;<-
+;====================================
+IsMbr:
+ push ax
+ push ecx
+ push di
+ push es
+ mov ecx,0
+ mov di,buffer
+ push cs
+ pop es
+ call readsector
+ add di,0x01BE
+ mov cl,4
+isgood:
+ mov al,[cs:di]
+ and al,0x7F
+ cmp al,0
+ jne noMbr
+ add di,16
+ dec cl
+ jne isgood
+ cmp word [cs:di],0xAA55
+noMbr:
+ pop es
+ pop di
+ pop ecx
+ pop ax
+ ret
+
+;=============DETECTDISK=============
+;Renvoie en ES:DI les disques d‚tect‚s fini par 0FFh
+;-> ES:DI
+;<-
+;====================================
+detectdisk:
+ push ax
+ push bx
+ push cx
+ push dx
+ push si
+ push di
+ mov si,PossibleDisks
+DetectAllDisk:
+ mov dl,[cs:si]
+ inc si
+ cmp dl,0xFF
+ je EndOfDetection
+ mov cl,4
+retry:
+ push cx
+ mov ax,0x0201
+ mov cx,0x0101
+ mov dh,0x00
+ mov bx,buffer
+ int 0x13
+ pop cx
+ jnc isdetected
+ dec cl
+ jnz retry
+ jmp DetectAllDisk
+isdetected:
+ mov [es:di],dl
+ inc di
+ jmp DetectAllDisk
+EndOfDetection:
+ mov byte [di],0xFF
+ pop di
+ pop si
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+PossibleDisks db 0x00,0x01,0x02,0x03,0x04,0x05,0x80,0x81,0x82,0x83,0x84,0x85,0xFF
+
+;=============INITDISK===============
+;Initialise le p‚riph‚rique BP pour une utilisation ult‚rieure
+;-> BP
+;<-
+;====================================
+initdisk:
+ push ax
+ push bx
+ push cx
+ push dx
+ push di
+ push es
+ mov dx,bp
+ mov ah,8
+ int 0x13
+ and cx,0x3F
+ mov [cs:sectorspertrack],cx
+ mov cl,dh
+ inc cl
+ mov [cs:headsperdrive],cx
+ pop es
+ pop di
+ pop dx
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;=============WRITESECTOR (Fonction 01H)===============
+;Ecrit le secteur ECX du disque BP depuis ds:si
+;-> AH=1
+;<- Flag Carry si erreur
+;=====================================================
+writesector:
+ push ax
+ push bx
+ push ecx
+ push dx
+ push si
+ push di
+ mov ax,bp
+ mov [cs:temp],al
+ mov ax, cx
+ ror ecx, 16
+ mov dx, cx
+ rol ecx,16
+ div word [cs:sectorspertrack]
+ inc dl
+ mov bl, dl
+ xor dx,dx
+ div word [cs:headsperdrive]
+ mov dh, [cs:temp]
+ xchg dl, dh
+ mov cx, ax
+ xchg cl, ch
+ shl cl, 6
+ or cl, bl
+ mov bx, si
+ mov si, 4
+ mov al, 1
+TryAgain2:
+ mov ah, 3
+ int 0x13
+ jnc Done2
+ dec si
+ jnz TryAgain2
+Done2:
+ pop di
+ pop si
+ pop dx
+ pop ecx
+ pop bx
+ pop ax
+ ret
+
+;=============READSECTOR===============
+;Lit le secteur ECX du disque BP et le met en es:di
+;->
+;<-
+;======================================
+readsector:
+ push ax
+ push bx
+ push ecx
+ push dx
+ push si
+ mov ax,bp
+ mov [cs:temp],al
+ mov ax, cx
+ ror ecx, 16
+ mov dx, cx
+ rol ecx,16
+ cmp ecx,4128705
+ ja extended
+ div word [cs:sectorspertrack]
+ inc dl
+ mov bl, dl
+ xor dx,dx
+ div word [cs:headsperdrive]
+ mov dh, [cs:temp]
+ xchg dl, dh
+ mov cx, ax
+ xchg cl, ch
+ shl cl, 6
+ or cl, bl
+ mov bx, di
+ mov si, 4
+ mov al, 1
+TryAgain:
+ mov ah, 2
+ int 0x13
+ jnc Done
+ dec si
+ jnz TryAgain
+Done:
+ pop si
+ pop dx
+ pop ecx
+ pop bx
+ pop ax
+ ret
+extended:
+ push di
+ push ds
+ push cs
+ pop ds
+ mov si,block
+ mov byte [si+Sizes],0x10
+ mov byte [si+Reserve],0x01
+ mov word [si+NumSectors],0x0001
+ mov [si+Adressseg],es
+ mov [si+Adressoff],di
+ mov [si+SectorLow],ax
+ mov [si+SectorHigh],dx
+ mov di,4
+ mov dl,[temp]
+TryAgainX:
+ mov ah, 0x42
+ int 0x13
+ jnc DoneX
+ dec di
+ jnz TryAgainX
+DoneX:
+ pop ds
+ pop di
+ pop si
+ pop dx
+ pop ecx
+ pop bx
+ pop ax
+ ret
+
+headsperdrive dw 16
+sectorspertrack dw 38
+block times 24 db 0
+temp db 0
+
+;============CLS==============
+;Efface l'‚cran
+;->
+;<-
+;=============================
+cls:
+ push ax
+ mov ax,0x0003
+ int 0x10
+ pop ax
+ ret
+
+;==========SHOWSTR============
+;Affiche une chaine de caractŠre point‚ par SI
+;-> SI pointe une chaine
+;<-
+;=============================
+showstr:
+ push ax
+ push bx
+ push si
+ cld
+again:
+ lodsb
+ or al,al
+ jz fin
+ call showchar
+ jmp again
+fin:
+ pop si
+ pop bx
+ pop ax
+ ret
+
+;==========SHOWPASSTR============
+;Affiche une chaine de caractŠre point‚ par SI
+;-> SI pointe une chaine
+;<-
+;=============================
+showpasstr:
+ push ax
+ push bx
+ push cx
+ push si
+ mov cl,[si]
+ inc si
+ cld
+again2:
+ lodsb
+ call showchar
+ dec cl
+ jnz again2
+fin2:
+ pop si
+ pop cx
+ pop bx
+ pop ax
+ ret
+
+;==========WAITKEY=============
+;Attend l'appuie d'une toouche et
+;renvoie en AL la touche appuyer
+;->
+;<- AL
+;==============================
+waitkey:
+ mov ax,0
+ int 0x16
+ ret
+
+;==========SHOWCHAR============
+;Affiche un caractŠre point‚ dans AL
+;-> AL
+;<-
+;==============================
+showchar:
+ push ax
+ push bx
+ mov ah,0x0E
+ mov bx,0x07
+ int 0x10
+ pop bx
+ pop ax
+ ret
+
+;==========SHOWINT============
+;Affiche un entier EDX apr‚s le curseur
+;-> EDX un entier
+;<-
+;=============================
+showint:
+ push eax
+ push bx
+ push cx
+ push edx
+ push esi
+ push di
+ push ds
+ push es
+ push cs
+ push cs
+ pop ds
+ pop es
+ mov cx,10
+ mov di,showbuffer
+ mov al,' '
+ cld
+ rep stosb
+ xor cx,cx
+ mov eax, edx
+ mov esi, 10
+ mov bx,di
+ mov byte [cs:di+1],0
+decint:
+ xor edx,edx
+ div esi
+ add dl,'0'
+ inc cx
+ mov [cs:bx],dl
+ dec bx
+ cmp ax, 0
+ jne decint
+showinteger:
+ mov si,showbuffer
+ call showstr
+ pop es
+ pop ds
+ pop di
+ pop esi
+ pop edx
+ pop cx
+ pop bx
+ pop eax
+ ret
+
+;=============================================================================
+
+; VARIABLES INITIALISEE
+
+;=============================================================================
+
+sel dw 0
+wheres dw 0
+numbers dw 0
+theprimary dd 0
+prog:
+
+incbin "mbr.bin"
+incbin "loader.bin"
+;=============================================================================
+
+; VARIABLES NON INITIALISEE
+
+;=============================================================================
+
+showbuffer equ $
+disk equ $+12
+partition equ $+12+26
+buffer equ $+12+26+512
+thepart equ $+12+26+512+512
+thedrive equ $+12+26+512+512+10000
+dummys equ $+12+26+512+512+10000+10000
+
+section .bss
+
+%include "partition.h"
+%include "echs.h"
+
+;showbuffer resb 12
+;disk resb 26
+;partition resb 512
+;buffer resb 512
+;thepart resb 10000
+;thedrive resb 10000
+;dummys resb 10000
+
diff --git a/install/mbrol/partition.h b/install/mbrol/partition.h
new file mode 100644
index 0000000..96800f8
--- /dev/null
+++ b/install/mbrol/partition.h
@@ -0,0 +1,10 @@
+struc part
+Active resb 1
+StartH resb 1
+StartCS resw 1
+Kind resb 1
+EndH resb 1
+EndCS resw 1
+StartSector resd 1
+NumSector resd 1
+endstruc
diff --git a/lib/8x8fnt.c b/lib/8x8fnt.c
new file mode 100644
index 0000000..e786385
--- /dev/null
+++ b/lib/8x8fnt.c
@@ -0,0 +1,130 @@
+static u8 font8x8 [2048] = {
+ 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00, 0x7E, 0x7E, 0x7E, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF,
+ 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00,
+ 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00,
+ 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00, 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00,
+ 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00,
+ 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00,
+ 0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00, 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00,
+ 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00,
+ 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0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0x38, 0x6C, 0xC6, 0x00, 0x00, 0x0E, 0x1B, 0x18, 0x3C, 0x18, 0xD8, 0x70, 0x00,
+ 0x18, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, 0x0C, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3C, 0x00,
+ 0x0C, 0x18, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x18, 0x30, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00,
+ 0x76, 0xDC, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x00, 0x76, 0xDC, 0x00, 0xE6, 0xF6, 0xDE, 0xCE, 0x00,
+ 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00,
+ 0x18, 0x00, 0x18, 0x18, 0x30, 0x63, 0x3E, 0x00, 0x7E, 0x81, 0xB9, 0xA5, 0xB9, 0xA5, 0x81, 0x7E,
+ 0x00, 0x00, 0x00, 0xFE, 0x06, 0x06, 0x00, 0x00, 0x63, 0xE6, 0x6C, 0x7E, 0x33, 0x66, 0xCC, 0x0F,
+ 0x63, 0xE6, 0x6C, 0x7A, 0x36, 0x6A, 0xDF, 0x06, 0x18, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x00,
+ 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00,
+ 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
+ 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x30, 0x60, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00,
+ 0x7C, 0x82, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00, 0x18, 0x0C, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00,
+ 0x7E, 0x81, 0x9D, 0xA1, 0xA1, 0x9D, 0x81, 0x7E, 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18,
+ 0x66, 0x66, 0x3C, 0x7E, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18,
+ 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18,
+ 0x76, 0xDC, 0x7C, 0x06, 0x7E, 0xC6, 0x7E, 0x00, 0x76, 0xDC, 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x00,
+ 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36,
+ 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 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 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00,
+ 0x78, 0x0C, 0x38, 0x0C, 0x78, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x18, 0x30, 0x7C, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
diff --git a/lib/makefile b/lib/makefile
new file mode 100644
index 0000000..6348347
--- /dev/null
+++ b/lib/makefile
@@ -0,0 +1,17 @@
+FREEC=gcc -O2 -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -I ../Include -c
+PARTIAL=-r
+OBJS= string.o vgatxt.o
+
+all: makeall
+
+makeall: $(OBJS)
+ (sync;ld $(PARTIAL) -o libs.o $(OBJS))
+
+vgatxt.o:vgatxt.c
+ $(FREEC) $^
+
+string.o:string.c
+ $(FREEC) $^
+clean:
+ rm -f *.o
+
diff --git a/lib/modes.c b/lib/modes.c
new file mode 100644
index 0000000..de3b38f
--- /dev/null
+++ b/lib/modes.c
@@ -0,0 +1,118 @@
+#define maxgraphmode 5
+#define maxtextmode 5
+
+static mode_def textmodes[maxtextmode] = {
+
+ /*MODE 0, 40*25 16 couleurs */
+ {
+ 0x67,0x00,0x03,0x08,0x03,0x00,0x02,
+ 0x2D,0x27,0x28,0x90,0x2B,0x0A,0xBF,0x1F,0x00,0x4F,0x0D,0x0E,0x00,0x00,0x00,0x00,
+ 0x9C,0x8E,0x8F,0x14,0x1F,0x96,0xB9,0xA3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x10,0x0E,0x00,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+ 0x0C,0x00,0x0F,0x08,0x00,
+ 40,25
+ },
+
+ /*MODE 1, 80*25 16 couleurs */
+ {
+ 0x67,0x00,0x03,0x00,0x03,0x00,0x02,
+ 0x5F,0x4F,0x50,0x82,0x55,0x81,0xBF,0x1F,0x00,0x4F,0x0D,0x0E,0x00,0x00,0x00,0x00,
+ 0x9C,0x0E,0x8F,0x28,0x1F,0x96,0xB9,0xA3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x10,0x0E,0x00,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+ 0x0C,0x00,0x0F,0x08,0x00,
+ 80,25
+ },
+
+ /*MODE 2, 80*50 16 couleurs */
+ {
+ 0x63,0x00,0x03,0x01,0x03,0x01,0x02,
+ 0x5F,0x4F,0x50,0x82,0x55,0x81,0xBF,0x1F,0x00,0x47,0x06,0x07,0x00,0x00,0x00,0x00,
+ 0x9C,0x8E,0x8F,0x28,0x1F,0x96,0xB9,0xA3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x10,0x0E,0x00,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,0x10,0x11,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+ 0xCF,0x00,0x0F,0x00,0x00,
+ 80,50
+ },
+
+ /*MODE 3, 100*50 16 couleurs */
+ {
+ 0x67,0x00,0x03,0x01,0x03,0x01,0x02,
+ 0x70,0x63,0x64,0x85,0x68,0x84,0xBF,0x1F,0x00,0x47,0x06,0x07,0x00,0x00,0x00,0x00,
+ 0x9C,0x8E,0x8F,0x32,0x1F,0x96,0xB9,0xA3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x10,0x0E,0x00,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,0x10,0x11,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+ 0x0C,0x00,0x0F,0x00,0x00,
+ 100,50
+ },
+
+ /*MODE 4, 100*60 16 couleurs */
+ {
+ 0xA7,0x00,0x03,0x01,0x03,0x01,0x02,
+ 0x70,0x63,0x64,0x85,0x68,0x84,0xFF,0x1F,0x00,0x47,0x06,0x07,0x00,0x00,0x00,0x00,
+ 0xE7,0x8E,0xDF,0x32,0x1F,0xDF,0xE5,0xA3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x10,0x0E,0x00,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,0x10,0x11,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
+ 0x0C,0x00,0x0F,0x00,0x00,
+ 100,60
+ }
+ };
+
+
+static mode_def graphmodes[maxgraphmode] = {
+ /*MODE 80, 320*200 256 couleurs */
+ {
+ 0x63,0x00,0x03,0x01,0x0F,0x00,0x06,
+ 0x5F,0x4F,0x50,0x82,0x54,0x80,0xBF,0x1F,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x9C,0x0E,0x8F,0x28,0x00,0x96,0xB9,0xE3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0F,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+ 0x41,0x00,0x0F,0x00,0x00,
+ 40,25
+ },
+
+ /*MODE 81, 320*400 256 couleurs */
+ {
+ 0x63,0x00,0x03,0x01,0x0F,0x00,0x06,
+ 0x5F,0x4F,0x50,0x82,0x54,0x80,0xBF,0x1F,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x9C,0x8E,0x8F,0x28,0x00,0x96,0xB9,0xE3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0F,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+ 0x41,0x00,0x0F,0x00,0x00,
+ 40,50
+ },
+
+ /*MODE 82, 320*480 256 couleurs */
+ {
+ 0xE3,0x00,0x03,0x01,0x0F,0x00,0x06,
+ 0x5F,0x4F,0x50,0x82,0x54,0x80,0x0B,0x3E,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xEA,0xAC,0xDF,0x28,0x00,0xE7,0x06,0xE3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0F,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+ 0x41,0x00,0x0F,0x00,0x00,
+ 40,60
+ },
+
+ /*MODE 83, 360*480 256 couleurs */
+ {
+ 0xE7,0x00,0x03,0x01,0x0F,0x00,0x06,
+ 0x6B,0x59,0x5A,0x8E,0x5E,0x8A,0x0D,0x3E,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xEA,0xAC,0xDF,0x2D,0x00,0xE7,0x06,0xE3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0F,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+ 0x41,0x00,0x0F,0x00,0x00,
+ 45,60
+ },
+
+ /*MODE 84, 400*600 256 couleurs */
+ {
+ 0xE7,0x00,0x03,0x01,0x0F,0x00,0x06,
+ 0x74,0x63,0x64,0x97,0x68,0x95,0x86,0xF0,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x5B,0x8D,0x57,0x32,0x00,0x60,0x80,0xE3,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0F,0xFF,
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
+ 0x41,0x00,0x0F,0x00,0x00,
+ 50,75
+ }
+ };
diff --git a/lib/string.c b/lib/string.c
new file mode 100644
index 0000000..a4ca0df
--- /dev/null
+++ b/lib/string.c
@@ -0,0 +1,11 @@
+#include "types.h"
+
+void memset(void *dst, u8 val, u16 count,u32 size)
+{
+ u8 *temp;
+ for(temp = (u8 *)dst; count != 0; count--)
+{
+temp+=size;
+*temp = val;
+}
+}
diff --git a/lib/vgatxt.c b/lib/vgatxt.c
new file mode 100644
index 0000000..046542d
--- /dev/null
+++ b/lib/vgatxt.c
@@ -0,0 +1,88 @@
+#include "vga.h"
+#include "string.h"
+#include "asm.h"
+
+#include "modes.c"
+#include "8x8fnt.c"
+
+#define sequencer 0x3c4
+#define misc 0x3c2
+#define ccrt 0x3D4
+#define attribs 0x3c0
+#define graphics 0x3ce
+#define state 0x3da
+
+
+static u16 resX,resY,cursX,cursY; /* resolution x,y en caractères et position du curseur */
+static u16 pages,pagesize,activepage; /* nombre de pages disponibles et taille d'une page */
+static u8 vmode; /* mode en cours d'utilisation */
+static u16 basemem; /* debut de la mémoire vidéo */
+static bool scrolling,graphic; /* Activation du défilement, Flag du mode graphique */
+
+
+void print (u8* string)
+{
+ u8 *source,*screen;
+ source = string;
+ screen = (u8 *)TEXTSCREEN;
+ while(*source!=0x00)
+ {
+ *screen = *source;
+ screen+=2;
+ source++;
+ }
+}
+
+void cls (void)
+{
+ memset((u8 *)TEXTSCREEN,0x20,(80*25*2),2);
+}
+
+
+u16 setvmode(u8 choosedmode)
+{
+ u8 *def,i,mode;
+
+ mode=choosedmode&0x7F;
+ if (choosedmode>0x7F)
+ {
+ if (mode>maxgraphmode) return 1; /* mode inexistant */
+ def=(u8 *)&graphmodes[mode];
+ graphic=true;
+ }
+ else
+ {
+ if (mode>maxtextmode) return 1; /* mode inexistant */
+ def=(u8 *)&textmodes[mode];
+ graphic=false;
+ }
+ outb(misc,*def++);
+ outb(state,*def++);
+ for(i=0;i<5;i++)
+ {
+ outb(sequencer,i);
+ outb(sequencer+1,*def++);
+ }
+ outb(ccrt,0x11);
+ outb(ccrt+1,0x0E);
+ for(i=0;i<25;i++)
+ {
+ outb(ccrt,i);
+ outb(ccrt+1,*def++);
+ }
+ for(i=0;i<9;i++)
+ {
+ outb(graphics,i);
+ outb(graphics+1,*def++);
+ }
+ inb(state);
+ for(i=0;i<21;i++)
+ {
+ inb(attribs);
+ outb(attribs,i);
+ outb(attribs,*def++);
+ }
+ inb(state);
+ outb(attribs,0x20);
+ return 0;
+}
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..bf21808
--- /dev/null
+++ b/makefile
@@ -0,0 +1,29 @@
+all: makall
+
+makall: boot/boot12.bin installer/mbrol.com lib/libs.o system/system.sys
+ sync
+
+clean:
+ (cd system; make clean)
+ (cd boot; make clean)
+ (cd install; make clean)
+ (cd lib;make clean)
+ sync
+
+backup: clean
+ (cd .. ; tar cf - cos | gzip -f - > backup.tar.gz)
+
+allbackup: backup
+ (echo Inserez une disquette; sleep ; cp ../backup.tar.bz2 /dev/fd0)
+
+system/system.sys:
+ (cd system; make)
+
+boot/boot12.bin:
+ (cd boot; make)
+
+installer/mbrol.com:
+ (cd install; make)
+
+lib/libs.o:
+ (cd lib; make)
\ No newline at end of file
diff --git a/system/loader.asm b/system/loader.asm
new file mode 100644
index 0000000..7b9deef
--- /dev/null
+++ b/system/loader.asm
@@ -0,0 +1,227 @@
+[BITS 16]
+[ORG 0x100]
+
+ SECTION .text
+ push cs
+ push cs
+ pop ds
+ pop es
+ call EnableA20
+ mov si,msgpmode
+ call showstr
+ mov ax,cs
+ mov [RealCS],ax
+ lea ax,[Real]
+ mov [RealIP],ax
+
+ xor eax,eax
+ mov ax,cs
+ shl eax,4
+ mov [GDT.Entry1+2],ax
+ mov [GDT.Entry2+2],ax
+ mov [GDT.Entry4+2],ax
+ mov [GDT.Entry5+2],ax
+ shr eax,16
+ mov [GDT.Entry1+4],al
+ mov [GDT.Entry2+4],al
+ mov [GDT.Entry4+4],al
+ mov [GDT.Entry5+4],al
+
+ xor eax,eax
+ mov ax,cs
+ shl eax,4
+ add eax,gdt0
+ mov [GDTR.Address],eax
+ lgdt [GDTR]
+
+ cli
+ ;mov al,0xFF
+ ;out 0x21,al
+ mov al,0x80
+ out 0x70,al
+
+ mov eax,cr0
+ or al,1
+ mov cr0,eax
+
+ jmp SYS_CODE_SEL:GoPMode32
+
+GoPMode32:
+[BITS 32]
+ mov ax,SYS_DATA_SEL
+ mov ds,ax
+ mov ecx,50000/4
+ cld
+ mov esi,kernel
+ mov edi,0x100000
+ mov ax,ALL_DATA_SEL
+ mov es,ax
+ mov gs,ax
+ mov fs,ax
+ mov ss,ax
+ rep movsd
+ mov ds,ax
+ mov esp,0x3fffff
+ call KERNEL_SEL:0x100000
+ jmp REAL_CODE_SEL:GoReal
+
+GoReal:
+[BITS 16]
+ mov ax,REAL_DATA_SEL
+ mov ds,ax
+ mov es,ax
+ mov ss,ax
+ mov gs,ax
+ mov fs,ax
+ mov esp,0xffff
+
+ mov eax,cr0
+ and al,0xFE
+ mov cr0,eax
+
+ jmp far [RealIP]
+
+Real:
+ jmp Real
+
+msgpmode db 'Pmode loader is loading',0
+
+;======================SHOWSTR========================
+;Affiche la chaine de caractère pointé par ds:si à l'écran
+;-> DS, SI
+;<- Flag Carry si erreur
+;=====================================================
+showstr:
+ pusha
+Next_Char:
+ lodsb
+ or al,al
+ jz End_Show
+ mov ah,0x0E
+ mov bx,0x07
+ int 0x10
+ jmp Next_Char
+End_Show:
+ popa
+ ret
+
+
+;***********************EnableA20*******************************
+;->
+;<-
+;Ouvre l'autoroute A20
+;***************************************************************
+EnableA20:
+ cli
+ call ClearKeybBuffer
+ call WaitKeybCommand
+ mov al,0xd1
+ out 0x64,al
+ call WaitKeybCommand
+ mov al,0xdf
+ out 0x60,al
+ call WaitKeybCommand
+ jmp A20Enabled
+WaitKeybCommand:
+ in al,0x64
+ test al,0x02
+ jnz WaitKeybCommand
+ ret
+ClearKeybBuffer:
+ in al,0x64
+ test al,0x01
+ jnz ReadKeyb
+ ret
+ReadKeyb:
+ in al,0x60
+ jmp ClearKeybBuffer
+A20Enabled:
+ sti
+ ret
+
+section .data
+
+RealIP: dw 0
+RealCS: dw 0
+
+GDTR:
+.Size: dw GDT_END
+.Address: dd 0
+
+
+
+gdt0 equ $ ; null entry
+GDT:
+.Entry0: dw 0 ; limit 15:0
+ dw 0 ; base 15:0
+ db 0 ; base 23:16
+ db 0 ; type
+ db 0 ; limit 19:16, flags
+ db 0 ; base 31:24
+
+
+SYS_CODE_SEL equ $-gdt0 ; code segment descriptor
+
+.Entry1: dw 0xFFFF
+ dw 0x0 ; base
+ db 0x0 ; base
+ db 0x9A ; present, ring 0, code, non-conforming, readable
+ db 0x40 ; 32 bit
+ db 0
+
+
+SYS_DATA_SEL equ $-gdt0 ; data segment descriptor
+
+.Entry2: dw 0xFFFF
+ dw 0x0 ; base
+ db 0x0 ; base
+ db 0x92 ; present, ring 0, data, expand-up, writable
+ db 0x40 ; 32 bit
+ db 0
+
+
+ALL_DATA_SEL equ $-gdt0 ; 4meg data segment descriptor
+
+.Entry3: dw 0x03ff
+ dw 0x0 ; base
+ db 0x0 ; base
+ db 0x92 ; present, ring 0, data, expand-up, writable
+ db 0xcf ; 4k pages, 32 bit
+ db 0
+
+
+REAL_CODE_SEL equ $-gdt0 ; code segment descriptor for 16 bit mode
+
+.Entry4: dw 0xFFFF
+ dw 0x0 ; base
+ db 0x0 ; base
+ db 0x9A ; present, ring 0, code, non-conforming, readable
+ db 0x00 ; 16 bit
+ db 0
+
+
+REAL_DATA_SEL equ $-gdt0 ; data segment descriptor for 16 bit mode
+
+.Entry5: dw 0xFFFF
+ dw 0x0 ; base
+ db 0x0 ; base
+ db 0x92 ; present, ring 0, data, expand-up, writable
+ db 0x00 ; 16 bit
+ db 0
+
+
+KERNEL_SEL equ $-gdt0 ; 4meg code segment descriptor
+
+.Entry6: dw 0x03ff
+ dw 0x0 ; base
+ db 0x0 ; base
+ db 0x9A ; present, ring 0, code, non-conforming, readable
+ db 0xcf ; 4k pages, 32 bit
+ db 0
+
+GDT_END equ $-gdt0 -1
+
+ kernel:
+
+ SECTION .bss
+
diff --git a/system/makefile b/system/makefile
new file mode 100644
index 0000000..ca416e6
--- /dev/null
+++ b/system/makefile
@@ -0,0 +1,31 @@
+FREEC=gcc -O2 -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -I ../Include -c -o
+
+
+LINK=ld -Ttext 0x100000 -e __main -o
+
+all: system.sys
+ sync
+
+copy:
+ (cp system.sys /cygdrive/a)
+
+copy2:
+ (cp system.sys /cygdrive/b)
+
+system.sys:
+ nasm -f bin -o loader.bin loader.asm
+ nasm -f elf -o system.o system.asm
+
+ $(FREEC) systemc.o system.c
+ $(LINK) system.out systemc.o system.o ../lib/libs.o
+ objcopy -O binary system.out system.bin
+ cat loader.bin>system.sys
+ cat system.bin>>system.sys
+
+clean:
+ rm -f *.o
+ rm -f *.out
+ rm -f *.bin
+ rm -f *.sys
+
+
diff --git a/system/system.asm b/system/system.asm
new file mode 100644
index 0000000..933909c
--- /dev/null
+++ b/system/system.asm
@@ -0,0 +1,5 @@
+[BITS 32]
+
+
+ SECTION .text
+
diff --git a/system/system.c b/system/system.c
new file mode 100644
index 0000000..548cb3e
--- /dev/null
+++ b/system/system.c
@@ -0,0 +1,8 @@
+#include "vga.h"
+
+int __main(void) {
+ setvmode(1);
+ cls();
+ print("Hello cos is here !");
+ while(1);
+}