Merge branch 'release/2.2.0'

This commit is contained in:
Nicolas Hordé 2007-04-02 14:36:13 +00:00
commit 6571bc696e
77 changed files with 5019 additions and 4513 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

4
SCREENSHOTS.md Normal file
View File

@ -0,0 +1,4 @@
![logo](https://github.com/dahut87/cos2000v2/raw/master/Graphisme/logo.png)
## Copies d'écran de COS2000
![screen](https://github.com/dahut87/cos2000v2/raw/develop/Graphisme/screenshots/ansi.png)

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

@ -26,38 +26,26 @@ Serial_Number dd 0x01020304 ;N
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
;Cpu_Message db "CPU test",0 Boot_Message db "Cos2000",0
Boot_Message db "Booting ",0 Entre_Message db "Fichier",0
Finding_Message db "System ",0 Loading_Message db "Charger",0
Loading_Message db "Loading ",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
System_File db "SYSTEM SYS"
Is_Ok db " [ OK ]",0x0A,0x0D,0 Is_Ok db " [ OK ]",0x0A,0x0D,0
Is_Failed db "[Failed]",0x0A,0x0D,"Press a key",0x0A,0x0D,0 Is_Failed db " [ERREUR]",0x0A,0x0D,0
The_Dot db '.',0 The_Dot db '.',0
Boot_Error: Boot_Error:
mov si,Is_Failed mov si,Is_Failed
call ShowString call ShowString
mov ah,0 xor ax,ax
int 0x16 int 0x16
int 0x19 int 0x19
Boot_Ok: Boot_Ok:
mov al,[Stage]
cmp al,0
jz No_Ok
mov si,Is_Ok mov si,Is_Ok
call ShowString call ShowString
No_Ok:
xor ah,ah
mov si,ax
add si,Boot_Message ;Cpu_Message
call ShowString
add byte [Stage],0x09
ret ret
Stage db 0
Boot: Boot:
push cs push cs
push cs push cs
@ -69,21 +57,29 @@ Boot:
mov ss,ax mov ss,ax
mov sp,0xFFFF mov sp,0xFFFF
sti sti
; call Detect_Cpu mov si,Boot_Message
; jc Boot_Error call ShowString
call Boot_Ok
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 di,Fat_Buffer mov di,Fat_Buffer
push bx
push cx
readfat:
call ReadSector call ReadSector
jc Boot_Error jc Boot_Error
inc cx
add di,[Sectors_Size]
dec bx
jnz readfat
pop cx
pop bx
xor ax,ax xor ax,ax
mov al,[Fats_Number] mov al,[Fats_Number]
mov bx,[Sectors_Per_Fat]
mul bx mul bx
add cx,ax add cx,ax
mov ax,32 mov ax,32
@ -94,6 +90,8 @@ Boot:
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
call ShowString
Find_System: Find_System:
mov di,Buffer mov di,Buffer
call ReadSector call ReadSector
@ -105,7 +103,7 @@ Next_Root_Entrie:
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
@ -120,13 +118,15 @@ 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,0x0071 mov si,Entre_Message
call ShowString
mov cx,[di+26+32]
mov ax,0x0080
mov es,ax mov es,ax
push es push es
mov di,0x100 mov di,0x0
push di push di
call Boot_Ok
mov si,The_Dot mov si,The_Dot
Resume_Loading: Resume_Loading:
cmp cx,0x0FF0 cmp cx,0x0FF0
@ -232,35 +232,6 @@ End_Show:
popa popa
ret ret
;======================DETECTCPU======================
;Detecte si le processeur est un 386 au mini
;->
;<- Flag Carry si erreur
;=====================================================
;Detect_Cpu:
; push ax ; test if 8088/8086 is present (flag bits 12-15 will be set)
; xor ah,ah ; ah = 0
; push ax ; copy ax into the flags
; popf ; with bits 12-15 clear
; pushf ; Read flags back into ax
; pop ax
; and ah,0xF0 ; check if bits 12-15 are set
; cmp ah,0xF0
; je No_386 ; no 386 detected (8088/8086 present)
; ; check for a 286 (bits 12-15 are clear)
; mov ah,0xF0 ; set bits 12-15
; push ax ; copy ax onto the flags
; popf
; pushf ; copy the flags into ax
; pop ax
; and ah,0xF0 ; check if bits 12-15 are clear
; jz No_386 ; no 386 detected (80286 present)
; clc
; ret
;No_386:
; stc
; ret
times 510-($-$$) db ' ' times 510-($-$$) db ' '
dw 0xAA55 dw 0xAA55

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

852
boot/loader.asm Executable file
View File

@ -0,0 +1,852 @@
[BITS 16]
[ORG 0x0]
SECTION .text
push cs
push cs
pop ds
pop es
mov si,msg0
call showstr
mov si,msg1
call showstr
call initfat
call ok
mov si,msg2
call showstr
mov si,System_File
call search
call ok
mov si,msg3
call showstr
call EnableA20
call ok
mov si,msg4
call showstr
mov eax,cs
shl eax,4
mov [GDT.Entry1+2],ax
mov [GDT.Entry2+2],ax
shr eax,16
mov [GDT.Entry1+4],al
mov [GDT.Entry2+4],al
mov eax,cs
shl eax,4
add eax,gdt0
mov [GDTR.Address],eax
lgdt [GDTR]
call ok
mov si,msg5
call showstr
cli
mov eax,cr0
or al,1
mov cr0,eax
jmp short $+2
mov bx,SYS_DATA_SEL
mov fs,bx
mov ds,bx
mov es,bx
mov gs,bx
and al,0FEh
mov cr0,eax
jmp short $+2
mov bx,cs
mov fs,bx
mov ds,bx
mov es,bx
mov gs,bx
sti
call ok
mov si,msg6
call showstr
mov ebx,0x300000
call load
call ok
mov si,msg7
call showstr
call initpe
call ok
suite:
;mov cx,suite
;call debug
mov si,msg8
call showstr
cli
mov al,0x80
out 0x70,al
mov eax,cr0
or al,1
mov cr0,eax
jmp SYS_CODE_SEL:GoPMode32
Boot_Error:
mov si,error
call showstr
xor ax,ax
int 16h
jmp 0xFFFF:0x0
ok:
push si
push cx
mov cl,67
call eol
mov si,okay
call showstr
pop cx
pop si
ret
;======================INITPE========================
;Initialise le PE de l'adresse EBX
;->
;<- Flag Carry si erreur
;=====================================================
initpe:
pusha
push es
xor ax,ax
mov es,ax
mov [begin],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
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
pop cx
mov esi,info4
call showstr
mov edx,[es:edi+Sections.Size]
push cx
mov cx,32
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 ecx
jnz copietomem
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 ecx
jnz zerotomem
pop ecx
pop edi
pop esi
pop eax
ret
begin dd 0
entriepoint 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
;-> EDX un entier, CX la taille
;<-
;===========================================
ShowHex:
push ax
push bx
push cx
push edx
push si
mov ax,cx
shr ax,2
sub cx,32
neg cx
shl edx,cl
xor cx,cx
inc cx
Hexaize:
rol edx,4
mov bx,dx
and bx,0fh
mov si,ax
mov al,[cs:bx+Tab]
xor bx,bx
mov ah,0x09
mov bl,[cs:thecolor]
int 0x10
mov ah,0x0E
int 0x10
mov ax,si
dec al
jnz Hexaize
pop si
pop edx
pop cx
pop bx
pop ax
ret
Tab db '0123456789ABCDEF'
;======================EOL========================
;Va en colonne CX
;->
;<- Flag Carry si erreur
;=====================================================
eol:
pusha
mov bp,cx
mov ah,03
xor bx,bx
int 10h
mov ah,02
mov cx,bp
mov dl,cl
int 10h
popa
ret
;======================LOAD========================
;Charge le groupe en mémoire en ebx
;->
;<- Flag Carry si erreur
;=====================================================
load:
push ax
push ebx
push ecx
push edx
push esi
push edi
push fs
xor edx,edx
xor ax,ax
mov fs,ax
mov si,The_Dot
mov dx,[Sectors_Size]
Resume_Loading:
cmp cx,0x0FF0
jae Finish_Loading
push cx
add cx,word [data]
mov edi,Buffer
call ReadSector
pop cx
jc near Boot_Error
call showstr
push esi
push ebx
push cx
mov esi,Buffer
mov cx,dx
shr cx,2
copie:
mov eax,[ds:esi]
mov [fs:ebx],eax
add ebx,4
add esi,4
dec cx
jnz copie
pop cx
pop ebx
pop esi
add ebx,edx
call NextFatGroup
jc near Boot_Error
jmp Resume_Loading
Finish_Loading:
pop fs
pop edi
pop esi
pop edx
pop ecx
pop ebx
pop ax
ret
;======================INITFAT========================
;Initialise les variables de la fat
;->
;<- Flag Carry si erreur
;=====================================================
initfat:
pusha
push ds
xor ax,ax
mov ds,ax
mov si,0x7C0B
mov di,bootsector
mov cx, 512
rep movsb
pop ds
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
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 [entries],cx
mov ax,32
mul word [Fits_Number]
div word [Sectors_Size]
add cx,ax
sub cx,2
mov word [data],cx
popa
ret
;======================SEARCH========================
;Recherche le groupe d'un fichier
;-> si nom du fichier
;<- Flag Carry si erreur CX
;=====================================================
search:
push bx
push dx
push di
mov cx,[entries]
mov di,Buffer
call ReadSector
jc Boot_Error
xor bx,bx
Next_Root_Entrie:
cmp byte [di],0
je Boot_Error
push si
push di
push cx
mov cx,32
rep cmpsb
pop cx
pop di
pop si
je Found
add di,32
add bx,32
inc dx
cmp dx,[Fits_Number]
ja Boot_Error
cmp bx,[Sectors_Size]
jb Next_Root_Entrie
inc cx
Found:
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:esi à l'écran
;-> DS, SI
;<- Flag Carry si erreur
;=====================================================
showstr:
pushad
xor bh,bh
nextchar:
mov al,[ds:esi]
inc esi
or al,al
jz endshow
cmp al,' '
jb justchar
cmp al,'#'
jne nocolor
mov al,[ds:esi]
inc esi
sub al,'0'
shl al,3
mov [cs:thecolor],al
shr al,2
add [cs:thecolor],al
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:
popad
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)
;<- Flag Carry si erreur
;=====================================================
ReadSector:
pusha
mov ax,cx
xor dx,dx
div word [Sectors_Per_Track]
inc dl
mov bl,dl
xor dx,dx
div word [Heads_Number]
mov dh, [Boot_Drive]
xchg dl,dh
mov cx,ax
xchg cl,ch
shl cl,6
or cl, bl
mov bx,di
mov si, 4
mov al, 1
Read_Again:
mov ah, 2
int 0x13
jnc Read_Done
dec si
jnz Read_Again
Read_Done:
popa
ret
;===================NEXTFATGROUP======================
;Renvoie en CX le groupe qui succède dans la FAT le groupe CX
;-> CX
;<-
;=====================================================
NextFatGroup:
push bx
push dx
push di
mov ax,cx
mov bx,ax
and bx,0000000000000001b
shr ax,1
mov cx,3
mul cx
mov di,Fat_Buffer
add di,ax
cmp bx,0
jnz Even_Group
Odd_Group:
mov dx,[di]
and dx,0x0FFF
mov cx,dx
jmp Next_Group_Found
Even_Group:
mov dx,[di+1]
and dx,0xFFF0
shr dx,4
mov cx,dx
Next_Group_Found:
pop di
pop dx
pop bx
ret
;***********************EnableA20*******************************
;->
;<-
;Ouvre l'autoroute A20
;***************************************************************
EnableA20:
cli
call ClearKeybBuffer
call WaitKeybCommand
mov al,0xd1
out 0x64,al
call WaitKeybCommand
mov al,0xdf
out 0x60,al
call WaitKeybCommand
jmp A20Enabled
WaitKeybCommand:
in al,0x64
test al,0x02
jnz WaitKeybCommand
ret
ClearKeybBuffer:
in al,0x64
test al,0x01
jnz ReadKeyb
ret
ReadKeyb:
in al,0x60
jmp ClearKeybBuffer
A20Enabled:
sti
ret
GoPMode32:
[BITS 32]
mov ax,ALL_DATA_SEL
mov es,ax
mov gs,ax
mov fs,ax
mov ss,ax
mov ds,ax
mov esp,0x3fffff
push KERNEL_SEL
push dword [cs:entriepoint]
retf
section .data
thecolor db 0x07
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 format ELF',0
msg8 db '#07Passage en mode protege',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,' <Appuyez une touche pour redemarrer>',0
The_Dot db '.',0
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
GDTR:
.Size: dw GDT_END
.Address: dd 0
gdt0 equ $ ; null entry
GDT:
.Entry0: dw 0 ; limit 15:0
dw 0 ; base 15:0
db 0 ; base 23:16
db 0 ; type
db 0 ; limit 19:16, flags
db 0 ; base 31:24
SYS_CODE_SEL equ $-gdt0 ; code segment descriptor
.Entry1: dw 0xFFFF
dw 0x0 ; base
db 0x0 ; base
db 0x9A ; present, ring 0, code, non-conforming, readable
db 0xCF ; 32 bit
db 0
SYS_DATA_SEL equ $-gdt0 ; data segment descriptor
.Entry2: dw 0xFFFF
dw 0x0 ; base
db 0x0 ; base
db 0x92 ; present, ring 0, data, expand-up, writable
db 0xCF ; 32 bit
db 0
ALL_DATA_SEL equ $-gdt0 ; 4meg data segment descriptor
.Entry3: dw 0xFFFF
dw 0x0 ; base
db 0x0 ; base
db 0x92 ; present, ring 0, data, expand-up, writable
db 0xCF ; 4k pages, 32 bit
db 0
KERNEL_SEL equ $-gdt0 ; 4g code segment descriptor
.Entry4: dw 0xffff
dw 0x0 ; base
db 0x0 ; base
db 0x9A ; present, ring 0, code, non-conforming, readable
db 0xCF ; 4k pages, 32 bit
db 0
GDT_END equ $-gdt0 -1
bootsector equ $
Sectors_Size dw 0 ;Nombre d'octets/secteur
Sectors_Per_Cluster db 0 ;Nombre de secteurs/cluster
Reserved_Sectors dw 0 ;Nombre de secteurs réservé
Fats_Number db 0 ;Nombre de copies de la FAT
Fits_Number dw 0 ;Taille du répertoire racine
Sectors_Per_Disk dw 0 ;Nombre secteurs du volume si < 32 Mo
Media_Descriptor db 0 ;Descripteur de média
Sectors_Per_Fat dw 0 ;Nombre secteurs/FAT
Sectors_Per_Track dw 0 ;Nombre secteurs/piste
Heads_Number dw 0 ;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 0 ;Signature Boot étendu 29h
Buffer equ $
Fat_Buffer equ $+512
SECTION .bss
%include "elf.h"

20
boot/makefile Normal file → Executable file
View File

@ -1,19 +1,17 @@
CC=nasm -f bin -o
all: makall all: makall
makall: boot12.bin boot16.bin boottest.bin bootcp.com makall: boot12.bin boot16.bin loader.sys
sync
boot12.bin: boot12.bin: boot12.asm
nasm -f bin -o boot12.bin boot12.asm $(CC) $@ $^
boot16.bin: boot16.bin: boot16.asm
nasm -f bin -o boot16.bin boot16.asm $(CC) $@ $^
boottest.bin: loader.sys: loader.asm
nasm -f bin -o boottest.bin boottest.asm $(CC) $@ $^
bootcp.com:
nasm -f bin -o bootcp.com bootcp.asm
clean: clean:
rm -f *.o rm -f *.o

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 Executable file
View File

26
include/Kmemory.h Executable file
View File

@ -0,0 +1,26 @@
/***********************************/
/* Librairie Kmemory.h */
/* 20 Mars 2007 */
/***********************************/
#ifndef JREKCED_KERNEL_MEMORY
# define JREKCED_KERNEL_MEMORY
# include "type.h"
# define MEMORY_BLOC_SIZE (1024L) /* Taille des blocs */
// Initialise les gestionnaire de memoire.
void Kernel_InitMemory (void *DataMemory, // DataMemory pointe vers la zone de memoire disponible.
UDWORD TotalMemorySize); // TotalMemorySize est la quantite total de memoire disponible.
void * Kernel_mballoc(UDWORD Size); // Alloue SIZE blocs de memoire et retourne un pointeur sur la zone.
// Retourne un pointeur nul si l'allocation est impossible.
int Kernel_mbfree (void *Adresse); // Libere le bloc memoire alloue a l'adresse ADRESSE.
// Retourne -1 si adresse incorrecte et 0 si tout s'est bien deroule.
void * Kernel_mbrealloc (void *Adresse, UDWORD Size); // Redimensionne un bloc, retourne NULL si le bloc
// n'est pas redimensionne.
#endif

85
include/LDT.h Executable file
View File

@ -0,0 +1,85 @@
/***********************************/
/* Librairie LDT.h */
/* 23 Mars 2007 */
/***********************************/
#ifndef JREKCED_LDT
# define JREKCED_LDT
# include "type.h"
# define LDT_BLOC_SIZE (128) /* Nombre de descripteur LDT dans un bloc */
// Types d'acces
# define GLT_ACCESSED (0x1)
# define LDT_DATA (0x0)
# define LDT_DATA_WRITE (0x2)
# define LDT_DATA_EXPAND (0x4)
# define LDT_CODE (0x8)
# define LDT_CODE_READ (0xA)
# define LDT_CODE_CONFORMING (0xD)
// Granularite
# define LDT_BYTE (0x0)
# define LDT_4KB (0x1)
// Mode du CPU
# define LDT_16BIT (0x0)
# define LDT_32BIT (0x1)
typedef struct
{
UWORD Limite_0_15; // Bit 00-15 : Limite (0-15)
UWORD Adresse_0_15; // Bit 16-31 : Adresse (0-15)
UBYTE Adresse_16_23; // Bit 32-39 : Adresse (16-23)
UBYTE Acces : 1; // 0 = System
// 1 = Code ou data
UBYTE Type : 4; // Bit 41-44 : Type
UBYTE DPL : 2; // Spécifie le niveau de privilège du segment
UBYTE Present : 1; // Indique si le segment est en mémoire (bit a 1) ou non (bit a 0)
UBYTE Limite_16_19 : 4; // Bit 48-51 : Limite (16-19)
UBYTE UserDefine : 1; // Bit 52 : Utilisation libre
UBYTE Unused : 1; // Bit 53 : Non utilise (toujours = 0)
UBYTE CPUMode : 1; // Bit 54 : = 0 -> 16-Bit
// = 1 -> 32-Bit
UBYTE Granularite : 1; // Si = 0 : Limite = 1 octet -> 1 Mo
// Si = 1 : Limite = 4 Ko -> 4 Go
UBYTE Adresse_24_31; // Bit 56-63 : Adresse (24-31)
} T_LDT;
typedef struct
{
UWORD Size; // Taille de la GDT
void * Adresse; // Adresse phisique de la GDT;
UWORD Empty;
} T_LDT_reg;
// T_LDT *GDT_BASE = ((T_LDT*)0x0800L); /* Addresse physique ou reside la GDT, le 1e element est toujours null */
T_LDT * LDT_balloc (UWORD Size); // Alloue un bloc de Size LDT
int LDT_bfree (void * Adresse); // Libere un bloc LDT
T_LDT * LDT_brealloc (T_LDT * OldLDT, UWORD NewSize); // Redimensionne un bloc LDT, retourne NULL en cas d'erreur.
T_LDT * LDT_AllocLDT (T_LDT *BaseLDT); // Cherche un LDT libre dans un bloc precedement
// alloue avec LDT_balloc.
// Retourne NULL si aucun bloc disponible.
// Si un bloc libre est trouve, il est marque comme
// utilise et un pointeur sur ce LDT est retourne.
int LDT_FreeLDT (T_LDT *LDT); // Marque le LDT comme non utilise et le met a NULL.
int LDT_MapMemory (T_LDT *LDT, void * Linear, // Met des donnees dans un LDT.
UDWORD Size, // Cette fonction est a tester.
UBYTE Granularite,
UBYTE DPL, UBYTE Type,
UBYTE CPUMode);
#endif

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

@ -8,8 +8,15 @@
#define nop() asm("nop"::) #define nop() asm("nop"::)
#define iret() asm("addl $0x0C, %esp; \ #define pushad() asm("pushal"::)
iret;")
#define popad() asm("popal"::)
#define pushf() asm("pushf"::)
#define popf() asm("popf"::)
#define iret() asm("iret"::)
#define irqendmaster() asm("movb $0x20,%al; \ #define irqendmaster() asm("movb $0x20,%al; \
outb %al,$0x20;") outb %al,$0x20;")

31
include/cpu.h Executable file
View File

@ -0,0 +1,31 @@
typedef struct cpuinfo
{
u8 vendor[13];
u8 names[32];
u8 detectedname[48];
u8 techs[48];
u8 stepping;
u8 models;
u8 family;
u8 types;
u8 emodels;
u8 efamily;
u8 apicid;
u8 count;
u8 linesize;
u8 brandid;
bool mmx;
bool mmx2;
bool sse;
bool sse2;
bool sse3;
bool fpu;
bool now3d;
bool now3d2;
bool htt;
bool apic;
} cpuinfo __attribute__ ((packed));
u8 getcpuinfos(cpuinfo *inf);

6
include/cpuid.h Executable file
View File

@ -0,0 +1,6 @@
bool cansetflag (u32 flag);
void cpuid(u32 op, u32 *eax, u32 *ebx,u32 *ecx, u32 *edx);
void dump_regs();

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

1
include/graph.h Executable file
View File

@ -0,0 +1 @@
void line(u32 x1, u32 y1, u32 x2, u32 y2, u8 color);

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

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

@ -28,35 +28,6 @@
#define STATUS_NUM 0x2000 #define STATUS_NUM 0x2000
#define STATUS_SCRL 0x4000 #define STATUS_SCRL 0x4000
/* "ASCII" values for non-ASCII keys. All of these are user-defined.*/
#define KEY_F1 0x80
#define KEY_F2 (KEY_F1 + 1)
#define KEY_F3 (KEY_F2 + 1)
#define KEY_F4 (KEY_F3 + 1)
#define KEY_F5 (KEY_F4 + 1)
#define KEY_F6 (KEY_F5 + 1)
#define KEY_F7 (KEY_F6 + 1)
#define KEY_F8 (KEY_F7 + 1)
#define KEY_F9 (KEY_F8 + 1)
#define KEY_F10 (KEY_F9 + 1)
#define KEY_F11 (KEY_F10 + 1)
#define KEY_F12 (KEY_F11 + 1)
#define KEY_INS 0x90
#define KEY_DEL (KEY_INS + 1)
#define KEY_HOME (KEY_DEL + 1)
#define KEY_END (KEY_HOME + 1)
#define KEY_PGUP (KEY_END + 1)
#define KEY_PGDN (KEY_PGUP + 1)
#define KEY_LFT (KEY_PGDN + 1)
#define KEY_UP (KEY_LFT + 1)
#define KEY_DN (KEY_UP + 1)
#define KEY_RT (KEY_DN + 1)
#define KEY_PRNT (KEY_RT + 1)
#define KEY_PAUSE (KEY_PRNT + 1)
#define KEY_LWIN (KEY_PAUSE + 1)
#define KEY_RWIN (KEY_LWIN + 1)
#define KEY_MENU (KEY_RWIN + 1)
void keyboard(); void keyboard();
void outkbd(u8 port, u8 data);
u8 waitascii();

3
include/math.h Executable file
View File

@ -0,0 +1,3 @@
#define sgn(x) ((x<0)?-1:((x>0)?1:0));
u32 abs(int x);

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

@ -3,3 +3,4 @@
void memset(void *dst, u8 val, u32 count,u32 size); void memset(void *dst, u8 val, u32 count,u32 size);
void memcpy(void *src, void *dst, u32 count, u32 size); void memcpy(void *src, void *dst, u32 count, u32 size);
u32 memcmp(void *src, void *dst, u32 count, u32 size); u32 memcmp(void *src, void *dst, u32 count, u32 size);

4
include/mouse.h Executable file
View File

@ -0,0 +1,4 @@
bool initmouse();
void mouse();
void outmseack(u8 value);
void outmsecmd(u8 command);

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

21
include/stdarg.h Executable file
View File

@ -0,0 +1,21 @@
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
#define __GNUC_VA_LIST
typedef void *__gnuc_va_list;
#define __va_rounded_size(TYPE) (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#define va_start(AP, LASTARG) (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
void va_end (__gnuc_va_list);
#define va_end(AP) ((void)0)
#define va_arg(AP, TYPE) (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
#define __va_copy(dest, src) (dest) = (src)
typedef __gnuc_va_list va_list;
#endif

8
include/string.h Executable file
View File

@ -0,0 +1,8 @@
#include "types.h"
s8 strcmp(const u8 *src,const u8 *des);
u32 strlen(const u8 *src);
u8 *strchr(const u8 *src, u8 achar);
u8 *strncpy(const u8 *src,u8 *des,u32 count);
u8 *strcat(const u8 *src,u8 *des);
u8* strcpy(const u8 *src, u8 *des);

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

31
include/type.h Executable file
View File

@ -0,0 +1,31 @@
/***********************************/
/* Librairie Type.h */
/* 20 Mars 2007 */
/***********************************/
#ifndef JREKCED_TYPE
# define JREKCED_TYPE
# define NULL (0x0LL)
typedef char int8;
typedef short int16;
typedef int int32;
typedef long long int64;
typedef char BYTE;
typedef short WORD;
typedef long DWORD;
typedef long long QWORD;
typedef signed char SBYTE;
typedef signed short SWORD;
typedef signed long SDWORD;
typedef signed long long SQWORD;
typedef unsigned char UBYTE;
typedef unsigned short UWORD;
typedef unsigned long UDWORD;
typedef unsigned long long UQWORD;
#endif

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

@ -4,9 +4,16 @@
typedef unsigned char u8; typedef unsigned char u8;
typedef unsigned short u16; typedef unsigned short u16;
typedef unsigned int u32; typedef unsigned int u32;
typedef unsigned char uchar; typedef char s8;
typedef short s16;
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;
@ -15,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"
{ {

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

@ -10,7 +10,7 @@ u32 setvmode(u8);
u32 loadfont(u8* def,u8 size,u8 font); u32 loadfont(u8* def,u8 size,u8 font);
void gotoscr(u16 x,u16 y); void gotoscr(u16 x,u16 y);
void useplane(u8 plan); void useplane(u8 plan);
u8 getfont(u8 num); u8 getfont();
void setfont(u8 num); void setfont(u8 num);
void waitvretrace (void); void waitvretrace (void);
void waithretrace (void); void waithretrace (void);
@ -22,8 +22,16 @@ void (*writepxl)(u16 x, u16 y, u32 c);
void (*showchar)(u16 coordx,u16 coordy,u8 thechar,u8 attrib); void (*showchar)(u16 coordx,u16 coordy,u8 thechar,u8 attrib);
void (*fill)(u8 attrib); void (*fill)(u8 attrib);
void (*scroll)(u8 lines,u8 attrib); void (*scroll)(u8 lines,u8 attrib);
void split(u16 x);
void showpage(u8 page);
u8 getpage();
void setpage(u8 page);
u16 getnbpages();
u16 getyres();
u8 getdepth();
u16 getxres();
u8 getfont2();
void enableblink();
void disableblink();
u8 (*getchar)(u16 coordx,u16 coordy);
u8 (*getattrib)(u16 coordx,u16 coordy);

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

@ -1,4 +1,19 @@
typedef struct console {
u8 attrib;
s16 cursX;
s16 cursY;
u8 ansi;
u8 param1;
u8 param2;
u8 param3;
u8 page;
} console __attribute__ ((packed));
void showhex(u8 src); void showhex(u8 src);
void putchar(u8 thechar); void putchar(u8 thechar);
void print(u8* string); void print(u8* string);
void printf (const u8 *string, ...);
void changevc(u8 vc);

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

5
lib/3d.c Executable file
View File

@ -0,0 +1,5 @@
#include "3d.h"
#include "vga.h"
#include "types.h"
#include "video.h"
#include "graph.h"

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

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

156
lib/Kmemory.c Executable file
View File

@ -0,0 +1,156 @@
/***********************************/
/* Librairie Kmemory.c */
/* 20 Mars 2007 */
/***********************************/
#include <type.h>
#include <Kmemory.h>
/* Structure table d'allocation memoire */
typedef struct
{
UBYTE Used : 1; // = 0 -> La zone memoire est libre.
// = 1 -> La zone memoire est utilisee.
UBYTE Expand : 1; // = 0 -> Fin du bloc.
// = 1 -> Le bloc se prolonge sur le bloc suivant.
UBYTE UnUsed : 6; // Zone libre.
} T_KernelMemoryMap;
T_KernelMemoryMap * BlocAllocate = NULL; // Table d'allocation des blocs memoire.
void * BaseDynAlloc = NULL; // Pointeur sur la zone memoire allouable.
UDWORD MaxMemoryBlocs;
// Initialisation du gestionnaire de memoire.
void Kernel_InitMemory (void *DataMemory, UDWORD TotalMemorySize)
{
UDWORD Boucle;
UDWORD TableBlocs;
UDWORD TotalBlocs;
// Alignement des bloc de memoire a un multiple de MEMORY_BLOC_SIZE
if ( (UDWORD)DataMemory % MEMORY_BLOC_SIZE != 0)
{ DataMemory = ((void*) ((((UDWORD)DataMemory) / MEMORY_BLOC_SIZE) * MEMORY_BLOC_SIZE) + MEMORY_BLOC_SIZE ); };
TotalBlocs = (((void*)TotalMemorySize) - DataMemory) / MEMORY_BLOC_SIZE;
TableBlocs = TotalBlocs / MEMORY_BLOC_SIZE;
MaxMemoryBlocs = TotalBlocs - TableBlocs;
BlocAllocate = (T_KernelMemoryMap *)DataMemory;
BaseDynAlloc = DataMemory + (TableBlocs * MEMORY_BLOC_SIZE);
for (Boucle = 0; Boucle < MaxMemoryBlocs; Boucle++)
{
BlocAllocate [Boucle].Used = 0;
BlocAllocate [Boucle].Expand = 0;
}
}
// Alloue SIZE blocs de memoire
void * Kernel_mballoc(UDWORD Size)
{
UDWORD Counter = 0;
UDWORD Base = 0;
UDWORD Boucle, Boucle2;
if (Size == 0) return NULL;
for (Boucle = 0; Boucle < MaxMemoryBlocs; Boucle++)
{
if (BlocAllocate[Boucle].Used == 0) { Counter++; }
else { Counter = 0; Base = Boucle + 1; }
if (Counter >= Size)
{
if (Base+Size > MaxMemoryBlocs) return NULL;
for (Boucle2=Base; Boucle2 < (Base+Size); Boucle2++)
{
BlocAllocate[Boucle2].Used = 1;
if (Boucle2+1 < (Base+Size) ) { BlocAllocate[Boucle2].Expand = 1; }
else { BlocAllocate[Boucle2].Expand = 0; }
}
return ((void*) (BaseDynAlloc + (Base * MEMORY_BLOC_SIZE) ));
}
}
return NULL;
}
// Libere un bloc memoire
int Kernel_mbfree (void *Adresse)
{
UDWORD Bloc;
if (((Adresse - BaseDynAlloc) % MEMORY_BLOC_SIZE) != 0) return -1;
if ((((UDWORD)Adresse) % MEMORY_BLOC_SIZE) != 0) return -1;
Bloc = (Adresse - BaseDynAlloc) / MEMORY_BLOC_SIZE;
for (; BlocAllocate[Bloc].Expand == 1; Bloc++)
{
BlocAllocate[Bloc].Used = 0;
BlocAllocate[Bloc].Expand = 0;
}
BlocAllocate[Bloc].Used = 0;
BlocAllocate[Bloc].Expand = 0;
return 0;
};
void * Kernel_mbrealloc (void *Adresse, UDWORD Size)
{
UDWORD Bloc, Boucle, OldSize, CopySize;
void * NewAdresse;
if (((Adresse - BaseDynAlloc) % MEMORY_BLOC_SIZE) != 0) return NULL;
Bloc = (Adresse - BaseDynAlloc) / MEMORY_BLOC_SIZE;
if (BlocAllocate[Bloc].Used == 0) return NULL;
for (Boucle = Bloc; BlocAllocate[Boucle].Expand == 1; Boucle++)
{ if (Boucle >= MaxMemoryBlocs) break; };
OldSize = Boucle - Bloc + 1;
// Si pas de changement de taille de bloc, ...
if ( Size == OldSize) return Adresse;
// Si on reduit le nombre de bloc, ...
if ( Size < OldSize)
{
for (Boucle = (Bloc + Size); Boucle < (Bloc + OldSize) ; Boucle++)
{
BlocAllocate[Boucle].Used = 0;
BlocAllocate[Boucle].Expand = 0;
}
BlocAllocate[Size-1].Expand = 0;
return Adresse;
}
// Si on augmente le nombre de bloc
for (Boucle = (Bloc + OldSize); Boucle < (Bloc + Size) ; Boucle++)
{
// Si le bloc ne peut etre simplement agrandit, ...
if ( BlocAllocate[Boucle].Used == 1 )
{
NewAdresse = Kernel_mballoc (Size);
if (NewAdresse == NULL) return NULL;
CopySize = (OldSize * MEMORY_BLOC_SIZE) / sizeof (int64);
for (Boucle = 0; Boucle < CopySize; Boucle++)
{ ((int64*) NewAdresse)[Boucle] = ((int64*) Adresse)[Boucle]; };
Kernel_mbfree (Adresse);
return NewAdresse;
}
}
// Le bloc est simplement agrandit
for (Boucle = (Bloc + OldSize - 1); Boucle < (Bloc + Size) ; Boucle++)
{
BlocAllocate[Boucle].Used = 1;
BlocAllocate[Boucle].Expand = 1;
}
BlocAllocate[Size-1].Expand = 0;
return Adresse;
}
#undef MAX_MEMORY_BLOCS

236
lib/LDT.c Executable file
View File

@ -0,0 +1,236 @@
/***********************************/
/* Librairie LDT.c */
/* 23 Mars 2007 */
/***********************************/
#include "LDT.h"
#include "Kmemory.h"
# define LDT_MANAGER_SIZE (127)
typedef struct // Structure de gestion des bloc LDT
{
void * Next; // Pointeur de chainage
UDWORD Empty;
T_LDT_reg LDTdesc [LDT_MANAGER_SIZE]; // Nombre de blocs LDT
} T_LDT_Manager;
void LDT_initalloc (void *AllocTable, UDWORD Index, UDWORD SetSize, UDWORD TotalSize);
T_LDT_Manager * LDT_mballoc (UWORD Size);
/////////////////////////////////////////////////////////////////////////
T_LDT_Manager * LDT_Manager = NULL;
/////////////////////////////////////////////////////////////////////////
T_LDT * LDT_balloc (UWORD Size) // Alloue un bloc de Size LDT
{
UWORD Boucle;
UDWORD Blocs, Boucle2;
T_LDT_Manager * * ptr_Manager = &LDT_Manager;
T_LDT_Manager * Manager = LDT_Manager;
do
{
if (* ptr_Manager == NULL)
{
* ptr_Manager = Kernel_mballoc (1);
Manager = * ptr_Manager;
Manager->Next = NULL;
for (Boucle = 0; Boucle < LDT_MANAGER_SIZE; Boucle++)
{
Manager->LDTdesc [Boucle].Adresse = NULL;
Manager->LDTdesc [Boucle].Size = NULL;
}
}
for (Boucle = 0; Boucle < LDT_MANAGER_SIZE; Boucle++)
{
if (Manager->LDTdesc [Boucle].Adresse == NULL)
{
Blocs = Size * sizeof(T_LDT);
if (Blocs % MEMORY_BLOC_SIZE == 0)
{ Blocs /= MEMORY_BLOC_SIZE; } else { Blocs = (Blocs / MEMORY_BLOC_SIZE) + 1; }
Manager->LDTdesc [Boucle].Adresse = Kernel_mballoc (Blocs);
if (Manager->LDTdesc [Boucle].Adresse == NULL) return NULL;
Manager->LDTdesc [Boucle].Size = (Blocs * MEMORY_BLOC_SIZE) / sizeof(T_LDT);
// Mise a zero de la LDT
for (Boucle2 = 0; Boucle2 < Manager->LDTdesc [Boucle].Size; Boucle2++)
{ ((int64*) Manager->LDTdesc [Boucle].Adresse)[Boucle2] = NULL; }
return Manager->LDTdesc [Boucle].Adresse;
}
}
*ptr_Manager = Manager;
Manager = Manager->Next;
} while (1);
}
int LDT_bfree (void * Adresse) // Libere un bloc LDT
{
UWORD Boucle, Boucle2;
int RetVal;
T_LDT_Manager * * ptr_Manager = &LDT_Manager;
T_LDT_Manager * Manager = LDT_Manager;
do
{
if (*ptr_Manager == NULL) { return -1; }
for (Boucle = 0; Boucle < LDT_MANAGER_SIZE; Boucle++)
{
if (Manager->LDTdesc [Boucle].Adresse == Adresse)
{
RetVal = Kernel_mbfree(Manager->LDTdesc [Boucle].Adresse);
if (Boucle == 0)
{
Kernel_mbfree (*ptr_Manager);
*ptr_Manager = NULL;
return RetVal;
}
else
{
for (Boucle2 = Boucle; Boucle2 < LDT_MANAGER_SIZE-1; Boucle2++)
{ Manager->LDTdesc [Boucle2] = Manager->LDTdesc [Boucle2+1]; }
Manager->LDTdesc [Boucle2+1].Size = NULL;
Manager->LDTdesc [Boucle2+1].Adresse = NULL;
}
Manager->LDTdesc [LDT_MANAGER_SIZE-1].Size = NULL;
Manager->LDTdesc [LDT_MANAGER_SIZE-1].Adresse = NULL;
return RetVal;
}
}
*ptr_Manager = Manager;
Manager = Manager->Next;
} while (1);
}
T_LDT * LDT_brealloc (T_LDT * OldLDT, UWORD NewSize)
{
T_LDT * NewLDT;
UDWORD Blocs;
UWORD Boucle;
T_LDT_Manager * * ptr_Manager = &LDT_Manager;
T_LDT_Manager * Manager = LDT_Manager;
Blocs = NewSize * sizeof(T_LDT);
if (Blocs % MEMORY_BLOC_SIZE == 0)
{ Blocs /= MEMORY_BLOC_SIZE; } else { Blocs = (Blocs / MEMORY_BLOC_SIZE) + 1; }
do
{
if (*ptr_Manager == NULL) { return NULL; }
for (Boucle = 0; Boucle < LDT_MANAGER_SIZE; Boucle++)
{
if (Manager->LDTdesc [Boucle].Adresse == OldLDT)
{
NewLDT = Kernel_mbrealloc (OldLDT, Blocs);
if (NewLDT == NULL) return NULL;
Manager->LDTdesc [Boucle].Adresse = NewLDT;
Manager->LDTdesc [Boucle].Size = NewSize;
return NewLDT;
}
}
*ptr_Manager = Manager;
Manager = Manager->Next;
} while (1);
}
///////////////////////////////////////////////////////////////////////
T_LDT * LDT_AllocLDT (T_LDT *BaseLDT)
{
UWORD Boucle;
UDWORD Boucle2;
UDWORD Size;
T_LDT_Manager * Manager = LDT_Manager;
if (BaseLDT == NULL) return NULL;
do
{
if (Manager == NULL) { return NULL; }
for (Boucle = 0; Boucle < LDT_MANAGER_SIZE; Boucle++)
{
Size = Manager->LDTdesc [Boucle].Size;
if (Manager->LDTdesc [Boucle].Adresse == ((void*)BaseLDT) )
{
for (Boucle2 = 1; Boucle2 < Size; Boucle2++) // Le 1e LDT reste null
{
if ( BaseLDT[Boucle2].UserDefine == 0 )
{
BaseLDT[Boucle2].UserDefine = 1;
return BaseLDT+Boucle2;
};
}
return NULL;
}
}
Manager = Manager->Next;
} while (1);
}
int LDT_FreeLDT (T_LDT *LDT) // Marque le LDT comme non utilise et le met a NULL
{
if ( ((UDWORD)LDT & 0x07L) != NULL) { return -2; }
if (LDT->UserDefine == 0) { return -1; }
*((int64*)LDT) = NULL;
return 0;
}
///////////////////////////////////////////////////////////////////////
int LDT_MapMemory (T_LDT *LDT, void * Linear, UDWORD Size, UBYTE Granularite, UBYTE DPL, UBYTE Type, UBYTE CPUMode)
{
if ( ((UDWORD)LDT & 0x07L) != NULL) { return -2; }
LDT->Adresse_0_15 = (DWORD)Linear & 0x0000FFFFL;
LDT->Adresse_16_23 = ((DWORD)Linear >> 16) & 0x000000FFL;
LDT->Adresse_24_31 = ((DWORD)Linear >> 24) & 0x000000FFL;
LDT->Limite_0_15 = Size & 0x0000FFFFL;
LDT->Limite_16_19 = (Size >> 16) & 0x0000000FL;
LDT->Granularite = Granularite;
LDT->Type = Type;
LDT->DPL = DPL;
LDT->CPUMode = CPUMode;
LDT->Present = 1;
LDT->UserDefine = 1;
return 0;
}
int LDT_load (T_LDT *LDT)
{
UWORD Boucle;
T_LDT_Manager * * ptr_Manager = &LDT_Manager;
T_LDT_Manager * Manager = LDT_Manager;
do
{
if (*ptr_Manager == NULL) { return -1; }
for (Boucle = 0; Boucle < LDT_MANAGER_SIZE; Boucle++)
{
if (Manager->LDTdesc [Boucle].Adresse == LDT)
{
asm("lgdt %0\n" : : "m" (Manager->LDTdesc [Boucle]));
return 0;
}
}
*ptr_Manager = Manager;
Manager = Manager->Next;
} while (1);
}

217
lib/cpu.c Executable file
View File

@ -0,0 +1,217 @@
#include "types.h"
#include "cpu.h"
#include "cpuid.h"
#include "memory.h"
#include "string.h"
static u8 *msg[] =
{
"mmx",
"mmx2",
"sse",
"sse2",
"sse3",
"fpu",
"3dNow!",
"3dNow Extended!",
"HyperThreading",
"apic",
};
static u8 space[]=" ";
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)
{
u32 i,maxfunction,maxextended,unused,regeax,regebx,regecx,regedx;
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, &regeax, &regebx, &regecx, &regedx);
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->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, &regeax, &regebx, &regecx, &regedx);
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, &regeax, &regebx, &regecx, &regedx);
memcpy(&regeax,&proc->detectedname[0+i*16],4,1);
memcpy(&regebx,&proc->detectedname[4+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;
for(i=0;i<10;i++)
if (*(boolean++)==1)
{
strcat(msg[i],&proc->techs);
strcat(space,&proc->techs);
}
return 0;
}
u32 viewstack(u32 number)
{
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));
}

58
lib/graph.c Executable file
View File

@ -0,0 +1,58 @@
#include "types.h"
#include "vga.h"
#include "video.h"
#include "graph.h"
#include "math.h"
/******************************************************************************/
/* Affiche une ligne entre les points spécifiés */
void line(u32 x1, u32 y1, u32 x2, u32 y2, u8 color)
{
s32 dx,dy,sdx,sdy;
u32 i,dxabs,dyabs,x,y,px,py;
dx=x2-x1; /* distance horizontale de la line */
dy=y2-y1; /* distance verticale de la line **/
dxabs=abs(dx);
dyabs=abs(dy);
sdx=sgn(dx);
sdy=sgn(dy);
x=dyabs>>1;
y=dxabs>>1;
px=x1;
py=y1;
writepxl(px,py,color);
if (dxabs>=dyabs) /* la ligne est plus horizontale que verticale */
{
for(i=0;i<dxabs;i++)
{
y+=dyabs;
if (y>=dxabs)
{
y-=dxabs;
py+=sdy;
}
px+=sdx;
writepxl(px,py,color);
}
}
else /* la ligne est plus verticale que horizontale */
{
for(i=0;i<dyabs;i++)
{
x+=dxabs;
if (x>=dyabs)
{
x-=dyabs;
px+=sdx;
}
py+=sdy;
writepxl(px,py,color);
}
}
}

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

@ -34,7 +34,7 @@ void initpic(void)
outb(0xA0,0x11); outb(0xA0,0x11);
nop(); nop();
/* Initialisation de ICW2 - vecteur de depart = 96 */ /* Initialisation de ICW2 - vecteur de depart = 96 */
outb(0xA1,0x70); outb(0xA1,0x60);
nop(); nop();
/* Initialisation de ICW3 */ /* Initialisation de ICW3 */
outb(0xA1,0x02); outb(0xA1,0x02);
@ -97,260 +97,342 @@ 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"); pushf();
pushad();
print("Appel d'une interruption\r\n");
popad();
popf();
sti(); sti();
iret(); iret();
} }
void exception0() void exception0()
{ {
print("divide error"); print("divide error\r\n");
iret();
} }
void exception1() void exception1()
{ {
print("debug exception"); cpuerror("debug exception\r\n");
iret();
} }
void exception2() void exception2()
{ {
print("non-maskable hardware interrupt"); cpuerror("non-maskable hardware interrupt\r\n");
iret();
} }
void exception3() void exception3()
{ {
print("INT3 instruction"); cpuerror("INT3 instruction\r\n");
iret();
} }
void exception4() void exception4()
{ {
print("INTO instruction detected overflow"); cpuerror("INTO instruction detected overflow\r\n");
iret();
} }
void exception5() void exception5()
{ {
print("BOUND instruction detected overrange"); print("BOUND instruction detected overrange\r\n");
iret();
} }
void exception6() void exception6()
{ {
print("invalid instruction opcode"); cpuerror("invalid instruction opcode\r\n");
iret();
} }
void exception7() void exception7()
{ {
print("no coprocessor"); cpuerror("no coprocessor\r\n");
iret();
} }
void exception8() void exception8()
{ {
print("double fault"); cpuerror("double fault\r\n");
iret();
} }
void exception9() void exception9()
{ {
print("coprocessor segment overrun"); cpuerror("coprocessor segment overrun\r\n");
iret();
} }
void exception10() void exception10()
{ {
print("invalid task state segment (TSS)"); cpuerror("invalid task state segment (TSS)\r\n");
iret();
} }
void exception11() void exception11()
{ {
print("segment not present"); cpuerror("segment not present\r\n");
iret();
} }
void exception12() void exception12()
{ {
print("stack fault"); cpuerror("stack fault");
iret();
} }
void exception13() void exception13()
{ {
print("general protection fault (GPF)"); cpuerror("general protection fault (GPF)\r\n");
iret();
} }
void exception14() void exception14()
{ {
print("page fault"); cpuerror("page fault\r\n");
iret();
} }
void exception15() void exception15()
{ {
print("(reserved)"); cpuerror("(reserved)\r\n");
iret();
} }
void exception16() void exception16()
{ {
print("coprocessor error"); cpuerror("coprocessor error\r\n");
iret();
} }
void exception17() void exception17()
{ {
print("alignment check"); cpuerror("alignment check\r\n");
iret();
} }
void exception18() void exception18()
{ {
print("machine check"); cpuerror("machine check");
iret();
} }
void irq0() void irq0()
{ {
cli(); cli();
pushf();
pushad();
print("irq 0"); print("irq 0");
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq1() void irq1()
{ {
cli(); cli();
pushf();
pushad();
print("irq 1"); print("irq 1");
while ((inb(0x64)&1)==0);
inb(0x60);
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq2() void irq2()
{ {
cli(); cli();
pushf();
pushad();
print("irq 2"); print("irq 2");
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq3() void irq3()
{ {
cli(); cli();
pushf();
pushad();
print("irq 3"); print("irq 3");
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq4() void irq4()
{ {
cli(); cli();
pushf();
pushad();
print("irq 4"); print("irq 4");
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq5() void irq5()
{ {
cli(); cli();
pushf();
pushad();
print("irq 5"); print("irq 5");
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq6() void irq6()
{ {
cli(); cli();
pushf();
pushad();
print("irq 6"); print("irq 6");
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq7() void irq7()
{ {
cli(); cli();
pushf();
pushad();
print("irq 7"); print("irq 7");
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq8() void irq8()
{ {
cli(); cli();
pushf();
pushad();
print("irq 8"); print("irq 8");
irqendslave(); irqendslave();
irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq9() void irq9()
{ {
cli(); cli();
pushf();
pushad();
print("irq 9"); print("irq 9");
irqendslave(); irqendslave();
irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq10() void irq10()
{ {
cli(); cli();
pushf();
pushad();
print("irq 10"); print("irq 10");
irqendslave(); irqendslave();
irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq11() void irq11()
{ {
cli(); cli();
pushf();
pushad();
print("irq 11"); print("irq 11");
irqendslave(); irqendslave();
irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq12() void irq12()
{ {
cli(); cli();
pushf();
pushad();
print("irq 12"); print("irq 12");
while ((inb(0x64)&1)==0);
inb(0x60);
irqendslave(); irqendslave();
irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq13() void irq13()
{ {
cli(); cli();
pushf();
pushad();
print("irq 13"); print("irq 13");
irqendslave(); irqendslave();
irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void irq14() void irq14()
{ {
cli(); cli();
pushf();
pushad();
print("irq 14"); print("irq 14");
irqendslave(); irqendslave();
irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
@ -359,59 +441,63 @@ void irq15()
cli(); cli();
print("irq 15"); print("irq 15");
irqendslave(); irqendslave();
irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }
void initidt(void) void initidt(void)
{ {
u16 i; u16 i;
putidt((u32)exception0, 0x30, INTGATE, 0); putidt((u32)exception0, 0x20, INTGATE, 0);
putidt((u32)exception1, 0x30, INTGATE, 1); putidt((u32)exception1, 0x20, INTGATE, 1);
putidt((u32)exception2, 0x30, INTGATE, 2); putidt((u32)exception2, 0x20, INTGATE, 2);
putidt((u32)exception3, 0x30, INTGATE, 3); putidt((u32)exception3, 0x20, INTGATE, 3);
putidt((u32)exception4, 0x30, INTGATE, 4); putidt((u32)exception4, 0x20, INTGATE, 4);
putidt((u32)exception5, 0x30, INTGATE, 5); putidt((u32)exception5, 0x20, INTGATE, 5);
putidt((u32)exception6, 0x30, INTGATE, 6); putidt((u32)exception6, 0x20, INTGATE, 6);
putidt((u32)exception7, 0x30, INTGATE, 7); putidt((u32)exception7, 0x20, INTGATE, 7);
putidt((u32)exception8, 0x30, INTGATE, 8); putidt((u32)exception8, 0x20, INTGATE, 8);
putidt((u32)exception9, 0x30, INTGATE, 9); putidt((u32)exception9, 0x20, INTGATE, 9);
putidt((u32)exception10, 0x30, INTGATE, 10); putidt((u32)exception10, 0x20, INTGATE, 10);
putidt((u32)exception11, 0x30, INTGATE, 11); putidt((u32)exception11, 0x20, INTGATE, 11);
putidt((u32)exception12, 0x30, INTGATE, 12); putidt((u32)exception12, 0x20, INTGATE, 12);
putidt((u32)exception13, 0x30, INTGATE, 13); putidt((u32)exception13, 0x20, INTGATE, 13);
putidt((u32)exception14, 0x30, INTGATE, 14); putidt((u32)exception14, 0x20, INTGATE, 14);
putidt((u32)exception15, 0x30, INTGATE, 15); putidt((u32)exception15, 0x20, INTGATE, 15);
putidt((u32)exception16, 0x30, INTGATE, 16); putidt((u32)exception16, 0x20, INTGATE, 16);
putidt((u32)exception17, 0x30, INTGATE, 17); putidt((u32)exception17, 0x20, INTGATE, 17);
putidt((u32)exception18, 0x30, INTGATE, 18); putidt((u32)exception18, 0x20, INTGATE, 18);
for(i=19;i<32;i++) for(i=19;i<32;i++)
{ {
putidt((u32)interruption, 0x30, INTGATE, i); putidt((u32)interruption, 0x20, INTGATE, i);
} }
putidt((u32)irq0, 0x30, INTGATE, 32); putidt((u32)irq0, 0x20, INTGATE, 32);
putidt((u32)irq1, 0x30, INTGATE, 33); putidt((u32)irq1, 0x20, INTGATE, 33);
putidt((u32)irq2, 0x30, INTGATE, 34); putidt((u32)irq2, 0x20, INTGATE, 34);
putidt((u32)irq3, 0x30, INTGATE, 35); putidt((u32)irq3, 0x20, INTGATE, 35);
putidt((u32)irq4, 0x30, INTGATE, 36); putidt((u32)irq4, 0x20, INTGATE, 36);
putidt((u32)irq5, 0x30, INTGATE, 37); putidt((u32)irq5, 0x20, INTGATE, 37);
putidt((u32)irq6, 0x30, INTGATE, 38); putidt((u32)irq6, 0x20, INTGATE, 38);
putidt((u32)irq7, 0x30, INTGATE, 39); putidt((u32)irq7, 0x20, INTGATE, 39);
for(i=40;i<112;i++) for(i=40;i<96;i++)
{ {
putidt((u32)interruption, 0x30, INTGATE, i); putidt((u32)interruption, 0x20, INTGATE, i);
} }
putidt((u32)irq8, 0x30, INTGATE, 112); putidt((u32)irq8, 0x20, INTGATE, 96);
putidt((u32)irq9, 0x30, INTGATE, 113); putidt((u32)irq9, 0x20, INTGATE, 97);
putidt((u32)irq10, 0x30, INTGATE, 114); putidt((u32)irq10, 0x20, INTGATE, 98);
putidt((u32)irq11, 0x30, INTGATE, 115); putidt((u32)irq11, 0x20, INTGATE, 99);
putidt((u32)irq12, 0x30, INTGATE, 116); putidt((u32)irq12, 0x20, INTGATE, 100);
putidt((u32)irq13, 0x30, INTGATE, 117); putidt((u32)irq13, 0x20, INTGATE, 101);
putidt((u32)irq14, 0x30, INTGATE, 118); putidt((u32)irq14, 0x20, INTGATE, 102);
putidt((u32)irq15, 0x30, INTGATE, 119); putidt((u32)irq15, 0x20, INTGATE, 103);
for(i=120;i<255;i++) for(i=104;i<255;i++)
{ {
putidt((u32)interruption, 0x30, INTGATE, i); putidt((u32)interruption, 0x20, INTGATE, i);
} }
/* initialise le registre idt */ /* initialise le registre idt */
idtreg.limite = 256*8; idtreg.limite = 256*8;

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

@ -6,7 +6,7 @@
#include "video.h" #include "video.h"
static u8 bufferscan[256]; static u8 bufferscan[256]={0};
static u8 bufferascii[256]={0}; static u8 bufferascii[256]={0};
static u8 ptrscan=0; static u8 ptrscan=0;
static u8 ptrascii=0; static u8 ptrascii=0;
@ -92,7 +92,15 @@ static const u8 set1_ctrl[] =
'2', '3','0','.',0, 0, 0, 0, '2', '3','0','.',0, 0, 0, 0,
0 0
}; };
/******************************************************************************/
u8 waitascii()
{
u8 oldptrscan=ptrscan;
u8 oldptrascii=ptrascii;
while((oldptrascii==ptrascii));/*(oldptrscan==ptrscan)&&*/
return bufferascii[ptrascii];
}
/******************************************************************************/ /******************************************************************************/
@ -136,7 +144,6 @@ static void reboot(void)
/******************************************************************************/ /******************************************************************************/
unsigned convert(u32 keypressed) unsigned convert(u32 keypressed)
{ {
u8 temp,key,lastscan; u8 temp,key,lastscan;
/* garde le dernier pointeur du buffer scan */ /* garde le dernier pointeur du buffer scan */
lastscan=ptrscan; lastscan=ptrscan;
@ -182,6 +189,11 @@ unsigned convert(u32 keypressed)
return 0; return 0;
} }
if ((key >= SCAN_F1) && (key <= SCAN_F8))
{
changevc(key-SCAN_F1);
}
/* Scroll Lock, Num Lock, and Caps Lock mise a jour des leds */ /* Scroll Lock, Num Lock, and Caps Lock mise a jour des leds */
if(key == SCAN_SCROLLLOCK) if(key == SCAN_SCROLLLOCK)
{ {
@ -259,7 +271,7 @@ if ((bufferscan[lastscan]==0xE0)||((kbdstatus & STATUS_NUM)&&(key>=0x47)&&(key<=
if(temp == 0) return temp; if(temp == 0) return temp;
/* Appuie de CRTL + ALT + SUPR ? */ /* Appuie de CRTL + ALT + SUPR ? */
if((kbdstatus & STATUS_CTRL) && (kbdstatus & STATUS_ALT) && if((kbdstatus & STATUS_CTRL) && (kbdstatus & STATUS_ALT) &&
(temp == KEY_DEL)) (key == 76))
{ {
print("redemarrage du systeme"); print("redemarrage du systeme");
reboot(); reboot();
@ -273,6 +285,9 @@ if ((bufferscan[lastscan]==0xE0)||((kbdstatus & STATUS_NUM)&&(key>=0x47)&&(key<=
void keyboard() void keyboard()
{ {
cli();
pushf();
pushad();
u8 scancode,ascii; u8 scancode,ascii;
cli(); cli();
while ((inb(0x64)&1)==0); while ((inb(0x64)&1)==0);
@ -280,13 +295,15 @@ scancode=inb(0x60);
ascii = convert(scancode); ascii = convert(scancode);
if(ascii != 0) if(ascii != 0)
{ {
putchar(ascii);
ptrascii++; ptrascii++;
if (ptrascii==255) ptrascii==0; if (ptrascii==255) ptrascii==0;
bufferascii[ptrascii]=ascii; bufferascii[ptrascii]=ascii;
} }
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x01C, %esp;");
iret(); iret();
} }

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

33
lib/makefile Normal file → Executable file
View File

@ -1,37 +1,16 @@
FREEC=gcc -O2 -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -I ../Include -c CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -fomit-frame-pointer -Wall -w -m32 -F pe-i386 -I ../include
PARTIAL=ld -r -o LINK=ld -m elf_i386 -r -o
OBJS= memory.o vga.o port.o video.o idt.o timer.o keyboard.o types.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
makeall: libs.o makeall: libs.o
libs.o:$(OBJS) libs.o:$(OBJS)
$(PARTIAL) libs.o $(OBJS) $(LINK) libs.o $(OBJS)
vga.o:vga.c .o: .c
$(FREEC) $^ $(CC) $^
types.o:types.c
$(FREEC) $^
idt.o:idt.c
$(FREEC) $^
keyboard.o:keyboard.c
$(FREEC) $^
timer.o:timer.c
$(FREEC) $^
video.o:video.c
$(FREEC) $^
port.o:port.c
$(FREEC) $^
memory.o:memory.c
$(FREEC) $^
clean: clean:
rm -f *.o rm -f *.o

7
lib/math.c Executable file
View File

@ -0,0 +1,7 @@
#include "types.h"
u32 abs(int x)
{
if (x<0) x=-x;
return (u32)x;
}

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

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

@ -3,8 +3,10 @@
#define maxgraphmode 11 #define maxgraphmode 11
#define maxtextmode 5 #define maxtextmode 5
static mode_def textmodes[maxtextmode] = { static mode_def textmodes[maxtextmode] = {
/*40*25 16 couleurs mode 0x00*/ /*40*25 16 couleurs mode 0x00*/
{ {
0x67, 0x67,
@ -12,12 +14,13 @@ static mode_def textmodes[maxtextmode] = {
0x2D, 0x27, 0x28, 0x90, 0x2B, 0xA0, 0xBF, 0x1F, 0x00, 0x2D, 0x27, 0x28, 0x90, 0x2B, 0xA0, 0xBF, 0x1F, 0x00,
0x4F, 0x0D, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x0D, 0x0E, 0x00, 0x00, 0x00, 0x00,
0x9C, 0x8E, 0x8F, 0x14, 0x1F, 0x96, 0xB9, 0xA3, 0xFF, 0x9C, 0x8E, 0x8F, 0x14, 0x1F, 0x96, 0xB9, 0xA3, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0E, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0xFF,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
0x0C, 0x00, 0x0F, 0x08, 0x00, 0x0C, 0x00, 0x0F, 0x08, 0x00,
45, 25, 4 45, 25, 4
}, },
/*80*25 16 couleurs mode 0x01*/ /*80*25 16 couleurs mode 0x01*/
{ {
0x67, 0x67,
@ -25,53 +28,55 @@ static mode_def textmodes[maxtextmode] = {
0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, 0x00, 0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, 0x00,
0x4F, 0x0D, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x4F, 0x0D, 0x0E, 0x00, 0x00, 0x00, 0x00,
0x9C, 0x0E, 0x8F, 0x28, 0x1F, 0x96, 0xB9, 0xA3, 0xFF, 0x9C, 0x0E, 0x8F, 0x28, 0x1F, 0x96, 0xB9, 0xA3, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0E, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0xFF,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
0x0C, 0x00, 0x0F, 0x08, 0x00, 0x0C, 0x00, 0x0F, 0x08, 0x00,
80, 25, 4 80, 25, 4
}, },
/*80*50 16 couleurs mode 0x02*/ /*80*50 16 couleurs mode 0x02*/
{ {
0x63, 0x63,
0x03, 0x01, 0x03, 0x01, 0x02, 0x03, 0x01, 0x03, 0x05, 0x02,
0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, 0x00, 0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, 0x00,
0x47, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x47, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
0x9C, 0x8E, 0x8F, 0x28, 0x1F, 0x96, 0xB9, 0xA3, 0xFF, 0x9C, 0x8E, 0x8F, 0x28, 0x1F, 0x96, 0xB9, 0xA3, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0E, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0xFF,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x10, 0x11, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
0x0C, 0x00, 0x0F, 0x00, 0x00, 0x0C, 0x00, 0x0F, 0x00, 0x00,
80, 50, 4 80, 50, 4
}, },
/*100*50 16 couleurs mode 0x03*/ /*100*50 16 couleurs mode 0x03*/
{ {
0x67, 0x67,
0x03, 0x01, 0x03, 0x01, 0x02, 0x03, 0x01, 0x03, 0x05, 0x02,
0x70, 0x63, 0x64, 0x85, 0x68, 0x84, 0xBF, 0x1F, 0x00, 0x70, 0x63, 0x64, 0x85, 0x68, 0x84, 0xBF, 0x1F, 0x00,
0x47, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x47, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
0x9C, 0x8E, 0x8F, 0x32, 0x1F, 0x96, 0xB9, 0xA3, 0xFF, 0x9C, 0x8E, 0x8F, 0x32, 0x1F, 0x96, 0xB9, 0xA3, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0E, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0xFF,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x10, 0x11, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
0x0C, 0x00, 0x0F, 0x00, 0x00, 0x0C, 0x00, 0x0F, 0x00, 0x00,
100, 50, 4 100, 50, 4
}, },
/*100*60 16 couleurs mode 0x04*/ /*100*60 16 couleurs mode 0x04*/
{ {
0xA7, 0xA7,
0x03, 0x01, 0x03, 0x01, 0x02, 0x03, 0x01, 0x03, 0x05, 0x02,
0x70, 0x63, 0x64, 0x85, 0x68, 0x84, 0xFF, 0x1F, 0x00, 0x70, 0x63, 0x64, 0x85, 0x68, 0x84, 0xFF, 0x1F, 0x00,
0x47, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x47, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00,
0xE7, 0x8E, 0xDF, 0x32, 0x1F, 0xDF, 0xE5, 0xA3, 0xFF, 0xE7, 0x8E, 0xDF, 0x32, 0x1F, 0xDF, 0xE5, 0xA3, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0E, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0xFF,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x10, 0x11, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
0x0C, 0x00, 0x0F, 0x00, 0x00, 0x0C, 0x00, 0x0F, 0x00, 0x00,
100, 60, 4 100, 60, 4
} }
}; };
static mode_def graphmodes[maxgraphmode] = { static mode_def graphmodes[maxgraphmode] = {
/*640*480 n&b mode 0x80*/ /*640*480 n&b mode 0x80*/
@ -97,7 +102,7 @@ static mode_def graphmodes[maxgraphmode] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0xFF,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
0x01, 0x00, 0x03, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00,
40, 25, 2 40, 25,
}, },
/*640*480 16 couleurs mode 0x82*/ /*640*480 16 couleurs mode 0x82*/
@ -216,5 +221,5 @@ static mode_def graphmodes[maxgraphmode] = {
0x41, 0x00, 0x0F, 0x00, 0x00, 0x41, 0x00, 0x0F, 0x00, 0x00,
50, 75, 8 50, 75, 8
} }
}; };

138
lib/mouse.c Executable file
View File

@ -0,0 +1,138 @@
#include "types.h"
#include "asm.h"
#include "mouse.h"
#include "keyboard.h"
#include "vga.h"
#include "video.h"
bool initmouse()
{
u16 i=1024;
outkbd(0x64,0xA8); /* autorisé Aux */
outmseack(0xf3); /*sample*/
outmseack(100); /*sample donnée*/
outmseack(0xe8); /*resolution*/
outmseack(3); /*resolution donnée*/
outmseack(0xe7); /* echelle 2:1*/
outmseack(0xf4); /* Autorise peripherique */
outmsecmd(0x47); /* Autorise interruption */
while(i-->0) if (inb(0x60)==250) return 1;
return 0;
}
static u8 bytepos=0,mousereplies=0;
static u8 mpacket[3];
static s32 mousex=40, mousey=12;
static u16 oldx=0, oldy=0;
static u8 oldchar=0x00,oldattr=0x07;
static bool mousebut1=0,mousebut2=0,mousebut3=0;
static u8 speed=6;
void outmseack(u8 value)
{
outkbd(0x64,0xD4); /* ecriture vers souris */
outb(0x60,value);
mousereplies++;
}
void outmsecmd(u8 command)
{
outkbd(0x64,0x60); /* ecriture vers mode */
outb(0x60,command);
}
void mouse()
{
u8 mbyte=inb(0x60);
s8 changex,changey;
cli();
if (mousereplies > 0)
{
if (mbyte == 0xFA)
{
mousereplies--;
goto endofint;
}
mousereplies = 0;
}
mpacket[bytepos]=mbyte;
bytepos++;
if(bytepos==3) {
bytepos=0;
if ( mpacket[1] == 0)
{
changex = 0;
}
else
{
changex = (mpacket[0] & 0x10) ?
mpacket[1] - 256 :
mpacket[1];
}
if (mpacket[2] == 0)
{
changey = 0;
}
else
{
changey = -((mpacket[0] & 0x20) ?
mpacket[2] - 256 :
mpacket[2]);
}
mousex+= (changex<<speed);
mousey+= (changey<<speed);
if(mousex<0) { mousex=0; }
if(mousex>=65535) { mousex=65535; }
if(mousey<0) { mousey=0; }
if(mousey>=65535) { mousey=65535; }
u16 newx=(u32)mousex*getxres()/65536;
u16 newy=(u32)mousey*getyres()/65536;
// Retrieve mouse button status from packet
mousebut1=mpacket[0] & 1;
mousebut2=mpacket[0] & 2;
mousebut3=mpacket[0] & 4;
// printf("RX:%d\tRY:%d\tX:%d\tY:%d\tB1:%d\tB2:%d\tB3:%d\t\r\n",changex,changey,mousex,mousey,mousebut1,mousebut2,mousebut3);
if ((newx!=oldx)||(newy!=oldy))
{
showchar(oldx,oldy,oldchar,oldattr);
oldx=newx;
oldy=newy;
oldchar=getchar(oldx,oldy);
oldattr=getattrib(oldx,oldy);
showchar(newx,newy,0xDB,0x0F);
}
}
endofint:
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 %bx;\
iret;");
}

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

65
lib/string.c Executable file
View File

@ -0,0 +1,65 @@
#include <string.h>
/* Compare 2 chaines de caractère et renvoie la premiere distance (diff) */
s8 strcmp(const u8 *src,const u8 *des)
{
register s8 result;
do
{
if ((result = *src - *des++) != 0) break;
}
while (*src++!=0);
return result;
}
/* Trouve la premiere occurence d'un caractère dans une chaine */
u8 * strchr(const u8 *src, u8 achar)
{
for(; *src!= achar; ++src)
if (*src == 0) return 0;
return (u8*)src;
}
/* Renvoie la taille de la chaine */
u32 strlen(const u8 *src)
{
u32 size;
for (size = 0; *(src+size) != 0; size++);
return size;
}
/* copie une chaine dans une autre */
u8* strcpy(const u8 *src, u8 *des)
{
u8 *temp = des;
while ((*des++ = *src++) != 0);
return temp;
}
/* copie une portion limité d'une chaine asciiZ*/
u8 *strncpy(const u8 *src,u8 *des,u32 count)
{
u8 *temp = des;
while (count) {
if ((*temp = *src) != 0) src++;
temp++;
count--;
}
return des;
}
/* concatene 2 chaines de caractère */
u8 *strcat( const u8 *src,u8 *des)
{
u8 *temp = des;
while (*des!=0) des++;
while ((*des++ = *src++) != 0);
return temp;
}

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

@ -14,9 +14,14 @@ static u8 curspos=0;
void timer() void timer()
{ {
cli(); cli();
pushf();
pushad();
showchar(0,0,curs[curspos],7); showchar(0,0,curs[curspos],7);
curspos=(curspos+1)&0x3; curspos=(curspos+1)&0x3;
irqendmaster(); irqendmaster();
popad();
popf();
sti(); sti();
asm("addl $0x1C,%esp;iret;"); asm("addl $0x0C, %esp;");
iret();
} }

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

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

@ -20,14 +20,130 @@
#define planesize 0x10000 #define planesize 0x10000
u16 resX,resY; /* resolution x,y en caractères*/ static u16 resX,resY,color,splitY; /* resolution x,y en caractères et profondeur */
static u8 pages,activepage; /* nombre de pages disponibles N° de la page active*/ static u8 pages,activepage,showedpage; /* nombre de pages disponibles N° de la page active*/
static u32 linesize,pagesize;/* Taille d'une ligne et d'une page */ static u32 linesize,pagesize;/* Taille d'une ligne et d'une page */
static u8 vmode=0xFF,color; /* mode en cours d'utilisation et profondeur */ static u8 vmode=0xFF; /* mode en cours d'utilisation */
static u32 basemem; /* Adresse de la mémoire vidéo */ static u32 basemem; /* Adresse de la mémoire vidéo */
static bool scrolling=0x1,graphic;/* Activation du défilement, Flag du mode graphique */ static bool scrolling,graphic,blink;/* Activation du défilement, Flag du mode graphique */
static u8 font; /* n° font active */
/*******************************************************************************/
/* Donne la resolution max horizontale */
u16 getxres()
{
return resX;
}
/*******************************************************************************/
/* Donne la profondeur en bit */
u8 getdepth()
{
return color;
}
/*******************************************************************************/
/* Donne la resolution max verticale */
u16 getyres()
{
return resY-splitY;
}
/*******************************************************************************/
/* Donne le nombre max de page ecran dispo */
u16 getnbpages()
{
return pages;
}
/*******************************************************************************/
/* Fixe la page ecran de travail */
void setpage(u8 page)
{
if (page<pages) activepage=page;
}
/*******************************************************************************/
/* Recupere la page ecran de travail */
u8 getpage()
{
return activepage;
}
/*******************************************************************************/
/* Affiche la page ecran specifié */
void showpage(u8 page)
{
if (page<pages)
{
u16 addr;
addr=page*pagesize/2;
outb(ccrt, 0x0C);
outb(ccrt+1,(addr>>8));
outb(ccrt, 0x0D);
outb(ccrt+1,(addr&0xFF));
showedpage=page;
}
}
/*******************************************************************************/
/* Sépare l'écran en 2 a partir de la ligne Y */
void split(u16 y)
{
u16 addr;
if (graphic==0)
addr=(y<<3);
else
addr=y;
/* line compare pour ligne atteinte */
outb(ccrt, 0x18);
outb(ccrt+1,(addr&0xFF));
/* overflow pour le bit 8 */
outb(ccrt, 0x07);
outb(ccrt+1,(inb(ccrt+1) & ~16)|((addr>>4)&16));
/* Maximum Scan Line pour le bit 9 */
outb(ccrt, 0x09);
outb(ccrt+1,(inb(ccrt+1) & ~64)|((addr>>3)&64));
splitY=y;
}
/*******************************************************************************/
/* Sépare l'écran en 2 a partir de la ligne Y */
void unsplit()
{
/* line compare pour ligne atteinte */
outb(ccrt, 0x18);
outb(ccrt+1,0);
/* overflow pour le bit 8 */
outb(ccrt, 0x07);
outb(ccrt+1,inb(ccrt+1) & ~16);
/* Maximum Scan Line pour le bit 9 */
outb(ccrt, 0x09);
outb(ccrt+1,inb(ccrt+1) & ~64);
splitY=0;
}
/*******************************************************************************/ /*******************************************************************************/
@ -145,20 +261,17 @@ void (*fill)(u8 attrib);
void fill_text (u8 attrib) void fill_text (u8 attrib)
{ {
gotoscr(0,0);
memset((u8 *)(basemem+activepage*pagesize),' ',pagesize/2,2); memset((u8 *)(basemem+activepage*pagesize),' ',pagesize/2,2);
memset((u8 *)(basemem+activepage*pagesize+1),attrib,pagesize/2,2); memset((u8 *)(basemem+activepage*pagesize+1),attrib,pagesize/2,2);
} }
void fill_chain (u8 attrib) void fill_chain (u8 attrib)
{ {
gotoscr(0,0);
memset((u8 *)(basemem+activepage*pagesize),attrib&0x0F,pagesize,1); memset((u8 *)(basemem+activepage*pagesize),attrib&0x0F,pagesize,1);
} }
void fill_unchain (u8 attrib) void fill_unchain (u8 attrib)
{ {
gotoscr(0,0);
int i; int i;
for(i=0;i<4;i++) for(i=0;i<4;i++)
{ {
@ -174,6 +287,9 @@ void fill_unchain (u8 attrib)
void gotoscr(u16 x,u16 y) void gotoscr(u16 x,u16 y)
{ {
u16 pos; u16 pos;
if (splitY==0)
pos=(showedpage*pagesize/2+x+y*resX);
else
pos=(x+y*resX); pos=(x+y*resX);
outb(ccrt,0x0F); outb(ccrt,0x0F);
outb(ccrt+1,(u8)(pos&0x00FF)); outb(ccrt+1,(u8)(pos&0x00FF));
@ -195,8 +311,8 @@ if (scrolling)
for(i=0;i<4;i++) for(i=0;i<4;i++)
{ {
useplane(i); useplane(i);
memcpy((u8*)(basemem+linesize*8*lines),(u8*)basemem,pagesize-linesize*8*lines,1); memcpy((u8*)(basemem+activepage*pagesize+linesize*8*lines),(u8*)basemem,pagesize-linesize*8*lines,1);
memset((u8*)(basemem+pagesize-linesize*8*lines),attrib&0x0F,linesize*8*lines,1); memset((u8*)(basemem+activepage*pagesize+pagesize-linesize*8*lines),attrib&0x0F,linesize*8*lines,1);
} }
} }
} }
@ -205,8 +321,8 @@ void scroll_chain(u8 lines,u8 attrib)
{ {
if (scrolling) if (scrolling)
{ {
memcpy((u8*)basemem+linesize*8*lines,(u8*)basemem,pagesize-linesize*8*lines,1); memcpy((u8*)basemem+activepage*pagesize+linesize*8*lines,(u8*)basemem+activepage*pagesize,pagesize-linesize*8*lines,1);
memset((u8*)(basemem+pagesize-linesize*8*lines),attrib&0x0F,linesize*8*lines,1); memset((u8*)(basemem+activepage*pagesize+pagesize-linesize*8*lines),attrib&0x0F,linesize*8*lines,1);
} }
} }
@ -214,9 +330,9 @@ void scroll_text(u8 lines,u8 attrib)
{ {
if (scrolling) if (scrolling)
{ {
memcpy((u8*)basemem+linesize*lines,(u8*)basemem,pagesize-linesize*lines,1); memcpy((u8*)basemem+activepage*pagesize+linesize*lines,(u8*)basemem+activepage*pagesize,pagesize-linesize*lines,1);
memset((u8*)(basemem+pagesize-linesize*lines-2),' ',(linesize*lines)/2,2); memset((u8*)(basemem+activepage*pagesize+pagesize-linesize*lines-2),' ',(linesize*lines)/2,2);
memset((u8*)(basemem+pagesize-linesize*lines-1),attrib,(linesize*lines)/2,2); memset((u8*)(basemem+activepage*pagesize+pagesize-linesize*lines-1),attrib,(linesize*lines)/2,2);
} }
} }
@ -254,6 +370,33 @@ void showchar_text(u16 coordx,u16 coordy,u8 thechar,u8 attrib)
*(++screen) =attrib; *(++screen) =attrib;
} }
/*******************************************************************************/
/* Recupere le caractère a l'écran */
u8 (*getchar)(u16 coordx,u16 coordy);
u8 getchar_text(u16 coordx,u16 coordy)
{
u8 *screen;
screen = (u8 *)basemem+activepage*pagesize+2*(coordx+coordy*resX);
return *screen;
}
/*******************************************************************************/
/* Recupere les attributs a l'écran */
u8 (*getattrib)(u16 coordx,u16 coordy);
u8 getattrib_text(u16 coordx,u16 coordy)
{
u8 *screen;
screen = (u8 *)basemem+activepage*pagesize+2*(coordx+coordy*resX)+1;
return *screen;
}
/*******************************************************************************/ /*******************************************************************************/
@ -324,7 +467,7 @@ void writepxl_8bitsunchain(u16 x, u16 y, u32 c)
u32 setvmode(u8 mode) u32 setvmode(u8 mode)
{ {
u8 *def,i,gmode; u8 *def,gmode;
/* Récupere la definition des registres VGA en fonction du mode /* Récupere la definition des registres VGA en fonction du mode
graphique : >0x80 graphique : >0x80
text : 0x00 - 0x7F text : 0x00 - 0x7F
@ -378,6 +521,8 @@ variables en fonction de la profondeur et du mode*/
scroll=scroll_text; scroll=scroll_text;
fill=fill_text; fill=fill_text;
pagesize=resY*linesize; pagesize=resY*linesize;
getchar=getchar_text;
getattrib=getattrib_text;
} }
else else
{ {
@ -431,7 +576,10 @@ variables en fonction de la profondeur et du mode*/
} }
/* calcul des variables d'état video */ /* calcul des variables d'état video */
activepage=0; activepage=0;
showedpage=0;
splitY=0;
vmode=mode; vmode=mode;
scrolling=1;
pages=(planesize/pagesize); pages=(planesize/pagesize);
basemem=(def[20]<<8)+def[21]+getbase(); basemem=(def[20]<<8)+def[21]+getbase();
return 0; return 0;
@ -503,25 +651,70 @@ u32 loadfont(u8* def,u8 size,u8 font)
/* Récupere le N° de la police de caractère en cours d'utilisation */ /* Récupere le N° de la police de caractère en cours d'utilisation */
u8 getfont(u8 num) u8 getfont()
{ {
return font; u8 num,tmp;
outb(sequencer,3);
tmp=inb(sequencer+1);
num=(tmp&0x03)|((tmp&0x10)>>2);
return num;
} }
/*******************************************************************************/
/* Récupere le N° de la police de caractère en cours d'utilisation */
u8 getfont2()
{
u8 num,tmp;
outb(sequencer,3);
tmp=inb(sequencer+1);
num=((tmp&0x0C)>>2)|((tmp&0x20)>>3);
return num;
}
/*******************************************************************************/ /*******************************************************************************/
/* Fixe le N° de la police de caractère a utiliser */ /* Fixe le N° de la police de caractère a utiliser */
void setfont(u8 num) void setfont(u8 num)
{ {
font=num&0x07; num&=0x07;
outb(sequencer,3); outb(sequencer,3);
outb(sequencer+1,(num&0x03)+((num&0x04)<<2)); outb(sequencer+1,(inb(sequencer+1)&0xEC)|((num&0x03)+((num&0x04)<<2)));
} }
/*******************************************************************************/ /*******************************************************************************/
/* Fixe le N° de la police de caractère a utiliser */
void setfont2(u8 num)
{
num&=0x07;
outb(sequencer,3);
outb(sequencer+1,(inb(sequencer+1)&0xD3)|(((num&0x03)<<2)+((num&0x04)<<3)));
}
/*******************************************************************************/
/* Fixe le N° de la police de caractère a utiliser */
void enableblink()
{
outb(ccrt,0x10);
outb(ccrt+1,(inb(sequencer+1)|0x04));
}
/*******************************************************************************/
/* Fixe le N° de la police de caractère a utiliser */
void disableblink()
{
outb(ccrt,0x10);
outb(ccrt+1,(inb(sequencer+1)&~0x04));
}
/*******************************************************************************/

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

@ -1,10 +1,19 @@
#include "vga.h" #include "vga.h"
#include "video.h" #include "video.h"
#include "stdarg.h"
u8 attrib=0x07;
u16 cursX,cursY; /* position du curseur */ console vc[8]={
extern u16 resX,resY; /* resolution x,y en caractères*/ {0x07,0,0,0,0,0,0,0},
u8 ansi,param1,param2,param3; {0x07,0,0,0,0,0,0,0},
{0x07,0,0,0,0,0,0,0},
{0x07,0,0,0,0,0,0,0},
{0x07,0,0,0,0,0,0,0},
{0x07,0,0,0,0,0,0,0},
{0x07,0,0,0,0,0,0,0},
{0x07,0,0,0,0,0,0,0}};
u8 usedvc=0;
/*******************************************************************************/ /*******************************************************************************/
@ -19,9 +28,15 @@ void setattrib(u8 att)
}; };
u8 tempattr; u8 tempattr;
tempattr = attrib; tempattr = vc[usedvc].attrib;
if(att == 0) if(att == 0)
tempattr &= ~0x08; /* Faible intensité */ tempattr = 0x07; /* Couleur Grise sur fond noir */
else if (att == 5)
tempattr |= 0x80;
else if (att == 7)
tempattr = ((tempattr&0x0F)<<4)+((tempattr&0xF0)>>4);
else if (att == 8)
tempattr = 0;
else if (att == 1) else if (att == 1)
tempattr |= 0x08; /* Forte intensité */ tempattr |= 0x08; /* Forte intensité */
else if(att >= 30 && att <= 37) else if(att >= 30 && att <= 37)
@ -34,7 +49,7 @@ void setattrib(u8 att)
att = ansitovga[att - 40] << 4; att = ansitovga[att - 40] << 4;
tempattr = (tempattr & ~0x70) | att;/* couleur de fond */ tempattr = (tempattr & ~0x70) | att;/* couleur de fond */
} }
attrib = tempattr; vc[usedvc].attrib = tempattr;
} }
/*******************************************************************************/ /*******************************************************************************/
@ -44,13 +59,13 @@ void setattrib(u8 att)
bool makeansi(u8 c) bool makeansi(u8 c)
{ {
/* state machine to handle the escape sequences */ /* state machine to handle the escape sequences */
switch(ansi) switch(vc[usedvc].ansi)
{ {
case 0: case 0:
/* ESC -- next state */ /* ESC -- next state */
if(c == 0x1B) if(c == 0x1B)
{ {
ansi++; vc[usedvc].ansi++;
return 1; /* "I handled it" */ return 1; /* "I handled it" */
} }
break; break;
@ -58,8 +73,8 @@ bool makeansi(u8 c)
case 1: case 1:
if(c == '[') if(c == '[')
{ {
ansi++; vc[usedvc].ansi++;
param1 = 0; vc[usedvc].param1 = 0;
return 1; return 1;
} }
break; break;
@ -67,62 +82,69 @@ bool makeansi(u8 c)
case 2: case 2:
if(isdigit(c)) if(isdigit(c))
{ {
param1 = param1 * 10 + c - '0'; vc[usedvc].param1 = vc[usedvc].param1 * 10 + c - '0';
return 1; return 1;
} }
else if(c == ';') else if(c == ';')
{ {
ansi++; vc[usedvc].ansi++;
param2 = 0; vc[usedvc].param2 = 0;
return 1; return 1;
} }
/* ESC[2J -- efface l'ecran */ /* ESC[2J -- efface l'ecran */
else if(c == 'J') else if(c == 'J')
{ {
if(param1 == 2) if(vc[usedvc].param1 == 2)
{ {
fill(attrib); fill(vc[usedvc].attrib);
ansi = 0; vc[usedvc].cursX=0;
vc[usedvc].cursY=0;
gotoscr(0,0);
vc[usedvc].ansi = 0;
return 1; return 1;
} }
} }
/* ESC[num1m -- met l'attribut num1 */ /* ESC[num1m -- met l'attribut num1 */
else if(c == 'm') else if(c == 'm')
{ {
setattrib(param1); setattrib(vc[usedvc].param1);
ansi = 0; vc[usedvc].ansi = 0;
return 1; return 1;
} }
/* ESC[num1A -- bouge le curseur de num1 vers le haut */ /* ESC[num1A -- bouge le curseur de num1 vers le haut */
else if(c == 'A') else if(c == 'A')
{ {
cursY-=param1; vc[usedvc].cursY-=vc[usedvc].param1;
ansi = 0; if (vc[usedvc].cursY<0) vc[usedvc].cursY=0;
gotoscr(cursX,cursY); vc[usedvc].ansi = 0;
gotoscr(vc[usedvc].cursX,vc[usedvc].cursY);
return 1; return 1;
} }
/* ESC[num1B -- bouge le curseur de num1 vers le bas */ /* ESC[num1B -- bouge le curseur de num1 vers le bas */
else if(c == 'B') else if(c == 'B')
{ {
cursY+=param1; vc[usedvc].cursY+=vc[usedvc].param1;
ansi = 0; if (vc[usedvc].cursY>=getyres()-1) vc[usedvc].cursY=getyres();
gotoscr(cursX,cursY); vc[usedvc].ansi = 0;
gotoscr(vc[usedvc].cursX,vc[usedvc].cursY);
return 1; return 1;
} }
/* ESC[num1C -- bouge le curseur de num1 vers la gauche */ /* ESC[num1D -- bouge le curseur de num1 vers la gauche */
else if(c == 'C')
{
cursX-=param1;
ansi = 0;
gotoscr(cursX,cursY);
return 1;
}
/* ESC[num1D -- bouge le curseur de num1 vers la droite */
else if(c == 'D') else if(c == 'D')
{ {
cursX+=param1; vc[usedvc].cursX-=vc[usedvc].param1;
ansi = 0; if (vc[usedvc].cursX<0) vc[usedvc].cursX=0;
gotoscr(cursX,cursY); vc[usedvc].ansi = 0;
gotoscr(vc[usedvc].cursX,vc[usedvc].cursY);
return 1;
}
/* ESC[num1C -- bouge le curseur de num1 vers la droite */
else if(c == 'C')
{
vc[usedvc].cursX+=vc[usedvc].param1;
if (vc[usedvc].cursX>=getxres()-1) vc[usedvc].cursX=getxres();
vc[usedvc].ansi = 0;
gotoscr(vc[usedvc].cursX,vc[usedvc].cursY);
return 1; return 1;
} }
break; break;
@ -130,32 +152,32 @@ bool makeansi(u8 c)
case 3: case 3:
if(isdigit(c)) if(isdigit(c))
{ {
param2 = param2 * 10 + c - '0'; vc[usedvc].param2 = vc[usedvc].param2 * 10 + c - '0';
return 1; return 1;
} }
else if(c == ';') else if(c == ';')
{ {
ansi++; vc[usedvc].ansi++;
param3 = 0; vc[usedvc].param3 = 0;
return 1; return 1;
} }
/* ESC[num1;num2H ou ESC[num1;num2f-- bouge le curseur en num1,num2 */ /* ESC[num1;num2H ou ESC[num1;num2f-- bouge le curseur en num1,num2 */
else if((c == 'H')||(c == 'f')) else if((c == 'H')||(c == 'f'))
{ {
/* Remet la position du curseur matériel a num1,num2 */ /* Remet la position du curseur matériel a num1,num2 */
gotoscr(param2,param1); gotoscr(vc[usedvc].param2,vc[usedvc].param1);
/* Remet la position du curseur logiciel a num1,num2 */ /* Remet la position du curseur logiciel a num1,num2 */
cursX=param2; vc[usedvc].cursX=vc[usedvc].param2;
cursY=param1; vc[usedvc].cursY=vc[usedvc].param1;
ansi = 0; vc[usedvc].ansi = 0;
return 1; return 1;
} }
/* ESC[num1;num2m -- met les attributs num1,num2 */ /* ESC[num1;num2m -- met les attributs num1,num2 */
else if(c == 'm') else if(c == 'm')
{ {
setattrib(param1); setattrib(vc[usedvc].param1);
setattrib(param2); setattrib(vc[usedvc].param2);
ansi = 0; vc[usedvc].ansi = 0;
return 1; return 1;
} }
break; break;
@ -163,104 +185,118 @@ bool makeansi(u8 c)
case 4: case 4:
if(isdigit(c)) if(isdigit(c))
{ {
param3 = param3 * 10 + c - '0'; vc[usedvc].param3 = vc[usedvc].param3 * 10 + c - '0';
return 1; return 1;
} }
/* ESC[num1;num2;num3m -- met les attributs num1,num2,num3 */ /* ESC[num1;num2;num3m -- met les attributs num1,num2,num3 */
else if(c == 'm') else if(c == 'm')
{ {
setattrib(param1); setattrib(vc[usedvc].param1);
setattrib(param2); setattrib(vc[usedvc].param2);
setattrib(param3); setattrib(vc[usedvc].param3);
ansi = 0; vc[usedvc].ansi = 0;
return 1; return 1;
} }
break; break;
/* Mauvais etat >> reset */ /* Mauvais etat >> reset */
default: default:
ansi = 0; vc[usedvc].ansi = 0;
break; break;
} }
ansi = 0; vc[usedvc].ansi = 0;
return 0; /* Ansi fini ;)*/ return 0; /* Ansi fini ;)*/
} }
/*******************************************************************************/ /*******************************************************************************/
/* Change la console en cours d'utilisation */
void changevc(u8 avc)
{
usedvc=avc;
showpage(usedvc);
setpage(usedvc);
gotoscr(vc[usedvc].cursX,vc[usedvc].cursY);
}
/*******************************************************************************/
/* affiche un caractère a l'écran */ /* affiche un caractère a l'écran */
void putchar(u8 thechar) void putchar(u8 thechar)
{ {
showpage(usedvc);
setpage(usedvc);
if(makeansi(thechar)) return; if(makeansi(thechar)) return;
switch (thechar) switch (thechar)
{ {
case 0x11: case 0x11:
if (cursY>0) cursY--; if (vc[usedvc].cursY>0) vc[usedvc].cursY--;
break; break;
case 0x12: case 0x12:
if (cursY<resY-1) cursY++; if (vc[usedvc].cursY<getyres()-1) vc[usedvc].cursY++;
break; break;
case 0x13: case 0x13:
if (cursX>0) cursX--; if (vc[usedvc].cursX>0) vc[usedvc].cursX--;
break; break;
case 0x14: case 0x14:
if (cursX<resX-1) cursX++; if (vc[usedvc].cursX<getxres()-1) vc[usedvc].cursX++;
break; break;
case 0x2: case 0x2:
cursX=0; vc[usedvc].cursX=0;
cursY=0; vc[usedvc].cursY=0;
break; break;
case 0x3: case 0x3:
cursX=0; vc[usedvc].cursX=0;
cursY=resY-1; vc[usedvc].cursY=getyres()-1;
break; break;
case 0x19: case 0x19:
cursX=resX-1; vc[usedvc].cursX=getxres()-1;
break; break;
case '\b': case '\b':
if (cursX==0) if (vc[usedvc].cursX==0)
{ {
if (cursY>0) if (vc[usedvc].cursY>0)
{ {
cursX=resX-1; vc[usedvc].cursX=getxres()-1;
cursY--; vc[usedvc].cursY--;
} }
} }
else else
{ {
cursX--; vc[usedvc].cursX--;
} }
showchar(cursX,cursY,' ',attrib); showchar(vc[usedvc].cursX,vc[usedvc].cursY,' ',vc[usedvc].attrib);
break; break;
case '\t': case '\t':
cursX=(cursX + 8) & ~(8 - 1); vc[usedvc].cursX=(vc[usedvc].cursX + 8) & ~(8 - 1);
break; break;
case '\n': case '\n':
cursX=0; vc[usedvc].cursX=0;
break; break;
case '\r': case '\r':
cursX=0; vc[usedvc].cursX=0;
cursY++; vc[usedvc].cursY++;
break; break;
default: default:
if (thechar>=' ') if (thechar>=' ')
{ {
showchar(cursX,cursY,thechar,attrib); showchar(vc[usedvc].cursX,vc[usedvc].cursY,thechar,vc[usedvc].attrib);
cursX++; vc[usedvc].cursX++;
} }
break; break;
} }
if (cursX>=resX) if (vc[usedvc].cursX>=getxres())
{ {
cursX=0; vc[usedvc].cursX=0;
cursY++; vc[usedvc].cursY++;
} }
if (cursY>=resY) if (vc[usedvc].cursY>=getyres())
{ {
scroll(1,attrib); scroll(1,vc[usedvc].attrib);
cursY=resY-1; vc[usedvc].cursY=getyres()-1;
} }
gotoscr(cursX,cursY); gotoscr(vc[usedvc].cursX,vc[usedvc].cursY);
} }
/*******************************************************************************/ /*******************************************************************************/
@ -271,7 +307,7 @@ void print(u8* string)
{ {
u8 *source; u8 *source;
source = string; source = string;
while(*source!=0x00) while(*source!=0)
{ {
putchar(*source++); putchar(*source++);
} }
@ -279,13 +315,87 @@ void print(u8* string)
/*******************************************************************************/ /*******************************************************************************/
/* affiche un octet sous forme hexadécimale a l'ecran */ /* affiche une chaine de caractère formaté a l'ecran */
void showhex(u8 src) void printf (const u8 *string, ...)
{ {
static u8 hexadigit[16] = "0123456789ABCDEF"; va_list ap;
putchar(hexadigit[(src&0xF0)>>4]); u8 buffer[50];
putchar(hexadigit[src&0x0F]); u8 *pointer;
u8 radix;
bool signe;
long num;
va_start(ap, string);
while(*string!= 0)
{
if (*string != '%')
putchar (*string);
else
{
switch (*++string)
{
case 'c':
putchar (va_arg(ap, int));
break;
case 'u':
radix=10;
signe=0;
showstring:
num=va_arg(ap, int);
pointer = buffer + 50 - 1;
*pointer = '\0';
if ((signe==1)&&(num<0))
{
num = -num;
signe++;
}
do
{
unsigned long temp;
temp = (unsigned long)num % radix;
pointer--;
if(temp < 10)
*pointer = temp + '0';
else
*pointer = temp - 10 + 'a';
num = (unsigned long)num / radix;
}
while(num != 0);
if (signe>1) *(--pointer)='-';
while (*pointer!=0) putchar(*pointer++);
break;
case 'o':
radix = 8;
signe=0;
goto showstring;
case 'd':
case 'i':
radix=10;
signe=1;
goto showstring;
case 'x':
radix=16;
signe=0;
goto showstring;
case 's':
pointer=va_arg(ap, u8*);
if (!pointer) pointer="(null)";
while (*pointer!=0) putchar(*pointer++);
break;
case '%':
putchar ('%');
break;
default:
putchar (va_arg(ap, int));
break;
}
}
string++;
}
va_end(ap);
} }
/*******************************************************************************/ /*******************************************************************************/

30
makefile Normal file → Executable file
View File

@ -3,25 +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 system/system.sys /cygdrive/a) (cd final; make)
copy2: test: all copy qemu
(cp system/system.sys /cygdrive/b)
test: clean all copy2 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: system/system.sys:
(cd system; make) (cd system; make)

318
system/ansi.c Executable file
View File

@ -0,0 +1,318 @@
u8 ansilogo[5056] = {
0x1B, 0x5B, 0x30, 0x6D, 0x1B, 0x5B, 0x31, 0x6D, 0xDA, 0x1B, 0x5B, 0x30, 0x6D, 0xC4, 0xC4, 0x1B,
0x5B, 0x31, 0x3B, 0x33, 0x30, 0x6D, 0xC4, 0x1B, 0x5B, 0x30, 0x6D, 0xC4, 0x1B, 0x5B, 0x31, 0x3B,
0x33, 0x30, 0x6D, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0x1B, 0x5B, 0x33, 0x37, 0x6D,
0x20, 0x1B, 0x5B, 0x30, 0x3B, 0x33, 0x31, 0x6D, 0x43, 0x1B, 0x5B, 0x31, 0x3B, 0x33, 0x37, 0x6D,
0x20, 0x1B, 0x5B, 0x33, 0x31,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,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4,
0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0xC4, 0x1B, 0x5B, 0x30, 0x6D, 0xC4, 0x1B, 0x5B, 0x31, 0x3B,
0x33, 0x30, 0x6D, 0xC4, 0x1B, 0x5B, 0x30, 0x6D, 0xC4, 0xC4, 0x1B, 0x5B, 0x31, 0x6D, 0xD9, 0x00
};

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

View File

@ -1,227 +0,0 @@
[BITS 16]
[ORG 0x100]
SECTION .text
push cs
push cs
pop ds
pop es
call EnableA20
mov si,msgpmode
call showstr
mov ax,cs
mov [RealCS],ax
lea ax,[Real]
mov [RealIP],ax
xor eax,eax
mov ax,cs
shl eax,4
mov [GDT.Entry1+2],ax
mov [GDT.Entry2+2],ax
mov [GDT.Entry4+2],ax
mov [GDT.Entry5+2],ax
shr eax,16
mov [GDT.Entry1+4],al
mov [GDT.Entry2+4],al
mov [GDT.Entry4+4],al
mov [GDT.Entry5+4],al
xor eax,eax
mov ax,cs
shl eax,4
add eax,gdt0
mov [GDTR.Address],eax
lgdt [GDTR]
cli
;mov al,0xFF
;out 0x21,al
mov al,0x80
out 0x70,al
mov eax,cr0
or al,1
mov cr0,eax
jmp SYS_CODE_SEL:GoPMode32
GoPMode32:
[BITS 32]
mov ax,SYS_DATA_SEL
mov ds,ax
mov ecx,50000/4
cld
mov esi,kernel
mov edi,0x100000
mov ax,ALL_DATA_SEL
mov es,ax
mov gs,ax
mov fs,ax
mov ss,ax
rep movsd
mov ds,ax
mov esp,0x3fffff
call KERNEL_SEL:0x100000
jmp REAL_CODE_SEL:GoReal
GoReal:
[BITS 16]
mov ax,REAL_DATA_SEL
mov ds,ax
mov es,ax
mov ss,ax
mov gs,ax
mov fs,ax
mov esp,0xffff
mov eax,cr0
and al,0xFE
mov cr0,eax
jmp far [RealIP]
Real:
jmp Real
msgpmode db 'Pmode loader is loading',0
;======================SHOWSTR========================
;Affiche la chaine de caractère pointé par ds:si à l'écran
;-> DS, SI
;<- Flag Carry si erreur
;=====================================================
showstr:
pusha
Next_Char:
lodsb
or al,al
jz End_Show
mov ah,0x0E
mov bx,0x07
int 0x10
jmp Next_Char
End_Show:
popa
ret
;***********************EnableA20*******************************
;->
;<-
;Ouvre l'autoroute A20
;***************************************************************
EnableA20:
cli
call ClearKeybBuffer
call WaitKeybCommand
mov al,0xd1
out 0x64,al
call WaitKeybCommand
mov al,0xdf
out 0x60,al
call WaitKeybCommand
jmp A20Enabled
WaitKeybCommand:
in al,0x64
test al,0x02
jnz WaitKeybCommand
ret
ClearKeybBuffer:
in al,0x64
test al,0x01
jnz ReadKeyb
ret
ReadKeyb:
in al,0x60
jmp ClearKeybBuffer
A20Enabled:
sti
ret
section .data
RealIP: dw 0
RealCS: dw 0
GDTR:
.Size: dw GDT_END
.Address: dd 0
gdt0 equ $ ; null entry
GDT:
.Entry0: dw 0 ; limit 15:0
dw 0 ; base 15:0
db 0 ; base 23:16
db 0 ; type
db 0 ; limit 19:16, flags
db 0 ; base 31:24
SYS_CODE_SEL equ $-gdt0 ; code segment descriptor
.Entry1: dw 0xFFFF
dw 0x0 ; base
db 0x0 ; base
db 0x9A ; present, ring 0, code, non-conforming, readable
db 0x40 ; 32 bit
db 0
SYS_DATA_SEL equ $-gdt0 ; data segment descriptor
.Entry2: dw 0xFFFF
dw 0x0 ; base
db 0x0 ; base
db 0x92 ; present, ring 0, data, expand-up, writable
db 0x40 ; 32 bit
db 0
ALL_DATA_SEL equ $-gdt0 ; 4meg data segment descriptor
.Entry3: dw 0x03ff
dw 0x0 ; base
db 0x0 ; base
db 0x92 ; present, ring 0, data, expand-up, writable
db 0xcf ; 4k pages, 32 bit
db 0
REAL_CODE_SEL equ $-gdt0 ; code segment descriptor for 16 bit mode
.Entry4: dw 0xFFFF
dw 0x0 ; base
db 0x0 ; base
db 0x9A ; present, ring 0, code, non-conforming, readable
db 0x00 ; 16 bit
db 0
REAL_DATA_SEL equ $-gdt0 ; data segment descriptor for 16 bit mode
.Entry5: dw 0xFFFF
dw 0x0 ; base
db 0x0 ; base
db 0x92 ; present, ring 0, data, expand-up, writable
db 0x00 ; 16 bit
db 0
KERNEL_SEL equ $-gdt0 ; 4meg code segment descriptor
.Entry6: dw 0x03ff
dw 0x0 ; base
db 0x0 ; base
db 0x9A ; present, ring 0, code, non-conforming, readable
db 0xcf ; 4k pages, 32 bit
db 0
GDT_END equ $-gdt0 -1
kernel:
SECTION .bss

16
system/makefile Normal file → Executable file
View File

@ -1,25 +1,21 @@
FREEC=gcc -O2 -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 -Ttext 0x100000 -e __main -o
all: system.sys all: system.sys
sync sync
system.sys: system.sys:
nasm -f bin -o loader.bin loader.asm
nasm -f elf -o system.o system.asm nasm -f elf -o system.o system.asm
$(GCC) systemc.o system.c
$(FREEC) systemc.o system.c $(LINK) system.sys systemc.o system.o ../lib/libs.o
$(LINK) system.out systemc.o system.o ../lib/libs.o
objcopy -O binary system.out system.bin
cat loader.bin>system.sys
cat system.bin>>system.sys
clean: clean:
rm -f *.o rm -f *.o
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

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

@ -3,38 +3,88 @@
#include "idt.h" #include "idt.h"
#include "timer.h" #include "timer.h"
#include "keyboard.h" #include "keyboard.h"
#include "mouse.h"
#include "asm.h" #include "asm.h"
#include "cpu.h"
#include "string.h"
u8 printok[]=" \033[37m\033[1m[ \033[32mOK\033[37m ]\033[0m\r\n"; #include "ansi.c"
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()
{
print(okmsg);
return;
}
int main(void) {
int _main(void) {
cli(); cli();
setvmode(0x02); setvmode(0x02);
/* Efface l'ecran */ /* Efface l'ecran */
print("\033[2J"); print("\033[2J\000");
print("Noyau charge en memoire"); printf(ansilogo);
print(printok); print("\033[0mNoyau charge en memoire\000");
print("Initilisation de la table d'interruption"); ok();
print("Initilisation de la table d'interruption\000");
initidt(); initidt();
print(printok); ok();
print("Initialisation du controleur d'interruption");
print("Initialisation du controleur d'interruption\000");
initpic(); initpic();
print(printok);
print("Activation logicielle des interruptions");
sti(); sti();
print(printok); ok();
print("Installation du handler timer");
setidt((u32)timer, 0x30, INTGATE, 32); print("Installation du handler timer\000");
print(printok); setidt((u32)timer, 0x20, INTGATE, 32);
print("Activation de l'IRQ 0"); ok();
print("Activation de l'IRQ 0\000");
enableirq(0); enableirq(0);
print(printok); ok();
print("Installation du handler clavier");
setidt((u32)keyboard, 0x30, INTGATE, 33); print("Installation du handler clavier\000");
print(printok); setidt((u32)keyboard, 0x20, INTGATE, 33);
print("Activation de l'IRQ 1"); ok();
print("Activation de l'IRQ 1\000");
enableirq(1); enableirq(1);
print(printok); ok();
while(1);
print("Installation du handler souris\000");
setidt((u32)mouse, 0x20, INTGATE, 100);
ok();
print("Initialisation du controleur souris :\000");
if (initmouse()==1)
print(" \033[1m\033[32mSouris Presente\033[0m\000");
else
print(" \033[1m\033[31mSouris non detecte\033[0m\000");
ok();
print("Activation de l'IRQ 2 (Controleur esclave)\000");
enableirq(2);
ok();
print("Activation de l'IRQ 12\000");
enableirq(12);
ok();
strcpy(&noproc,&cpu.detectedname);
getcpuinfos(&cpu);
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();
while(1)
{
key=waitascii();
putchar(key);
}
} }