diff --git a/Graphisme/boot.png b/Graphisme/boot.png
new file mode 100644
index 0000000..55b85d0
Binary files /dev/null and b/Graphisme/boot.png differ
diff --git a/Graphisme/boot.svg b/Graphisme/boot.svg
new file mode 100644
index 0000000..b160d96
--- /dev/null
+++ b/Graphisme/boot.svg
@@ -0,0 +1,246 @@
+
+
+
+
diff --git a/Graphisme/fond.png b/Graphisme/fond.png
new file mode 100644
index 0000000..f6a7e1b
Binary files /dev/null and b/Graphisme/fond.png differ
diff --git a/Graphisme/fond.svg b/Graphisme/fond.svg
new file mode 100644
index 0000000..5429d97
--- /dev/null
+++ b/Graphisme/fond.svg
@@ -0,0 +1,567 @@
+
+
+
+
diff --git a/Graphisme/logo.svg b/Graphisme/logo.svg
new file mode 100644
index 0000000..9dee3f9
--- /dev/null
+++ b/Graphisme/logo.svg
@@ -0,0 +1,250 @@
+
+
+
+
diff --git a/boot/boot12.asm b/boot/boot12.asm
old mode 100644
new mode 100755
index 4334b63..6b2242f
--- a/boot/boot12.asm
+++ b/boot/boot12.asm
@@ -4,14 +4,14 @@
section .text
start:
- jmp near Boot
+ jmp near Boot
-Disk_ID db "COS2000A" ;Fabricant + n° de série Formatage
+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
+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
@@ -19,127 +19,131 @@ 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)
+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
+Disk_Name db "COS2000 " ;Nom de volume
+Fat_Type db "FAT12 " ;Type de système de fichiers
-Boot_Message db "Demarrage de COS",0
-Loading_Message db "Chargement",0
-System_File db "LOADER SYS"
-Is_Ok db " [ OK ]",0x0A,0x0D,0
-Is_Failed db " [Erreur]",0x0A,0x0D,"",0
-The_Dot db '.',0
+Boot_Message db "Cos2000",0
+Entre_Message db "Fichier",0
+Loading_Message db "Charger",0
+System_File db "Al",0,"o",0,"a",0,"d",0,"e",0,0x0F,0,0x38,"r",0,".",0,"s",0,"y",0,"s",0,0,0,0,0,0xFF,0xFF,0xFF,0xFF
+Is_Ok db " [ OK ]",0x0A,0x0D,0
+Is_Failed db " [ERREUR]",0x0A,0x0D,0
+The_Dot db '.',0
Boot_Error:
- mov si,Is_Failed
- call ShowString
- xor ax,ax
- int 0x16
- int 0x19
+ mov si,Is_Failed
+ call ShowString
+ xor ax,ax
+ int 0x16
+ int 0x19
Boot_Ok:
- mov si,Is_Ok
+ mov si,Is_Ok
call ShowString
ret
Boot:
- push cs
- push cs
- pop es
- pop ds
+ push cs
+ push cs
+ pop es
+ pop ds
mov [Boot_Drive],dl
- cli
- mov ax,0x9000
- mov ss,ax
- mov sp,0xFFFF
- sti
- mov si,Boot_Message
- call ShowString
- xor ax,ax
- int 0x13
- jc Boot_Error
+ cli
+ mov ax,0x9000
+ mov ss,ax
+ mov sp,0xFFFF
+ sti
+ mov si,Boot_Message
+ call ShowString
+ xor ax,ax
+ int 0x13
+ jc Boot_Error
mov cx,[Reserved_Sectors]
- add cx,[Sectors_Hidden]
- adc cx,[Sectors_Hidden+2]
- mov bx,[Sectors_Per_Fat]
- mov di,Fat_Buffer
- push bx
- push cx
+ add cx,[Sectors_Hidden]
+ adc cx,[Sectors_Hidden+2]
+ mov bx,[Sectors_Per_Fat]
+ mov di,Fat_Buffer
+ push bx
+ push cx
readfat:
- call ReadSector
- jc Boot_Error
- inc cx
- add di,[Sectors_Size]
- dec bx
- jnz readfat
- pop cx
- pop bx
- xor ax,ax
- mov al,[Fats_Number]
- 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
- mov si,Loading_Message
- call ShowString
+ call ReadSector
+ jc Boot_Error
+ inc cx
+ add di,[Sectors_Size]
+ dec bx
+ jnz readfat
+ pop cx
+ pop bx
+ xor ax,ax
+ mov al,[Fats_Number]
+ 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
+ mov si,Loading_Message
+ call ShowString
Find_System:
- mov di,Buffer
- call ReadSector
- jc Near Boot_Error
- xor bx,bx
+ 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
+ cmp byte [di],0
+ je near Boot_Error
+ push di
+ push cx
+ mov si,System_File
+ mov cx,32
+ 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,0x0070
- mov es,ax
- push es
- mov di,0x100
- push di
+ call Boot_Ok
+ mov si,Entre_Message
+ call ShowString
+ mov cx,[di+26+32]
+ mov ax,0x0080
+ mov es,ax
+ push es
+ mov di,0x0
+ push di
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
+ 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
+ retf
;====================READSECTOR=======================
;Lit le secteur logique LBA CX et le met en es:di
@@ -148,15 +152,15 @@ Finish_Loading:
;=====================================================
ReadSector:
pusha
- mov ax,cx
+ 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
+ div word [Heads_Number]
+ mov dh, [Boot_Drive]
+ xchg dl,dh
mov cx,ax
xchg cl,ch
shl cl,6
@@ -183,30 +187,30 @@ 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
+ 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
+ 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
+ mov dx,[di+1]
+ and dx,0xFFF0
+ shr dx,4
+ mov cx,dx
Next_Group_Found:
- pop di
- pop dx
- pop bx
+ pop di
+ pop dx
+ pop bx
ret
;======================SHOWSTR========================
@@ -215,7 +219,7 @@ Next_Group_Found:
;<- Flag Carry si erreur
;=====================================================
ShowString:
- pusha
+ pusha
Next_Char:
lodsb
or al,al
@@ -225,10 +229,8 @@ Next_Char:
int 0x10
jmp Next_Char
End_Show:
- popa
- ret
-
-
+ popa
+ ret
times 510-($-$$) db ' '
diff --git a/boot/boot16.asm b/boot/boot16.asm
old mode 100644
new mode 100755
diff --git a/boot/bootcp.asm b/boot/bootcp.asm
deleted file mode 100644
index 6a32fa9..0000000
--- a/boot/bootcp.asm
+++ /dev/null
@@ -1,88 +0,0 @@
-[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
deleted file mode 100644
index 3e61ceb..0000000
--- a/boot/boottest.asm
+++ /dev/null
@@ -1,217 +0,0 @@
-[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
old mode 100644
new mode 100755
diff --git a/boot/elf.h b/boot/elf.h
new file mode 100755
index 0000000..bfb892f
--- /dev/null
+++ b/boot/elf.h
@@ -0,0 +1,116 @@
+struc ELFheader
+.Magic resb 1;"0x7F"
+.MagicStr resb 3;"ELF"
+.Computertype resb 1;1
+.Endianness resb 1;1
+.Original resb 1;1
+.OS resb 1;0
+.ABI resb 1;0
+.Dummy resb 7;0
+.Type resw 1;2
+.Target resw 1;3
+.Version resd 1;1
+.Entrypoint resd 1
+.Offsetprogram resd 1
+.Offsetsection resd 1
+.Flags resd 1
+.SizeELFheader resw 1
+.Sizeprogram resw 1
+.Nbprogram resw 1
+.Sizesection resw 1
+.Nbsection resw 1
+.Index resw 1
+.end equ $
+endstruc
+
+struc Program
+.Type resd 1
+.Offset resd 1
+.Vadress resd 1
+.PAdress resd 1
+.Size resd 1
+.Memsize resd 1
+.Flags resd 1
+.Align resd 1
+.end equ $
+endstruc
+
+struc Sections
+.Name resd 1
+.Type resd 1
+.Flags resd 1
+.Vadress resd 1
+.Offset resd 1
+.Size resd 1
+.Link resd 1
+.Info resd 1
+.Align resd 1
+.Entrysize resd 1
+.end equ $
+endstruc
+
+
+;type
+PT_NULL equ 0
+PT_LOAD equ 1
+PT_DYNAMIC equ 2
+PT_INTERP equ 3
+PT_NOTE equ 4
+PT_SHLIB equ 5
+PT_PHDR equ 6
+PT_TLS equ 7
+PT_LOOS equ 0x60000000
+PT_HIOS equ 0x6fffffff
+PT_LOPROC equ 0x70000000
+PT_HIPROC equ 0x7fffffff
+
+;flags
+PF_WRITE equ 0x1
+PF_ALLOC equ 0x2
+PF_X equ 0x1 ;Execute
+PF_W equ 0x2 ;Write
+PF_R equ 0x4 ;Read
+PF_MASKOS equ 0x0ff00000 ;Unspecified
+PF_MASKPROC equ 0xf0000000 ;Unspecified
+
+;type
+ST_EXIT equ 1
+ST_NULL equ 0
+ST_PROGBITS equ 1
+ST_SYMTAB equ 2
+ST_STRTAB equ 3
+ST_RELA equ 4
+ST_HASH equ 5
+ST_DYNAMIC equ 6
+ST_NOTE equ 7
+ST_NOBITS equ 8
+ST_REL equ 9
+ST_SHLIB equ 10
+ST_DYNSYM equ 11
+ST_INIT_ARRAY equ 14
+ST_FINI_ARRAY equ 15
+ST_PREINIT_ARRAY equ 16
+ST_GROUP equ 17
+ST_SYMTAB_SHNDX equ 18
+ST_LOOS equ 0x60000000
+ST_HIOS equ 0x6fffffff
+ST_LOPROC equ 0x70000000
+ST_HIPROC equ 0x7fffffff
+ST_LOUSER equ 0x80000000
+ST_HIUSER equ 0xffffffff
+
+;flags
+SF_WRITE equ 0x1
+SF_ALLOC equ 0x2
+SF_EXECINSTR equ 0x4
+SF_MERGE equ 0x10
+SF_STRINGS equ 0x20
+SF_INFO_LINK equ 0x40
+SF_LINK_ORDER equ 0x80
+SF_OS_NONCONFORMING equ 0x100
+SF_GROUP equ 0x200
+SF_TLS equ 0x400
+SF_COMPRESSED equ 0x800
+SF_MASKOS equ 0x0ff00000
+SF_MASKPROC equ 0xf0000000
+
diff --git a/boot/loader.asm b/boot/loader.asm
old mode 100644
new mode 100755
index 9808d5c..a7eb206
--- a/boot/loader.asm
+++ b/boot/loader.asm
@@ -1,5 +1,5 @@
[BITS 16]
-[ORG 0x100]
+[ORG 0x0]
SECTION .text
push cs
@@ -12,18 +12,18 @@
mov si,msg1
call showstr
call initfat
-call ok
+ call ok
mov si,msg2
call showstr
mov si,System_File
call search
-call ok
+ call ok
mov si,msg3
call showstr
call EnableA20
-call ok
+ call ok
mov si,msg4
call showstr
@@ -76,8 +76,9 @@ call ok
call showstr
call initpe
call ok
-
-
+ suite:
+ ;mov cx,suite
+ ;call debug
mov si,msg8
call showstr
cli
@@ -118,111 +119,227 @@ initpe:
xor ax,ax
mov es,ax
mov [begin],ebx
- cmp word [es:ebx+mzheader.magic],"MZ" ; bien l'entete .exe dos ?
- jne near errorpe
- add ebx,[es:ebx+mzheader.lfanew] ; Pointe vers l'entete PE
- cmp word [es:ebx+peheader.Signature],"PE" ; bien l'entete PE ?
- jne near errorpe
- cmp word [es:ebx+peheader.Signature+2],0 ; bien l'entete PE ?
- jne near errorpe
- mov [p_pe],ebx
- mov esi,[es:ebx+peheader.ImageBase]
- mov [base],esi
- add esi,[es:ebx+peheader.AddressOfEntryPoint]
- mov [entriepoint],esi
- mov ax,[es:ebx+peheader.NumberOfSections]
- add ebx,peheader.end
- mov [p_sections],ebx
+ cmp word [es:ebx+ELFheader.Magic],0x457F ; bien l'entete .elf ?
+ jne near errorelf
+ cmp word [es:ebx+ELFheader.Magic+2],"LF" ; bien l'entete .elf ?
+ jne near errorelf
+ cmp byte [es:ebx+ELFheader.Computertype],0x1 ; type ok ?
+ jne near errorelf
+ cmp byte [es:ebx+ELFheader.Endianness],0x1 ; type ok ?
+ jne near errorelf
+ cmp byte [es:ebx+ELFheader.Original],0x1 ; type ok ?
+ jne near errorelf
+ cmp byte [es:ebx+ELFheader.OS],0x0 ; type ok ?
+ jne near errorelf
+ cmp byte [es:ebx+ELFheader.ABI],0x0 ; type ok ?
+ jne near errorelf
+ cmp byte [es:ebx+ELFheader.Dummy],0x0 ; type ok ?
+ jne near errorelf
mov si,info1
call showstr
-readsections:
- mov si,info2
- call showstr
- mov esi,ebx
- mov cx,8
- call showfixstr
- mov cl,17
- call eol
- mov edx,[es:ebx+sections.VirtualAddress]
- add edx,[base]
+ mov esi,[es:ebx+ELFheader.Entrypoint]
+ mov [entriepoint],esi
+ mov esi,[es:ebx+ELFheader.Offsetprogram]
+ add esi,ebx
+ mov [offsetheader],esi
+ mov esi,[es:ebx+ELFheader.Offsetsection]
+ add esi,ebx
+ mov [offsetsection],esi
+ mov cx,[es:ebx+ELFheader.Nbprogram]
+ mov [cs:nbprogram],cx
+ mov cx,[es:ebx+ELFheader.Nbsection]
+ mov [cs:nbsection],cx
+ xor eax,eax
+ mov ax,[es:ebx+ELFheader.Index]
+ xor edx,edx
+ mov dx,[es:ebx+ELFheader.Sizesection]
+ mul edx
+ add eax,esi
+ mov eax,[es:eax+Sections.Offset]
+ add eax,ebx
+ mov [cs:symbol],eax
+ xor eax,eax
+ add ax,[es:ebx+ELFheader.Sizesection]
+ add esi,eax
+sections:
+ mov edi,esi
+ cmp dword [es:edi+Sections.Type],0x00
+ jz nothing
+ mov esi,info2
+ call showstr
+ push ds
+ push es
+ pop ds
+ mov esi,[es:edi+Sections.Name]
+ add esi,[cs:symbol]
+ call showstr
+ pop ds
+ mov esi,info3
+ call showstr
+ mov edx,[es:edi+Sections.Offset]
+ push cx
mov cx,32
call ShowHex
- mov cl,30
- call eol
- mov si,info3
- call showstr
- mov edx,[es:ebx+sections.VirtualSize]
+ pop cx
+ mov esi,info4
+ call showstr
+ mov edx,[es:edi+Sections.Size]
+ push cx
mov cx,32
- call ShowHex
- mov si,info4
- call showstr
- mov edi,[es:ebx+sections.VirtualAddress]
- add edi,[base]
- cmp edi,0
- je noload
- push eax
- push ecx
- mov esi,[es:ebx+sections.PointerToRawData]
- add esi,[begin]
- mov ecx,[es:ebx+sections.SizeOfRawData]
- shr cx,2
- cmp cx,0
- je zeroize
+ call ShowHex
+ pop cx
+ mov esi,info5
+ call showstr
+ mov edx,[es:edi+Sections.Vadress]
+ push cx
+ mov cx,32
+ call ShowHex
+ pop cx
+ and dword [es:edi+Sections.Flags],SF_ALLOC
+ jne itsok
+ mov esi,info6
+ call showstr
+ jmp itsok2
+itsok:
+ mov esi,info10
+ call showstr
+call copy2mem
+ cmp dword [es:edi+Sections.Type],ST_NOBITS
+ jne itsok2
+ mov esi,info9
+ call showstr
+ mov esi,info10
+ call showstr
+call zero2mem
+itsok2:
+ push cx
+ xor cx,cx
+ mov edx,[es:edi+Sections.Align]
+ mov esi,info8
+ call showstr
+nextpower:
+ cmp edx,0
+ je powerok
+ cmp edx,1
+ je powerok
+ cmp cx,32
+ je powerok
+ inc cx
+ shr edx,1
+ jnc nextpower
+powerok:
+ mov edx,ecx
+ mov cx,4
+ call ShowHex
+ pop cx
+ call showrtn
+ mov esi,edi
+nothing:
+ add esi,eax
+ dec cx
+ jnz sections
+ mov esi,info7
+ call showstr
+ mov edx,[cs:entriepoint]
+ mov cx,32
+ call ShowHex
+ clc
+ pop es
+ popa
+ ret
+
+errorelf:
+ stc
+ pop es
+ popa
+ ret
+
+;==========DEBUG===========
+;CX adresse
+;->CX
+;<-
+;===========================================
+debug:
+ mov esi,info11
+ call showstr
+ xor edx,edx
+ mov dx,cs
+ shl edx,4
+ add edx,ecx
+ mov cx,32
+ call ShowHex
+infini:
+ jmp infini
+
+
+;==========COPY2MEM===========
+;Copie de es:esi vers es:edi
+;->ES:ESI ES:EDI CX
+;<- Flag
+;===========================================
+copy2mem:
+ push eax
+ push esi
+ push edi
+push ecx
+mov esi,[es:edi+Sections.Offset]
+add esi,[cs:begin]
+mov ecx,[es:edi+Sections.Size]
+shr ecx,2
+inc ecx
+mov edi,[es:edi+Sections.Vadress]
copietomem:
mov eax,[es:esi]
mov [es:edi],eax
add edi,4
add esi,4
- dec cx
+ dec ecx
jnz copietomem
- pop ecx
- pop eax
- jmp nextsymb
-zeroize:
- mov ecx,[es:ebx+sections.VirtualSize]
- shr cx,2
+pop ecx
+pop edi
+pop esi
+pop eax
+ret
+
+;==========ZERO2MEM===========
+;Remise à zero de es:edi
+;->ES:EDI CX
+;<- Flag
+;===========================================
+zero2mem:
+ push eax
+ push esi
+ push edi
+push ecx
+mov esi,[es:edi+Sections.Offset]
+add esi,[cs:begin]
+mov ecx,[es:edi+Sections.Size]
+shr ecx,2
+inc ecx
+mov edi,[es:edi+Sections.Vadress]
mov eax,0
zerotomem:
mov [es:edi],eax
add edi,4
- dec cx
- jnz zerotomem
- pop ecx
- pop eax
- jmp nextsymb
-noload:
- mov si,info5
- call showstr
-nextsymb:
- mov si,return
- call showstr
- add ebx,sections.end
- dec ax
- jnz readsections
- mov si,info6
- call showstr
- mov edx,[entriepoint]
- mov cx,32
- call ShowHex
- clc
- pop es
- popa
- ret
-errorpe:
- stc
- pop es
- popa
- ret
-
+ dec ecx
+ jnz zerotomem
+pop ecx
+pop edi
+pop esi
+pop eax
+ret
+
+begin dd 0
entriepoint dd 0
-begin dd 0
-base dd 0
-p_pe dd 0
-p_sections dd 0
+offsetheader dd 0
+offsetsection dd 0
+nbprogram dw 0
+nbsection dw 0
+symbol dd 0
;==========SHOWHEX===========
;Affiche un nombre hexadécimal EDX de taille CX aprés le curseur
-;-> AH=10, EDX un entier, CX la taille
+;-> EDX un entier, CX la taille
;<-
;===========================================
ShowHex:
@@ -230,6 +347,7 @@ ShowHex:
push bx
push cx
push edx
+ push si
mov ax,cx
shr ax,2
sub cx,32
@@ -241,7 +359,7 @@ Hexaize:
rol edx,4
mov bx,dx
and bx,0fh
- push ax
+ mov si,ax
mov al,[cs:bx+Tab]
xor bx,bx
mov ah,0x09
@@ -249,9 +367,10 @@ Hexaize:
int 0x10
mov ah,0x0E
int 0x10
- pop ax
+ mov ax,si
dec al
jnz Hexaize
+ pop si
pop edx
pop cx
pop bx
@@ -401,7 +520,7 @@ Next_Root_Entrie:
push si
push di
push cx
- mov cx,11
+ mov cx,32
rep cmpsb
pop cx
pop di
@@ -416,91 +535,91 @@ Next_Root_Entrie:
jb Next_Root_Entrie
inc cx
Found:
- mov cx,[di+26]
+ mov cx,[di+26+32]
pop di
pop dx
pop bx
ret
-
+;======================SHOWRTN========================
+;Affiche la chaine de caractère return
+;->
+;<- Flag Carry si erreur
+;=====================================================
+showrtn:
+ push ds
+ push ax
+ push esi
+ mov esi,return
+ mov ax,cs
+ mov ds,ax
+ call showstr
+ pop esi
+ pop ax
+ pop ds
+ ret
;======================SHOWSTR========================
-;Affiche la chaine de caractère pointé par ds:si à l'écran
+;Affiche la chaine de caractère pointé par ds:esi à l'écran
;-> DS, SI
;<- Flag Carry si erreur
;=====================================================
showstr:
- pusha
+ pushad
xor bh,bh
- xor cx,cx
- inc cx
nextchar:
- lodsb
+ mov al,[ds:esi]
+ inc esi
or al,al
jz endshow
- cmp al,' '
+ cmp al,' '
jb justchar
cmp al,'#'
jne nocolor
- lodsb
+ mov al,[ds:esi]
+ inc esi
sub al,'0'
shl al,3
mov [cs:thecolor],al
shr al,2
add [cs:thecolor],al
- lodsb
+ mov al,[ds:esi]
+ inc esi
sub al,'0'
add [cs:thecolor],al
jmp nextchar
nocolor:
+ cmp al,'@'
+ jne nocolor2
+ mov al,[ds:esi]
+ inc esi
+ sub al,'0'
+ shl al,3
+ mov cl,al
+ shr al,2
+ add cl,al
+ mov al,[ds:esi]
+ inc esi
+ sub cl,'0'
+ add cl,al
+ call eol
+ jmp nextchar
+nocolor2:
xor bx,bx
mov ah,0x09
mov bl,[cs:thecolor]
+ xor cx,cx
+ inc cx
int 0x10
justchar:
mov ah,0x0E
int 0x10
jmp nextchar
endshow:
- popa
+ popad
ret
-;======================SHOWFIXEDSTR========================
-;Affiche la chaine de caractère pointé par esi à l'écran pour CX caractères
-;-> DS, SI
-;<- Flag Carry si erreur
-;=====================================================
-showfixstr:
- pusha
- push ds
- xor ax,ax
- mov ds,ax
- xor bh,bh
- mov dx,cx
- xor cx,cx
- inc cx
-nextchars:
- mov al,[ds:esi]
- inc esi
- or al,al
- jz endshows
- cmp al,' '
- jb justchars
- xor bx,bx
- mov ah,0x09
- mov bl,[cs:thecolor]
- int 0x10
-justchars:
- mov ah,0x0E
- int 0x10
- dec dx
- jnz nextchars
-endshows:
-pop ds
- popa
- ret
-
-
+
;====================READSECTOR=======================
;Lit le secteur logique LBA CX et le met en es:di
;-> CX (limité à 65536 secteurs, soit 32 Mo avec secteur 512 octets)
@@ -615,37 +734,39 @@ GoPMode32:
push KERNEL_SEL
push dword [cs:entriepoint]
retf
- ; jmp KERNEL_SEL:0x401020
section .data
thecolor db 0x07
-msg0 db '#12-=< Lancement du Chargeur PE >=-',0x0A,0x0D,0x0A,0x0D,0
+msg0 db '#12@20-=< Lancement du Chargeur ELF >=-',0x0A,0x0D,0x0A,0x0D,0
msg1 db '#07Initialisation de la FAT',0
msg2 db '#07Recherche du systeme',0
msg3 db '#07Activation adressage 24 bits',0
msg4 db '#07Chargement des descripteurs',0
msg5 db '#07Passage en mode Flat real',0
msg6 db '#07Chargement du systeme',0
-msg7 db '#07Mise en place image PE',0
+msg7 db '#07Mise en place format ELF',0
msg8 db '#07Passage en mode protege',0
-msg9 db '#07Execution du noyau',0
-info1 db 0x0A,0x0D,'#08Sections :',0x0A,0x0D,0
-info2 db ' -',0
-info3 db ' (',0
-info4 db ') ',0
-info5 db ' #12Non projete#08',0
-
-info6 db 'Point entree en ',0
+info1 db 0x0A,0x0D,'Format ELF i386 reconnu, #08Sections :',0x0A,0x0D,0
+info2 db ' ',0
+info3 db '@12 | ',0
+info4 db ' - ',0
+info5 db ' -> ',0
+info6 db '@35#12NON ALLOUE #08',0
+info7 db 'Point entree en ',0
+info8 db '@48 2**',0
+info9 db '@15#12 VIDE #08',0
+info10 db '@70MEM',0
+info11 db 0x0A,0x0D,'#12Arret debug en ',0
return db 0x0A,0x0D,0
okay db ' #15[ #10OK #15]',0x0A,0x0D,0
error db ' #15[#12Erreur#15]',0x0A,0x0D,0x0A,0x0D,' ',0
The_Dot db '.',0
-System_File db "SYSTEM SYS"
+System_File db "As",0,"y",0,"s",0,"t",0,"e",0,0x0F,0,0xB8,"m",0,".",0,"s",0,"y",0,"s",0,0,0,0,0,0xFF,0xFF,0xFF,0xFF
entries dw 0
data dw 0
xy dw 0
@@ -727,5 +848,5 @@ Fat_Buffer equ $+512
SECTION .bss
-%include "pe.h"
+%include "elf.h"
diff --git a/boot/makefile b/boot/makefile
old mode 100644
new mode 100755
index f38d5ab..6f6f26a
--- a/boot/makefile
+++ b/boot/makefile
@@ -1,9 +1,8 @@
CC=nasm -f bin -o
-BINS=boot12.bin boot16.bin boottest.bin bootcp.com loader.sys
all: makall
-makall:$(BINS)
+makall: boot12.bin boot16.bin loader.sys
boot12.bin: boot12.asm
$(CC) $@ $^
@@ -11,12 +10,6 @@ boot12.bin: boot12.asm
boot16.bin: boot16.asm
$(CC) $@ $^
-boottest.bin: boottest.asm
- $(CC) $@ $^
-
-bootcp.com: bootcp.asm
- $(CC) $@ $^
-
loader.sys: loader.asm
$(CC) $@ $^
diff --git a/boot/pe.h b/boot/pe.h
deleted file mode 100644
index 9d68f4f..0000000
--- a/boot/pe.h
+++ /dev/null
@@ -1,81 +0,0 @@
-struc mzheader
-.magic resb 2;"MZ"
-.cblp resw 1
-.cp resw 1
-.crlc resw 1
-.cparhdr resw 1
-.minalloc resw 1
-.maxalloc resw 1
-.ss resw 1
-.sp resw 1
-.csum resw 1
-.ip resw 1
-.cs resw 1
-.lfarlc resw 1
-.ovno resw 1
-.res resw 4
-.oemid resw 1
-.oeminfo resw 1
-.res2 resw 10
-.lfanew resd 1
-.end equ $
-endstruc
-
-struc peheader
-.Signature resd 1
-.Machine resw 1
-.NumberOfSections resw 1
-.TimeDateStamp resd 1
-.PointerToSymbolTable resd 1
-.NumberOfSymbols resd 1
-.SizeOfOptionalHeader resw 1
-.Characteristics resw 1
-.Magic resw 1
-.MajorLinkerVersion resb 1
-.MinorLinkerVersion resb 1
-.SizeOfCode resd 1
-.SizeOfInitializedData resd 1
-.SizeOfUninitialzedData resd 1
-.AddressOfEntryPoint resd 1
-.BaseOfCode resd 1
-.BaseOfData resd 1
-.ImageBase resd 1
-.SectionAlignment resd 1
-.FileAlignment resd 1
-.MajorOperSystemVersion resw 1
-.MinorOperSystemVersion resw 1
-.MajorImageVersion resw 1
-.MinorImageVersion resw 1
-.MajorSubsystemVersion resw 1
-.MinorSubsystemVersion resw 1
-.Reserved1 resd 1
-.SizeOfImage resd 1
-.SizeOfHeaders resd 1
-.CheckSum resd 1
-.Subsystem resw 1
-.DllCharacteristics resw 1
-.SizeOfStackReserve resd 1
-.SizeOfStackCommit resd 1
-.SizeOfHeapReserve resd 1
-.SizeOfHeapCommit resd 1
-.LoaderFlags resd 1
-.NumberOfRvaAndSizes resd 1
-.export resd 2
-.import resd 2
-.misc_sectionz resd 28
-.end equ $
-endstruc
-
-struc sections
-.SectionName resb 8
-.VirtualSize resd 1
-.VirtualAddress resd 1
-.SizeOfRawData resd 1
-.PointerToRawData resd 1
-.PointerToRelocations resd 1
-.PointerToLinenumbers resd 1
-.NumberOfRelocations resw 1
-.NumberOfLinenumbers resw 1
-.Characteristics resd 1
-.end equ $
-endstruc
diff --git a/debug/boot.txt b/debug/boot.txt
new file mode 100644
index 0000000..79251d8
--- /dev/null
+++ b/debug/boot.txt
@@ -0,0 +1,8 @@
+target remote localhost:1234
+set disassembly-flavor intel
+set architecture i8086
+break *0x7c00
+cont
+clear *0x7c00
+layout asm
+layout regs
diff --git a/debug/loader.txt b/debug/loader.txt
new file mode 100644
index 0000000..25dfdc0
--- /dev/null
+++ b/debug/loader.txt
@@ -0,0 +1,7 @@
+target remote localhost:1234
+set disassembly-flavor intel
+set architecture i8086
+break *0x800
+cont
+display/20i $pc+$cs*16
+clear *0x800
diff --git a/debug/system.txt b/debug/system.txt
new file mode 100644
index 0000000..213fbf9
--- /dev/null
+++ b/debug/system.txt
@@ -0,0 +1,8 @@
+target remote localhost:1234
+set disassembly-flavor intel
+set architecture i386
+break *0x50000
+cont
+symbol-file ./system/system.sys
+clear *0x50000
+display/20i $pc
diff --git a/final/makefile b/final/makefile
new file mode 100755
index 0000000..b434092
--- /dev/null
+++ b/final/makefile
@@ -0,0 +1,13 @@
+all: cos2000.img
+
+cos2000.img:
+ (dd if=/dev/zero of=cos2000.img count=2880 bs=512)
+ (mkfs.msdos -F 12 -n "COS2000" cos2000.img)
+ (fusefat cos2000.img ./mnt -o rw+)
+ (cp ../boot/loader.sys ./mnt/)
+ (cp ../system/system.sys ./mnt/;sync)
+ (fusermount ./mnt -u)
+ (dd if=../boot/boot12.bin of=cos2000.img seek=0 count=1 conv=notrunc;sync)
+
+clean:
+ rm -f *.img
diff --git a/include/3d.h b/include/3d.h
old mode 100644
new mode 100755
diff --git a/include/kmemory.h b/include/Kmemory.h
old mode 100644
new mode 100755
similarity index 100%
rename from include/kmemory.h
rename to include/Kmemory.h
diff --git a/include/ldt.h b/include/LDT.h
old mode 100644
new mode 100755
similarity index 100%
rename from include/ldt.h
rename to include/LDT.h
diff --git a/include/asm.h b/include/asm.h
old mode 100644
new mode 100755
diff --git a/include/cpu.h b/include/cpu.h
old mode 100644
new mode 100755
diff --git a/include/cpuid.h b/include/cpuid.h
old mode 100644
new mode 100755
index bde58ca..0ecc299
--- a/include/cpuid.h
+++ b/include/cpuid.h
@@ -1,24 +1,6 @@
-inline bool cansetflag (u32 flag)
-{
-u32 r1, r2;
-asm("pushfl\n"
-"popl %0\n"
-"movl %0, %1\n"
-"xorl %2, %0\n"
-"pushl %0\n"
-"popfl\n"
-"pushfl\n"
-"popl %0\n"
-"pushl %1\n"
-"popfl\n"
-: "=&r" (r1), "=&r" (r2)
-: "ir" (flag)
-);
-return ((r1 ^ r2) & flag) != 0;
-}
+bool cansetflag (u32 flag);
-inline void cpuid(u32 op, u32 *eax, u32 *ebx,u32 *ecx, u32 *edx)
-{
- asm("cpuid" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (op) : "cc");
-}
+void cpuid(u32 op, u32 *eax, u32 *ebx,u32 *ecx, u32 *edx);
+
+void dump_regs();
diff --git a/include/ctype.h b/include/ctype.h
old mode 100644
new mode 100755
diff --git a/include/graph.h b/include/graph.h
old mode 100644
new mode 100755
diff --git a/include/idt.h b/include/idt.h
old mode 100644
new mode 100755
index 65f4cb9..b80dd6b
--- a/include/idt.h
+++ b/include/idt.h
@@ -24,7 +24,7 @@ typedef struct idtdes {
void initpic(void);
void enableirq(u8 irq);
void disableirq(u8 irq);
-
+ void cpuerror(const u8 *src);
diff --git a/include/keyboard.h b/include/keyboard.h
old mode 100644
new mode 100755
diff --git a/include/math.h b/include/math.h
old mode 100644
new mode 100755
diff --git a/include/memory.h b/include/memory.h
old mode 100644
new mode 100755
diff --git a/include/mouse.h b/include/mouse.h
old mode 100644
new mode 100755
diff --git a/include/port.h b/include/port.h
old mode 100644
new mode 100755
diff --git a/include/stdarg.h b/include/stdarg.h
old mode 100644
new mode 100755
diff --git a/include/string.h b/include/string.h
old mode 100644
new mode 100755
diff --git a/include/timer.h b/include/timer.h
old mode 100644
new mode 100755
diff --git a/include/type.h b/include/type.h
old mode 100644
new mode 100755
diff --git a/include/types.h b/include/types.h
old mode 100644
new mode 100755
index a1622fe..be5b73d
--- a/include/types.h
+++ b/include/types.h
@@ -9,6 +9,11 @@ typedef short s16;
typedef int s32;
typedef int bool;
+
+#define true -1;
+#define false 0;
+#define NULL 0x0000;
+
struct dtr {
u16 limite;
@@ -17,10 +22,6 @@ struct dtr {
} __attribute__ ((packed));
-#define true 1;
-#define false 0;
-#define NULL 0x0000;
-
#ifdef __cplusplus
extern "C"
{
diff --git a/include/vga.h b/include/vga.h
old mode 100644
new mode 100755
diff --git a/include/video.h b/include/video.h
old mode 100644
new mode 100755
diff --git a/install/iflop/iflop.asm b/install/iflop/iflop.asm
deleted file mode 100644
index d01f2e9..0000000
--- a/install/iflop/iflop.asm
+++ /dev/null
@@ -1,375 +0,0 @@
-;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
-;³ 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
deleted file mode 100644
index 84d3c6c..0000000
--- a/install/iflop/makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 21dc04f..0000000
--- a/install/makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-all: makall
-
-makall: iflop/iflop.com mbrol/mbrol.com
- 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
deleted file mode 100644
index fc1bba9..0000000
--- a/install/mbrol/echs.h
+++ /dev/null
@@ -1,10 +0,0 @@
-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
deleted file mode 100644
index de1af90..0000000
--- a/install/mbrol/loader.asm
+++ /dev/null
@@ -1,897 +0,0 @@
-[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
deleted file mode 100644
index 21ce4c0..0000000
--- a/install/mbrol/makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-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
deleted file mode 100644
index ef31b01..0000000
--- a/install/mbrol/mbr.asm
+++ /dev/null
@@ -1,214 +0,0 @@
-[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
deleted file mode 100644
index 8cec9bd..0000000
--- a/install/mbrol/mbrol.asm
+++ /dev/null
@@ -1,1343 +0,0 @@
-[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
deleted file mode 100644
index 96800f8..0000000
--- a/install/mbrol/partition.h
+++ /dev/null
@@ -1,10 +0,0 @@
-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/3d.c b/lib/3d.c
old mode 100644
new mode 100755
diff --git a/lib/8x16fnt.c b/lib/8x16fnt.c
old mode 100644
new mode 100755
diff --git a/lib/8x8fnt.c b/lib/8x8fnt.c
old mode 100644
new mode 100755
diff --git a/lib/kmemory.c b/lib/Kmemory.c
old mode 100644
new mode 100755
similarity index 100%
rename from lib/kmemory.c
rename to lib/Kmemory.c
diff --git a/lib/ldt.c b/lib/LDT.c
old mode 100644
new mode 100755
similarity index 100%
rename from lib/ldt.c
rename to lib/LDT.c
diff --git a/lib/cpu.c b/lib/cpu.c
old mode 100644
new mode 100755
index 0d90c35..1d23680
--- a/lib/cpu.c
+++ b/lib/cpu.c
@@ -7,7 +7,7 @@
static u8 *msg[] =
- {
+{
"mmx",
"mmx2",
"sse",
@@ -18,13 +18,32 @@ static u8 *msg[] =
"3dNow Extended!",
"HyperThreading",
"apic",
- };
+};
static u8 space[]=" ";
-void strcpuinfos(cpuinfo *proc,u8 *string)
+bool cansetflag (u32 flag)
{
+u32 r1, r2;
+asm("pushfl\n"
+"popl %0\n"
+"movl %0, %1\n"
+"xorl %2, %0\n"
+"pushl %0\n"
+"popfl\n"
+"pushfl\n"
+"popl %0\n"
+"pushl %1\n"
+"popfl\n"
+: "=&r" (r1), "=&r" (r2)
+: "ir" (flag)
+);
+return ((r1 ^ r2) & flag) != 0;
+}
+void cpuid(u32 op, u32 *eax, u32 *ebx,u32 *ecx, u32 *edx)
+{
+ asm("cpuid" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (op) : "cc");
}
u8 getcpuinfos(cpuinfo *proc)
@@ -35,60 +54,164 @@ bool *boolean;
if (!cansetflag (0x00040000)) return 1; /*386 processor - no cpuid*/
if (!cansetflag (0x00200000)) return 2; /*486 processor with no cpuid*/
-cpuid(0, &maxfunction, &unused, &unused, &unused);
-maxfunction &= 0xffff;
-cpuid(0x80000000, &maxextended, &unused, &unused, &unused);
-maxextended &= 0xffff;
-if (maxfunction >= 1)
- {
- cpuid(1, ®eax, ®ebx, ®ecx, ®edx);
- proc->stepping = (regeax & 0x0000000F);
- proc->models = ((regeax>>4) & 0x0000000F);
- proc->family = ((regeax>>8) & 0x0000000F);
- proc->types = ((regeax>>12) & 0x00000003);
- proc->emodels = ((regeax>>16) & 0x0000000F);
- proc->efamily = ((regeax>>20) & 0x000000FF);
+ cpuid(0, &maxfunction, &unused, &unused, &unused);
+ maxfunction &= 0xffff;
+ cpuid(0x80000000, &maxextended, &unused, &unused, &unused);
+ maxextended &= 0xffff;
+ if (maxfunction >= 1)
+ {
+ cpuid(1, ®eax, ®ebx, ®ecx, ®edx);
+ proc->stepping = (regeax & 0x0000000F);
+ proc->models = ((regeax>>4) & 0x0000000F);
+ proc->family = ((regeax>>8) & 0x0000000F);
+ proc->types = ((regeax>>12) & 0x00000003);
+ proc->emodels = ((regeax>>16) & 0x0000000F);
+ proc->efamily = ((regeax>>20) & 0x000000FF);
- proc->brandid = (regeax & 0xF);
- proc->linesize = ((regeax>>8) & 0xF);
- proc->count = ((regeax>>16) & 0xF);
- proc->apicid = ((regeax>>24) & 0xF);
+ proc->brandid = (regeax & 0xF);
+ proc->linesize = ((regeax>>8) & 0xF);
+ proc->count = ((regeax>>16) & 0xF);
+ proc->apicid = ((regeax>>24) & 0xF);
- proc->mmx=((regedx>>23) & 0x00000001);
- proc->sse=((regedx>>25) & 0x00000001);
- proc->sse2=((regedx>>26) & 0x00000001);
- proc->sse3=(regecx & 0x00000001);
- proc->fpu=(regedx & 0x00000001);
- proc->htt=((regedx>>28) & 0x00000001);
+ proc->mmx=((regedx>>23) & 0x00000001);
+ proc->sse=((regedx>>25) & 0x00000001);
+ proc->sse2=((regedx>>26) & 0x00000001);
+ proc->sse3=(regecx & 0x00000001);
+ proc->fpu=(regedx & 0x00000001);
+ proc->htt=((regedx>>28) & 0x00000001);
- }
-if (maxextended >= 1)
- {
- cpuid(0x80000001, ®eax, ®ebx, ®ecx, ®edx);
- proc->mmx2=((regedx>>22) & 0x00000001);
- proc->apic=((regedx>>9) & 0x00000001);
- proc->now3d=((regedx>>30) & 0x00000001);
- proc->now3d2=((regedx>>31) & 0x00000001);
- }
-if (maxextended >= 4)
- {
+ }
+ if (maxextended >= 1)
+ {
+ cpuid(0x80000001, ®eax, ®ebx, ®ecx, ®edx);
+ proc->mmx2=((regedx>>22) & 0x00000001);
+ proc->apic=((regedx>>9) & 0x00000001);
+ proc->now3d=((regedx>>30) & 0x00000001);
+ proc->now3d2=((regedx>>31) & 0x00000001);
+ }
+ if (maxextended >= 4)
+ {
int i;
for(i=0;i<3;i++)
- cpuid(0x80000002+i, ®eax, ®ebx, ®ecx, ®edx);
- memcpy(®eax,&proc->detectedname[0+i*16],4,1);
- memcpy(®ebx,&proc->detectedname[4+i*16],4,1);
- memcpy(®ecx,&proc->detectedname[8+i*16],4,1);
- memcpy(®edx,&proc->detectedname[12+i*16],4,1);
- }
-boolean=&proc->mmx;
-i=0;
+ {
+ cpuid(0x80000002+i, ®eax, ®ebx, ®ecx, ®edx);
+ memcpy(®eax,&proc->detectedname[0+i*16],4,1);
+ memcpy(®ebx,&proc->detectedname[4+i*16],4,1);
+ memcpy(®ecx,&proc->detectedname[8+i*16],4,1);
+ memcpy(®edx,&proc->detectedname[12+i*16],4,1);
+ }
+ }
+ boolean=&proc->mmx;
+ i=0;
-for(i=0;i<10;i++)
-if (*(boolean++)==1)
+ for(i=0;i<10;i++)
+ if (*(boolean++)==1)
+ {
+ strcat(msg[i],&proc->techs);
+ strcat(space,&proc->techs);
+ }
+ return 0;
+}
+
+u32 viewstack(u32 number)
{
-strcat(msg[i],&proc->techs);
-strcat(space,&proc->techs);
-}
- return 0;
+ u32 stack = 0;
+ asm (
+ "movl %[a1],%%esi;"
+ "addl %%esp,%%esi;"
+ "movl (%%esi), %[a1] ;"
+ :[result] "=r" (stack)
+ :[a1] "r" (number)
+ :"%esi"
+ );
+ return stack;
+}
+
+void dump_regs()
+{
+ u32 eax = 0;
+ u32 ebx = 0;
+ u32 ecx = 0;
+ u32 edx = 0;
+ u32 esi = 0;
+ u32 edi = 0;
+ u32 ebp = 0;
+ u32 esp = 0;
+ u16 cs = 0;
+ u16 ds = 0;
+ u16 es = 0;
+ u16 fs = 0;
+ u16 gs = 0;
+ u16 ss = 0;
+ u32 flags = 0;
+ asm (
+ "movl %%eax, %[a1] ;"
+ "movl %%ebx, %[b1] ;"
+ "movl %%ecx, %[c1] ;"
+ "movl %%edx, %[d1] ;"
+ "movl %%esi, %[e1] ;"
+ "movl %%edi, %[f1] ;"
+ "movl %%esp, %[g1] ;"
+ "movl %%ebp, %[h1] ;"
+ "movw %%cs, %[i1] ;"
+ "movw %%ds, %[j1] ;"
+ "movw %%es, %[k1] ;"
+ "movw %%fs, %[l1] ;"
+ "movw %%gs, %[m1] ;"
+ "movw %%ss, %[n1] ;"
+ :
+ [a1] "=m" (eax), [b1] "=m" (ebx), [c1] "=m" (ecx), [d1] "=m" (edx), [e1] "=m" (esi), [f1] "=m" (edi),
+ [g1] "=m" (ebp), [h1] "=m" (esp), [i1] "=m" (cs), [j1] "=m" (ds), [k1] "=m" (es), [l1] "=m" (fs), [m1] "=m" (gs), [n1] "=m" (ss)
+ );
+
+ printf("eax=%x ebx=%x ecx=%x eax=%x\r\n", eax,ebx,ecx,edx);
+ printf("esi=%x edi=%x\r\n", esi,edi);
+ printf("cs=%x ds=%x es=%x fs=%x gs=%x\r\n", cs,ds,es,fs,gs);
+ printf("ss=%x esp=%x ebp=%x\r\n",ss,esp,ebp);
+
+ asm (
+ "pushf ;"
+ "pop %[f1] ;"
+ :
+ [f1] "=m" (flags)
+ );
+
+ printf("FLAGS");
+
+ if(flags & (1 << 0)) // Carry
+ printf(" (C1");
+ else
+ printf(" (C0");
+
+ if(flags & (1 << 2)) // Parity
+ printf(" P1");
+ else
+ printf(" P0");
+
+ if(flags & (1 << 4)) // Adjust
+ printf(" A1");
+ else
+ printf(" A0");
+
+ if(flags & (1 << 6)) // Zero
+ printf(" Z1");
+ else
+ printf(" Z0");
+
+ if(flags & (1 << 7)) // Sign
+ printf(" S1");
+ else
+ printf(" S0");
+
+ if(flags & (1 << 11)) // Overflow
+ printf(" O1)\n");
+ else
+ printf(" O0)\n");
+
+ printf("STACK\r\n");
+ for(u8 i=0;i<25;i++)
+ printf("+%d\t\t%x\r\n",i,viewstack(i*4));
+
+
}
diff --git a/lib/graph.c b/lib/graph.c
old mode 100644
new mode 100755
diff --git a/lib/idt.c b/lib/idt.c
old mode 100644
new mode 100755
index 025d0db..7f860cf
--- a/lib/idt.c
+++ b/lib/idt.c
@@ -97,125 +97,136 @@ makeidtdes(offset,select,type,&temp);
idt[index]=temp;
}
+void cpuerror(const u8 *src)
+{
+ print("\033[31m***** ERREUR CPU ****\r\n -");
+ print(src);
+ dump_regs();
+ while(1)
+ {
+ nop();
+ }
+}
+
void interruption()
{
cli();
- print("Appel d'une interruption");
+ print("Appel d'une interruption\r\n");
sti();
iret();
}
void exception0()
{
- print("divide error");
+ print("divide error\r\n");
iret();
}
void exception1()
{
- print("debug exception");
+ cpuerror("debug exception\r\n");
iret();
}
void exception2()
{
- print("non-maskable hardware interrupt");
+ cpuerror("non-maskable hardware interrupt\r\n");
iret();
}
void exception3()
{
- print("INT3 instruction");
+ cpuerror("INT3 instruction\r\n");
iret();
}
void exception4()
{
- print("INTO instruction detected overflow");
+ cpuerror("INTO instruction detected overflow\r\n");
iret();
}
void exception5()
{
- print("BOUND instruction detected overrange");
+ print("BOUND instruction detected overrange\r\n");
iret();
}
void exception6()
{
- print("invalid instruction opcode");
+ cpuerror("invalid instruction opcode\r\n");
iret();
}
void exception7()
{
- print("no coprocessor");
+ cpuerror("no coprocessor\r\n");
iret();
}
void exception8()
{
- print("double fault");
+ cpuerror("double fault\r\n");
iret();
}
void exception9()
{
- print("coprocessor segment overrun");
+ cpuerror("coprocessor segment overrun\r\n");
iret();
}
void exception10()
{
- print("invalid task state segment (TSS)");
+ cpuerror("invalid task state segment (TSS)\r\n");
iret();
}
void exception11()
{
- print("segment not present");
+ cpuerror("segment not present\r\n");
iret();
}
void exception12()
{
- print("stack fault");
+ cpuerror("stack fault");
iret();
}
void exception13()
{
- print("general protection fault (GPF)");
+ cpuerror("general protection fault (GPF)\r\n");
iret();
}
void exception14()
{
- print("page fault");
+ cpuerror("page fault\r\n");
iret();
}
void exception15()
{
- print("(reserved)");
+ cpuerror("(reserved)\r\n");
iret();
}
void exception16()
{
- print("coprocessor error");
+ cpuerror("coprocessor error\r\n");
iret();
}
void exception17()
{
- print("alignment check");
+ cpuerror("alignment check\r\n");
iret();
}
void exception18()
{
- print("machine check");
+ cpuerror("machine check");
iret();
}
diff --git a/lib/keyboard.c b/lib/keyboard.c
old mode 100644
new mode 100755
index f13b460..1678dbc
--- a/lib/keyboard.c
+++ b/lib/keyboard.c
@@ -285,6 +285,7 @@ if ((bufferscan[lastscan]==0xE0)||((kbdstatus & STATUS_NUM)&&(key>=0x47)&&(key<=
void keyboard()
{
+printf("test");
u8 scancode,ascii;
cli();
while ((inb(0x64)&1)==0);
diff --git a/lib/keymap.c b/lib/keymap.c
old mode 100644
new mode 100755
diff --git a/lib/makefile b/lib/makefile
old mode 100644
new mode 100755
index a53528d..96ec60e
--- a/lib/makefile
+++ b/lib/makefile
@@ -1,6 +1,6 @@
-CC=gcc -O0 -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -I ../Include
-LINK=ld -r -o
-OBJS= memory.o vga.o port.o video.o mouse.o idt.o timer.o keyboard.o types.o string.o graph.o 3d.o math.o cpu.o
+CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -w -m32 -F pe-i386 -I ../include
+LINK=ld -m elf_i386 -r -o
+OBJS=memory.o vga.o port.o video.o mouse.o idt.o timer.o keyboard.o types.o string.o graph.o 3d.o math.o cpu.o
all: makeall
diff --git a/lib/math.c b/lib/math.c
old mode 100644
new mode 100755
diff --git a/lib/memory.c b/lib/memory.c
old mode 100644
new mode 100755
diff --git a/lib/modes.c b/lib/modes.c
old mode 100644
new mode 100755
diff --git a/lib/mouse.c b/lib/mouse.c
old mode 100644
new mode 100755
index 2cc2332..a87d0d5
--- a/lib/mouse.c
+++ b/lib/mouse.c
@@ -124,7 +124,10 @@ irqendmaster();
irqendslave();
sti();
//asm("movl 0x2C(%esp), %ebx;movl 0x30(%esp), %esi;movl 0x34(%esp), %edi;movl 0x38(%esp), %ebp;addl $0x3C, %esp;iret;");
-asm("addl $0x18, %esp;popl %ebx;iret;");
+asm(
+"addl $0x18,%esp;\
+popl %bx;\
+iret;");
}
diff --git a/lib/port.c b/lib/port.c
old mode 100644
new mode 100755
diff --git a/lib/string.c b/lib/string.c
old mode 100644
new mode 100755
diff --git a/lib/timer.c b/lib/timer.c
old mode 100644
new mode 100755
diff --git a/lib/types.c b/lib/types.c
old mode 100644
new mode 100755
diff --git a/lib/vga.c b/lib/vga.c
old mode 100644
new mode 100755
diff --git a/lib/video.c b/lib/video.c
old mode 100644
new mode 100755
diff --git a/makefile b/makefile
old mode 100644
new mode 100755
index ed4250e..1fc204c
--- a/makefile
+++ b/makefile
@@ -3,29 +3,41 @@ all: makall
makall: boot/boot12.bin lib/libs.o system/system.sys
sync
+install:
+ (sudo apt-get install nasm gcc qemu fusefat cgdb)
+
clean:
(cd system; make clean)
(cd boot; make clean)
(cd lib;make clean)
+ (cd final;make clean)
sync
backup: clean
(cd .. ; tar cf - cosc | gzip -f - > backup.tar.gz ; cd cosc)
-
-allbackup: backup
- (echo Inserez une disquette; sleep ; cp ../backup.tar.bz2 /dev/fd0)
copy:
- (cp boot/loader.sys /cygdrive/a)
- (cp system/system.sys /cygdrive/a)
- (dd if=boot/boot12.bin of=/cygdrive/a bs=512 count=1)
+ (cd final; make)
-copy2:
- (cp boot/loader.sys /cygdrive/b)
- (cp system/system.sys /cygdrive/b)
- (dd if=boot/boot12.bin of=/cygdrive/b bs=512 count=1)
-
-test: clean all copy2
+test: all copy qemu
+
+view:
+ (hexdump -C ./final/cos2000.img|head -c10000)
+
+debug-boot: all copy qemu-debug
+ (sleep 2;cgdb -x ./debug/boot.txt)
+
+debug-loader: all copy qemu-debug
+ (sleep 2;cgdb -x ./debug/loader.txt)
+
+debug-system: all copy qemu-debug
+ (sleep 2;cgdb -x ./debug/system.txt)
+
+qemu-debug:
+ (qemu-system-i386 -m 1G -fda ./final/cos2000.img -s -S &)
+
+qemu:
+ (qemu-system-i386 -m 1G -fda ./final/cos2000.img -s)
system/system.sys:
(cd system; make)
diff --git a/system/ansi.c b/system/ansi.c
old mode 100644
new mode 100755
diff --git a/system/linker.lds b/system/linker.lds
new file mode 100644
index 0000000..3c125f5
--- /dev/null
+++ b/system/linker.lds
@@ -0,0 +1,20 @@
+OUTPUT_FORMAT("elf32-i386", "elf32-i386",
+ "elf32-i386")
+OUTPUT_ARCH(i386)
+
+ENTRY(mymain)
+
+SECTIONS
+{
+ . = 0x50000;
+ .text ALIGN(16): {
+ *(.text)
+ }
+ . = 0x200000;
+ .data ALIGN(16): {
+ *(.data)
+ }
+ .bss ALIGN(16): {
+ *(.bss)
+ }
+}
diff --git a/system/makefile b/system/makefile
old mode 100644
new mode 100755
index 07022ba..270d3a1
--- a/system/makefile
+++ b/system/makefile
@@ -1,15 +1,14 @@
-CC=gcc -O0 -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -I ../Include -c -o
+FINALCC=gcc -O4 -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -w -I ../include -m32 -c -o
+GCC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -w -I ../include -m32 -c -o
-
-LINK=ld -e __main -o
+LINK=ld -m elf_i386 -T linker.lds -e main -o
all: system.sys
sync
system.sys:
nasm -f elf -o system.o system.asm
-
- $(CC) systemc.o system.c
+ $(GCC) systemc.o system.c
$(LINK) system.sys systemc.o system.o ../lib/libs.o
clean:
@@ -17,5 +16,6 @@ clean:
rm -f *.out
rm -f *.bin
rm -f *.sys
+ rm -f *.s
diff --git a/system/system.asm b/system/system.asm
old mode 100644
new mode 100755
diff --git a/system/system.c b/system/system.c
old mode 100644
new mode 100755
index 64c8c9b..9e16a4c
--- a/system/system.c
+++ b/system/system.c
@@ -12,18 +12,19 @@
static cpuinfo cpu;
static u8 noproc[]="\033[31mInconnu\033[0m\000";
+static u8 okmsg[]="\033[99C\033[8D\033[37m\033[1m[ \033[32mOK\033[37m ]\033[0m\000";
+static u8 key=0;
void ok()
{
-static u8 okmsg[]="\033[99C\033[8D\033[37m\033[1m[ \033[32mOK\033[37m ]\033[0m\000";
-print(okmsg);
-return;
+ print(okmsg);
+ return;
}
-int _main(void) {
+int main(void) {
cli();
- setvmode(0x02);
+ setvmode(0x02);
/* Efface l'ecran */
print("\033[2J\000");
printf(ansilogo);
@@ -44,7 +45,7 @@ int _main(void) {
ok();
print("Activation de l'IRQ 0\000");
- enableirq(0);
+ //enableirq(0);
ok();
print("Installation du handler clavier\000");
@@ -79,11 +80,10 @@ int _main(void) {
printf("Processeur detecte\r Revision \t:%d\r Modele \t:%d\r Famille \t:%d\r Nom cpuid\t:%s\rJeux\t:%s\000",cpu.stepping,cpu.models,cpu.family,&cpu.detectedname,&cpu.techs);
ok();
- u8 key=0;
while(1)
{
- key=waitascii();
- putchar(key);
+ key=waitascii();
+ putchar(key);
}
}