fix: correction pour adaptation sous Linux, passage au format ELF

BREAKING CHANGE: attention modification majeure du code
This commit is contained in:
Nicolas Hordé 2018-07-24 04:04:07 +02:00
parent 39822e8f9e
commit b09af8b250
75 changed files with 1909 additions and 3711 deletions

BIN
Graphisme/boot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

246
Graphisme/boot.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB

BIN
Graphisme/fond.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 KiB

567
Graphisme/fond.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1.1 MiB

250
Graphisme/logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB

270
boot/boot12.asm Normal file → Executable file
View File

@ -4,14 +4,14 @@
section .text section .text
start: 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_Size dw 512 ;Nombre d'octets/secteur
Sectors_Per_Cluster db 1 ;Nombre de secteurs/cluster Sectors_Per_Cluster db 1 ;Nombre de secteurs/cluster
Reserved_Sectors dw 1 ;Nombre de secteurs réservé Reserved_Sectors dw 1 ;Nombre de secteurs réservé
Fats_Number db 2 ;Nombre de copies de la FAT Fats_Number db 2 ;Nombre de copies de la FAT
Fits_Number dw 224 ;Taille du répertoire racine Fits_Number dw 224 ;Taille du répertoire racine
Sectors_Per_Disk dw 2880 ;Nombre secteurs du volume si < 32 Mo Sectors_Per_Disk dw 2880 ;Nombre secteurs du volume si < 32 Mo
Media_Descriptor db 0xF0 ;Descripteur de média Media_Descriptor db 0xF0 ;Descripteur de média
Sectors_Per_Fat dw 9 ;Nombre secteurs/FAT 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 Heads_Number dw 2 ;Nombre de tete de lecture/écriture
Sectors_Hidden dd 0 ;Nombre de secteurs cachés Sectors_Hidden dd 0 ;Nombre de secteurs cachés
Sectors_Per_Disk2 dd 0 ;Nombre secteurs du volume si > 32 Mo Sectors_Per_Disk2 dd 0 ;Nombre secteurs du volume si > 32 Mo
Boot_Drive db 0 ;Lecteur de démarrage Boot_Drive db 0 ;Lecteur de démarrage
Reserved db 0 ;NA (pour NT seulement) Reserved db 0 ;NA (pour NT seulement)
Extended_Boot_ID db 0x29 ;Signature Boot étendu 29h Extended_Boot_ID db 0x29 ;Signature Boot étendu 29h
Serial_Number dd 0x01020304 ;N° de série Serial_Number dd 0x01020304 ;N° de série
Disk_Name db "COS2000 " ;Nom de volume Disk_Name db "COS2000 " ;Nom de volume
Fat_Type db "FAT12 " ;Type de système de fichiers Fat_Type db "FAT12 " ;Type de système de fichiers
Boot_Message db "Demarrage de COS",0 Boot_Message db "Cos2000",0
Loading_Message db "Chargement",0 Entre_Message db "Fichier",0
System_File db "LOADER SYS" Loading_Message db "Charger",0
Is_Ok db " [ OK ]",0x0A,0x0D,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_Failed db " [Erreur]",0x0A,0x0D,"<Appuyer une touche>",0 Is_Ok db " [ OK ]",0x0A,0x0D,0
The_Dot db '.',0 Is_Failed db " [ERREUR]",0x0A,0x0D,0
The_Dot db '.',0
Boot_Error: Boot_Error:
mov si,Is_Failed mov si,Is_Failed
call ShowString call ShowString
xor ax,ax xor ax,ax
int 0x16 int 0x16
int 0x19 int 0x19
Boot_Ok: Boot_Ok:
mov si,Is_Ok mov si,Is_Ok
call ShowString call ShowString
ret ret
Boot: Boot:
push cs push cs
push cs push cs
pop es pop es
pop ds pop ds
mov [Boot_Drive],dl mov [Boot_Drive],dl
cli cli
mov ax,0x9000 mov ax,0x9000
mov ss,ax mov ss,ax
mov sp,0xFFFF mov sp,0xFFFF
sti sti
mov si,Boot_Message mov si,Boot_Message
call ShowString call ShowString
xor ax,ax xor ax,ax
int 0x13 int 0x13
jc Boot_Error jc Boot_Error
mov cx,[Reserved_Sectors] mov cx,[Reserved_Sectors]
add cx,[Sectors_Hidden] add cx,[Sectors_Hidden]
adc cx,[Sectors_Hidden+2] adc cx,[Sectors_Hidden+2]
mov bx,[Sectors_Per_Fat] mov bx,[Sectors_Per_Fat]
mov di,Fat_Buffer mov di,Fat_Buffer
push bx push bx
push cx push cx
readfat: readfat:
call ReadSector call ReadSector
jc Boot_Error jc Boot_Error
inc cx inc cx
add di,[Sectors_Size] add di,[Sectors_Size]
dec bx dec bx
jnz readfat jnz readfat
pop cx pop cx
pop bx pop bx
xor ax,ax xor ax,ax
mov al,[Fats_Number] mov al,[Fats_Number]
mul bx mul bx
add cx,ax add cx,ax
mov ax,32 mov ax,32
mul word [Fits_Number] mul word [Fits_Number]
div word [Sectors_Size] div word [Sectors_Size]
add ax,cx add ax,cx
sub ax,2 sub ax,2
mov word [Serial_Number],ax mov word [Serial_Number],ax
xor dx,dx xor dx,dx
call Boot_Ok call Boot_Ok
mov si,Loading_Message mov si,Loading_Message
call ShowString call ShowString
Find_System: Find_System:
mov di,Buffer mov di,Buffer
call ReadSector call ReadSector
jc Near Boot_Error jc Near Boot_Error
xor bx,bx xor bx,bx
Next_Root_Entrie: Next_Root_Entrie:
cmp byte [di],0 cmp byte [di],0
je near Boot_Error je near Boot_Error
push di push di
push cx push cx
mov si,System_File mov si,System_File
mov cx,11 mov cx,32
rep cmpsb rep cmpsb
pop cx pop cx
pop di pop di
je System_Found je System_Found
add di,32 add di,32
add bx,32 add bx,32
inc dx inc dx
cmp dx,[Fits_Number] cmp dx,[Fits_Number]
ja near Boot_Error ja near Boot_Error
cmp bx,[Sectors_Size] cmp bx,[Sectors_Size]
jb Next_Root_Entrie jb Next_Root_Entrie
inc cx inc cx
jmp Find_System jmp Find_System
System_Found: System_Found:
mov cx,[di+26] call Boot_Ok
mov ax,0x0070 mov si,Entre_Message
mov es,ax call ShowString
push es mov cx,[di+26+32]
mov di,0x100 mov ax,0x0080
push di mov es,ax
push es
mov di,0x0
push di
mov si,The_Dot mov si,The_Dot
Resume_Loading: Resume_Loading:
cmp cx,0x0FF0 cmp cx,0x0FF0
jae Finish_Loading jae Finish_Loading
push cx push cx
add cx,word [Serial_Number] add cx,word [Serial_Number]
call ReadSector call ReadSector
pop cx pop cx
jc near Boot_Error jc near Boot_Error
call ShowString call ShowString
add di,[Sectors_Size] add di,[Sectors_Size]
call NextFatGroup call NextFatGroup
jc near Boot_Error jc near Boot_Error
jmp Resume_Loading jmp Resume_Loading
Finish_Loading: Finish_Loading:
call Boot_Ok call Boot_Ok
retf retf
;====================READSECTOR======================= ;====================READSECTOR=======================
;Lit le secteur logique LBA CX et le met en es:di ;Lit le secteur logique LBA CX et le met en es:di
@ -148,15 +152,15 @@ Finish_Loading:
;===================================================== ;=====================================================
ReadSector: ReadSector:
pusha pusha
mov ax,cx mov ax,cx
xor dx,dx xor dx,dx
div word [Sectors_Per_Track] div word [Sectors_Per_Track]
inc dl inc dl
mov bl,dl mov bl,dl
xor dx,dx xor dx,dx
div word [Heads_Number] div word [Heads_Number]
mov dh, [Boot_Drive] mov dh, [Boot_Drive]
xchg dl,dh xchg dl,dh
mov cx,ax mov cx,ax
xchg cl,ch xchg cl,ch
shl cl,6 shl cl,6
@ -183,30 +187,30 @@ NextFatGroup:
push bx push bx
push dx push dx
push di push di
mov ax,cx mov ax,cx
mov bx,ax mov bx,ax
and bx,0000000000000001b and bx,0000000000000001b
shr ax,1 shr ax,1
mov cx,3 mov cx,3
mul cx mul cx
mov di,Fat_Buffer mov di,Fat_Buffer
add di,ax add di,ax
cmp bx,0 cmp bx,0
jnz Even_Group jnz Even_Group
Odd_Group: Odd_Group:
mov dx,[di] mov dx,[di]
and dx,0x0FFF and dx,0x0FFF
mov cx,dx mov cx,dx
jmp Next_Group_Found jmp Next_Group_Found
Even_Group: Even_Group:
mov dx,[di+1] mov dx,[di+1]
and dx,0xFFF0 and dx,0xFFF0
shr dx,4 shr dx,4
mov cx,dx mov cx,dx
Next_Group_Found: Next_Group_Found:
pop di pop di
pop dx pop dx
pop bx pop bx
ret ret
;======================SHOWSTR======================== ;======================SHOWSTR========================
@ -215,7 +219,7 @@ Next_Group_Found:
;<- Flag Carry si erreur ;<- Flag Carry si erreur
;===================================================== ;=====================================================
ShowString: ShowString:
pusha pusha
Next_Char: Next_Char:
lodsb lodsb
or al,al or al,al
@ -225,10 +229,8 @@ Next_Char:
int 0x10 int 0x10
jmp Next_Char jmp Next_Char
End_Show: End_Show:
popa popa
ret ret
times 510-($-$$) db ' ' times 510-($-$$) db ' '

0
boot/boot16.asm Normal file → Executable file
View File

View File

@ -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

View File

@ -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

0
boot/echs.h Normal file → Executable file
View File

116
boot/elf.h Executable file
View File

@ -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

431
boot/loader.asm Normal file → Executable file
View File

@ -1,5 +1,5 @@
[BITS 16] [BITS 16]
[ORG 0x100] [ORG 0x0]
SECTION .text SECTION .text
push cs push cs
@ -12,18 +12,18 @@
mov si,msg1 mov si,msg1
call showstr call showstr
call initfat call initfat
call ok call ok
mov si,msg2 mov si,msg2
call showstr call showstr
mov si,System_File mov si,System_File
call search call search
call ok call ok
mov si,msg3 mov si,msg3
call showstr call showstr
call EnableA20 call EnableA20
call ok call ok
mov si,msg4 mov si,msg4
call showstr call showstr
@ -76,8 +76,9 @@ call ok
call showstr call showstr
call initpe call initpe
call ok call ok
suite:
;mov cx,suite
;call debug
mov si,msg8 mov si,msg8
call showstr call showstr
cli cli
@ -118,111 +119,227 @@ initpe:
xor ax,ax xor ax,ax
mov es,ax mov es,ax
mov [begin],ebx mov [begin],ebx
cmp word [es:ebx+mzheader.magic],"MZ" ; bien l'entete .exe dos ? cmp word [es:ebx+ELFheader.Magic],0x457F ; bien l'entete .elf ?
jne near errorpe jne near errorelf
add ebx,[es:ebx+mzheader.lfanew] ; Pointe vers l'entete PE cmp word [es:ebx+ELFheader.Magic+2],"LF" ; bien l'entete .elf ?
cmp word [es:ebx+peheader.Signature],"PE" ; bien l'entete PE ? jne near errorelf
jne near errorpe cmp byte [es:ebx+ELFheader.Computertype],0x1 ; type ok ?
cmp word [es:ebx+peheader.Signature+2],0 ; bien l'entete PE ? jne near errorelf
jne near errorpe cmp byte [es:ebx+ELFheader.Endianness],0x1 ; type ok ?
mov [p_pe],ebx jne near errorelf
mov esi,[es:ebx+peheader.ImageBase] cmp byte [es:ebx+ELFheader.Original],0x1 ; type ok ?
mov [base],esi jne near errorelf
add esi,[es:ebx+peheader.AddressOfEntryPoint] cmp byte [es:ebx+ELFheader.OS],0x0 ; type ok ?
mov [entriepoint],esi jne near errorelf
mov ax,[es:ebx+peheader.NumberOfSections] cmp byte [es:ebx+ELFheader.ABI],0x0 ; type ok ?
add ebx,peheader.end jne near errorelf
mov [p_sections],ebx cmp byte [es:ebx+ELFheader.Dummy],0x0 ; type ok ?
jne near errorelf
mov si,info1 mov si,info1
call showstr call showstr
readsections: mov esi,[es:ebx+ELFheader.Entrypoint]
mov si,info2 mov [entriepoint],esi
call showstr mov esi,[es:ebx+ELFheader.Offsetprogram]
mov esi,ebx add esi,ebx
mov cx,8 mov [offsetheader],esi
call showfixstr mov esi,[es:ebx+ELFheader.Offsetsection]
mov cl,17 add esi,ebx
call eol mov [offsetsection],esi
mov edx,[es:ebx+sections.VirtualAddress] mov cx,[es:ebx+ELFheader.Nbprogram]
add edx,[base] 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 mov cx,32
call ShowHex call ShowHex
mov cl,30 pop cx
call eol mov esi,info4
mov si,info3 call showstr
call showstr mov edx,[es:edi+Sections.Size]
mov edx,[es:ebx+sections.VirtualSize] push cx
mov cx,32 mov cx,32
call ShowHex call ShowHex
mov si,info4 pop cx
call showstr mov esi,info5
mov edi,[es:ebx+sections.VirtualAddress] call showstr
add edi,[base] mov edx,[es:edi+Sections.Vadress]
cmp edi,0 push cx
je noload mov cx,32
push eax call ShowHex
push ecx pop cx
mov esi,[es:ebx+sections.PointerToRawData] and dword [es:edi+Sections.Flags],SF_ALLOC
add esi,[begin] jne itsok
mov ecx,[es:ebx+sections.SizeOfRawData] mov esi,info6
shr cx,2 call showstr
cmp cx,0 jmp itsok2
je zeroize 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: copietomem:
mov eax,[es:esi] mov eax,[es:esi]
mov [es:edi],eax mov [es:edi],eax
add edi,4 add edi,4
add esi,4 add esi,4
dec cx dec ecx
jnz copietomem jnz copietomem
pop ecx pop ecx
pop eax pop edi
jmp nextsymb pop esi
zeroize: pop eax
mov ecx,[es:ebx+sections.VirtualSize] ret
shr cx,2
;==========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 mov eax,0
zerotomem: zerotomem:
mov [es:edi],eax mov [es:edi],eax
add edi,4 add edi,4
dec cx dec ecx
jnz zerotomem jnz zerotomem
pop ecx pop ecx
pop eax pop edi
jmp nextsymb pop esi
noload: pop eax
mov si,info5 ret
call showstr
nextsymb: begin dd 0
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
entriepoint dd 0 entriepoint dd 0
begin dd 0 offsetheader dd 0
base dd 0 offsetsection dd 0
p_pe dd 0 nbprogram dw 0
p_sections dd 0 nbsection dw 0
symbol dd 0
;==========SHOWHEX=========== ;==========SHOWHEX===========
;Affiche un nombre hexadécimal EDX de taille CX aprés le curseur ;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: ShowHex:
@ -230,6 +347,7 @@ ShowHex:
push bx push bx
push cx push cx
push edx push edx
push si
mov ax,cx mov ax,cx
shr ax,2 shr ax,2
sub cx,32 sub cx,32
@ -241,7 +359,7 @@ Hexaize:
rol edx,4 rol edx,4
mov bx,dx mov bx,dx
and bx,0fh and bx,0fh
push ax mov si,ax
mov al,[cs:bx+Tab] mov al,[cs:bx+Tab]
xor bx,bx xor bx,bx
mov ah,0x09 mov ah,0x09
@ -249,9 +367,10 @@ Hexaize:
int 0x10 int 0x10
mov ah,0x0E mov ah,0x0E
int 0x10 int 0x10
pop ax mov ax,si
dec al dec al
jnz Hexaize jnz Hexaize
pop si
pop edx pop edx
pop cx pop cx
pop bx pop bx
@ -401,7 +520,7 @@ Next_Root_Entrie:
push si push si
push di push di
push cx push cx
mov cx,11 mov cx,32
rep cmpsb rep cmpsb
pop cx pop cx
pop di pop di
@ -416,91 +535,91 @@ Next_Root_Entrie:
jb Next_Root_Entrie jb Next_Root_Entrie
inc cx inc cx
Found: Found:
mov cx,[di+26] mov cx,[di+26+32]
pop di pop di
pop dx pop dx
pop bx pop bx
ret 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======================== ;======================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 ;-> DS, SI
;<- Flag Carry si erreur ;<- Flag Carry si erreur
;===================================================== ;=====================================================
showstr: showstr:
pusha pushad
xor bh,bh xor bh,bh
xor cx,cx
inc cx
nextchar: nextchar:
lodsb mov al,[ds:esi]
inc esi
or al,al or al,al
jz endshow jz endshow
cmp al,' ' cmp al,' '
jb justchar jb justchar
cmp al,'#' cmp al,'#'
jne nocolor jne nocolor
lodsb mov al,[ds:esi]
inc esi
sub al,'0' sub al,'0'
shl al,3 shl al,3
mov [cs:thecolor],al mov [cs:thecolor],al
shr al,2 shr al,2
add [cs:thecolor],al add [cs:thecolor],al
lodsb mov al,[ds:esi]
inc esi
sub al,'0' sub al,'0'
add [cs:thecolor],al add [cs:thecolor],al
jmp nextchar jmp nextchar
nocolor: 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 xor bx,bx
mov ah,0x09 mov ah,0x09
mov bl,[cs:thecolor] mov bl,[cs:thecolor]
xor cx,cx
inc cx
int 0x10 int 0x10
justchar: justchar:
mov ah,0x0E mov ah,0x0E
int 0x10 int 0x10
jmp nextchar jmp nextchar
endshow: endshow:
popa popad
ret 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======================= ;====================READSECTOR=======================
;Lit le secteur logique LBA CX et le met en es:di ;Lit le secteur logique LBA CX et le met en es:di
;-> CX (limité à 65536 secteurs, soit 32 Mo avec secteur 512 octets) ;-> CX (limité à 65536 secteurs, soit 32 Mo avec secteur 512 octets)
@ -615,37 +734,39 @@ GoPMode32:
push KERNEL_SEL push KERNEL_SEL
push dword [cs:entriepoint] push dword [cs:entriepoint]
retf retf
; jmp KERNEL_SEL:0x401020
section .data section .data
thecolor db 0x07 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 msg1 db '#07Initialisation de la FAT',0
msg2 db '#07Recherche du systeme',0 msg2 db '#07Recherche du systeme',0
msg3 db '#07Activation adressage 24 bits',0 msg3 db '#07Activation adressage 24 bits',0
msg4 db '#07Chargement des descripteurs',0 msg4 db '#07Chargement des descripteurs',0
msg5 db '#07Passage en mode Flat real',0 msg5 db '#07Passage en mode Flat real',0
msg6 db '#07Chargement du systeme',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 msg8 db '#07Passage en mode protege',0
msg9 db '#07Execution du noyau',0
info1 db 0x0A,0x0D,'#08Sections :',0x0A,0x0D,0 info1 db 0x0A,0x0D,'Format ELF i386 reconnu, #08Sections :',0x0A,0x0D,0
info2 db ' -',0 info2 db ' ',0
info3 db ' (',0 info3 db '@12 | ',0
info4 db ') ',0 info4 db ' - ',0
info5 db ' #12Non projete#08',0 info5 db ' -> ',0
info6 db '@35#12NON ALLOUE #08',0
info6 db 'Point entree en ',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 return db 0x0A,0x0D,0
okay db ' #15[ #10OK #15]',0x0A,0x0D,0 okay db ' #15[ #10OK #15]',0x0A,0x0D,0
error db ' #15[#12Erreur#15]',0x0A,0x0D,0x0A,0x0D,' <Appuyez une touche pour redemarrer>',0 error db ' #15[#12Erreur#15]',0x0A,0x0D,0x0A,0x0D,' <Appuyez une touche pour redemarrer>',0
The_Dot db '.',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 entries dw 0
data dw 0 data dw 0
xy dw 0 xy dw 0
@ -727,5 +848,5 @@ Fat_Buffer equ $+512
SECTION .bss SECTION .bss
%include "pe.h" %include "elf.h"

9
boot/makefile Normal file → Executable file
View File

@ -1,9 +1,8 @@
CC=nasm -f bin -o CC=nasm -f bin -o
BINS=boot12.bin boot16.bin boottest.bin bootcp.com loader.sys
all: makall all: makall
makall:$(BINS) makall: boot12.bin boot16.bin loader.sys
boot12.bin: boot12.asm boot12.bin: boot12.asm
$(CC) $@ $^ $(CC) $@ $^
@ -11,12 +10,6 @@ boot12.bin: boot12.asm
boot16.bin: boot16.asm boot16.bin: boot16.asm
$(CC) $@ $^ $(CC) $@ $^
boottest.bin: boottest.asm
$(CC) $@ $^
bootcp.com: bootcp.asm
$(CC) $@ $^
loader.sys: loader.asm loader.sys: loader.asm
$(CC) $@ $^ $(CC) $@ $^

View File

@ -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

8
debug/boot.txt Normal file
View File

@ -0,0 +1,8 @@
target remote localhost:1234
set disassembly-flavor intel
set architecture i8086
break *0x7c00
cont
clear *0x7c00
layout asm
layout regs

7
debug/loader.txt Normal file
View File

@ -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

8
debug/system.txt Normal file
View File

@ -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

13
final/makefile Executable file
View File

@ -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

0
include/3d.h Normal file → Executable file
View File

0
include/kmemory.h → include/Kmemory.h Normal file → Executable file
View File

0
include/ldt.h → include/LDT.h Normal file → Executable file
View File

0
include/asm.h Normal file → Executable file
View File

0
include/cpu.h Normal file → Executable file
View File

26
include/cpuid.h Normal file → Executable file
View File

@ -1,24 +1,6 @@
inline bool cansetflag (u32 flag) 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;
}
inline void cpuid(u32 op, u32 *eax, u32 *ebx,u32 *ecx, u32 *edx) 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 dump_regs();
}

0
include/ctype.h Normal file → Executable file
View File

0
include/graph.h Normal file → Executable file
View File

2
include/idt.h Normal file → Executable file
View File

@ -24,7 +24,7 @@ typedef struct idtdes {
void initpic(void); void initpic(void);
void enableirq(u8 irq); void enableirq(u8 irq);
void disableirq(u8 irq); void disableirq(u8 irq);
void cpuerror(const u8 *src);

0
include/keyboard.h Normal file → Executable file
View File

0
include/math.h Normal file → Executable file
View File

0
include/memory.h Normal file → Executable file
View File

0
include/mouse.h Normal file → Executable file
View File

0
include/port.h Normal file → Executable file
View File

0
include/stdarg.h Normal file → Executable file
View File

0
include/string.h Normal file → Executable file
View File

0
include/timer.h Normal file → Executable file
View File

0
include/type.h Normal file → Executable file
View File

9
include/types.h Normal file → Executable file
View File

@ -9,6 +9,11 @@ typedef short s16;
typedef int s32; typedef int s32;
typedef int bool; typedef int bool;
#define true -1;
#define false 0;
#define NULL 0x0000;
struct dtr { struct dtr {
u16 limite; u16 limite;
@ -17,10 +22,6 @@ struct dtr {
} __attribute__ ((packed)); } __attribute__ ((packed));
#define true 1;
#define false 0;
#define NULL 0x0000;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

0
include/vga.h Normal file → Executable file
View File

0
include/video.h Normal file → Executable file
View File

View File

@ -1,375 +0,0 @@
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
;³ COS 2000 ³
;³ http://www.multimania.com/cos2000 ³
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
;³ D I S K I M A G E ³
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
;³ Fonction : Programme permettant de raliser 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 gnration de code 16 bits
[ORG 0x100] ;Directive pour indiquer le dbut du code
section .text
;=============================Debut du programmes=============================
start: ;Label du dbut.
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
;Cre 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 prcdamment 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 "Insrez 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 ralise",0x0A,0x0D,'$'
SectorsPerTrack dw 18 ;Nombre de secteur par pistes.
HeadsPerDrive dw 2 ;Nombre de ttes 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 raliser 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.

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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 surligne 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 dtects 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 priphrique BP pour une utilisation ultrieure
;-> 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 aprs 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

View File

@ -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

View File

@ -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 ;RcupŠre en BP le nølecteur de dmarrage
call initdisk ;Initialisation du priphrique
;call cls ;Efface l'cran
mov si, msg
call showstr ;Affiche le splatch de boot
call getkey ;RcupŠ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 dmarrage 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 dmarrage
mov si,[sitemp] ;restaure si (adresse de la partition)
jmp 0x0000:0x7C00 ;Une opration normalement ralise 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 priphrique BP pour une utilisation ultrieure
;-> 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

File diff suppressed because it is too large Load Diff

View File

@ -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

0
lib/3d.c Normal file → Executable file
View File

0
lib/8x16fnt.c Normal file → Executable file
View File

0
lib/8x8fnt.c Normal file → Executable file
View File

0
lib/kmemory.c → lib/Kmemory.c Normal file → Executable file
View File

0
lib/ldt.c → lib/LDT.c Normal file → Executable file
View File

225
lib/cpu.c Normal file → Executable file
View File

@ -7,7 +7,7 @@
static u8 *msg[] = static u8 *msg[] =
{ {
"mmx", "mmx",
"mmx2", "mmx2",
"sse", "sse",
@ -18,13 +18,32 @@ static u8 *msg[] =
"3dNow Extended!", "3dNow Extended!",
"HyperThreading", "HyperThreading",
"apic", "apic",
}; };
static u8 space[]=" "; 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) u8 getcpuinfos(cpuinfo *proc)
@ -35,60 +54,164 @@ bool *boolean;
if (!cansetflag (0x00040000)) return 1; /*386 processor - no cpuid*/ if (!cansetflag (0x00040000)) return 1; /*386 processor - no cpuid*/
if (!cansetflag (0x00200000)) return 2; /*486 processor with no cpuid*/ if (!cansetflag (0x00200000)) return 2; /*486 processor with no cpuid*/
cpuid(0, &maxfunction, &unused, &unused, &unused); cpuid(0, &maxfunction, &unused, &unused, &unused);
maxfunction &= 0xffff; maxfunction &= 0xffff;
cpuid(0x80000000, &maxextended, &unused, &unused, &unused); cpuid(0x80000000, &maxextended, &unused, &unused, &unused);
maxextended &= 0xffff; maxextended &= 0xffff;
if (maxfunction >= 1) if (maxfunction >= 1)
{ {
cpuid(1, &regeax, &regebx, &regecx, &regedx); cpuid(1, &regeax, &regebx, &regecx, &regedx);
proc->stepping = (regeax & 0x0000000F); proc->stepping = (regeax & 0x0000000F);
proc->models = ((regeax>>4) & 0x0000000F); proc->models = ((regeax>>4) & 0x0000000F);
proc->family = ((regeax>>8) & 0x0000000F); proc->family = ((regeax>>8) & 0x0000000F);
proc->types = ((regeax>>12) & 0x00000003); proc->types = ((regeax>>12) & 0x00000003);
proc->emodels = ((regeax>>16) & 0x0000000F); proc->emodels = ((regeax>>16) & 0x0000000F);
proc->efamily = ((regeax>>20) & 0x000000FF); proc->efamily = ((regeax>>20) & 0x000000FF);
proc->brandid = (regeax & 0xF); proc->brandid = (regeax & 0xF);
proc->linesize = ((regeax>>8) & 0xF); proc->linesize = ((regeax>>8) & 0xF);
proc->count = ((regeax>>16) & 0xF); proc->count = ((regeax>>16) & 0xF);
proc->apicid = ((regeax>>24) & 0xF); proc->apicid = ((regeax>>24) & 0xF);
proc->mmx=((regedx>>23) & 0x00000001); proc->mmx=((regedx>>23) & 0x00000001);
proc->sse=((regedx>>25) & 0x00000001); proc->sse=((regedx>>25) & 0x00000001);
proc->sse2=((regedx>>26) & 0x00000001); proc->sse2=((regedx>>26) & 0x00000001);
proc->sse3=(regecx & 0x00000001); proc->sse3=(regecx & 0x00000001);
proc->fpu=(regedx & 0x00000001); proc->fpu=(regedx & 0x00000001);
proc->htt=((regedx>>28) & 0x00000001); proc->htt=((regedx>>28) & 0x00000001);
} }
if (maxextended >= 1) if (maxextended >= 1)
{ {
cpuid(0x80000001, &regeax, &regebx, &regecx, &regedx); cpuid(0x80000001, &regeax, &regebx, &regecx, &regedx);
proc->mmx2=((regedx>>22) & 0x00000001); proc->mmx2=((regedx>>22) & 0x00000001);
proc->apic=((regedx>>9) & 0x00000001); proc->apic=((regedx>>9) & 0x00000001);
proc->now3d=((regedx>>30) & 0x00000001); proc->now3d=((regedx>>30) & 0x00000001);
proc->now3d2=((regedx>>31) & 0x00000001); proc->now3d2=((regedx>>31) & 0x00000001);
} }
if (maxextended >= 4) if (maxextended >= 4)
{ {
int i; int i;
for(i=0;i<3;i++) for(i=0;i<3;i++)
cpuid(0x80000002+i, &regeax, &regebx, &regecx, &regedx); {
memcpy(&regeax,&proc->detectedname[0+i*16],4,1); cpuid(0x80000002+i, &regeax, &regebx, &regecx, &regedx);
memcpy(&regebx,&proc->detectedname[4+i*16],4,1); memcpy(&regeax,&proc->detectedname[0+i*16],4,1);
memcpy(&regecx,&proc->detectedname[8+i*16],4,1); memcpy(&regebx,&proc->detectedname[4+i*16],4,1);
memcpy(&regedx,&proc->detectedname[12+i*16],4,1); memcpy(&regecx,&proc->detectedname[8+i*16],4,1);
} memcpy(&regedx,&proc->detectedname[12+i*16],4,1);
boolean=&proc->mmx; }
i=0; }
boolean=&proc->mmx;
i=0;
for(i=0;i<10;i++) for(i=0;i<10;i++)
if (*(boolean++)==1) if (*(boolean++)==1)
{
strcat(msg[i],&proc->techs);
strcat(space,&proc->techs);
}
return 0;
}
u32 viewstack(u32 number)
{ {
strcat(msg[i],&proc->techs); u32 stack = 0;
strcat(space,&proc->techs); asm (
} "movl %[a1],%%esi;"
return 0; "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));
} }

0
lib/graph.c Normal file → Executable file
View File

51
lib/idt.c Normal file → Executable file
View File

@ -97,125 +97,136 @@ makeidtdes(offset,select,type,&temp);
idt[index]=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() void interruption()
{ {
cli(); cli();
print("Appel d'une interruption"); print("Appel d'une interruption\r\n");
sti(); sti();
iret(); iret();
} }
void exception0() void exception0()
{ {
print("divide error"); print("divide error\r\n");
iret(); iret();
} }
void exception1() void exception1()
{ {
print("debug exception"); cpuerror("debug exception\r\n");
iret(); iret();
} }
void exception2() void exception2()
{ {
print("non-maskable hardware interrupt"); cpuerror("non-maskable hardware interrupt\r\n");
iret(); iret();
} }
void exception3() void exception3()
{ {
print("INT3 instruction"); cpuerror("INT3 instruction\r\n");
iret(); iret();
} }
void exception4() void exception4()
{ {
print("INTO instruction detected overflow"); cpuerror("INTO instruction detected overflow\r\n");
iret(); iret();
} }
void exception5() void exception5()
{ {
print("BOUND instruction detected overrange"); print("BOUND instruction detected overrange\r\n");
iret(); iret();
} }
void exception6() void exception6()
{ {
print("invalid instruction opcode"); cpuerror("invalid instruction opcode\r\n");
iret(); iret();
} }
void exception7() void exception7()
{ {
print("no coprocessor"); cpuerror("no coprocessor\r\n");
iret(); iret();
} }
void exception8() void exception8()
{ {
print("double fault"); cpuerror("double fault\r\n");
iret(); iret();
} }
void exception9() void exception9()
{ {
print("coprocessor segment overrun"); cpuerror("coprocessor segment overrun\r\n");
iret(); iret();
} }
void exception10() void exception10()
{ {
print("invalid task state segment (TSS)"); cpuerror("invalid task state segment (TSS)\r\n");
iret(); iret();
} }
void exception11() void exception11()
{ {
print("segment not present"); cpuerror("segment not present\r\n");
iret(); iret();
} }
void exception12() void exception12()
{ {
print("stack fault"); cpuerror("stack fault");
iret(); iret();
} }
void exception13() void exception13()
{ {
print("general protection fault (GPF)"); cpuerror("general protection fault (GPF)\r\n");
iret(); iret();
} }
void exception14() void exception14()
{ {
print("page fault"); cpuerror("page fault\r\n");
iret(); iret();
} }
void exception15() void exception15()
{ {
print("(reserved)"); cpuerror("(reserved)\r\n");
iret(); iret();
} }
void exception16() void exception16()
{ {
print("coprocessor error"); cpuerror("coprocessor error\r\n");
iret(); iret();
} }
void exception17() void exception17()
{ {
print("alignment check"); cpuerror("alignment check\r\n");
iret(); iret();
} }
void exception18() void exception18()
{ {
print("machine check"); cpuerror("machine check");
iret(); iret();
} }

1
lib/keyboard.c Normal file → Executable file
View File

@ -285,6 +285,7 @@ if ((bufferscan[lastscan]==0xE0)||((kbdstatus & STATUS_NUM)&&(key>=0x47)&&(key<=
void keyboard() void keyboard()
{ {
printf("test");
u8 scancode,ascii; u8 scancode,ascii;
cli(); cli();
while ((inb(0x64)&1)==0); while ((inb(0x64)&1)==0);

0
lib/keymap.c Normal file → Executable file
View File

6
lib/makefile Normal file → Executable file
View File

@ -1,6 +1,6 @@
CC=gcc -O0 -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -I ../Include CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -w -m32 -F pe-i386 -I ../include
LINK=ld -r -o 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 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 all: makeall

0
lib/math.c Normal file → Executable file
View File

0
lib/memory.c Normal file → Executable file
View File

0
lib/modes.c Normal file → Executable file
View File

5
lib/mouse.c Normal file → Executable file
View File

@ -124,7 +124,10 @@ irqendmaster();
irqendslave(); irqendslave();
sti(); sti();
//asm("movl 0x2C(%esp), %ebx;movl 0x30(%esp), %esi;movl 0x34(%esp), %edi;movl 0x38(%esp), %ebp;addl $0x3C, %esp;iret;"); //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;");
} }

0
lib/port.c Normal file → Executable file
View File

0
lib/string.c Normal file → Executable file
View File

0
lib/timer.c Normal file → Executable file
View File

0
lib/types.c Normal file → Executable file
View File

0
lib/vga.c Normal file → Executable file
View File

0
lib/video.c Normal file → Executable file
View File

36
makefile Normal file → Executable file
View File

@ -3,29 +3,41 @@ all: makall
makall: boot/boot12.bin lib/libs.o system/system.sys makall: boot/boot12.bin lib/libs.o system/system.sys
sync sync
install:
(sudo apt-get install nasm gcc qemu fusefat cgdb)
clean: clean:
(cd system; make clean) (cd system; make clean)
(cd boot; make clean) (cd boot; make clean)
(cd lib;make clean) (cd lib;make clean)
(cd final;make clean)
sync sync
backup: clean backup: clean
(cd .. ; tar cf - cosc | gzip -f - > backup.tar.gz ; cd cosc) (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: copy:
(cp boot/loader.sys /cygdrive/a) (cd final; make)
(cp system/system.sys /cygdrive/a)
(dd if=boot/boot12.bin of=/cygdrive/a bs=512 count=1)
copy2: test: all copy qemu
(cp boot/loader.sys /cygdrive/b)
(cp system/system.sys /cygdrive/b) view:
(dd if=boot/boot12.bin of=/cygdrive/b bs=512 count=1) (hexdump -C ./final/cos2000.img|head -c10000)
test: clean all copy2 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: system/system.sys:
(cd system; make) (cd system; make)

0
system/ansi.c Normal file → Executable file
View File

20
system/linker.lds Normal file
View File

@ -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)
}
}

10
system/makefile Normal file → Executable file
View File

@ -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 -m elf_i386 -T linker.lds -e main -o
LINK=ld -e __main -o
all: system.sys all: system.sys
sync sync
system.sys: system.sys:
nasm -f elf -o system.o system.asm nasm -f elf -o system.o system.asm
$(GCC) systemc.o system.c
$(CC) systemc.o system.c
$(LINK) system.sys systemc.o system.o ../lib/libs.o $(LINK) system.sys systemc.o system.o ../lib/libs.o
clean: clean:
@ -17,5 +16,6 @@ clean:
rm -f *.out rm -f *.out
rm -f *.bin rm -f *.bin
rm -f *.sys rm -f *.sys
rm -f *.s

0
system/system.asm Normal file → Executable file
View File

18
system/system.c Normal file → Executable file
View File

@ -12,18 +12,19 @@
static cpuinfo cpu; static cpuinfo cpu;
static u8 noproc[]="\033[31mInconnu\033[0m\000"; 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() void ok()
{ {
static u8 okmsg[]="\033[99C\033[8D\033[37m\033[1m[ \033[32mOK\033[37m ]\033[0m\000"; print(okmsg);
print(okmsg); return;
return;
} }
int _main(void) { int main(void) {
cli(); cli();
setvmode(0x02); setvmode(0x02);
/* Efface l'ecran */ /* Efface l'ecran */
print("\033[2J\000"); print("\033[2J\000");
printf(ansilogo); printf(ansilogo);
@ -44,7 +45,7 @@ int _main(void) {
ok(); ok();
print("Activation de l'IRQ 0\000"); print("Activation de l'IRQ 0\000");
enableirq(0); //enableirq(0);
ok(); ok();
print("Installation du handler clavier\000"); 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); 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(); ok();
u8 key=0;
while(1) while(1)
{ {
key=waitascii(); key=waitascii();
putchar(key); putchar(key);
} }
} }