Compare commits

..

No commits in common. "develop" and "master" have entirely different histories.

63 changed files with 5467 additions and 9193 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View File

@ -11,31 +11,9 @@ all:
make
cd ..
cd commande
make
cd ..
cd programs
make
cd ..
install:
if not exist data mkdir data
copy noyau\systeme.sys data
copy noyau\boot.bin data
copy commande\commande.ce data
copy lib\*.lib data
copy programs\*.ce data
copy programs\exem-lib.lib data
copy programs\cos.rip data
copy install\setup.com .
copy: clean all
copy noyau\systeme.sys b:
copy commande\*.ce b:
copy lib\*.lib b:
copy programs\*.ce b:
copy programs\*.lib b:
copy:
make all
clean:
cd lib
@ -49,11 +27,3 @@ clean:
cd install
make clean
cd ..
cd commande
make clean
cd ..
cd programs
make clean
cd ..

View File

@ -2,14 +2,12 @@
## Copies d'écran de COS2000
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/bootnew.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/ceexplorer.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/chargement.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/dir.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/editeur.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/gestionnaire.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/installation.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/interpreteur.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/librairies.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/logo.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/pci.jpg)
![screen](https://github.com/dahut87/cos2000v1/raw/develop/Graphisme/screenshots/video.jpg)

View File

@ -1,20 +1,17 @@
asm= lzasm /z/t
lnk= elink
lnk_boot = tlink /x
asm= tasm /t/m5/zi
lnk= tlink /x/t
all: commande.ce
all: commande.exe
commande.ce: commande.obj
$(lnk) commande.obj commande.ce
commande.obj: commande.asm
$(asm) commande.asm
commande.exe: commande.asm str0.asm
$(asm) commande
$(lnk) commande
ren commande.com commande.exe
clean:
del *.obj
del *.ce
del *.bak
del *.lib
del *.exe
del *.com
del *.bin
del *.sys
del *.err
del *.err

File diff suppressed because it is too large Load Diff

857
commande/str0.asm Normal file
View File

@ -0,0 +1,857 @@
;Librairie qui prend en charge le format de STR ASCIIZ
;# nombre 8
;@ str 7
;& nom 6
;High Low
;0 variable 4 hex
;1 byte 3 dec
;2 word 2 oct
;3 3 octets 1 bin
;4 dword 5 adresse
;5 5 octets 6 nom
;6 ... 7 str
; 8 nombre
;Renvoie carry si la syntaxe de ds:si n'est pas respect par rapport a es:di
CheckSyntax0:
push ax bx dx bp si di ds es
push es di
push cs
pop es
mov di,offset temp2
call copy0
mov si,di
push cs
pop ds
pop di es
call getdelimiter0
mov bp,dx
mov dl,' '
call setdelimiter0
call compressdelimiter0
call uppercase0
call getnbitems0
;call xch
;mov ax,cx
;call getnbitem0
;call xch
;cmp ax,cx
;call xch
;jne notequalatall
mov bx,cx
xor cx,cx
itemer:
call whatisitem0
mov dx,ax
call xch
call whatisitem0
call xch
cmp ax,dx
jne prob
cmp al,6
jb equal
call cmpitems0
je equal
prob:
cmp dl,4
ja nosize
cmp al,8
je equal
cmp al,4
jne notequalatall
cmp dh,ah
ja notequalatall
jmp equal
nosize:
cmp al,7
jne noname
cmp ah,0
jne notequalatall
jmp equal
noname:
cmp al,8
je equal
jmp notequalatall
equal:
inc cx
cmp cx,bx
jne itemer
cld
ackno:
mov dx,bp
call setdelimiter0
pop es ds di si bp dx bx ax
ret
notequalatall:
stc
jmp ackno
xch:
push ds
push es
pop ds
pop es
xchg si,di
ret
temp2 db 256 dup (0)
;Compare les lments cx de deux chaine ds:si et es:di
Cmpitems0:
push cx dx si di
push cx di
call getpointeritem0
mov si,di
xor cx,cx
inc cx
call getpointeritem0
mov dx,di
sub dx,si
dec cx
pop di cx
push ds si
push es
pop ds
mov si,di
call getpointeritem0
pop si ds
mov cx,dx
rep cmpsb
pop di si dx cx
ret
;Renvoie l'lment cx de ds:si dans edx si nb et dans es:di si str ou name
gettypeditem0:
push bx cx si
call getpointeritem0
mov si,di
xor cx,cx
inc cl
call getpointeritem0
mov bx,di
dec bx
mov cl,0
xchg cl,ds:[bx]
call gettyped0
xchg cl,ds:[bx]
pop si cx bx
ret
;Renvoie ds:si dans edx si nb et dans es:di si str ou name
gettyped0:
push ax
call whatis0
cmp al,5
jb number
cmp al,6
je pointer
push ds
pop es
call getpointeritem0
jmp endofGettypeditem0
number:
mov edx,cs:lastnumber
jmp endofgettypeditem0
pointer:
call str0toadress
endofgettypeditem0:
pop ax
ret
;Renvoie dans ax le type de la str0 pointe par ds:si lment cx
whatisitem0:
push bx cx si di
call getpointeritem0
mov si,di
xor cx,cx
inc cl
call getpointeritem0
mov bx,di
dec bx
mov cl,0
xchg cl,ds:[bx]
call whatis0
xchg cl,ds:[bx]
pop di si cx bx
ret
;Renvoie dans ax le type de la str0 pointe par ds:si
;High Low
;0 variable 4 hex
;1 byte 3 dec
;2 word 2 oct
;3 3 octets 1 bin
;4 dword 5 adresse
;5 5 octets 6 name
;6 ... 7 str
whatis0:
push bx cx edx
mov cl,2
call str0isbase
jnc finbase
mov cl,8
call str0isbase
jnc finbase
mov cl,10
call str0isbase
jnc finbase
mov cl,16
call str0isbase
jc testadress
finbase:
mov bx,cx
xor ch,ch
mov al,cs:[bx+offset basenn-2]
call str0toint
mov cs:Lastnumber,edx
cmp edx,0000FFFFh
ja bits32
cmp dx,00FFh
ja bits16
mov ah,1
jmp endofwhat
bits16:
mov ah,2
jmp endofwhat
bits32:
mov ah,3
jmp endofwhat
testadress:
call str0isadress
jc testname
mov ax,0005h
jmp endofwhat
testname:
;call str0isname
;jc testvarstr
;jnc isok
;mov al,06h
cmp byte ptr [si],'&'
jne testvarstr
mov al,06h
call getlength0
dec cl
mov ah,cl
jmp endofwhat
testvarstr:
cmp byte ptr [si],'@'
jne testnumber
mov al,07h
call getlength0
dec cl
mov ah,cl
jmp endofwhat
testnumber:
cmp byte ptr [si],'#'
jne isstr
mov al,8
call getlength0
dec cl
mov ah,cl
jmp endofwhat
isstr:
mov al,07h
call getlength0
mov ah,cl
endofwhat:
pop edx cx bx
ret
Lastnumber dd 0
;Renvoie non carry si la str ds:si pointe peut ˆtre une adresse
str0isadress:
;push
stc
;pop
ret
;Renvoie en es:di le pointeur str0 ds:si
Str0toAdress:
;push
stc
;pop
ret
;Renvoie non carry si la str ds:si pointe peut ˆtre un nom de fichier
str0isname:
push ax si di
isname:
mov al,[si]
inc si
cmp al,0
je itsok
mov di,offset non
verify:
mov ah,[di]
inc di
cmp ah,0FFh
je isname
cmp ah,al
jne verify
stc
jmp itsdead
itsok:
clc
itsdead:
pop di si ax
ret
non db '/<>|"?*:\',01,0FFh
;Renvoie non carry si le texte point par si est de la base cl
str0isbase:
push ax cx si di es
push cs
pop es
mov ah,cl
isstrbase:
mov al,[si]
cmp al,0
je okbase
mov cl,ah
xor ch,ch
mov di,cx
cmp al,es:[di-2+offset basen]
je verifbase
xor ch,ch
inc cl
mov di,offset base
cld
repne scasb
cmp cx,0
je nobase
inc si
jmp isstrbase
okbase:
clc
endbase:
pop es di si cx ax
ret
verifbase:
cmp byte ptr [si+1],0
je okbase
nobase:
stc
jmp endbase
temp dw 0
;Converti un str de base cl en int dans edx
str0toint:
push eax bx ecx si edi ebp es
push cs
pop es
mov ah,cl
mov cs:temp,si
gotos:
cmp byte ptr [si+1], 0
je oklo
inc si
jmp gotos
oklo:
mov edi,1
xor ebp,ebp
mov bl,cl
baseto:
cmp si,cs:temp
jb endbaseto
mov al,[si]
xor ecx,ecx
mov cl,bl
inc cl
push di
mov di,offset base
cld
repne scasb
pop di
jne noop
sub cl,bl
neg cl
mov eax,edi
mul ecx
add ebp,eax
mov eax,edi
mov cl,bl
mul ecx
mov edi,eax
noop:
dec si
jmp baseto
endbaseto:
mov edx,ebp
pop es ebp edi si ecx bx eax
ret
base db '0123456789ABCDEF'
basen db 'B O D H'
basenn db 1,0,0,0,0,0,2,0,3,0,0,0,0,0,4
;Renvoie en es:di la partie de cx caractŠres a partir de la gauche de ds:si
Left0:
push ax cx si di
cld
rep movsb
mov al,0
stosb
pop di si cx ax
ret
;Renvoie en es:di la partie de cx caractŠres a partir de la droite de ds:si
Right0:
push ax cx dx si di
mov dx,cx
call getlength0
add si,cx
sub si,dx
mov cx,dx
cld
rep movsb
mov al,0
stosb
pop di si dx cx ax
ret
;Renvoie en es:di la partie de cx caractŠres a partir de la position bx de ds:si
middle0:
push ax cx si di
add si,bx
cld
rep movsb
mov al,0
stosb
pop di si cx ax
ret
;Rempli de cx caractŠres dl a partir de la position bx de ds:si
Fill0:
push ax bx cx si di es
push ds
pop es
add si,bx
mov al,dl
mov di,si
cld
rep stosb
pop es di si cx bx ax
ret
;Remplace tout les caractŠres al de ds:si par des caractŠres dl
ReplaceAllchar0:
push ax cx di es
call GetLength0
push ds
pop es
mov di,si
findandchange:
repne scasb
cmp cx,0
je endofchange
mov es:[di-1],dl
jmp findandchange
endofchange:
pop es di cx ax
ret
;Recherche un caractŠre dl dans la chaŒne ds:si
SearchChar0:
push ax cx di es
call GetLength0
push ds
pop es
mov di,si
mov al,dl
repne scasb
pop es di cx ax
ret
;Inverse la chaine pointe en ds:si
invert0:
push ax cx si di es
call GetLength0
push ds
pop es
mov di,si
add di,cx
dec di
revert:
mov al,[si]
xchg al,es:[di]
mov [si],al
inc si
dec di
cmp si,di
je finishinvert
dec di
cmp si,di
je finishinvert
inc di
jmp revert
finishinvert:
pop es di si cx ax
ret
;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal
cmpstr0:
push cx dx si di
call GetLength0
mov dx,cx
push ds si
push es
pop ds
mov si,di
call GetLength0
pop si ds
cmp cx,dx
jne NotEqual
repe cmpsb
NotEqual:
pop di si dx cx
ret
;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal et renvoie le nb de caractŠre egaux dans dx
evalue0:
push cx si di
push ds si
push es
pop ds
mov si,di
call GetLength0
pop si ds
mov dx,cx
repe cmpsb
pushf
sub dx,cx
popf
pop di si cx
ret
;Insert une chaine ds:si en es:di a partir du caractŠre cx
insert0:
push cx di si
add di,cx
call getlength0
push si di ds
push es
pop ds
mov si,di
add di,cx
call copy20
pop ds di si
cld
inc di
rep movsb
pop si di cx
ret
;Detruit CX caractŠres a partir du caractŠre BX de DS:SI
delete0:
push cx dx si di es
push ds
pop es
mov dx,cx
call getlength0
sub cx,dx
sub cx,bx
inc cx
add si,bx
mov di,si
add si,dx
cld
rep movsb
pop es di si dx cx
ret
;Copie une chaine de ds:si en es:di
Copy0:
push ax cx si di
call GetLength0
cld
rep movsb
mov al,0
stosb
pop di si cx ax
ret
;Copie une chaine de ds:si en es:di
Copy20:
push ax cx si di
call GetLength0
cld
add si,cx
add di,cx
inc cx
std
rep movsb
pop di si cx ax
ret
;ConcatŠne le chaine ds:si avec es:di
Concat0:
push ax cx dx si di
call GetLength0
mov dx,cx
xchg si,di
push ds
push es
pop ds
call GetLength0
pop ds
xchg si,di
add di,cx
mov cx,dx
cld
rep movsb
mov al,0
stosb
pop di si dx cx ax
ret
;Met DL comme dlimiteur par dfaut
SetDelimiter0:
mov cs:delim,dl
ret
;Renvoie le dlimiteur par dfaut dans dl
GetDelimiter0:
mov dl,cs:delim
ret
delim db 0
;Dtruit les dlimiteur qui sont conscutifs dans ds:si
CompressDelimiter0:
push ax dx si di es
call Getlength0
push ds
pop es
mov di,si
mov al,cs:delim
xor dx,dx
Compressitems:
repne scasb
inc dx
againcomp:
cmp [di],al
jne nosup
mov si,di
mov bx,0
push cx
mov cx,1
call delete0
pop cx
jmp againcomp
nosup:
cmp cx,0
jne compressitems
mov cx,dx
pop es di si dx ax
ret
;Met le nombre d'lments … cx
Setnbitems0:
push ax cx dx di es
mov dx,cx
call Getnbitems0
cmp cx,dx
je noadjust
ja subsome
push ds
pop es
mov di,si
sub cx,dx
neg cx
push cx
call getlength0
add di,cx
pop cx
mov al,cs:delim
mov ah,'a'
rep stosw
mov al,0
stosb
jmp noadjust
subsome:
mov cx,dx
call GetPointeritem0
dec di
mov byte ptr [di],0
noadjust:
pop es di dx cx
ret
;Renvoie la taille dx de l'lment cx
Getitemsize:
push cx di
call getpointeritem0
mov dx,di
inc cx
call getpointeritem0
sub dx,di
neg dx
dec dx
pop di cx
ret
;Renvoie en es:di l'lment cx de ds:si
Getitem0:
push si di cx ax
push di
call getPointeritem0
call getitemsize
mov si,di
pop di
mov cx,dx
rep movsb
mov al,0
stosb
pop ax cx di si
ret
;renvoi un pointeur di sur l'lment cx de ds:si
GetPointeritem0:
push ax bx cx dx es
mov bx,cx
call Getlength0
push ds
pop es
mov di,si
mov al,cs:delim
xor dx,dx
Countnbitems:
cmp bx,dx
je finishpointer
repne scasb
inc dx
cmp cx,0
jne countnbitems
inc di
finishpointer:
pop es dx cx bx ax
ret
;Renvoie le nombre d'lments cx de ds:si
GetNbitems0:
push ax dx di es
call Getlength0
push ds
pop es
mov di,si
mov al,cs:delim
xor dx,dx
Countitems:
repne scasb
inc dx
cmp cx,0
jne countitems
mov cx,dx
pop es di dx ax
ret
;renvoie la taille en octets CX de la chaine pointe en ds:si
GetLength0:
push ax di es
push ds
pop es
mov di,si
mov al,0
mov cx,0FFFFh
cld
repne scasb
neg cx
dec cx
dec cx
pop es di ax
ret
;Met la taille en octets de la chaine pointe ds:si a CX
SetLength0:
push bx
mov bx,cx
mov byte ptr [si+bx],0
pop bx
ret
;met en majuscule la chaine ds:si
UpperCase0:
push si ax
UpperCase:
mov al,ds:[si]
inc si
cmp al,0
je EndUpperCase
cmp al,'a'
jb UpperCase
cmp al,'z'
ja UpperCase
sub byte ptr [si-1],'a'-'A'
jmp UpperCase
EndUpperCase:
clc
pop ax si
ret
;met en majuscule la premiŠre lettre chaine ds:si
OneCase0:
push ax
OneUpperCase:
mov al,ds:[si]
cmp al,'a'
jb OneEndUpperCase
cmp al,'z'
ja OneEndUpperCase
sub byte ptr [si],'a'-'A'
OneEndUpperCase:
clc
pop ax
ret
;met en minuscule la chaine ds:si
LowerCase0:
push si ax
LowerCase:
mov al,ds:[si]
inc si
cmp al,0
je EndLowerCase
cmp al,'A'
jb LowerCase
cmp al,'Z'
ja LowerCase
add byte ptr [si-1],'a'-'A'
jmp LowerCase
EndLowerCase:
clc
pop ax si
ret
;Inverse la casse la chaine ds:si
InvertCase0:
push si ax
InvertCase:
mov al,ds:[si]
inc si
cmp al,0
je EndInvertCase
cmp al,'A'
jb InvertCase
cmp al,'Z'
jbe GoInvertCase
cmp al,'a'
jb InvertCase
cmp al,'z'
ja InvertCase
sub byte ptr [si-1],'a'-'A'
jmp InvertCase
GoInvertCase:
add byte ptr [si-1],'a'-'A'
jmp InvertCase
EndInvertCase:
clc
pop ax si
ret

25
commande/test.asm Normal file
View File

@ -0,0 +1,25 @@
.model tiny
.486
smart
.code
org 0100h
start:
mov si,offset essai
call whatis0
mov si,offset pop1
mov di,offset pop2
call checksyntax0
ret
essai db '#',0
pop1 db 'essai 0FFh',0
pop2 db 'ESSAI 012H',0
include str0.asm
end start

View File

@ -1,27 +1,14 @@
[bits 16] ;16 bits
[org 0x0] ;Point d'entré en 0h
[org 0x0100] ;Point d'entré en 0100h
section .text ;Segment de code
checks db "CE" ;signature de l'exe
major db 1 ;N° version
checksum dd 0 ;Checksum de l'exe
compressed db 0 ;a 1 si compressé par RLE
exports dw 0 ;importation de fonctions
imports dw imported ;exportation de fonctions
sections dw 0 ;sections des blocs mémoire
starting dw realstart
start:
mov ah,0x0D
mov si,msg
int 0x47 ;Afficher le texte (Showstring0)
xor ax,ax
int 0x16 ;Attendre l'appuie sur une touche
retf ;retour far
imported:
db "VIDEO.LIB::print",0
print dd 0
endofimport dd 0
realstart:
push msg
call far [cs:print] ;Afficher le texte (Showstring0)
xor ax,ax
int 0x16 ;Attendre l'appuie sur une touche
retf ;retour far
msg db 'Hello World !!',0
msg db 'Hello World',0

View File

@ -3,29 +3,17 @@
Smart ;Optimisations
.code ;Segment de code
org 0h ;Point d'entré en 0h
checks db "CE" ;signature de l'exe
major db 1 ;N° version
checksum dd 0 ;Checksum de l'exe
compressed db 0 ;a 1 si compressé par RLE
exports dw 0 ;importation de fonctions
imports dw imported ;exportation de fonctions
sections dw 0 ;sections des blocs mémoire
starting dw realstart
imported:
db "VIDEO.LIB::print",0
print dd 0
org 0100h ;Point d'entré en 0100h
start:
push msg
call far [cs:print] ;Afficher le texte (Showstring0)
xor ax,ax
int 16h ;Attendre l'appuie sur une touche
db 0CBH ;retour far
mov ah,0Dh
mov si,offset msg
int 47h ;Afficher le texte (Showstring0)
xor ax,ax
int 16h ;Attendre l'appuie sur une touche
db 0CBH ;retour far
msg db 'Hello World !!',0
msg db 'Hello World',0
end start

BIN
doc_origine.pdf Normal file

Binary file not shown.

View File

@ -1,32 +0,0 @@
struc vertex3d
tx dd ?
ty dd ?
tz dd ?
ends vertex3d
struc mat
p1 dd ?
p2 dd ?
p3 dd ?
p4 dd ?
p5 dd ?
p6 dd ?
p7 dd ?
p8 dd ?
p9 dd ?
p10 dd ?
p11 dd ?
p12 dd ?
p13 dd ?
p14 dd ?
p15 dd ?
p16 dd ?
ends mat
main equ 4D4Dh
edit equ 3D3Dh
object equ 4000h
mesh equ 4100h
vertex equ 4110h
face equ 4120h
locale equ 4160h

View File

@ -1,40 +1,40 @@
struc bmp_file
bmp_filetype db 'bm'
bmp_filesize dd ? ; taille du fichier
bmp_reserved dd 0 ; toujours 0
bmp_bitmapoffset dd ? ; offset de l'image
bmp_headersize dd ? ; taille de l'entete en octects
bmp_width dd ? ; largeur en pixels de l'image
bmp_height dd ? ; hauteur en pixels de l'image
bmp_planes dw 1 ; nombre de plan utilisés
bmp_bitsperpixel dw ? ; nombre de bits par pixels
bmp_compression dd ? ; méthode de compression
bmp_sizeofbitmap dd ? ; taille de l'image en octects
bmp_horzresolution dd ? ; resolution horizontale en pixels par mètre
bmp_vertresolution dd ? ; resolution verticale en pixels par mètre
bmp_colorsused dd ? ; nombre de couleur dans la palette si 0: palette entière si bitperpixel<=8
bmp_colorsimportant dd ? ; nombre de couleurs importantes masques pour les modes de plus de 8 bits par pixels
bmp_redmask dd ?
bmp_greenmask dd ?
bmp_bluemask dd ?
bmp_alphamask dd ?
bmp_colorspacetype dd ?
bmp_redx dd ?
bmp_redy dd ?
bmp_redz dd ?
bmp_greenx dd ?
bmp_greeny dd ?
bmp_greenz dd ?
bmp_bluex dd ?
bmp_bluey dd ?
bmp_bluez dd ?
bmp_gammared dd ?
bmp_gammagreen dd ?
bmp_gammeblue dd ?
ends bmp_file
BMP_File struc
BMP_FileType db 'BM'
BMP_FileSize dd ? ; taille du fichier
BMP_Reserved dd 0 ; toujours 0
BMP_BitMapOffset dd ? ; offset de l'image
BMP_HeaderSize dd ? ; taille de l'entete en octects
BMP_Width dd ? ; largeur en pixels de l'image
BMP_Height dd ? ; hauteur en pixels de l'image
BMP_Planes dw 1 ; nombre de plan utilisés
BMP_BitsPerPixel dw ? ; nombre de bits par pixels
BMP_Compression dd ? ; méthode de compression
BMP_SizeOfBitMap dd ? ; taille de l'image en octects
BMP_HorzResolution dd ? ; resolution horizontale en pixels par mètre
BMP_VertResolution dd ? ; resolution verticale en pixels par mètre
BMP_ColorsUsed dd ? ; nombre de couleur dans la palette si 0: palette entière si BitPerPixel<=8
BMP_ColorsImportant dd ? ; nombre de couleurs importantes masques pour les modes de plus de 8 bits par pixels
BMP_RedMask dd ?
BMP_GreenMask dd ?
BMP_BlueMask dd ?
BMP_AlphaMask dd ?
BMP_ColorSpaceType dd ?
BMP_RedX dd ?
BMP_RedY dd ?
BMP_RedZ dd ?
BMP_GreenX dd ?
BMP_GreenY dd ?
BMP_GreenZ dd ?
BMP_BlueX dd ?
BMP_BlueY dd ?
BMP_BlueZ dd ?
BMP_GammaRed dd ?
BMP_GammaGreen dd ?
BMP_GammeBlue dd ?
BMP_file ends
;bmp_compression peut prendre les valeurs suivantes:
bmp_comp_uncomp equ 0 ; pas de compression
bmp_comp_rle8 equ 1 ; 8-bit run length encoding
bmp_comp_rle4 equ 2 ; 4-bit tun length encoding
bmp_comp_bfe equ 3 ; bitfields encoding
;BMP_Compression peut prendre les valeurs suivantes:
BMP_COMP_UNCOMP equ 0 ; pas de compression
BMP_COMP_RLE8 equ 1 ; 8-bit run length encoding
BMP_COMP_RLE4 equ 2 ; 4-bit tun length encoding
BMP_COMP_BFE equ 3 ; bitfields encoding

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,9 +1,3 @@
struc diskbuffer
size dw 12
current dw 0FFFFh
chain dw 128 dup (0FFFFh)
ends diskbuffer
struc dpt
steprate&headunload db 0DFh ;Vitesse de progression & monte de la tˆte
dmaflag&headload db 002h ;Etat Dma et temps de descente de la tˆte
@ -34,15 +28,6 @@ filegroup dw 0
filesize dd 0
ends entries
;Pour recherches
struct find
files db 13 dup (0) ;le fichier
entryplace dw 0 ;En octet
adressdirectory dw 0 ;En cluster
firstsearch db 1 ;Premiere requete ?
result entries <>
ends find
struc bootinfo
vendor db 'COS2000A' ;Fabricant + n°série Formatage
sectorsize dw 512 ;octet/secteur

View File

@ -2,31 +2,3 @@ struc point
coordx db 0
coordy db 0
ends point
struc vgainf
lines db 0
columns db 0
x db 0
y db 0
xy dw 0
colors db 7
mode db 0FFh
pagesize dw 0
style db 0
font db 0
graphic db 0
nbpage db 0
color db 0
cursor db 0
segments dw 0
linesize dw 0
adress dw 0
base dw 0
scrolling db 1
ends vgainf
struc vertex2d
px dw ?
py dw ?
ends vertex2d

View File

@ -1,58 +1,3 @@
struc regs
seip dd 0
seax dd 0
sebx dd 0
secx dd 0
sedx dd 0
sesi dd 0
sedi dd 0
sebp dd 0
sesp dd 0
scs dw 0
sds dw 0
ses dw 0
sfs dw 0
sgs dw 0
sss dw 0
seflags dd 0
;sst0 dt 0
;sst1 dt 0
;sst2 dt 0
;sst3 dt 0
;sst4 dt 0
;sst5 dt 0
;sst6 dt 0
;sst7 dt 0
ends regs
struc tuple ;vecteur d'interruption
off dw 0 ;adresse
seg dw 0 ;segment
ends tuple
union vector
data tuple <>
content dd 0
ends
struc ints ;bloc interruption
number db 0 ;numero de l'interruption
activated db 0 ;activé ou non
locked db 0 ;verrouillée
launchedlow dd 0
launchedhigh dd 0
calledlow dd 0
calledhigh dd 0
vector1 vector ?
vector2 vector ?
vector3 vector ?
vector4 vector ?
vector5 vector ?
vector6 vector ?
vector7 vector ?
vector8 vector ?
ends ints
struc mb ;Bloc de mémoire
check db "NH" ;signature du bloc de mémoire
isnotlast db 0 ;flag indiquant le dernier bloc
@ -84,49 +29,4 @@ ends descriptor
free equ 0 ;Reference quand libre
macro exporting
label exports
endm
macro importing
label imports
endm
macro noimporting
label imports
dd 0
endm
macro noexporting
label imports
dd 0
endm
macro ende
dd 0
endm
macro endi
dd 0
endm
macro use lib:req,fonction:req
db "&lib&::&fonction&",0
label &fonction& dword
dd 0
endm
macro declare fonction:req
db "&fonction&",0
dw offset fonction
endm
macro heading versmaj:req,versmin:req,start:req
header exe <"CE",offset &versmaj&,offset &versmin&,0,offset exports,offset imports,0,offset &start&>
db "&fonction&",0
dw offset fonction
endif
endm
memorystart equ 0052h ;premier bloc de la mémoire

View File

@ -1,10 +1,10 @@
asm= lzasm /z/t
asm= lzasm
lnk= elink
all: setup.com
setup.com: setup.obj
$(lnk) setup.obj setup.com /c
$(lnk) setup.obj setup.com
setup.obj:
$(asm) setup.asm

View File

@ -11,7 +11,7 @@ ent equ 32h
jmp copycos
message db 0Dh,0Ah,'COS 2000 V1.4Fr programme d''installation',0Dh,0AH,'Inserez une disquette formatee et appuyez sur entre...',0Dh,0AH,'Attention le contenu de celle ci peut etre altere !!!',0Dh,0AH,'$'
message db 0Dh,0Ah,'COS 2000 V1.3.1BetaFr programme d''installation',0Dh,0AH,'Inserez une disquette formatee et appuyez sur entre...',0Dh,0AH,'Attention le contenu de celle ci peut etre altere !!!',0Dh,0AH,'$'
message2 db 0Dh,0AH,'Creation du secteur de demarrage...',0Dh,0Ah,'$'
message3 db 0Dh,0AH,'Copie des fichiers systeme...',0Dh,0Ah,'$'
errormsg db 0Dh,0AH,'Erreur d''installation, contactez moi a COS2000@MULTIMANIA.COM !',0Dh,0AH,'$'

1222
lib/3d.asm

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,23 @@
asm= lzasm /z/t
asm= lzasm
lnk= elink
all: detect.lib video.lib str0.lib bmp.lib graphic.lib 3d.lib math.lib
all: detect.lib video.lib
.asm.obj:
$(asm) $<
detect.lib: detect.obj
$(lnk) detect.obj detect.lib
.obj.lib:
$(lnk) $< $*.lib
video.lib: video.obj
$(lnk) video.obj video.lib
detect.obj:
$(asm) detect.asm
video.obj:
$(asm) video.asm
clean:
del *.obj
del *.ce
del *.exe
del *.bak
del *.lib
del *.com

View File

@ -1,72 +1,77 @@
model tiny,stdcall
p586N
.model tiny
.486
smart
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
include "..\include\bmp.h"
.code
org 0h
start:
header exe <"CE",1,0,0,offset exports,offset imports,,>
exporting
declare showbmp
declare loadbmppalet
ende
include ..\include\mem.h
include ..\include\bmp.h
importing
use VIDEO,showpixel
endi
start:
header exe <,1,0,,,,offset exports,>
exports:
db "showbmp",0
dw showbmp
db "loadbmppalet",0
dw loadbmppalet
dw 0
;==========SHOWBMP=========
;Affiche le BMP pointée par DS:%0 en %1, %2
;<- DS:%0 BMP, %1 coordonnées X, %2 coordonnées Y
;->
;==========================
PROC showbmp FAR
ARG @pointer:word, @x:word, @y:word
USES ax,bx,cx,dx,si,di
mov si,[@pointer]
cmp [word ptr (bmp_file si).bmp_filetype],"MB"
showbmp PROC FAR
ARG pointer:word, x:word, y:word=taille
push bp
mov bp,sp
push ax bx cx dx si di
mov si,[pointer]
cmp word ptr [si+BMP_file.BMP_FileType],"MB"
jne @@errorshowing
mov edi,[(bmp_file si).bmp_bitmapoffset]
add di,400h
mov edi,[si+BMP_BitMapOffset]
add di,si
mov ah,8
xor ebx,ebx
mov ecx,[(bmp_file si).bmp_height]
mov edx,[(bmp_file si).bmp_width]
;and dx,11111100b
cmp edx,[(bmp_file si).bmp_width]
;jae @@noadjust
;add dx,4
mov ecx,[si+offset BMP_File.BMP_height]
mov edx,[si+offset BMP_File.BMP_width]
and dx,11111100b
cmp edx,[si+offset BMP_File.BMP_width]
jae @@noadjust
add dx,4
@@noadjust:
sub edx,[(bmp_file si).bmp_width]
sub dx,[si+offset BMP_File.BMP_width]
@@bouclette:
mov al,[di]
push bx cx
add bx,[@x]
add cx,[@y]
call [cs:showpixel],bx,cx,[word ptr di]
add bx,[x]
add cx,[y]
int 47h
pop cx bx
inc bx
inc di
cmp ebx,[(bmp_file si).bmp_width]
jb @@bouclette
cmp ebx,[si+offset BMP_File.BMP_width]
jb @@bouclette
xor bx,bx
;add di,dx
add di,dx
dec cx
cmp cx,0
jne @@bouclette
clc
ret
pop di si dx cx bx ax
pop bp
retf taille
@@errorshowing:
stc
ret
ENDP showbmp
pop di si cx bx ax
pop bp
retf taille
showbmp ENDP
;==========LOADBMPPALET=========
@ -74,14 +79,16 @@ ENDP showbmp
;-> DS:%0 BMP
;<-
;===============================
PROC loadbmppalet FAR
ARG @pointer:word
USES ax,bx,cx,dx,si
mov si,[@pointer]
loadbmppalet PROC FAR
ARG pointer:word=taille
push bp
mov bp,sp
push ax bx cx dx si
mov si,[pointer]
mov bx,0400h+36h-4
mov cx,100h
mov dx, 3c8h
@@paletteload:
paletteload:
mov al, cl
dec al
out dx, al
@ -98,8 +105,10 @@ PROC loadbmppalet FAR
sub bx,4
dec dx
dec cl
jnz @@paletteload
ret
ENDP loadbmppalet
jnz paletteload
pop si dx cx bx ax
pop bp
retf taille
loadbmppalet ENDP
end start

View File

@ -13,18 +13,28 @@ org 0h
header exe <"CE",1,0,0,offset exports,,,>
exporting
declare cpuinfo
declare setinfo
declare pciinfo
declare getpciclass
declare getpcisubclass
declare getcardinfo
declare pcireadbyte
declare pcireadword
declare pcireaddword
declare detectvmware
ende
exports:
db "cpuinfo",0
dw cpuinfo
db "setinfo",0
dw setinfo
db "pciinfo",0
dw pciinfo
db "getpciclass",0
dw getpciclass
db "getpcisubclass",0
dw getpcisubclass
db "getcardinfo",0
dw getcardinfo
db "pcireadbyte",0
dw pcireadbyte
db "pcireadword",0
dw pcireadword
db "pcireaddword",0
dw pcireaddword
db "detectvmware",0
dw detectvmware
dd 0
PROC detectvmware FAR
USES eax,ebx,ecx,edx
@ -307,7 +317,6 @@ subclass170 db 'dpio',0
PROC getcardinfo FAR
ARG @bus:word,@device:word,@function:word,@pointer:word
USES eax,bx,di
mov di,[@pointer]
cmp [@function],0
je @@amultiorfirst
call pcireadbyte,[@bus],[@device],0,offset (pcidata).typed
@ -318,6 +327,7 @@ PROC getcardinfo FAR
jmp @@notexist
@@amultiorfirst:
xor bx,bx
mov di,[@pointer]
@@goinfos:
call pcireadword,[@bus],[@device],[@function],bx
inc bl
@ -341,7 +351,7 @@ PROC getcardinfo FAR
ret
endp getcardinfo
;lit un octet du bus %0 device %1 function %2 nø %3 et le met en AL
;lit un octet du bus %0 device %1 function %2 n° %3 et le met en AL
PROC pcireadbyte FAR
ARG @bus:word,@device:word,@function:word,@pointer:word
USES bx,dx
@ -363,7 +373,7 @@ PROC pcireadbyte FAR
ret
endp pcireadbyte
;lit 2 octet du bus %0 device %1 function %2 nø %3 et le met en AX
;lit 2 octet du bus %0 device %1 function %2 n° %3 et le met en AX
PROC pcireadword FAR
ARG @bus:word,@device:word,@function:word,@pointer:word
USES bx,dx
@ -385,7 +395,7 @@ PROC pcireadword FAR
ret
endp pcireadword
;lit 4 octet du bus %0 device %1 function %2 nø %3 et le met en EAX
;lit 4 octet du bus %0 device %1 function %2 n° %3 et le met en EAX
PROC pcireaddword FAR
ARG @bus:word,@device:word,@function:word,@pointer:word
USES bx,dx

View File

@ -1,230 +0,0 @@
model tiny,stdcall
p586
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\graphic.h"
org 0h
header exe <"CE",1,0,0,offset exports,offset imports,,>
exporting
declare hline
declare line
declare polyfill
ende
importing
use VIDEO,showpixel
endi
PROC hline FAR
ARG @x1:word,@x2:word,@y:word,@color:word
USES cx,dx
mov cx,[@x1]
mov dx,[@x2]
cmp cx,dx
jbe @@boucle
xchg cx,dx
@@boucle:
call [cs:showpixel],cx,[@y],[@color]
inc cx
cmp cx,dx
jbe @@boucle
ret
endp hline
; affiche un pixel en %0 %1 couleur %2
PROC line FAR
ARG @x1:word,@y1:word,@x2:word,@y2:word,@color:word
USES ax,bx,cx,dx,si,di
LOCAL @@deltax:word,@@deltay:word
mov ax,[@x2]
sub ax,[@x1]
call absolute
mov [@@deltax],ax
mov cx,ax
mov ax,[@y2]
sub ax,[@y1]
call absolute
mov dx,ax
mov [@@deltay],ax
mov ax,-1
mov bx,-1
mov si,[@x1]
mov di,[@y1]
cmp si,[@x2]
jg @@x1greater
mov ax,1
@@x1greater:
cmp di,[@y2]
jg @@y1greater
mov bx,1
@@y1greater:
cmp cx,dx
jl @@deltaxgreater
mov dx,[@@deltax]
sar dx,1
xor cx,cx
@@boucle1:
add si,ax
add dx,[@@deltay]
cmp dx,[@@deltax]
jl @@above1
sub dx,[@@deltax]
add di,bx
@@above1:
call [cs:showpixel],si,di,[@color]
inc cx
cmp cx,[@@deltax]
jl @@boucle1
jmp @@endofline
@@deltaxgreater:
mov dx,[@@deltay]
sar dx,1
xor cx,cx
@@boucle2:
add di,bx
add dx,[@@deltax]
cmp dx,[@@deltay]
jle @@above2
sub dx,[@@deltay]
add si,ax
@@above2:
call [cs:showpixel],si,di,[@color]
inc cx
cmp cx,[@@deltay]
jl @@boucle2
@@endofline:
ret
endp line
;renvoie la valeur absolue de AX
PROC absolute NEAR
cmp ax,0
jg @@noabs
neg ax
@@noabs:
ret
endp absolute
ymax equ 200
; initialise un segment 2
PROC polyfill FAR
ARG @pointer:word,@nbfaces:word,@color:word;
LOCAL @@startx:word:200,@@endx:word:200,@@pas:dword,@@miny:word,@@maxy:word
USES eax,ebx,ecx,edx,si,di,es
mov di,bp
sub di,2
mov ax,16000
mov cx,(200+200)*2
push ss
pop es
std
rep stosw
mov si,[@pointer]
mov di,[@pointer]
add di,size vertex2d
mov [@@miny],ymax
mov [@@maxy],0
mov cx,[@nbfaces]
dec cx
@@boucle:
push si di cx
mov ax,[(vertex2d di).py]
cmp ax,[(vertex2d si).py]
je @@noexchange
jge @@nothingtodo
xchg si,di
@@nothingtodo:
xor eax,eax
mov ax,[(vertex2d si).px]
cwde
sal eax,8
mov ebx,eax
xor eax,eax
mov ax,[(vertex2d di).px]
sub ax,[(vertex2d si).px]
cwde
sal eax,8
xor ecx,ecx
mov cx,[(vertex2d di).py]
sub cx,[(vertex2d si).py]
cdq
idiv ecx
mov [@@pas],eax
add ebx,eax
mov dx,[(vertex2d si).py]
inc dx
cmp dx,[@@miny]
jge @@notinf
mov [@@miny],dx
@@notinf:
mov ax,[(vertex2d di).py]
cmp ax,[@@maxy]
jle @@boucle2
mov [@@maxy],ax
@@boucle2:
cmp dx,0
jl @@notgood
cmp dx,ymax
jge @@notgood
mov si,dx
shl si,1
neg si
cmp [word ptr bp+si-2],16000
jne @@notgoodforinf
mov eax,ebx
sar eax,8
mov [bp+si-2],ax
@@notgoodforinf:
mov eax,ebx
sar eax,8
mov [bp+si-200*2-2],ax
@@notgood:
add ebx,[@@pas]
inc dx
cmp dx,[(vertex2d di).py]
jle @@boucle2
@@noexchange:
pop cx di si
add si,size vertex2d
add di,size vertex2d
dec cx
js @@finished
jnz @@boucle
mov di,[@pointer]
mov cx,0FFFFh
jmp @@boucle
@@finished:
cmp [word ptr @@miny],0
jae @@noadj
mov [@@miny],0
@@noadj:
cmp [word ptr @@maxy],ymax
jb @@noadj2
mov [@@maxy],ymax-1
@@noadj2:
mov cx,[@@miny]
@@drawboucle:
mov si,cx
shl si,1
neg si
mov ax,[bp+si-2]
mov bx,[bp+si-200*2-2]
cmp bx,16000
jnz @@noinfatall
mov ax,bx
@@noinfatall:
call hline,ax,bx,cx,[@color]
inc cx
cmp cx,[@@maxy]
jna @@drawboucle
ret
endp polyfill

View File

@ -1,38 +0,0 @@
model tiny,stdcall
p586
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
org 0h
header exe <"CE",1,0,0,offset exports,,,>
exporting
declare random
declare randomize
ende
randseed dw 1234h
PROC random FAR
USES dx
mov ax,[cs:randseed]
mov dx,8405h
mul dx
inc ax
mov [cs:randseed],ax
mov ax,dx
ret
endp random
PROC randomize FAR
USES ax,cx,dx
mov ah,0
int 1ah
mov [cs:randseed],dx
ret
endp randomize

View File

@ -1,993 +0,0 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
org 0h
header exe <"CE",1,0,0,offset exports,,,>
exporting
declare checksyntax
declare cmpitems
declare gettypeditem
declare gettyped
declare whatisitem
declare whatis
declare strtoadress
declare strisadress
declare strisname
declare strisbase
declare strtoint
declare left
declare right
declare middle
declare fill
declare replaceallchar
declare searchchar
declare invert
declare cmpstr
declare evalue
declare insert
declare delete
declare copy
declare concat
declare compressdelimiter
declare setnbitems
declare getitemsize
declare getitem
declare getpointeritem
declare getnbitems
declare getlength
declare setlength
declare uppercase
declare onecase
declare lowercase
declare invertcase
ende
;Librairie qui prend en charge le format de STR ASCIIZ
;# nombre 8
;? str 7
;& nom 6
;High Low
;0 variable 4 hex
;1 byte 3 dec
;2 word 2 oct
;3 3 octets 1 bin
;4 dword 5 adresse
;5 5 octets 6 nom
;6 ... 7 str
; 8 nombre
;Renvoie carry si la syntaxe de ds:si n'est pas respect par rapport a es:di
PROC checksyntax FAR
ARG @src:word,@dest:word,@delim:word
USES ax,bx,cx,dx,si,di,ds,es
LOCAL @@temp:word:256
push ss
pop es
lea si,[@@temp]
mov di,[@dest]
call copy,[@src],si
call xch
call compressdelimiter,si,[@delim]
call getnbitems,si,[@delim]
mov bx,ax
call xch
call getnbitems,di,[@delim]
cmp bx,ax
jne @@notequalatall
xor cx,cx
@@itemer:
call xch
call whatisitem,si,cx,[@delim]
mov dx,ax
call xch
call whatisitem,di,cx,[@delim]
cmp ax,dx
jne @@prob
cmp al,6
jb @@equal
call cmpitems
je @@equal
@@prob:
cmp dl,4
ja @@nonumber
cmp dl,8
je @@equal
;cmp al,4
;jne @@notequalatall
cmp dh,ah
ja @@notequalatall
jmp @@equal
@@nonumber:
cmp al,7
jne @@nostr
cmp ah,0
jne @@notequalatall
jmp @@equal
@@nostr:
cmp al,6
jne @@noname
cmp dl,6
jne @@noname
cmp ah,0
jne @@notequalatall
jmp @@equal
@@noname:
cmp al,8
je @@equal
jmp @@notequalatall
@@equal:
inc cx
cmp cx,bx
jne @@itemer
cld
@@ackno:
ret
@@notequalatall:
stc
jmp @@ackno
endp checksyntax
xch:
push es
push ds
pop es
pop ds
ret
;Compare les lments cx de deux chaine ds:si et es:di
PROC cmpitems FAR
ARG @src:word,@dest:word,@item:word,@delim:word
USES ax,cx,si,di,es
push ds
pop es
call getpointeritem,[@src],[@item],[@delim]
mov si,ax
call getitemsize,[@src],[@item],[@delim]
mov di,[@dest]
mov cx,ax
cld
rep cmpsb
clc
ret
endp cmpitems
;Renvoie l'lment cx de ds:si dans edx si nb et dans es:di si str ou name
PROC gettypeditem FAR
ARG @src:word,@item:word,@delim:word
USES bx,cx,si,di
mov si,[@src]
mov cx,[@item]
call getpointeritem,si,cx,[@delim]
mov di,ax
inc cx
call getpointeritem,si,cx,[@delim]
mov si,ax
dec si
mov cl,0
xchg cl,[ds:si]
call gettyped,di
xchg cl,[ds:si]
clc
ret
endp gettypeditem
;Renvoie eax si nb et dans ds:eax si str ou name
PROC gettyped FAR
ARG @src:word
USES si
mov si,[@src]
xor eax,eax
call whatis,si
cmp al,1
je @@bin
cmp al,2
je @@oct
cmp al,3
je @@dec
cmp al,4
je @@hex
cmp al,5
je @@pointer
mov ax,si
jmp @@endofgettypeditem
@@bin:
call strtoint,si,2
jmp @@endofgettypeditem
@@oct:
call strtoint,si,8
jmp @@endofgettypeditem
@@dec:
call strtoint,si,10
jmp @@endofgettypeditem
@@hex:
call strtoint,si,16
jmp @@endofgettypeditem
@@pointer:
call strtoadress,si
@@endofgettypeditem:
clc
ret
endp gettyped
;Renvoie dans ax le type de la str0 pointe par ds:%0 lment %1 delim %3
PROC whatisitem FAR
ARG @src:word,@item:word,@delim:word
USES bx,cx,si,di
mov si,[@src]
mov cx,[@item]
call getpointeritem,si,cx,[@delim]
mov di,ax
inc cx
call getpointeritem,si,cx,[@delim]
mov si,ax
dec si
mov cl,0
xchg cl,[ds:si]
call whatis,di
xchg cl,[ds:si]
clc
ret
endp whatisitem
;Renvoie dans ax le type de la str0 pointe par ds:%0
;High Low
;0 variable 4 hex
;1 byte 3 dec
;2 word 2 oct
;3 3 octets 1 bin
;4 dword 5 adresse
;5 5 octets 6 name
;6 ... 7 str
PROC whatis FAR
ARG @src:word
USES bx,cx,edx,si
mov si,[@src]
xor cx,cx
mov cl,2
call strisbase,si,cx
jnc @@finbase
mov cl,8
call strisbase,si,cx
jnc @@finbase
mov cl,10
call strisbase,si,cx
jnc @@finbase
mov cl,16
call strisbase,si,cx
jc @@testadress
@@finbase:
mov bx,cx
xor ch,ch
mov al,[cs:bx+offset basenn-2]
push eax
call strtoint,si,cx
mov edx,eax
pop eax
cmp edx,0000FFFFh
ja @@bits32
cmp dx,00FFh
ja @@bits16
mov ah,1
jmp @@endofwhat
@@bits16:
mov ah,2
jmp @@endofwhat
@@bits32:
mov ah,4
jmp @@endofwhat
@@testadress:
call strisadress,si
jc @@testname
mov ax,0005h
jmp @@endofwhat
@@testname:
call strisname
jc @@testnumber
xor ah,ah
cmp [byte ptr si],'&'
je @@okname
call getlength,si
mov ah,al
@@okname:
mov al,06h
jmp @@endofwhat
@@testnumber:
cmp [byte ptr si],'#'
jne @@testvarstr
xor ah,ah
mov al,08h
jmp @@endofwhat
@@testvarstr:
xor ah,ah
cmp [byte ptr si],'?'
je @@okvarstr
call getlength,si
mov ah,al
@@okvarstr:
mov al,07h
@@endofwhat:
clc
ret
endp whatis
;Renvoie non carry si la str ds:si pointe peut ˆtre une adresse
PROC strtoadress FAR
;push
stc
;pop
ret
endp strtoadress
;Renvoie en es:di le pointeur str0 ds:si
PROC strisadress FAR
;push
stc
;pop
ret
endp strisadress
;Renvoie non carry si la str ds:%0 pointe peut ˆtre un nom de fichier
PROC strisname FAR
ARG @src:word
USES ax,si,di
mov si,[@src]
@@isname:
mov al,[si]
inc si
cmp al,0
je @@itsok
mov di,offset non
@@verify:
mov ah,[cs:di]
inc di
cmp ah,0FFh
je @@isname
cmp ah,al
jne @@verify
stc
jmp @@itsdead
@@itsok:
clc
@@itsdead:
ret
endp strisname
non db '/<>|"?*:\',01,0FFh
;Renvoie non carry si le texte point par %0 est de la base %1
PROC strisbase FAR
ARG @src:word,@base:word
USES ax,cx,si,di,es
push cs
pop es
mov si,[@src]
@@isstrbase:
mov al,[si]
cmp al,0
je @@okbase
mov cx,[@base]
xor ch,ch
mov di,cx
cmp al,[es:di-2+offset basen]
je @@verifbase
xor ch,ch
inc cl
mov di,offset base
cld
repne scasb
cmp cx,0
je @@nobase
inc si
jmp @@isstrbase
@@okbase:
clc
@@endbase:
ret
@@verifbase:
cmp [byte ptr si+1],0
je @@okbase
@@nobase:
stc
jmp @@endbase
endp strisbase
base db '0123456789ABCDEF'
basen db 'b o d h'
basenn db 1,0,0,0,0,0,2,0,3,0,0,0,0,0,4
;Converti un str %0 de base %1 en int dans eax
PROC strtoint FAR
ARG @src:word,@base:word
USES ebx,ecx,edx,si,edi,es
push cs
pop es
mov si,[@src]
@@gotos:
cmp [byte ptr si+1], 0
je @@oklo
inc si
jmp @@gotos
@@oklo:
mov edi,1
xor ebx,ebx
@@baseto:
cmp [@src],si
ja @@endbaseto
mov al,[si]
xor ecx,ecx
mov cl,[byte ptr @base]
inc cl
push di
mov di,offset base
cld
repne scasb
pop di
jne @@noop
sub cl,[byte ptr @base]
neg cl
mov eax,edi
mul ecx
add ebx,eax
mov eax,edi
mov cl,[byte ptr @base]
mul ecx
mov edi,eax
@@noop:
dec si
jmp @@baseto
@@endbaseto:
mov eax,ebx
clc
ret
endp strtoint
;Renvoie en ds:%1 la partie de %2 caractŠres a partir de la gauche de ds:%0
PROC left FAR
ARG @src:word,@dest:word,@nb:word
USES ax,cx,si,di,es
push ds
pop es
mov si,[@src]
mov di,[@dest]
mov cx,[@nb]
cld
rep movsb
mov al,0
stosb
clc
ret
endp left
;Renvoie en ds:%1 la partie de %2 caractŠres a partir de la droite de ds:%0
PROC right FAR
ARG @src:word,@dest:word,@nb:word
USES ax,cx,si,di,es
push ds
pop es
mov si,[@src]
mov di,[@dest]
call getlength,si
add si,ax
sub si,[@nb]
mov cx,[@nb]
cld
rep movsb
mov al,0
stosb
clc
ret
endp right
;Renvoie en ds:%1 la partie de %3 caractŠres a partir de la position %2 de ds:%0
PROC middle FAR
ARG @src:word,@dest:word,@item:word,@nb:word
USES ax,cx,si,di,es
push ds
pop es
mov si,[@src]
mov di,[@dest]
mov cx,[@nb]
add si,[@item]
cld
rep movsb
mov al,0
stosb
clc
ret
endp middle
;Rempli de %3 caractŠres %2 a partir de la position %1 de ds:%0
PROC fill FAR
ARG @src:word,@item:word,@char:word,@nb:word
USES ax,cx,si,di,es
push ds
pop es
mov di,[@src]
add di,[@item]
mov ax,[@char]
mov cx,[@nb]
cld
rep stosb
clc
ret
endp fill
;Remplace tout les caractŠres %1 de ds:%0 par des caractŠres %2
PROC replaceallchar FAR
ARG @src:word,@char1:word,@char2:word
USES ax,cx,dx,di,es
mov di,[@src]
call getlength,di
mov cx,ax
mov ax,[@char1]
mov dx,[@char2]
push ds
pop es
@@findandchange:
repne scasb
cmp cx,0
je @@endofchange
mov [es:di-1],dl
jmp @@findandchange
@@endofchange:
clc
ret
endp replaceallchar
;Recherche un caractŠre dl dans la chaŒne ds:%0
PROC searchchar FAR
ARG @src:word,@char:word
USES cx,di,es
mov di,[@src]
call getlength,di
mov cx,ax
push ds
pop es
mov ax,[@char]
repne scasb
mov ax,di
dec ax
clc
ret
endp searchchar
;Inverse la chaine pointe en ds:%0
PROC invert FAR
ARG @src:word
USES ax,cx,si,di
mov si,[@src]
call getlength,si
mov di,si
add di,ax
dec di
@@revert:
mov al,[si]
xchg al,[di]
mov [si],al
inc si
dec di
cmp si,di
ja @@finishinvert
dec di
cmp si,di
ja @@finishinvert
inc di
jmp @@revert
@@finishinvert:
clc
ret
endp invert
;Compares 2 chaines de caractŠres DS:%0 et DS:%1 zerof si non equal
PROC cmpstr FAR
ARG @src:word,@dest:word
USES cx,dx,si,di
push ds
pop es
mov si,[@src]
mov di,[@dest]
call getlength,di
mov cx,ax
call getlength,si
cmp cx,ax
jne @@notequal
repe cmpsb
@@notequal:
ret
endp cmpstr
;Compares 2 chaines de caractŠres DS:%0 et DS:%1 zerof si non equal et renvoie le nb de caractŠre egaux dans ax
PROC evalue FAR
ARG @src:word,@dest:word
USES cx,si,di,es
push ds
pop es
mov si,[@src]
mov di,[@dest]
call getlength ,di
mov cx,ax
repe cmpsb
pushf
jne @@noident
sub ax,cx
popf
clc
ret
@@noident:
sub ax,cx
dec ax
popf
clc
ret
endp evalue
;Insert une chaine ds:%0 en ds:%1 a partir du caractŠre %2
PROC insert FAR
ARG @src:word,@dest:word,@item:word
USES ax,cx,si,di,es
push es
pop ds
mov si,[@dest]
call getlength,si
mov cx,ax
add si,ax
mov di,si
call getlength,[@src]
add di,ax
sub cx,[@item]
inc cx
std
rep movsb
mov si,[@src]
mov di,[@dest]
add di,[@item]
mov cx,ax
cld
rep movsb
clc
ret
endp insert
;Detruit %2 caractŠres a partir du caractŠre %1 de DS:%0
PROC delete FAR
ARG @src:word,@item:word,@size:word
USES ax,cx,dx,si,di,es
push ds
pop es
mov si,[@src]
call getlength,si
mov cx,ax
sub cx,[@size]
sub cx,[@item]
inc cx
add si,[@item]
mov di,si
add si,[@size]
cld
rep movsb
clc
ret
endp delete
;Copie une chaine de ds:si en es:di
PROC copy FAR
ARG @src:word,@dest:word
USES ax,cx,si,di
mov si,[@src]
mov di,[@dest]
call getlength,si
mov cx,ax
cld
rep movsb
mov al,0
stosb
clc
ret
endp copy
;ConcatŠne le chaine ds:si avec ds:di
PROC concat FAR
ARG @src:word,@dest:word
USES ax,cx,si,di,es
push ds
pop es
mov si,[@src]
call getlength,si
mov cx,ax
mov di,[@dest]
call getlength,di
add di,ax
cld
rep movsb
mov al,0
stosb
clc
ret
endp concat
;Dtruit les dlimiteur qui sont conscutifs dans ds:%0 -> renvoie le nb d'item
PROC compressdelimiter FAR
ARG @src:word,@delim:word
USES cx,dx,si,di,es
mov di,[@src]
call getlength,di
mov cx,ax
push ds
pop es
mov ax,[@delim]
xor dx,dx
@@compressitems:
repne scasb
inc dx
@@againcomp:
cmp [di],al
jne @@nosup
call delete,di,0,1
jmp @@againcomp
@@nosup:
cmp cx,0
jne @@compressitems
mov ax,dx
clc
ret
endp compressdelimiter
;Met le nombre d'lments de ds:%0 à %1
PROC setnbitems FAR
ARG @src:word,@size:word,@delim:word
USES ax,cx,di,es
mov di,[@src]
cmp [@size],0
je @@onlyzero
call getnbitems,di,[@delim]
cmp [@size],ax
je @@noadjust
jb @@subsome
push ds
pop es
sub ax,[@size]
neg ax
mov cx,ax
call getlength,di
add di,ax
mov ax,[@delim]
mov ah,'a'
rep stosw
xor al,al
stosb
jmp @@noadjust
@@subsome:
call getpointeritem,[@src],[@size],[@delim]
dec ax
mov di,ax
@@onlyzero:
mov [byte ptr di],0
@@noadjust:
clc
ret
endp setnbitems
;Renvoie la taille ax de l'lment %0
PROC getitemsize FAR
ARG @src:word,@item:word,@delim:word
USES cx,dx
mov cx,[@item]
call getpointeritem,[@src],cx,[@delim]
mov dx,ax
inc cx
call getpointeritem,[@src],cx,[@delim]
sub ax,dx
dec ax
clc
ret
endp getitemsize
;Renvoie en ds:%1 l'lment %2 de ds:%0
PROC getitem FAR
ARG @src:word,@dest:word,@item:word,@delim:word
USES ax,cx,si,di,es
push ds
pop es
call getpointeritem,[@src],[@item],[@delim]
mov si,ax
call getitemsize,[@src],[@item],[@delim]
mov di,[@dest]
mov cx,ax
cld
rep movsb
mov al,0
stosb
clc
ret
endp getitem
;renvoi un pointeur ax sur l'lment %1 de ds:%0
PROC getpointeritem FAR
ARG @src:word,@item:word,@delim:word
USES cx,dx,di,es
mov di,[@src]
cmp [@item],0
je @@finishpointer
push ds
pop es
call getlength,di
mov cx,ax
push ds
pop es
mov ax,[@delim]
xor dx,dx
@@countnbitems:
cmp [@item],dx
je @@finishpointer
cld
repne scasb
inc dx
cmp cx,0
jne @@countnbitems
inc di
@@finishpointer:
mov ax,di
clc
ret
endp getpointeritem
;Renvoie le nombre d'lments ax de ds:%0
PROC getnbitems FAR
ARG @src:word,@delim:word
USES cx,dx,di,es
mov di,[@src]
call getlength,di
mov cx,ax
push ds
pop es
mov ax,[@delim]
xor dx,dx
cld
@@countitems:
repne scasb
inc dx
cmp cx,0
jne @@countitems
mov ax,dx
clc
ret
endp getnbitems
;renvoie la taille en octets AX de la chaine pointe en ds:%0
PROC getlength FAR
ARG @src:word
USES cx,di,es
push ds
pop es
mov di,[@src]
mov al,0
mov cx,0FFFFh
cld
repne scasb
neg cx
dec cx
dec cx
mov ax,cx
clc
ret
endp getlength
;Met la taille en octets de la chaine pointe ds:%0 a %1
PROC setlength FAR
ARG @src:word,@size:word
USES si
mov si,[@src]
add si,[@size]
mov [byte ptr si],0
clc
ret
endp setlength
;met en majuscule la chaine ds:%0
PROC uppercase FAR
ARG @src:word
USES si,ax
mov si,[@src]
@@uppercase:
mov al,[ds:si]
inc si
cmp al,0
je @@enduppercase
cmp al,'a'
jb @@uppercase
cmp al,'z'
ja @@uppercase
sub [byte ptr si-1],'a'-'A'
jmp @@uppercase
@@enduppercase:
clc
ret
endp uppercase
;met en majuscule la premiŠre lettre chaine ds:%0
PROC onecase FAR
ARG @src:word
USES ax
mov si,[@src]
mov al,[ds:si]
cmp al,'a'
jb @@oneenduppercase
cmp al,'z'
ja @@oneenduppercase
sub [byte ptr si],'a'-'A'
@@oneenduppercase:
clc
ret
endp onecase
;met en minuscule la chaine ds:%0
PROC lowercase FAR
ARG @src:word
USES si,ax
mov si,[@src]
@@lowercase:
mov al,[ds:si]
inc si
cmp al,0
je @@endlowercase
cmp al,'A'
jb @@lowercase
cmp al,'Z'
ja @@lowercase
add [byte ptr si-1],'a'-'A'
jmp @@lowercase
@@endlowercase:
clc
ret
endp lowercase
;Inverse la casse la chaine ds:%0
PROC invertcase FAR
ARG @src:word
USES si,ax
mov si,[@src]
@@invertcase:
mov al,[ds:si]
inc si
cmp al,0
je @@endinvertcase
cmp al,'A'
jb @@invertcase
cmp al,'Z'
jbe @@goinvertcase
cmp al,'a'
jb @@invertcase
cmp al,'z'
ja @@invertcase
sub [byte ptr si-1],'a'-'A'
jmp @@invertcase
@@goinvertcase:
add [byte ptr si-1],'a'-'A'
jmp @@invertcase
@@endinvertcase:
clc
ret
endp invertcase

View File

@ -11,41 +11,63 @@ org 0h
header exe <"CE",1,0,0,offset exports,offset imports,,>
exporting
declare print
declare showdate
declare showtime
declare showname
declare showattr
declare showsize
declare showspace
declare showint
declare showsigned
declare showhex
declare showbin
declare showbcd
declare showstring
declare showstring0
declare showintr
declare showintl
declare showchar
ende
importing
use VIDEO,addline
use VIDEO,setcolor
use VIDEO,getxy
use VIDEO,setxy
use VIDEO,setvideomode
use VIDEO,setfont
use VIDEO,clearscreen
use VIDEO,enablescroll
use VIDEO,disablescroll
use VIDEO,showchars
use VIDEO,savestate
use VIDEO,restorestate
endi
exports:
db "print",0
dw print
db "showdate",0
dw showdate
db "showtime",0
dw showtime
db "showname",0
dw showname
db "showattr",0
dw showattr
db "showsize",0
dw showsize
db "showspace",0
dw showspace
db "showint",0
dw showint
db "showsigned",0
dw showsigned
db "showhex",0
dw showhex
db "showbin",0
dw showbin
db "showbcd",0
dw showbcd
db "showstring",0
dw showstring
db "showstring0",0
dw showstring0
db "showintr",0
dw showintr
db "showintl",0
dw showintl
dw 0
imports:
db "VIDEO::addline",0
addline dd 0
db "VIDEO::setcolor",0
setcolor dd 0
db "VIDEO::getxy",0
getxy dd 0
db "VIDEO::setxy",0
setxy dd 0
db "VIDEO::setvideomode",0
setvideomode dd 0
db "VIDEO::setfont",0
setfont dd 0
db "VIDEO::clearscreen",0
clearscreen dd 0
db "VIDEO::enablescroll",0
enablescroll dd 0
db "VIDEO::disablescroll",0
disablescroll dd 0
db "VIDEO::showchar",0
showchar dd 0
dw 0
;================PRINT==============
;Affiche la chaine %0 en utilisant les parametres de formatage %x....%x
@ -67,7 +89,7 @@ PROC print FAR
je @@special2
@@showit:
xor ch,ch
call [cs:showchars],cx,0FFFFh
call [cs:showchar],cx,0FFFFh
inc si
jmp @@strinaize0
@@special:
@ -78,7 +100,7 @@ PROC print FAR
@@notshowit:
mov cl,[byte ptr si+1]
cmp cl,'c'
je @@showchars
je @@showchar
cmp cl,'u'
je @@showint
cmp cl,'v'
@ -110,10 +132,10 @@ PROC print FAR
clc
jmp @@no0
@@showchars:
@@showchar:
cmp [byte ptr si+2],'M'
je @@showmultchar
call [cs:showchars],[word ptr @@pointer+di+2],0FFFFh
call [cs:showchar],[word ptr @@pointer+di+2],0FFFFh
add si,2
add di,2
jmp @@strinaize0
@ -121,10 +143,10 @@ PROC print FAR
mov cx,[offset @@pointer+di+2+2]
cmp cx,0
je @@nextfunc
@@showcharsx:
call [cs:showchars],[word ptr @@pointer+di+2],0FFFFh
@@showcharx:
call [cs:showchar],[word ptr @@pointer+di+2],0FFFFh
dec cx
jnz @@showcharsx
jnz @@showcharx
@@nextfunc:
add si,3
add di,4
@ -329,7 +351,7 @@ PROC print FAR
add al,[si+3]
sub al,'0'
xor ah,ah
call [cs:setvideomode],ax
call [cs:setvideomode]
add si,4
jmp @@strinaize0
@ -358,12 +380,14 @@ PROC print FAR
jmp @@strinaize0
@@savestate:
call [cs:savestate]
mov ah,40
int 47h
add si,2
jmp @@strinaize0
@@restorestate:
call [cs:restorestate]
mov ah,41
int 47h
add si,2
jmp @@strinaize0
@ -398,6 +422,8 @@ PROC print FAR
sub bl,'0'
xor bh,bh
call [cs:setxy],ax,bx
mov ah,25
int 47h
add si,7
jmp @@strinaize0
@ -413,6 +439,7 @@ PROC print FAR
pop di si cx bx ax
mov sp,bp
ret
ENDP print
@ -428,12 +455,12 @@ PROC showdate FAR
mov dx,[@dates]
and dx,11111b
call showintl,2,edx
call [cs:showchars],'/',0FFFFh
call [cs:showchar],'/',0FFFFh
mov dx,[@dates]
shr dx,5
and dx,111b
call showintl,2,edx
call [cs:showchars],'/',0FFFFh
call [cs:showchar],'/',0FFFFh
mov dx,[@dates]
shr dx,8
and dx,11111111b
@ -455,12 +482,12 @@ PROC showtime FAR
shr dx,11
and dx,11111b
call showintl,2,edx
call [cs:showchars],':',0FFFFh
call [cs:showchar],':',0FFFFh
mov dx,[@times]
shr dx,5
and dx,111111b
call showintl,2,edx
call [cs:showchars],':',0FFFFh
call [cs:showchar],':',0FFFFh
mov dx,[@times]
and dx,11111b
shl dx,1
@ -479,12 +506,12 @@ PROC showname FAR
mov si,[@thename]
xor cx,cx
@@showthename:
call [cs:showchars],[word ptr ds:si],0FFFFh
call [cs:showchar],[word ptr ds:si],0FFFFh
inc si
inc cx
cmp cx,8
jne @@suiteaname
call [cs:showchars],' ',0FFFFh
call [cs:showchar],' ',0FFFFh
@@suiteaname:
cmp cx,8+3
jb @@showthename
@ -506,7 +533,7 @@ PROC showattr FAR
@@noreadonly:
push '-'
@@readonly:
call [cs:showchars]
call [cs:showchar]
push 0FFFFh
test [@attr],00000010b
je @@nohidden
@ -515,7 +542,7 @@ PROC showattr FAR
@@nohidden:
push '-'
@@hidden:
call [cs:showchars]
call [cs:showchar]
push 0FFFFh
test [@attr],00000100b
je @@nosystem
@ -524,7 +551,7 @@ PROC showattr FAR
@@nosystem:
push '-'
@@system:
call [cs:showchars]
call [cs:showchar]
push 0FFFFh
test [@attr],00100000b
je @@noarchive
@ -533,7 +560,7 @@ PROC showattr FAR
@@noarchive:
push '-'
@@archive:
call [cs:showchars]
call [cs:showchar]
push 0FFFFh
test [@attr],00010000b
je @@nodirectory
@ -542,7 +569,7 @@ PROC showattr FAR
@@nodirectory:
push '-'
@@directory:
call [cs:showchars]
call [cs:showchar]
ret
ENDP showattr
@ -595,7 +622,7 @@ ENDP showsize
;<-
;==============================
PROC showspace FAR
call [cs:showchars],' ',0FFFFh
call [cs:showchar],' ',0FFFFh
clc
ret
ENDP showspace
@ -626,7 +653,7 @@ PROC showint FAR
@@showinteger:
inc bx
mov cl,[cs:bx]
call [cs:showchars],cx,0FFFFh
call [cs:showchar],cx,0FFFFh
dec ax
jnz @@showinteger
ret
@ -673,7 +700,7 @@ PROC showintl FAR
@@showinteger:
inc bx
mov cl,[cs:bx]
call [cs:showchars],cx,0FFFFh
call [cs:showchar],cx,0FFFFh
dec ax
jnz @@showinteger
ret
@ -718,7 +745,7 @@ PROC showintr FAR
@@showinteger:
inc bx
mov cl,[cs:bx]
call [cs:showchars],cx,0FFFFh
call [cs:showchar],cx,0FFFFh
dec ax
jnz @@showinteger
ret
@ -756,9 +783,9 @@ PROC showsigned FAR
jbe @@notsigned
neg edx
@@showminus:
call [cs:showchars],'-',0FFFFh
call [cs:showchar],'-',0FFFFh
@@notsigned:
call showint,edx
call showint,edx,0FFFFh
ret
ENDP showsigned
@ -782,7 +809,7 @@ PROC showhex FAR
mov bx,dx
and bx,0fh
mov cl,[cs:bx+offset Tab]
call [cs:showchars],cx,0FFFFh
call [cs:showchar],cx,0FFFFh
dec al
jnz @@Hexaize
ret
@ -808,7 +835,7 @@ PROC showbin FAR
rol edx,1
mov cl,'0'
adc cl,0
call [cs:showchars],cx,0FFFFh
call [cs:showchar],cx,0FFFFh
dec al
jnz @@binaize
ret
@ -834,7 +861,7 @@ PROC showbcd FAR
mov cl,dl
and cl,0fh
add cl,'0'
call [cs:showchars],cx,0FFFFh
call [cs:showchar],cx,0FFFFh
dec al
jnz @@BCDaize
ret
@ -852,23 +879,12 @@ PROC showstring FAR
mov bl,[si]
@@strinaize:
inc si
call [cs:showchars],[word ptr si],0FFFFh
call [cs:showchar],[word ptr si],0FFFFh
dec bl
jnz @@strinaize
ret
ENDP showstring
;==========showchars===========
;Affiche un caractčre %0 aprés le curseur
;-> %0 caractčre
;<-
;===============================
PROC showchar FAR
ARG @pointer:word
call [cs:showchars],[@pointer],0FFFFh
ret
ENDP showchar
;==========SHOWSTRING0===========
;Affiche une chaine de caractère pointée par ds:%1 aprés le curseur
;-> ds:%1 pointeur chaine type zéro terminal
@ -882,7 +898,7 @@ PROC showstring0 FAR
mov cl,[si]
cmp cl,0
je @@no0
call [cs:showchars],cx,0FFFFh
call [cs:showchar],cx,0FFFFh
inc si
jmp @@strinaize0
@@no0:

View File

@ -91,7 +91,7 @@ endp seteoi
;Lit les masques d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
PROC readimr FAR
PROC readmaskirq FAR
ARG @controleur:word
USES bx,dx
mov bx,[@controleur]
@ -104,7 +104,7 @@ PROC readimr FAR
in al,dx
pop dx
ret
endp readimr
endp readmaskirq
;Lit le registre d'tat d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
PROC readisr FAR
@ -139,277 +139,4 @@ PROC readirr FAR
xor ah,ah
in al,dx
ret
endp readirr
;carry si enable et pas carry si pas enable
PROC isenableirq FAR
ARG @irq:word
USES ax,cx,dx
mov ax,[@irq]
mov dx,MASTERPIC+IRQMASK
cmp al,7
jbe @@master
mov dx,SLAVEPIC+IRQMASK
@@master:
mov cl,al
and cx,7
in al,dx
neg al
bt ax,cx
ret
endp isenableirq
;carry si enable et pas carry si pas enable
PROC isinserviceirq FAR
ARG @irq:word
USES ax,cx,dx
mov ax,[@irq]
mov dx,MASTERPIC
cmp al,7
jbe @@master
mov dx,SLAVEPIC
@@master:
mov cl,al
mov al,ISR
out dx,al
and cx,7
in al,dx
neg al
bt ax,cx
ret
endp isinserviceirq
;carry si enable et pas carry si pas enable
PROC isrequestirq FAR
ARG @irq:word
USES ax,cx,dx
mov ax,[@irq]
mov dx,MASTERPIC
cmp al,7
jbe @@master
mov dx,SLAVEPIC
@@master:
mov cl,al
mov al,IRR
out dx,al
and cx,7
in al,dx
neg al
bt ax,cx
ret
endp isrequestirq
PROC installirqhandler FAR
USES eax,bx,cx,edx,si,di,ds,es
push fs
call mbcreate,offset interruptionbloc,256*size ints
mov es,ax
mov ax,0x0000
mov ds,ax
xor si,si
@@searchdummypointer:
mov fs,[(vector si).data.seg]
mov bx,[(vector si).data.off]
cmp [byte ptr fs:bx],0xCF ;iret
je @@founded
add si,size vector
cmp si,256*4
jb @@searchdummypointer
xor edx,edx
jmp @@suite
@@founded:
mov edx,[(vector si).content]
@@suite:
xor cx,cx
xor si,si
xor di,di
cli
@@copy:
mov [es:(ints di).number],cl
mov [es:(ints di).locked],0
mov [es:(ints di).vector1.content],0
mov [es:(ints di).vector3.content],0
mov [es:(ints di).vector4.content],0
mov [es:(ints di).vector5.content],0
mov [es:(ints di).vector6.content],0
mov [es:(ints di).vector7.content],0
mov [es:(ints di).vector8.content],0
mov [es:(ints di).launchedlow],0
mov [es:(ints di).launchedhigh],0
mov [es:(ints di).calledlow],0
mov [es:(ints di).calledhigh],0
mov eax,[(vector si).content]
cmp eax,edx
je @@notarealvector
mov [es:(ints di).vector1.content],eax
mov [es:(ints di).activated],1
jmp @@copynext
@@notarealvector:
mov [es:(ints di).vector1.content],0
mov [es:(ints di).activated],0
@@copynext:
mov bx,cx
shl bx,3
sub bx,cx
add bx,offset coupling
mov [(vector si).data.seg],cs
mov [(vector si).data.off],bx
add si,size vector
add di,size ints
inc cl
cmp cl,0
jne @@copy
@@end:
pop fs
sti
ret
endp installirqhandler
interruptionbloc db '/interrupts',0
PROC savecontext FAR
ARG @pointer:word
USES eax,si,ds
pushfd
push eax
push ebx
push ecx
push edx
push esi
push edi
push ds
push es
push fs
push gs
push ss
mov si,[@pointer]
mov ds,[ss:bp+4]
mov eax,ebp
mov ax,[word ptr ss:bp]
push eax
push [word ptr ss:bp+4]
xor eax,eax
mov ax,[word ptr ss:bp+2]
push eax
mov ax,bp
add ax,4
push eax
pop [(regs si).sesp]
pop [(regs si).seip]
pop [(regs si).scs]
pop [(regs si).sebp]
pop [(regs si).sss]
pop [(regs si).sgs]
pop [(regs si).sfs]
pop [(regs si).ses]
pop [(regs si).sds]
pop [(regs si).sedi]
pop [(regs si).sesi]
pop [(regs si).sedx]
pop [(regs si).secx]
pop [(regs si).sebx]
pop [(regs si).seax]
pop [(regs si).seflags]
ret
endp savecontext
PROC restorecontextg FAR
ARG @pointer:word
mov si,[@pointer]
pushd [cs:(regs si).sesi]
pushd [cs:(regs si).seflags]
mov eax,[cs:(regs si).seax]
mov ebx,[cs:(regs si).sebx]
mov ecx,[cs:(regs si).secx]
mov edx,[cs:(regs si).sedx]
mov edi,[cs:(regs si).sedi]
mov ebp,[cs:(regs si).sebp]
mov es,[cs:(regs si).ses]
mov fs,[cs:(regs si).sfs]
mov gs,[cs:(regs si).sgs]
mov ds,[cs:(regs si).sds]
popfd
pop esi
pop [cs:dummy]
db 0xCA,0x02,0x00 ;retf 2
endp restorecontextg
coupling:
counter = 0
REPEAT 256
push counter+256
push offset irqhandlers
ret
counter = counter + 1
ENDM
interrupt dw 0
dummy dw 0
calling_reg regs <>
function_reg regs <>
irqhandlers:
cli
pop [cs:interrupt]
call savecontext,offset calling_reg
call irqhandler,[cs:interrupt]
call restorecontextg,offset calling_reg
sti
iret
PROC irqhandler NEAR
ARG @int:word
push cs
pop ds
call mbfindsb,offset interruptionbloc,cs
jc @@end
mov es,ax
mov ax,[@int]
sub ax,256
mov cx,size ints
mul cx
mov si,ax
add [es:(ints si).calledlow],1
adc [es:(ints si).calledhigh],0
cmp [es:(ints si).activated],1
jne @@end
add [es:(ints si).launchedlow],1
adc [es:(ints si).launchedhigh],0
lea si,[es:(ints si).vector1]
mov cl,8
@@launchall:
cmp [es:(vector si).content],0
je @@end
push [word ptr cs:calling_reg.seflags]
push cs
push offset @@back
push [es:(vector si).data.seg]
push [es:(vector si).data.off]
call savecontext,offset function_reg
call restorecontextg,offset calling_reg
db 0xCB
@@back:
cli
call savecontext,offset calling_reg
call restorecontextg,offset function_reg
@@next:
add si,size vector
dec cl
jnz @@launchall
@@end:
ret
endp irqhandler
endp readirr

View File

@ -1,16 +1,14 @@
asm= lzasm /z/t
asm= lzasm
lnk= elink
all: systeme.sys boot.bin
systeme.sys: video.obj disque.obj systeme.obj
systeme.sys: video.obj systeme.obj
$(lnk) systeme.obj systeme.sys
systeme.obj: ..\lib\detect.lib ..\lib\video.lib video.sys disque.sys
systeme.obj: ../lib/detect.lib ../lib/video.lib video.sys
$(asm) systeme.asm
disque.sys:
$(lnk) disque.obj disque.sys
video.sys:
$(lnk) video.obj video.sys
@ -18,12 +16,12 @@ video.sys:
boot.bin: boot.obj
$(lnk) boot.obj boot.bin /bs
detect.obj:
$(asm) detect.asm
video.obj:
$(asm) video.asm
disque.obj:
$(asm) disque.asm
boot.obj:
$(asm) boot.asm

View File

@ -108,7 +108,7 @@ oksystem:
mov si,offset syst
call showstr
mov cx,[di+26]
mov ax,8000h
mov ax,0900h
mov es,ax
push es
mov di,0000h

File diff suppressed because it is too large Load Diff

911
noyau/format.asm Normal file
View File

@ -0,0 +1,911 @@
.model tiny
.486
smart
.code
org 0h
start:
jmp tsr ;Saute à la routine résidente
names db 'FORMAT' ;Nom drivers
id dw 1234h ;Identifiant drivers
Tsr:
cli ;Désactive interruptions logiciellement
cmp ax,cs:ID ;Compare si test de chargement
jne nomore ;Si pas test alors on continu
rol ax,3*4 ;Rotation de 3 chiffre de l'ID pour montrer que le drivers est chargé
jmp itsok ;On termine l'int avec notre code d'ID preuve du bon chargement de VIDEO
nomore:
cmp ah,maxfunc
jbe noerrorint
stc
jmp itsok
noerrorint:
clc
push bx
mov bl,ah ;On calcule d'aprés le n° de fonction
xor bh,bh ;quel sera l'entrée dans la table indexée
shl bx,1 ;des adresses fonctions.
mov bx,cs:[bx+tables] ;On récupère cette adresse depuis la table
mov cs:current,bx ;On la stocke temporairement pour obtenir les registres d'origine
pop bx
clc
call cs:current ;Puis on execute la fonction
itsok:
push bp
mov bp,sp ;On prend sp dans bp pour adresser la pile
jnc noerror ;La fonction appelée a renvoyer une erreur : Flag CARRY ?
or byte ptr [bp+6],1b;Si oui on le retranscrit sur le registre FLAG qui sera dépilé lors du IRET
;xor eax,eax
;mov ax,cs ;On récupère le segment et l'offset puis en renvoie l'adresse physique
;shl eax,4 ;de l'erreur.
;add ax,cs:current
;jmp endofint ;on termine l'int
noerror:
and byte ptr [bp+6],0FEh;Si pas d'erreur on efface le Bit CARRY du FLAG qui sera dépilé lors du IRET
endofint:
pop bp
sti ;On réactive les interruptions logiciellement
iret ;Puis on retourne au programme appelant.
current dw 0 ;Mot temporaire qui contient l'adresse de la fonction appelée
tables dw setvideomode ;Table qui contient les adresses de toutes les fonctions de VIDEO (WORD)
;Librairie qui prend en charge le format de STR ASCIIZ
;# nombre 8
;@ str 7
;& nom 6
;High Low
;0 variable 4 hex
;1 byte 3 dec
;2 word 2 oct
;3 3 octets 1 bin
;4 dword 5 adresse
;5 5 octets 6 nom
;6 ... 7 str
; 8 nombre
;Renvoie carry si la syntaxe de ds:si n'est pas respect par rapport a es:di
CheckSyntax0:
push ax bx dx bp si di ds es
push es di
push cs
pop es
mov di,offset temp2
call copy0
mov si,di
push cs
pop ds
pop di es
call getdelimiter0
mov bp,dx
mov dl,' '
call setdelimiter0
call compressdelimiter0
call uppercase0
call getnbitems0
;call xch
;mov ax,cx
;call getnbitem0
;call xch
;cmp ax,cx
;call xch
;jne notequalatall
mov bx,cx
xor cx,cx
itemer:
call whatisitem0
mov dx,ax
call xch
call whatisitem0
call xch
cmp ax,dx
jne prob
cmp al,6
jb equal
call cmpitems0
je equal
prob:
cmp dl,4
ja nosize
cmp al,8
je equal
cmp al,4
jne notequalatall
cmp dh,ah
ja notequalatall
jmp equal
nosize:
cmp al,7
jne noname
cmp ah,0
jne notequalatall
jmp equal
noname:
cmp al,8
je equal
jmp notequalatall
equal:
inc cx
cmp cx,bx
jne itemer
cld
ackno:
mov dx,bp
call setdelimiter0
pop es ds di si bp dx bx ax
ret
notequalatall:
stc
jmp ackno
xch:
push ds
push es
pop ds
pop es
xchg si,di
ret
temp2 db 256 dup (0)
;Compare les lments cx de deux chaine ds:si et es:di
Cmpitems0:
push cx dx si di
push cx di
call getpointeritem0
mov si,di
xor cx,cx
inc cx
call getpointeritem0
mov dx,di
sub dx,si
dec cx
pop di cx
push ds si
push es
pop ds
mov si,di
call getpointeritem0
pop si ds
mov cx,dx
rep cmpsb
pop di si dx cx
ret
;Renvoie l'lment cx de ds:si dans edx si nb et dans es:di si str ou name
gettypeditem0:
push bx cx si
call getpointeritem0
mov si,di
xor cx,cx
inc cl
call getpointeritem0
mov bx,di
dec bx
mov cl,0
xchg cl,ds:[bx]
call gettyped0
xchg cl,ds:[bx]
pop si cx bx
ret
;Renvoie ds:si dans edx si nb et dans es:di si str ou name
gettyped0:
push ax
call whatis0
cmp al,5
jb number
cmp al,6
je pointer
push ds
pop es
call getpointeritem0
jmp endofGettypeditem0
number:
mov edx,cs:lastnumber
jmp endofgettypeditem0
pointer:
call str0toadress
endofgettypeditem0:
pop ax
ret
;Renvoie dans ax le type de la str0 pointe par ds:si lment cx
whatisitem0:
push bx cx si di
call getpointeritem0
mov si,di
xor cx,cx
inc cl
call getpointeritem0
mov bx,di
dec bx
mov cl,0
xchg cl,ds:[bx]
call whatis0
xchg cl,ds:[bx]
pop di si cx bx
ret
;Renvoie dans ax le type de la str0 pointe par ds:si
;High Low
;0 variable 4 hex
;1 byte 3 dec
;2 word 2 oct
;3 3 octets 1 bin
;4 dword 5 adresse
;5 5 octets 6 name
;6 ... 7 str
whatis0:
push bx cx edx
mov cl,2
call str0isbase
jnc finbase
mov cl,8
call str0isbase
jnc finbase
mov cl,10
call str0isbase
jnc finbase
mov cl,16
call str0isbase
jc testadress
finbase:
mov bx,cx
xor ch,ch
mov al,cs:[bx+offset basenn-2]
call str0toint
mov cs:Lastnumber,edx
cmp edx,0000FFFFh
ja bits32
cmp dx,00FFh
ja bits16
mov ah,1
jmp endofwhat
bits16:
mov ah,2
jmp endofwhat
bits32:
mov ah,3
jmp endofwhat
testadress:
call str0isadress
jc testname
mov ax,0005h
jmp endofwhat
testname:
;call str0isname
;jc testvarstr
;jnc isok
;mov al,06h
cmp byte ptr [si],'&'
jne testvarstr
mov al,06h
call getlength0
dec cl
mov ah,cl
jmp endofwhat
testvarstr:
cmp byte ptr [si],'@'
jne testnumber
mov al,07h
call getlength0
dec cl
mov ah,cl
jmp endofwhat
testnumber:
cmp byte ptr [si],'#'
jne isstr
mov al,8
call getlength0
dec cl
mov ah,cl
jmp endofwhat
isstr:
mov al,07h
call getlength0
mov ah,cl
endofwhat:
pop edx cx bx
ret
Lastnumber dd 0
;Renvoie non carry si la str ds:si pointe peut ˆtre une adresse
str0isadress:
;push
stc
;pop
ret
;Renvoie en es:di le pointeur str0 ds:si
Str0toAdress:
;push
stc
;pop
ret
;Renvoie non carry si la str ds:si pointe peut ˆtre un nom de fichier
str0isname:
push ax si di
isname:
mov al,[si]
inc si
cmp al,0
je itsok
mov di,offset non
verify:
mov ah,[di]
inc di
cmp ah,0FFh
je isname
cmp ah,al
jne verify
stc
jmp itsdead
itsok:
clc
itsdead:
pop di si ax
ret
non db '/<>|"?*:\',01,0FFh
;Renvoie non carry si le texte point par si est de la base cl
str0isbase:
push ax cx si di es
push cs
pop es
mov ah,cl
isstrbase:
mov al,[si]
cmp al,0
je okbase
mov cl,ah
xor ch,ch
mov di,cx
cmp al,es:[di-2+offset basen]
je verifbase
xor ch,ch
inc cl
mov di,offset base
cld
repne scasb
cmp cx,0
je nobase
inc si
jmp isstrbase
okbase:
clc
endbase:
pop es di si cx ax
ret
verifbase:
cmp byte ptr [si+1],0
je okbase
nobase:
stc
jmp endbase
temp dw 0
;Converti un str de base cl en int dans edx
str0toint:
push eax bx ecx si edi ebp es
push cs
pop es
mov ah,cl
mov cs:temp,si
gotos:
cmp byte ptr [si+1], 0
je oklo
inc si
jmp gotos
oklo:
mov edi,1
xor ebp,ebp
mov bl,cl
baseto:
cmp si,cs:temp
jb endbaseto
mov al,[si]
xor ecx,ecx
mov cl,bl
inc cl
push di
mov di,offset base
cld
repne scasb
pop di
jne noop
sub cl,bl
neg cl
mov eax,edi
mul ecx
add ebp,eax
mov eax,edi
mov cl,bl
mul ecx
mov edi,eax
noop:
dec si
jmp baseto
endbaseto:
mov edx,ebp
pop es ebp edi si ecx bx eax
ret
base db '0123456789ABCDEF'
basen db 'B O D H'
basenn db 1,0,0,0,0,0,2,0,3,0,0,0,0,0,4
;Renvoie en es:di la partie de cx caractŠres a partir de la gauche de ds:si
Left0:
push ax cx si di
cld
rep movsb
mov al,0
stosb
pop di si cx ax
ret
;Renvoie en es:di la partie de cx caractŠres a partir de la droite de ds:si
Right0:
push ax cx dx si di
mov dx,cx
call getlength0
add si,cx
sub si,dx
mov cx,dx
cld
rep movsb
mov al,0
stosb
pop di si dx cx ax
ret
;Renvoie en es:di la partie de cx caractŠres a partir de la position bx de ds:si
middle0:
push ax cx si di
add si,bx
cld
rep movsb
mov al,0
stosb
pop di si cx ax
ret
;Rempli de cx caractŠres dl a partir de la position bx de ds:si
Fill0:
push ax bx cx si di es
push ds
pop es
add si,bx
mov al,dl
mov di,si
cld
rep stosb
pop es di si cx bx ax
ret
;Remplace tout les caractŠres al de ds:si par des caractŠres dl
ReplaceAllchar0:
push ax cx di es
call GetLength0
push ds
pop es
mov di,si
findandchange:
repne scasb
cmp cx,0
je endofchange
mov es:[di-1],dl
jmp findandchange
endofchange:
pop es di cx ax
ret
;Recherche un caractŠre dl dans la chaŒne ds:si
SearchChar0:
push ax cx di es
call GetLength0
push ds
pop es
mov di,si
mov al,dl
repne scasb
pop es di cx ax
ret
;Inverse la chaine pointe en ds:si
invert0:
push ax cx si di es
call GetLength0
push ds
pop es
mov di,si
add di,cx
dec di
revert:
mov al,[si]
xchg al,es:[di]
mov [si],al
inc si
dec di
cmp si,di
je finishinvert
dec di
cmp si,di
je finishinvert
inc di
jmp revert
finishinvert:
pop es di si cx ax
ret
;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal
cmpstr0:
push cx dx si di
call GetLength0
mov dx,cx
push ds si
push es
pop ds
mov si,di
call GetLength0
pop si ds
cmp cx,dx
jne NotEqual
repe cmpsb
NotEqual:
pop di si dx cx
ret
;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal et renvoie le nb de caractŠre egaux dans dx
evalue0:
push cx si di
push ds si
push es
pop ds
mov si,di
call GetLength0
pop si ds
mov dx,cx
repe cmpsb
pushf
sub dx,cx
popf
pop di si cx
ret
;Insert une chaine ds:si en es:di a partir du caractŠre cx
insert0:
push cx di si
add di,cx
call getlength0
push si di ds
push es
pop ds
mov si,di
add di,cx
call copy20
pop ds di si
cld
inc di
rep movsb
pop si di cx
ret
;Detruit CX caractŠres a partir du caractŠre BX de DS:SI
delete0:
push cx dx si di es
push ds
pop es
mov dx,cx
call getlength0
sub cx,dx
sub cx,bx
inc cx
add si,bx
mov di,si
add si,dx
cld
rep movsb
pop es di si dx cx
ret
;Copie une chaine de ds:si en es:di
Copy0:
push ax cx si di
call GetLength0
cld
rep movsb
mov al,0
stosb
pop di si cx ax
ret
;Copie une chaine de ds:si en es:di
Copy20:
push ax cx si di
call GetLength0
cld
add si,cx
add di,cx
inc cx
std
rep movsb
pop di si cx ax
ret
;ConcatŠne le chaine ds:si avec es:di
Concat0:
push ax cx dx si di
call GetLength0
mov dx,cx
xchg si,di
push ds
push es
pop ds
call GetLength0
pop ds
xchg si,di
add di,cx
mov cx,dx
cld
rep movsb
mov al,0
stosb
pop di si dx cx ax
ret
;Met DL comme dlimiteur par dfaut
SetDelimiter0:
mov cs:delim,dl
ret
;Renvoie le dlimiteur par dfaut dans dl
GetDelimiter0:
mov dl,cs:delim
ret
delim db 0
;Dtruit les dlimiteur qui sont conscutifs dans ds:si
CompressDelimiter0:
push ax dx si di es
call Getlength0
push ds
pop es
mov di,si
mov al,cs:delim
xor dx,dx
Compressitems:
repne scasb
inc dx
againcomp:
cmp [di],al
jne nosup
mov si,di
mov bx,0
push cx
mov cx,1
call delete0
pop cx
jmp againcomp
nosup:
cmp cx,0
jne compressitems
mov cx,dx
pop es di si dx ax
ret
;Met le nombre d'lments … cx
Setnbitems0:
push ax cx dx di es
mov dx,cx
call Getnbitems0
cmp cx,dx
je noadjust
ja subsome
push ds
pop es
mov di,si
sub cx,dx
neg cx
push cx
call getlength0
add di,cx
pop cx
mov al,cs:delim
mov ah,'a'
rep stosw
mov al,0
stosb
jmp noadjust
subsome:
mov cx,dx
call GetPointeritem0
dec di
mov byte ptr [di],0
noadjust:
pop es di dx cx
ret
;Renvoie la taille dx de l'lment cx
Getitemsize:
push cx di
call getpointeritem0
mov dx,di
inc cx
call getpointeritem0
sub dx,di
neg dx
dec dx
pop di cx
ret
;Renvoie en es:di l'lment cx de ds:si
Getitem0:
push si di cx ax
push di
call getPointeritem0
call getitemsize
mov si,di
pop di
mov cx,dx
rep movsb
mov al,0
stosb
pop ax cx di si
ret
;renvoi un pointeur di sur l'lment cx de ds:si
GetPointeritem0:
push ax bx cx dx es
mov bx,cx
call Getlength0
push ds
pop es
mov di,si
mov al,cs:delim
xor dx,dx
Countnbitems:
cmp bx,dx
je finishpointer
repne scasb
inc dx
cmp cx,0
jne countnbitems
inc di
finishpointer:
pop es dx cx bx ax
ret
;Renvoie le nombre d'lments cx de ds:si
GetNbitems0:
push ax dx di es
call Getlength0
push ds
pop es
mov di,si
mov al,cs:delim
xor dx,dx
Countitems:
repne scasb
inc dx
cmp cx,0
jne countitems
mov cx,dx
pop es di dx ax
ret
;renvoie la taille en octets CX de la chaine pointe en ds:si
GetLength0:
push ax di es
push ds
pop es
mov di,si
mov al,0
mov cx,0FFFFh
cld
repne scasb
neg cx
dec cx
dec cx
pop es di ax
ret
;Met la taille en octets de la chaine pointe ds:si a CX
SetLength0:
push bx
mov bx,cx
mov byte ptr [si+bx],0
pop bx
ret
;met en majuscule la chaine ds:si
UpperCase0:
push si ax
UpperCase:
mov al,ds:[si]
inc si
cmp al,0
je EndUpperCase
cmp al,'a'
jb UpperCase
cmp al,'z'
ja UpperCase
sub byte ptr [si-1],'a'-'A'
jmp UpperCase
EndUpperCase:
clc
pop ax si
ret
;met en majuscule la premiŠre lettre chaine ds:si
OneCase0:
push ax
OneUpperCase:
mov al,ds:[si]
cmp al,'a'
jb OneEndUpperCase
cmp al,'z'
ja OneEndUpperCase
sub byte ptr [si],'a'-'A'
OneEndUpperCase:
clc
pop ax
ret
;met en minuscule la chaine ds:si
LowerCase0:
push si ax
LowerCase:
mov al,ds:[si]
inc si
cmp al,0
je EndLowerCase
cmp al,'A'
jb LowerCase
cmp al,'Z'
ja LowerCase
add byte ptr [si-1],'a'-'A'
jmp LowerCase
EndLowerCase:
clc
pop ax si
ret
;Inverse la casse la chaine ds:si
InvertCase0:
push si ax
InvertCase:
mov al,ds:[si]
inc si
cmp al,0
je EndInvertCase
cmp al,'A'
jb InvertCase
cmp al,'Z'
jbe GoInvertCase
cmp al,'a'
jb InvertCase
cmp al,'z'
ja InvertCase
sub byte ptr [si-1],'a'-'A'
jmp InvertCase
GoInvertCase:
add byte ptr [si-1],'a'-'A'
jmp InvertCase
EndInvertCase:
clc
pop ax si
ret
end start

View File

@ -1,4 +1,52 @@
db "biosprint",0
dw biosprint
db "mbinit",0
dw mbinit
db "mbcreate",0
dw mbcreate
db "mbfree",0
dw mbfree
db "mbclean",0
dw mbclean
db "mbresident",0
dw mbresident
db "mbnonresident",0
dw mbnonresident
db "mbchown",0
dw mbchown
db "mballoc",0
dw mballoc
db "mbfind",0
dw mbfind
db "mbfindsb",0
dw mbfindsb
db "mbget",0
dw mbget
db "mbloadfuncs",0
dw mbloadfuncs
db "mbsearchfunc",0
dw mbsearchfunc
db "bioswaitkey",0
dw bioswaitkey
db "mbloadsection",0
dw mbloadsection
db "enableirq",0
dw enableirq
db "disableirq",0
dw enableirq
db "readmaskirq",0
dw readmaskirq
db "readirr",0
dw readirr
db "readisr",0
dw readisr
db "seteoi",0
dw seteoi
dd 0
include "8259a.asm"
;Affiche le nombre hexa dans %0[dword]
PROC biosprinth FAR
ARG @num:dword
@ -49,85 +97,34 @@ PROC biosprint FAR
ret
endp biosprint
PROC enablea20 FAR
USES ax
mov al,0d1h
out 64h,al
call a20wait
mov al,0dfh
out 60h,al
call a20wait
;mov al,0ffh
;out 64h,al
;call a20wait
ret
endp enablea20
PROC disablea20 FAR
USES ax
mov al,0d1h
out 64h,al
call a20wait
mov al,0DDh
out 60h,al
call a20wait
;mov al,0ffh
;out 64h,al
;call a20wait
ret
endp disablea20
a20wait:
in al,64h
jmp @@suite
@@suite:
and al,2
jnz a20wait
ret
;par le system control port A
;in al,92h
;or al,2
;out 92h,al
;par le system control port A
;in al,92h
;and al,not 2
;out 92h,al
PROC flatmode FAR
USES eax,bx,ds
push cs
pop ds
; first, calculate the linear address of GDT
xor eax,eax
mov ax,ds
shl eax,4
add [dword ptr offset @@gdt+2],eax ; store as GDT linear base addr
; now load the GDT into the GDTR
lgdt [fword ptr offset @@gdt] ; load GDT base
mov bx,1 * size descriptor ; point to first descriptor
cli ; turn off interrupts
mov eax,cr0 ; prepare to enter protected mode
or al,1 ; flip the PE bit
mov cr0,eax ; we're now in protected mode
jmp @@suite
@@suite:
mov fs,bx ; load the FS segment register
and al,0FEh ; clear the PE bit again
mov cr0,eax ; back to real mode
jmp @@suite2
@@suite2:
sti ; resume handling interrupts
ret ;
;PROC flatmode FAR
; USES eax,bx,edx
; ; first, calculate the linear address of GDT
; xor edx,edx
; xor eax,eax
; mov dx,cs
; shl edx,4
; add [dword ptr cs:offset @@gdt+2],edx ; store as GDT linear base addr
; ; now load the GDT into the GDTR
; lgdt [fword ptr cs:offset @@gdt] ; load GDT base (286-style 24-bit load)
; mov bx,1 * size descriptor ; point to first descriptor
; mov eax,cr0 ; prepare to enter protected mode
; or al,1 ; flip the PE bit
; cli ; turn off interrupts
; mov cr0,eax ; we're now in protected mode
; mov fs,bx ; load the FS segment register
; and al,0FEh ; clear the PE bit again
; mov cr0,eax ; back to real mode
; sti ; resume handling interrupts
; ret ;
@@gdt descriptor <offset @@gdtend - offset @@gdt - 1, offset @@gdt, 0, 0, 0, 0> ; the GDT itself
descriptor <0ffffh, 0, 0, 091h, 0cfh, 0> ; 4G data segment
@@gdtend:
endp flatmode
;@@gdt descriptor <@@gdtend - @@gdt - 1, @@gdt, 0, 0, 0, 0> ; the GDT itself
; descriptor <0ffffh, 0, 0, 091h, 0cfh, 0> ; 4G data segment
;@@gdtend:
;endp flatmode
;Attend l'appuie sur une touche
PROC bioswaitkey FAR
USES ax
xor ax,ax
int 16h
ret
@ -142,6 +139,8 @@ PROC mbloadsection FAR
USES ax,bx,cx,si,di,ds,es
LOCAL @@toresov:word:60
mov ax,[@blocks]
inc ax
inc ax
mov es,ax
mov ds,ax
cmp [word ptr 0],"EC"
@ -149,16 +148,11 @@ PROC mbloadsection FAR
lea si,[@@toresov]
mov [word ptr ss:si],0FFFFh
mov bx,[ds:exe.sections]
cmp bx,0
je @@finishloading
@@loading:
cmp [dword ptr bx],0
je @@finishloading
mov ax,bx
add ax,4
pushad
call biosprint,ax
popad
call mbcreate,ax,[word ptr bx+2]
jc @@error
inc si
@ -180,6 +174,11 @@ popad
inc bx
jmp @@loading
@@finishloading:
pushad
xor eax,eax
mov ax,[word ptr ss:si]
call biosprinth,eax
popad
cmp [word ptr ss:si],0FFFFh
je @@finishdepands
call mbloadfuncs,[word ptr ss:si]
@ -230,16 +229,7 @@ PROC mbcreate FAR
ARG @blocks:word,@size:word
USES bx,cx,dx,si,di,ds,es
push gs
mov ax,[ss:bp+4]
mov dx,ax
dec dx
dec dx
mov gs,dx
cmp [word ptr gs:0x0],'NH'
je @@oktoset
mov ax,memorystart
@@oktoset:
mov gs,ax
mov gs,[ss:bp+4]
mov cx,[@size]
shr cx,4
inc cx
@ -254,19 +244,21 @@ PROC mbcreate FAR
cmp [word ptr es:mb.check],"NH"
jne @@memoryerror
cmp [es:mb.isnotlast],true
sete dl
sete dl
cmp [es:mb.reference],free
jne @@notsogood
mov ax,[es:mb.sizes]
cmp cx,ax
ja @@notsogood
mov [word ptr es:mb.check],"NH"
;mov [word ptr es:mb.check],"NH"
mov [es:mb.isnotlast],true
mov [es:mb.reference],gs
mov [es:mb.isresident],false
lea di,[es:mb.names]
push cx
mov cx,24/4
push cs
pop ds
mov si,[@blocks]
cld
rep movsd
@ -284,16 +276,14 @@ PROC mbcreate FAR
mov si,offset afree
xor di,di
mov cx,size mb
push cs
pop ds
cld
rep movsb
mov [es:mb.isnotlast],dl
mov [es:mb.sizes],ax
@@nofree:
mov ax,bx
pop gs
clc
pop gs
ret
@@notsogood:
inc bx
@ -301,8 +291,8 @@ PROC mbcreate FAR
add bx,[es:mb.sizes]
jmp @@searchfree
@@memoryerror:
pop gs
stc
pop gs
ret
@@notenougtmem:
pop gs
@ -349,8 +339,6 @@ PROC mbfree FAR
jne @@nottofree
mov [es:mb.isresident],false
mov [es:mb.reference],free
mov si,offset @@isfree
lea di,[es:mb.names]
mov cx,6
cld
rep movsb
@ -489,7 +477,7 @@ endp mbchown
;Alloue un bloc /data de CX caractere pour le process appelant -> ax
PROC mballoc FAR
ARG @size:word
USES si,ds
USES ax,si,ds
push cs
pop ds
call mbcreate,offset @@data,[@size]
@ -544,9 +532,9 @@ PROC mbfind FAR
dec bx
dec bx
mov si,[@blocks]
lea di,[es:mb.names]
@@search:
mov es,bx
lea di,[es:mb.names]
cmp [word ptr es:mb.check],"NH"
jne @@memoryerror
inc bx
@ -651,20 +639,14 @@ PROC mbloadfuncs FAR
call mbsearchfunc,si
jnc @@toendoftext
mov bx,si
;pushad
;call biosprint,si
;popad
@@findend:
inc bx
cmp [byte ptr bx], ':'
jne @@findend
mov [byte ptr bx],0
call [cs:projfile],si
mov [byte ptr bx],':'
;call projectfile,bx
jc @@erroronload
;pushad
;call biosprint,si
;popad
mov [byte ptr bx],':'
call mbsearchfunc,si
jc @@libnotexist
@@toendoftext:
@ -694,18 +676,18 @@ PROC mbloadfuncs FAR
endp mbloadfuncs
;Recherche une fonction pointé par DS:%0 en mémoire et renvoie son adresse en DX:AX
;Recherche une fonction pointé par DS:SI en mémoire et renvoie son adresse en DX:AX
PROC mbsearchfunc FAR
ARG @func:word
USES bx,si,di,es
mov bx,[@func]
mov si,bx
push bx
@@findend:
inc bx
cmp [byte ptr bx], ':'
jne @@findend
mov [byte ptr bx],0
call mbfind,si
call mbfind
mov [byte ptr bx],':'
jc @@notfoundattallthesb
mov es,ax

View File

@ -9,9 +9,6 @@ include "..\include\mem.h"
include "..\include\divers.h"
include "..\include\cpu.h"
include "..\include\pci.h"
include "..\include\fat.h"
memorystart equ 0052h ;premier bloc de la mémoire
org 0h
@ -36,6 +33,8 @@ start:
call biosprint,offset msg_ok
call biosprint,offset msg_memory_section
mov ax,cs
dec ax
dec ax
call mbloadsection,ax
jc error
call biosprint,offset msg_ok
@ -55,26 +54,23 @@ suite:
pop gs
call biosprint,offset msg_ok
call biosprint,offset msg_video_init
call [cs:setvideomode],2
call [setvideomode],2
jc error
call [cs:clearscreen]
call [cs:print],offset msg_memory
call [cs:print],offset msg_ok2
call [cs:print],offset msg_memory_init
call [cs:print],offset msg_ok2
call [cs:print],offset msg_memory_section
call [cs:print],offset msg_ok2
call [cs:print],offset msg_memory_jumps
call [cs:print],offset msg_ok2
call [cs:print],offset msg_video_init
call [cs:print],offset msg_ok2
call [cs:print],offset msg_handler
;call installirqhandler
call [cs:print],offset msg_ok2
call [cs:print],offset msg_cpu_detect
call [cs:cpuinfo],offset thecpu
call [cs:setinfo],offset thecpu,offset temp
call [cs:print],offset msg_ok2
call [clearscreen]
call [print],offset msg_memory
call [print],offset msg_ok2
call [print],offset msg_memory_init
call [print],offset msg_ok2
call [print],offset msg_memory_section
call [print],offset msg_ok2
call [print],offset msg_memory_jumps
call [print],offset msg_ok2
call [print],offset msg_video_init
call [print],offset msg_ok2
call [print],offset msg_cpu_detect
call [cpuinfo],offset thecpu
call [setinfo],offset thecpu,offset temp
call [print],offset msg_ok2
push offset temp
xor eax,eax
mov al,[thecpu.family]
@ -85,11 +81,11 @@ suite:
push eax
push offset thecpu.names
push offset thecpu.vendor
call [cs:print],offset msg_cpu_detect_inf
call [cs:print],offset msg_pci
call [cs:pciinfo],offset thepci
call [print],offset msg_cpu_detect_inf
call [print],offset msg_pci
call [pciinfo],offset thepci
jc nopci
call [cs:print],offset msg_ok2
call [print],offset msg_ok2
xor eax,eax
mov al,[thepci.maxbus]
push eax
@ -97,25 +93,25 @@ suite:
push eax
mov al,[thepci.version_major]
push eax
call [cs:print],offset msg_pci_info
call [cs:print],offset msg_pci_enum
call [print],offset msg_pci_info
call [print],offset msg_pci_enum
xor ebx,ebx
xor ecx,ecx
xor si,si
xor esi,esi
searchpci:
call [cs:getcardinfo],bx,cx,si,offset temp
call [getcardinfo],bx,cx,si,offset temp
jc stopthis
mov al,[(pcidata offset temp).subclass]
push ax
mov al,[(pcidata offset temp).class]
push ax
call [cs:getpcisubclass]
call [getpcisubclass]
push dx
push ax
mov al,[(pcidata offset temp).class]
xor ah,ah
push ax
call [cs:getpciclass]
call [getpciclass]
push dx
push ax
push 4
@ -128,7 +124,7 @@ searchpci:
push eax
mov ax,[(pcidata offset temp).vendor]
push eax
call [cs:print],offset msg_pci_card
call [print],offset msg_pci_card
inc si
cmp si,7
jbe searchpci
@ -143,29 +139,16 @@ stopthis:
jbe searchpci
jmp next
nopci:
call [cs:print],offset msg_echec2
call [print],offset msg_echec2
next:
;call [cs:detectvmware]
;jne novirtual
;call [cs:print],offset msg_vmware
novirtual:
;call [cs:print],offset msg_flat
;call enablea20
;call flatmode
;xor ax,ax
;mov fs,ax
;mov esi,0100000h
;mov [dword ptr fs:esi],"OKIN"
call [cs:print],offset msg_ok2
call [cs:print],offset msg_disk_init
call [cs:initdrive]
jc error2
call [cs:print],offset msg_ok2
call [cs:print],offset msg_launchcommand
call [cs:execfile],offset shell
jc error2
call [print],offset msg_fini
; call [detectvmware]
; jne novirtual
; call [print],offset msg_vmware
;novirtual:
error2:
call [cs:print],offset msg_error2
call [print],offset msg_error2
call bioswaitkey
jmp far 0FFFFh:0000h
@ -174,7 +157,7 @@ error:
call bioswaitkey
jmp far 0FFFFh:0000h
shell find <"COMMANDE.CE",0,0,0,1,>
thepci pciinf <>
thecpu cpu <>
temp db 256 dup (0)
@ -182,83 +165,56 @@ return db 0dh,0ah,0
msg_memory db "Initialisation de la memoire",0
msg_memory_init db " -Creation du bloc primordial",0
msg_memory_section db " -Developpement des sections",0
msg_memory_jumps db "Redirection du systeme",0
msg_memory_jumps db " -Redirection du systeme",0
msg_video_init db "Initialisation du pilote VIDEO",0
msg_handler db "Initialisation du gestionnaire d'interruption",0
msg_cpu_detect db "Dectection du processeur",0
msg_cpu_detect_inf db " -Fondeur : %0\l -Modele : %0\l -Revision : %u\l -Version : %u\l -Famille : %u\l -Technologies: %0\l",0
msg_pci db "Detection des systemes PCI",0
msg_pci_info db " -Version : %yB.%yB\l -Numero bus max: %u\l",0
msg_pci_info db " -Version : %yB.%yB\l -Nombre de bus : %u\l",0
msg_pci_enum db " -Enumeration des peripheriques PCI:\l"
db " | Vendeur | Modele |Bus |Dev.|Func|Classe.Sous-classe\l",0
msg_pci_card db " | 0x%hW | 0x%hW |%w|%w|%w|%0P.%0P\l",0
msg_vmware db "\c04 VMWare a ete detecte !!!\c07\l",0
msg_flat db "Initialisation du Flat Real Mode\l",0
msg_disk_init db "Initialisation du pilote DISQUE\l",0
msg_launchcommand db "Execution du SHELL\l",0
db " |Vendeur|Modele|Bus |Dev.|Func|Classe.Sous-classe\l",0
msg_pci_card db " | %hW | %hW |%w|%w|%w|%0P.%0P\l",0
;msg_vmware db "\c04 VMWare a été detecté !!!\c07",0
msg_fini db "\c04Demarrage terminee : c pas encore fini :(:(:( mais c pour l'inspiration !",0
msg_error db " [Erreur]",0dh,0ah,"<Pressez une touche pour redemarrer le systeme>",0
msg_ok db " [ Ok ]",0dh,0ah,0
msg_error2 db "\h70 [\c04Erreur\c07]\g00,49<Pressez une touche pour redemarrer le systeme>",0
msg_ok2 db "\h70 [\c02 Ok \c07]\l",0
msg_echec2 db "\h70 [\c0CPasser\c07]\l",0
exporting
declare biosprinth
declare biosprint
declare mbinit
declare mbcreate
declare mbfree
declare mbclean
declare mbresident
declare mbnonresident
declare mbchown
declare mballoc
declare mbfind
declare mbfindsb
declare mbget
declare mbloadfuncs
declare mbsearchfunc
declare bioswaitkey
declare mbloadsection
declare enableirq
declare enableirq
declare readimr
declare readirr
declare readisr
declare seteoi
declare enablea20
declare disablea20
declare flatmode
declare installirqhandler
declare irqhandler
declare isenableirq
declare isrequestirq
declare isinserviceirq
declare savecontext
declare restorecontextg
ende
importing
use VIDEO,setvideomode
use VIDEO,clearscreen
use VIDEO.LIB,print
use DETECT.LIB,cpuinfo
use DETECT.LIB,setinfo
use DETECT.LIB,pciinfo
use DETECT.LIB,getcardinfo
use DETECT.LIB,getpcisubclass
use DETECT.LIB,getpciclass
use DETECT.LIB,detectvmware
use DISQUE,initdrive
use DISQUE,projfile
use DISQUE,execfile
endi
imports:
db "VIDEO::setvideomode",0
setvideomode dd 0
db "VIDEO::clearscreen",0
clearscreen dd 0
db "VIDEO.LIB::print",0
print dd 0
db "DETECT.LIB::cpuinfo",0
cpuinfo dd 0
db "DETECT.LIB::setinfo",0
setinfo dd 0
db "DETECT.LIB::pciinfo",0
pciinfo dd 0
db "DETECT.LIB::getcardinfo",0
getcardinfo dd 0
db "DETECT.LIB::getpcisubclass",0
getpcisubclass dd 0
db "DETECT.LIB::getpciclass",0
getpciclass dd 0
;db "DETECT.LIB::detectvmware",0
;detectvmware dd 0
dw 0
exports:
include "mcb.asm"
include "8259a.asm"
mb1:
includebin "video.sys"
mb2:
includebin "..\lib\video.lib"
mb3:
includebin "..\lib\detect.lib"
mb4:
section:
dw offset mb0
@ -274,25 +230,9 @@ dw offset mb3-offset mb2
db "VIDEO.LIB",0
dw offset mb3
dw offset mb4-offset mb3
dw offset mb4-offset mb
db "DETECT.LIB",0
dw offset mb4
dw offset mb5-offset mb4
db "DISQUE",0
dd 0
mb1:
includebin "video.sys"
mb2:
includebin "..\lib\video.lib"
mb3:
includebin "..\lib\detect.lib"
mb4:
includebin "disque.sys"
mb5:

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -1,139 +0,0 @@
<?xml version='1.0' encoding='utf-8' ?>
<!-- C++Builder XML Project -->
<PROJECT>
<MACROS>
<VERSION value="BCB.06.00"/>
<PROJECT value="Project1.exe"/>
<OBJFILES value="Project1.obj Unit1.obj"/>
<RESFILES value="Project1.res"/>
<IDLFILES value=""/>
<IDLGENFILES value=""/>
<DEFFILE value=""/>
<RESDEPEN value="$(RESFILES) Unit1.dfm"/>
<LIBFILES value=""/>
<LIBRARIES value="rtl.lib vcl.lib"/>
<SPARELIBS value="vcl.lib rtl.lib"/>
<PACKAGES value="vcl.bpi rtl.bpi dbrtl.bpi adortl.bpi vcldb.bpi vclx.bpi bdertl.bpi
ibxpress.bpi dsnap.bpi cds.bpi bdecds.bpi qrpt.bpi teeui.bpi teedb.bpi
tee.bpi vcldbx.bpi dss.bpi teeqr.bpi visualclx.bpi visualdbclx.bpi
dsnapcrba.bpi dsnapcon.bpi bcbsmp.bpi vclie.bpi xmlrtl.bpi inet.bpi
inetdbbde.bpi inetdbxpress.bpi inetdb.bpi nmfast.bpi webdsnap.bpi
bcbie.bpi websnap.bpi soaprtl.bpi dclocx.bpi dbexpress.bpi dbxcds.bpi
indy.bpi bcb2kaxserver.bpi OpenGLPanel_DP.bpi IcsBcb60.bpi ZComponent.bpi
ZPlain.bpi ZCore.bpi ZDbc.bpi ZParseSql.bpi"/>
<PATHCPP value=".;"/>
<PATHPAS value=".;"/>
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
<USERDEFINES value=""/>
<SYSDEFINES value="_RTLDLL;NO_STRICT"/>
<MAINSOURCE value="Project1.cpp"/>
<INCLUDEPATH value="D:\CBuilder6\Bin;&quot;C:\Documents and Settings\admin\Bureau\perso\cos\CE explorer&quot;;$(BCB)\include;$(BCB)\include\vcl"/>
<LIBPATH value="D:\CBuilder6\Bin;&quot;C:\Documents and Settings\admin\Bureau\perso\cos\CE explorer&quot;;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w-par"/>
<OTHERFILES value=""/>
</MACROS>
<OPTIONS>
<IDLCFLAGS value="-ID:\CBuilder6\Bin
-I&quot;C:\Documents and Settings\admin\Bureau\perso\cos\CE explorer&quot;
-I$(BCB)\include -I$(BCB)\include\vcl -src_suffix cpp -boa"/>
<CFLAG1 value="-O2 -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -c -tW -tWM"/>
<PFLAGS value="-$Y- -$L- -$D- -$A8 -v -JPHNE -M"/>
<RFLAGS value=""/>
<AFLAGS value="/mx /w2 /zn"/>
<LFLAGS value="-D&quot;&quot; -aa -Tpe -x -Gn"/>
<OTHERFILES value=""/>
</OPTIONS>
<LINKER>
<ALLOBJ value="c0w32.obj Memmgr.Lib sysinit.obj $(OBJFILES)"/>
<ALLRES value="$(RESFILES)"/>
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib"/>
<OTHERFILES value=""/>
</LINKER>
<FILELIST>
<FILE FILENAME="Project1.res" FORMNAME="" UNITNAME="Project1.res" CONTAINERID="ResTool" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="Project1.cpp" FORMNAME="" UNITNAME="Project1" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="Unit1.cpp" FORMNAME="Form1" UNITNAME="Unit1" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
</FILELIST>
<BUILDTOOLS>
</BUILDTOOLS>
<IDEOPTIONS>
[Version Info]
IncludeVerInfo=1
AutoIncBuild=1
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1036
CodePage=1252
[Version Info Keys]
CompanyName=COS2000
FileDescription=Cos2000 lib explorer
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=Cos2000 lib explorer
ProductVersion=1.0.0.0
Comments=FOR CE ONLY
[Excluded Packages]
..\lib\DragDrop_B5.bpl=(untitled)
..\lib\Moje_B5.bpl=(untitled)
..\lib\DriveDir_B5.bpl=(untitled)
..\lib\tb2k_cb6.bpl=(untitled)
..\lib\tb2kdsgn_cb6.bpl=(untitled)
..\lib\tbx_cb6.bpl=(untitled)
..\lib\tbxdsgn_cb6.bpl=(untitled)
d:\cbuilder6\Bin\dclite60.bpl=Borland Integrated Translation Environment
[HistoryLists\hlIncludePath]
Count=1
Item0=D:\CBuilder6\Bin;C:\Documents and Settings\admin\Bureau\perso\cos\CE explorer;$(BCB)\include;$(BCB)\include\vcl
[HistoryLists\hlLibraryPath]
Count=1
Item0=D:\CBuilder6\Bin;C:\Documents and Settings\admin\Bureau\perso\cos\CE explorer;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib
[HistoryLists\hlDebugSourcePath]
Count=1
Item0=$(BCB)\source\vcl
[Debugging]
DebugSourceDirs=$(BCB)\source\vcl
[Parameters]
RunParams=
Launcher=
UseLauncher=0
DebugCWD=
HostApplication=
RemoteHost=
RemotePath=
RemoteLauncher=
RemoteCWD=
RemoteDebug=0
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=0
LinkCGLIB=0
[CORBA]
AddServerUnit=1
AddClientUnit=1
PrecompiledHeaders=1
</IDEOPTIONS>
</PROJECT>

View File

@ -1,34 +0,0 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->Title = "CE explorer";
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------

Binary file not shown.

Binary file not shown.

View File

@ -1,273 +0,0 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#include <math.h>
#include <stdio.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
tree(AnsiString file,int offset,TTreeNode* rootnode)
{
FILE* in;
#pragma option -a1
struct CE {
char checks[2];
unsigned char major;
unsigned int checksum;
unsigned char compressed;
unsigned short exports;
unsigned short imports;
unsigned short sections;
unsigned short starting;
} myce;
#pragma option -a
long pointeur=0;
if ((in = fopen(file.c_str(), "rb"))!= NULL)
{
fseek(in, pointeur+offset, SEEK_SET);
fread(&myce, sizeof(myce), 1, in);
TTreeNode* currentnode;
TTreeNode* subcurrentnode;
TTreeNode* subsubcurrentnode;
if (offset==0)
{
fseek(in, 0L, SEEK_END);
Form1->TreeView->Items->AddChild(rootnode,"Adresse réelle: 0x0000")->ImageIndex=31;
Form1->TreeView->Items->AddChild(rootnode,"Adresse : 0x0000")->ImageIndex=31;
}
currentnode=Form1->TreeView->Items->AddChild(rootnode,"Entête");
currentnode->ImageIndex=10;
Form1->TreeView->Items->AddChild(currentnode,"Adresse réelle: 0x"+IntToHex((int)pointeur+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(currentnode,"Adresse : 0x"+IntToHex((int)pointeur,4))->ImageIndex=31;
if (AnsiString(myce.checks,2)!="CE")
{
rootnode->ImageIndex=4;
Form1->TreeView->Items->AddChild(currentnode,"Type : ceci n'est pas un fichier CE")->ImageIndex=1;
}
else
{
rootnode->ImageIndex=2;
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,"Type : "+AnsiString(myce.checks,2));
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex((int)0+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex((int)0,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Taille: 0x0002")->ImageIndex=31;
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,"Version : "+IntToStr(myce.major));
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex((int)2+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex((int)2,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Taille: 0x0001")->ImageIndex=31;
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,"Checksum : 0x"+IntToHex((int)myce.checksum,8));
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex((int)3+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex((int)3,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Taille: 0x0004")->ImageIndex=31;
if (myce.compressed>=1)
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,"Fichier compressé avec RIP");
else
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,"Fichier sans compression");
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex((int)7+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex((int)7,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Taille: 0x0001")->ImageIndex=31;
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,"Pointeur exportation : 0x"+IntToHex(myce.exports,4));
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex((int)8+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex((int)8,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Taille: 0x0002")->ImageIndex=31;
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,"Pointeur Importation : 0x"+IntToHex(myce.imports,4));
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex((int)10+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex((int)10,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Taille: 0x0002")->ImageIndex=31;
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,"Pointeur sections : 0x"+IntToHex(myce.sections,4));
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex((int)12+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex((int)12,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Taille: 0x0002")->ImageIndex=31;
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,"Point d'entrée : 0x"+IntToHex(myce.starting,4));
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex((int)14+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex((int)14,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Taille: 0x0002")->ImageIndex=31;
Form1->TreeView->Items->AddChild(currentnode,"Taille : 0x0010")->ImageIndex=31;
char imported[30];
AnsiString imports[30]={""};
AnsiString exports[30]={""};
AnsiString sections[30]={""};
unsigned short iaddrs[30]={0};
unsigned short eaddrs[30]={0};
unsigned short saddrs[30]={0};
unsigned short ssize[30]={0};
AnsiString libraries[30]={""};
AnsiString alib;
int i=0;
pointeur=myce.imports;
int nblib=0;
int nbimp=0;
if (myce.imports!=0)
{
currentnode=Form1->TreeView->Items->AddChild(rootnode,"Importations");
currentnode->ImageIndex=14;
Form1->TreeView->Items->AddChild(currentnode,"Adresse réelle: 0x"+IntToHex((int)pointeur+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(currentnode,"Adresse : 0x"+IntToHex((int)pointeur,4))->ImageIndex=31;
do
{
fseek(in, pointeur+offset, SEEK_SET);
fread(&imported, sizeof(imported), 1, in);
imports[i]=AnsiString((char*)&imported);
iaddrs[i]=pointeur;
pointeur+=imports[i].Length()+5;
alib=imports[i].SubString(0,imports[i].Pos(":")-1);
int j;
for(j=0;(j<nblib)&&(alib!=libraries[j])&&(libraries[j]!="");j++);
if ((libraries[j]=="")&&(alib!="")) {
libraries[j]=alib;
nblib++;
}
i++;
} while(imports[i-1]!="");
nbimp=i-1;
for(int i=0;i<nblib;i++)
{
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,libraries[i]);
subcurrentnode->ImageIndex=13;
for(int j=0;j<nbimp;j++)
{
if (imports[j].SubString(0,imports[j].Pos(":")-1)==libraries[i])
{
subsubcurrentnode=Form1->TreeView->Items->AddChild(subcurrentnode,imports[j].SubString(imports[j].Pos(":")+2,255));
subsubcurrentnode->ImageIndex=3;
Form1->TreeView->Items->AddChild(subsubcurrentnode,"Adresse réelle: 0x"+IntToHex((int)iaddrs[j]+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subsubcurrentnode,"Adresse : 0x"+IntToHex((int)iaddrs[j],4))->ImageIndex=31;
}
}
}
currentnode->Text="importations ("+IntToStr(nbimp)+"/"+IntToStr(nblib)+")";
Form1->TreeView->Items->AddChild(currentnode,"Taille : 0x"+IntToHex((int)pointeur-myce.imports,4))->ImageIndex=31;
}
else
{
nbimp=0;
}
i=0;
pointeur=myce.exports;
int nbexp=0;
if (myce.exports!=0)
{
currentnode=Form1->TreeView->Items->AddChild(rootnode,"Exportations");
currentnode->ImageIndex=14;
Form1->TreeView->Items->AddChild(currentnode,"Adresse réelle: 0x"+IntToHex((int)pointeur+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(currentnode,"Adresse : 0x"+IntToHex((int)pointeur,4))->ImageIndex=31;
do
{
fseek(in, pointeur+offset, SEEK_SET);
fread(&imported, sizeof(imported), 1, in);
exports[i]=AnsiString((char*)&imported);
pointeur+=exports[i].Length()+1;
fseek(in, pointeur+offset, SEEK_SET);
fread(&eaddrs[i],sizeof(eaddrs[i]),1,in);
pointeur+=2;
i++;
} while(exports[i-1]!="");
nbexp=i-1;
for(int i=0;i<nbexp;i++)
{
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,exports[i]);
subcurrentnode->ImageIndex=3;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex(eaddrs[i]+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex(eaddrs[i],4))->ImageIndex=31;
}
currentnode->Text="exportations ("+IntToStr(nbexp)+")";
Form1->TreeView->Items->AddChild(currentnode,"Taille : 0x"+IntToHex((int)pointeur-myce.exports,4))->ImageIndex=31;
}
else
{
nbexp=0;
}
pointeur=myce.sections;
i=0;
int nbsec=0;
if (myce.sections!=0)
{
currentnode=Form1->TreeView->Items->AddChild(rootnode,"Sections");
currentnode->ImageIndex=12;
Form1->TreeView->Items->AddChild(currentnode,"Adresse réelle: 0x"+IntToHex((int)pointeur+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(currentnode,"Adresse : 0x"+IntToHex((int)pointeur,4))->ImageIndex=31;
do
{
fseek(in, pointeur+offset, SEEK_SET);
fread(&saddrs[i],sizeof(saddrs[i]),1,in);
pointeur+=2;
fseek(in, pointeur+offset, SEEK_SET);
fread(&ssize[i],sizeof(ssize[i]),1,in);
pointeur+=2;
fseek(in, pointeur+offset, SEEK_SET);
fread(&imported, sizeof(imported), 1, in);
sections[i]=AnsiString((char*)&imported);
pointeur+=sections[i].Length()+1;
i++;
} while(ssize[i-1]!=0);
nbsec=i-1;
for(int i=0;i<nbsec;i++)
{
subcurrentnode=Form1->TreeView->Items->AddChild(currentnode,sections[i]);
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse réelle: 0x"+IntToHex(saddrs[i]+offset,4))->ImageIndex=31;
Form1->TreeView->Items->AddChild(subcurrentnode,"Adresse : 0x"+IntToHex(saddrs[i],4))->ImageIndex=31;
if (saddrs[i]!=0) tree(file,saddrs[i],subcurrentnode);
subcurrentnode->ImageIndex=2;
Form1->TreeView->Items->AddChild(subcurrentnode,"Taille : 0x"+IntToHex(ssize[i],4))->ImageIndex=31;
}
Form1->TreeView->Items->AddChild(currentnode,"Taille : 0x"+IntToHex((int)pointeur-myce.sections,4))->ImageIndex=31;
currentnode->Text="Sections ("+IntToStr(nbsec)+")";
}
else
{
nbsec=0;
}
if (offset==0)
{
fseek(in, 0L, SEEK_END);
int size = ftell(in);
Form1->TreeView->Items->AddChild(rootnode,"Taille : 0x"+IntToHex(size,4))->ImageIndex=31;
}
}
fclose(in);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Ouvrir1Click(TObject *Sender)
{
if (OpenDialog->Execute())
tree(OpenDialog->FileName,0,Form1->TreeView->Items->Add(Form1->TreeView->Items->GetFirstNode(),ExtractFileName(OpenDialog->FileName)));
TTreeNode* node=Form1->TreeView->Items->GetFirstNode();
while(node!=NULL)
{
node->SelectedIndex=node->ImageIndex;
node=node->GetNext();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Quitter1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Menus.hpp>
#include <Dialogs.hpp>
#include <ComCtrls.hpp>
#include <ImgList.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TMainMenu *MainMenu1;
TMenuItem *Fichier1;
TMenuItem *Ouvrir1;
TOpenDialog *OpenDialog;
TTreeView *TreeView;
TImageList *ImageList;
TMenuItem *N1;
TMenuItem *Quitter1;
TRichEdit *RichEdit1;
void __fastcall Ouvrir1Click(TObject *Sender);
void __fastcall Quitter1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

View File

@ -1,108 +0,0 @@
net segment
org 0100h
assume cs:net,ds:net
start:
jmp deb
taille dw 0
signe db 'rip'
signe2 db 64 dup (0)
p1 db '@'
p2 db '@'
min db 4
deb:
mov BL,DS:[0080h]
xor BH,BH
or BX,BX
mov byte ptr [0081h+BX],00h
mov AX,3D02h
mov DX,0082H
int 21h
mov bx,ax
mov ah,3fh
mov cx,0ffffh
mov dx,offset data
int 21h
mov taille,ax
mov ah,3eh
int 21h
mov si,82h
mov di,offset signe2
mov cx,64
rep movsb
mov di,offset signe2
mov cx,64
mov al,2eh
repne scasb
push di
mov si,di
mov di,offset data
add di,taille
mov cx,3
rep movsb
mov ax,di
pop di
mov cx,3
mov si,offset signe
rep movsb
mov di,ax
mov cx,taille
mov si,offset data
mov dx,1
boucle:
lodsb
cmp al,[si]
jne pas
inc dl
loop boucle
jmp fin
pas:
cmp dl,min
jb suite
cmp dl,1
jne go
suite:
mov bx,cx
mov cx,dx
rep stosb
mov cx,bx
mov dl,1
loop boucle
jmp fin
go:
mov ah,al
mov al,p1
stosb
mov al,dl
stosb
mov al,ah
stosb
mov al,p2
stosb
mov dl,1
loop boucle
fin:
mov ah,3ch
mov cx,0
mov dx,offset signe2
int 21h
mov bx,ax
mov ah,40h
mov cx,di
sub cx,offset data
sub cx,taille
mov dx,offset data
add dx,taille
int 21h
mov ah,3eh
int 21h
mov ah,41h
mov dx,82h
int 21h
ret
data db 0
net ends
end start
net

View File

@ -1,88 +0,0 @@
net segment
org 0100h
assume cs:net,ds:net
start:
jmp deb
taille dw 0
signe2 db 64 dup (0)
p1 db '@'
p2 db '@'
deb:
mov BL,DS:[0080h]
xor BH,BH
or BX,BX
mov byte ptr [0081h+BX],00h
mov AX,3D02h
mov DX,0082H
int 21h
mov bx,ax
mov ah,3fh
mov cx,0ffffh
mov dx,offset data
int 21h
mov taille,ax
mov ah,3eh
int 21h
mov si,82h
mov di,offset signe2
mov cx,64
rep movsb
mov di,offset signe2
mov cx,64
mov al,2eh
repne scasb
mov si,offset data
mov cx,3
rep movsb
mov cx,taille
mov di,offset data
add di,taille
mov dx,1
boucle:
lodsb
cmp al,p1
je pas
suite:
stosb
loop boucle
jmp fin
pas:
mov al,p2
cmp [si+2],al
jne suite
lodsb
mov bx,cx
mov cl,al
xor ch,ch
lodsb
rep stosb
mov cx,bx
sub cx,3
inc si
loop boucle
fin:
mov ah,3ch
mov cx,0
mov dx,offset signe2
int 21h
mov bx,ax
mov ah,40h
mov cx,di
sub cx,offset data
sub cx,taille
mov dx,offset data
add dx,taille
int 21h
mov ah,3eh
int 21h
mov ah,41h
mov dx,82h
int 21h
ret
data db 0
net ends
end start
net

View File

@ -1,23 +1,53 @@
asm= lzasm /z/t
lnk= elink
lnk_boot = tlink /x
asm= tasm /t/m5/zi
lnk= tlink /x/t
all: exem-lib.lib exem-ce.ce pmode.ce isa.ce editeur.ce volume.ce test.ce verifier.ce gestion.ce logo.ce souris.ce test3d.ce test2d.ce
all: detect.com editeur.com gestion.com logo.com pmode.com souris.com test.com verifier.com volume.com memoire.com
.asm.obj:
$(asm) $<
memoire.com: memoire.asm
$(asm) memoire
$(lnk) memoire
.obj.ce:
$(lnk) $< $*.ce
detect.com: detect.asm
$(asm) detect
$(lnk) detect
editeur.com: editeur.asm
$(asm) editeur
$(lnk) editeur
gestion.com: gestion.asm
$(asm) gestion
$(lnk) gestion
logo.com: logo.asm
$(asm) logo
$(lnk) logo
pmode.com: pmode.asm
$(asm) pmode
$(lnk) pmode
souris.com: souris.asm
$(asm) souris
$(lnk) souris
test.com: test.asm
$(asm) test
$(lnk) test
verifier.com: verifier.asm
$(asm) verifier
$(lnk) verifier
volume.com: volume.asm
$(asm) volume
$(lnk) volume
.obj.lib:
$(lnk) $< $*.lib
clean:
del *.obj
del *.ce
del *.bak
del *.lib
del *.com
del *.bin
del *.com
del *.sys
del *.err

551
programs/detect.asm Normal file
View File

@ -0,0 +1,551 @@
.model tiny
.486
smart
.code
org 0h
include ..\include\pci.h
include ..\include\mem.h
start:
header exe <,1,0,,,offset imports,,>
realstart:
call getpciinfos
mov [pciversion],bx
mov [nbbus],cl
mov [pcitype],al
xor edx,edx
mov dl,[nbbus]
inc dl
push edx
mov dx,[pciversion]
push edx
mov dx,[pciversion]
shr dx,8
push edx
push offset msg
call [print]
mov di,offset types
mov bx,7
mov al,pcitype
vote:
bt ax,bx
jnc nowas
shl bx,1
push word ptr [di+bx]
call [print]
shr bx,1
nowas:
dec bx
jns vote
push offset return
call [print]
xor ax,ax
xor cx,cx
mov si,offset infos
search:
mov di,si
call Getallfunctionsinfos
jc stopthis
mov dh,[si+pci.subclass]
mov dl,[si+pci.class]
;sousclasse
mov di,offset subclasse
call getpcisubclass
push di
;classe
mov di,offset classe
call getpciclass
push di
;fonction
mov dl,ch
push edx
;device
mov dl,cl
push edx
;bus
mov dl,al
push edx
;device
mov dx,[si+pci.device]
push edx
;vendeur
mov dx,[si+pci.vendor]
push edx
push offset msg2
call [print]
inc ch
cmp ch,7
jbe search
stopthis:
xor ch,ch
inc cl
cmp cl,31
jbe search
xor cl,cl
inc al
cmp al,16
jbe search
retf
msg db "COS2000 hardware detecteur V1.6\lBIOS PCI version %hB.%hB a ete detecte !\lNombre de bus : %u\lCaracterisques PCI: ",0
msg2 db "Peripherique :%hW Constructeur :%hW Id :%hB.%hB.%hB Classe :%0.%0\l",0
return db "\l",0
classe db 128 dup (0)
subclasse db 128 dup (0)
types dw config1
dw config2
dw null
dw null
dw config3
dw config4
dw null
dw null
null db 'indefini',0
config1 db 'Config Mechanism 1',0
config2 db 'Config Mechanism 2',0
config3 db 'Special Cycle Mechanism 1',0
config4 db 'Special Cycle Mechanism 2',0
PciVersion dw 0
Nbbus db 0
PciType db 0
infos db 256 dup (0)
;fonction 0-7 bus 0-255 device 0-31
;renvoie en es:di de classe dl
getpciclass:
push ax cx dx si di ds es
push es
push di
mov di,dx
and di,0FFh
shl di,1
mov di,[offset classes+di]
mov cx,0FFh
mov al,0
push cs
pop es
repne scasb
sub cx,0FFh
neg cx
sub di,cx
mov si,di
push cs
pop ds
pop di
pop es
rep movsb
pop es ds di si dx cx ax
ret
;renvoie en es:di la sous-classe de dh et de classe dl
getpcisubclass:
push ax cx dx si di ds es
push es
push di
mov di,dx
and di,0FFh
shl di,1
mov di,[offset classesd+di]
xchg dh,dl
xor dh,dh
cmp dx,80h
jne suiteac
mov di,offset divers
jmp found
suiteac:
shl dx,1
add di,dx
mov di,[di]
found:
mov cx,0FFh
mov al,0
push cs
pop es
repne scasb
sub cx,0FFh
neg cx
sub di,cx
mov si,di
push cs
pop ds
pop di
pop es
rep movsb
pop es ds di si dx cx ax
ret
divers db 'divers',0
classes:
dw offset class0
dw offset class1
dw offset class2
dw offset class3
dw offset class4
dw offset class5
dw offset class6
dw offset class7
dw offset class8
dw offset class9
dw offset class10
dw offset class11
dw offset class12
dw offset class13
dw offset class14
dw offset class15
dw offset class16
dw offset class17
class0 db 'ancien',0
class1 db 'stockage',0
class2 db 'reseau',0
class3 db 'affichage',0
class4 db 'multimedia',0
class5 db 'memoire',0
class6 db 'pont',0
class7 db 'communication',0
class8 db 'systeme',0
class9 db 'acquisition',0
class10 db 'dock',0
class11 db 'processeur',0
class12 db 'bus serie',0
class13 db 'sans fil',0
class14 db 'intelligent',0
class15 db 'satellite',0
class16 db 'cryptage',0
class17 db 'traitement signal',0
;Classes et sous classes
classesd:
dw offset class0d
dw offset class1d
dw offset class2d
dw offset class3d
dw offset class4d
dw offset class5d
dw offset class6d
dw offset class7d
dw offset class8d
dw offset class9d
dw offset class10d
dw offset class11d
dw offset class12d
dw offset class13d
dw offset class14d
dw offset class15d
dw offset class16d
dw offset class17d
class0d:
dw offset subclass00
dw offset subclass01
subclass00 db 'divers',0
subclass01 db 'vga',0
class1d:
dw offset subclass10
dw offset subclass11
dw offset subclass12
dw offset subclass13
dw offset subclass14
subclass10 db 'scsi',0
subclass11 db 'ide',0
subclass12 db 'disquette',0
subclass13 db 'ipi',0
subclass14 db 'raid',0
class2d:
dw offset subclass20
dw offset subclass21
dw offset subclass22
dw offset subclass23
dw offset subclass24
subclass20 db 'ethernet',0
subclass21 db 'token ring',0
subclass22 db 'fddi',0
subclass23 db 'atm',0
subclass24 db 'isdn',0
class3d:
dw offset subclass30
dw offset subclass31
dw offset subclass32
subclass30 db 'vga',0
subclass31 db 'xga',0
subclass32 db '3D',0
class4d:
dw offset subclass40
dw offset subclass41
dw offset subclass42
subclass40 db 'video',0
subclass41 db 'audio',0
subclass42 db 'telephonie',0
class5d:
dw offset subclass50
dw offset subclass51
subclass50 db 'ram',0
subclass51 db 'flash',0
class6d:
dw offset subclass60
dw offset subclass61
dw offset subclass62
dw offset subclass63
dw offset subclass64
dw offset subclass65
dw offset subclass66
dw offset subclass67
dw offset subclass68
subclass60 db 'hote',0
subclass61 db 'isa',0
subclass62 db 'eisa',0
subclass63 db 'mca',0
subclass64 db 'pci',0
subclass65 db 'pcmcia',0
subclass66 db 'nubus',0
subclass67 db 'cardbus',0
subclass68 db 'RACEway',0
class7d:
dw offset subclass70
dw offset subclass71
dw offset subclass72
dw offset subclass73
subclass70 db 'serie',0
subclass71 db 'parallele',0
subclass72 db 'serie multiport',0
subclass73 db 'modem',0
class8d:
dw offset subclass80
dw offset subclass81
dw offset subclass82
dw offset subclass83
dw offset subclass84
subclass80 db 'pic',0
subclass81 db 'dma',0
subclass82 db 'timer',0
subclass83 db 'rtc',0
subclass84 db 'hotplug',0
class9d:
dw offset subclass90
dw offset subclass91
dw offset subclass92
dw offset subclass93
dw offset subclass94
subclass90 db 'clavier',0
subclass91 db 'stylo',0
subclass92 db 'souris',0
subclass93 db 'scanner',0
subclass94 db 'joystick',0
class10d:
dw offset subclass100
subclass100 db 'station',0
class11d:
dw offset subclass110
dw offset subclass111
dw offset subclass112
dw offset subclass113
dw offset subclass114
subclass110 db '386',0
subclass111 db '486',0
subclass112 db 'pentium',0
subclass113 db 'alpha',0
subclass114 db 'coprocesseur',0
class12d:
dw offset subclass120
dw offset subclass121
dw offset subclass122
dw offset subclass123
dw offset subclass124
dw offset subclass125
subclass120 db 'firewire',0
subclass121 db 'access',0
subclass122 db 'ssa',0
subclass123 db 'usb',0
subclass124 db 'fibre',0
subclass125 db 'smbus',0
class13d:
dw offset subclass130
dw offset subclass131
dw offset subclass132
subclass130 db 'irda',0
subclass131 db 'ir',0
subclass132 db 'rf',0
class14d:
dw offset subclass140
subclass140 db 'IO arch',0
class15d:
dw offset subclass150
dw offset subclass151
dw offset subclass152
dw offset subclass153
subclass150 db 'tv',0
subclass151 db 'audio',0
subclass152 db 'voix',0
subclass153 db 'donnees',0
class16d:
dw offset subclass160
dw offset subclass161
subclass160 db 'reseau',0
subclass161 db 'jeux',0
class17d:
dw offset subclass170
subclass170 db 'dpio',0
;bx pci version, cl nbbus, al pci type
getPciInfos:
push dx
mov ax,0B101h
xor edi,edi
mov edx," PCI"
int 1Ah
jc ErrorPci
cmp dx,04350h
jne ErrorPci
clc
pop dx
ret
errorpci:
stc
pop dx
ret
;al=bus cl=deviceid ch=func es:di
Getallfunctionsinfos:
push ax bx dx di
cmp ch,0
je amultiorfirst
mov bl,0Eh
push cx
xor ch,ch
call getfunctioninfo
pop cx
and dl,80h
cmp dl,0
jne amultiorfirst
mov word ptr [di],0000h
jmp notexist
amultiorfirst:
xor bl,bl
goinfos:
call getfunctioninfo
inc bl
cmp bl,2
ja notzarb
cmp dl,0FFh
je notexist
notzarb:
mov es:[di],dl
inc di
cmp bl,255
jb goinfos
pop di
push di
cmp word ptr [di],0000h
je notexist
clc
pop di dx bx ax
ret
notexist:
stc
pop di dx bx ax
ret
; PCI TYPE 1
;*******************************************************************
config1_addr equ 0CF8h
config1_data equ 0CFCh
pci_type1_detect:
mov dx, config1_addr+3
mov al, 01h
out dx,al
mov dx,config1_addr
in eax,dx
mov ecx,eax
mov eax,80000000h
out dx,eax
in eax,dx
cmp eax,80000000h
jne endofdetectiontype1
mov eax,ecx
out dx,eax
endofdetectiontype1:
ret
;al=bus bl=index cl=deviceid ch=func->dl
getfunctioninfo:
push eax bx cx
mov ah,80h
shl eax,16
mov ah,cl
shl ah,3
or ah,ch
mov al,bl
and al,0fch
mov dx,0cf8h
out dx,eax
mov dx,0CFCh
and bl,3
or dl,bl
in al,dx
mov dl,al
pop cx bx eax
ret
; PCI TYPE 2
;*******************************************************************
config2_reg0 equ 0CFBh
config2_reg1 equ 0CF8h
config2_reg2 equ 0CFAh
pci_type2_detect:
xor ax,ax
mov dx,config2_reg0
out dx,ax
mov dx,config2_reg1
out dx,ax
mov dx,config2_reg2
out dx,ax
mov ax,config2_reg1
in al,dx
cmp al,0
jne endofdetectiontype2
mov ax,config2_reg0
in al,dx
cmp al,0
jne endofdetectiontype2
endofdetectiontype2:
ret
imports:
db "VIDEO.LIB::print",0
print dd 0
dw 0
end start

View File

@ -1,350 +1,373 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
include "..\include\graphic.h"
.model tiny
.486
smart
.code
org 0h
include ..\include\mem.h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe <,1,0,,,offset imports,,>
realstart:
mov ax,0305h
mov bx,0008h
int 16h
call [savestate]
call [setvideomode],2
xor ebp,ebp
xor ax,ax
mov fs,ax
call [disablescroll]
adres:
call [saveparamto],offset infos
mov al,[infos.lines]
dec al
mov [lastline],al
mov al,[infos.columns]
sub al,16
mov bl,al
shr al,2
mov [sizex],al
and bl,11b
mov [sizex2],bl
mov al,[infos.mode]
cmp al,[oldmode]
je noinit
call [clearscreen]
mov [oldmode],al
noinit:
call [setxy],0,0
mov edi,ebp
mov bh,[lastline]
mov ax,0305h
mov bx,0008h
int 16h
mov ah,28h
int 47h
mov ax,0002
int 47H
mov ah,2
int 47h
xor ebp,ebp
xor ax,ax
mov fs,ax
mov ah,43
int 47h
Adres:
mov di,offset infos
mov ah,34
int 47h
dec byte ptr [di]
mov al,[di+1]
sub al,16
mov bl,al
shr al,2
mov [di+1],al
and bl,11b
mov [di+2],bl
mov al,[di+7]
cmp al,oldmode
je noinit
mov ah,2
int 47h
mov oldmode,al
noinit:
mov bx,0
mov ah,25
int 47h
mov bh,infos
mov edi,ebp
lines:
xor edx,edx
mov dx,di
push edx
mov edx,edi
shr edx,4*4
shl edx,4*3
push edx
push offset spaces
call [print]
mov dx,di
mov al,[sizex]
mov esi,edi
xor edx,edx
mov dx,di
push edx
mov edx,edi
shr edx,4*4
shl edx,4*3
push edx
push offset spaces
call [print]
mov dx,di
mov al,infos+1
mov esi,edi
doaline:
mov edx,edi
shr edx,4*4
shl edx,4*3
mov fs,dx
push [dword ptr fs:di]
push 8
call [showhex]
call [showchar],' '
inc edi
dec al
jnz doaline
mov edi,esi
push offset spaces2
call [print]
mov al,[sizex]
mov edx,edi
shr edx,4*4
shl edx,4*3
mov fs,dx
push dword ptr fs:[di]
push 8
call [showhex]
push ' '
call [showchar]
inc edi
dec al
jnz doaline
mov edi,esi
push offset spaces2
call [print]
mov al,infos+1
doaline2:
mov edx,edi
shr edx,4*4
shl edx,4*3
mov fs,dx
push [word ptr fs:di]
call [showchar]
inc edi
dec al
jnz doaline2
dec bh
je outes
cmp [sizex2],0
je lines
call [addline]
jmp lines
outes:
call [setxy],0,[word ptr lastline]
call [print],offset menu
waitkey:
mov ax,0
int 16h
cmp ax,3B00h
jne suit
inc ebp
jmp adres
suit:
cmp ax,3C00h
jne suit2
dec ebp
jmp adres
suit2:
cmp ax,3D00h
jne suit3
add ebp,24*16
jmp adres
suit3:
cmp ax,3E00h
jne suit4
sub ebp,24*16
jmp adres
suit4:
cmp ax,3F00h
jne suit5
add ebp,010000h
jmp adres
suit5:
cmp ax,4000h
jne suit6
sub ebp,010000h
jmp adres
suit6:
cmp ax,4100h
jne suit7
mov [dword ptr pope],'TIDE'
call [setxy],0,[word ptr lastline]
call [print],offset menu
mov ax,0B800h
mov es,ax
mov [xxyy2],3
mov [xxyy],3
call calc1
call calc2
mov edx,edi
shr edx,4*4
shl edx,4*3
mov fs,dx
push word ptr fs:[di]
call [showchar]
inc edi
dec al
jnz doaline2
dec bh
je outes
cmp byte ptr infos+2,0
je lines
mov ah,6
int 47h
jmp lines
outes:
mov bh,0
mov bl,infos
mov ah,25
int 47h
push offset menu
call [print]
waitkey:
mov ax,0
int 16h
cmp ax,3B00h
jne suit
inc ebp
jmp adres
suit:
cmp ax,3C00h
jne suit2
dec ebp
jmp adres
suit2:
cmp ax,3D00h
jne suit3
add ebp,24*16
jmp adres
suit3:
cmp ax,3E00h
jne suit4
sub ebp,24*16
jmp adres
suit4:
cmp ax,3F00h
jne suit5
add ebp,010000h
jmp adres
suit5:
cmp ax,4000h
jne suit6
sub ebp,010000h
jmp adres
suit6:
cmp ax,4100h
jne suit7
mov dword ptr [pope],'TIDE'
mov bh,0
mov bl,infos
mov ah,25
int 47h
push offset menu
call [print]
mov ax,0B800h
mov es,ax
mov xxyy2,3
mov xxyy,3
call calc1
call calc2
waitst:
mov ax,0
int 16h
cmp ah,41h
jne tre
mov [dword ptr pope],' EUV'
push cs
pop es
jmp adres
mov ax,0
int 16h
cmp ah,41h
jne tre
mov dword ptr [pope],' EUV'
push cs
pop es
jmp adres
tre:
cmp al,0
jne write
cmp ah,48h
jne tre1
cmp [yy],0
je waitst
dec [yy]
jmp cursor
cmp al,0
jne write
cmp ah,48h
jne tre1
cmp yy,0
je waitst
dec yy
jmp cursor
tre1:
cmp ah,50h
jne tre2
mov al,[lastline]
dec al
xor ah,ah
cmp [yy],ax
je waitst
inc [yy]
jmp cursor
cmp ah,50h
jne tre2
mov al,infos
dec al
xor ah,ah
cmp yy,ax
je waitst
inc yy
jmp cursor
tre2:
cmp ah,4Dh
jne tre4
cmp [xx],15
je waitst
inc [xx]
jmp cursor
tre4:
cmp ah,4Bh
jne waitst
cmp [xx],0
je waitst
dec [xx]
jmp cursor
cmp ah,4Dh
jne tre4
cmp xx,15
je waitst
inc xx
jmp cursor
tre4:
cmp ah,4Bh
jne waitst
cmp xx,0
je waitst
dec xx
jmp cursor
write:
call asciihex2dec
cmp cl,15
ja waitst
call calc1
call calc2
mov edi,[es:bx-1]
mov dx,[es:si-1]
mov [byte ptr es:bx],0112
mov [es:bx-1],al
call AsciiHex2dec
cmp cl,15
ja waitst
call calc1
call calc2
mov edi,es:[bx-1]
mov dx,es:[si-1]
mov byte ptr es:[bx],0112
mov es:[bx-1],al
writs:
mov ax,0
int 16H
mov ch,cl
call asciihex2dec
cmp cl,15
ja writs
shl ch,4
add ch,cl
mov [es:bx+1],al
mov [es:si-1],ch
mov ax,bx
call calc3
mov [gs:bx],ch
pusha
popa
mov cl,[gs:bx]
cmp ch,cl
je no
push si ax
call [setxy],0,[word ptr lastline]
call [print],offset msg
mov ax,0
int 16h
call [setxy],0,[word ptr lastline]
call [print],offset menu
pop bx si
mov [es:bx-1],edi
mov [es:si-1],dx
no:
inc [xx]
cmp [xx],16
jne pasde
inc [yy]
mov [xx],0h
pasde:
call calc1
call calc2
jmp waitst
cursor:
call calc1
call calc2
jmp waitst
suit7:
cmp ax,4200h
jne adres
call [restorestate]
retf
calc1:
push ax dx si
mov ax,[xx]
mov dx,[xx]
shl ax,2
shl dx,1
add ax,dx
add ax,27
mov bx,[yy]
mov dx,[yy]
shl bx,5
shl dx,7
add bx,dx
add bx,ax
mov [byte ptr es:bx],112
mov [byte ptr es:bx+2],112
mov si,[xxyy]
mov [byte ptr es:si],07
mov [byte ptr es:si+2],07
mov [xxyy],bx
pop si dx ax
ret
calc2:
push ax bx dx
mov si,[yy]
mov dx,[yy]
shl si,5
shl dx,7
add si,dx
mov dx,[xx]
shl dx,1
add si,dx
add si,129
mov [byte ptr es:si],112
mov bx,[xxyy2]
mov [byte ptr es:bx],07
mov [xxyy2],si
pop dx bx ax
ret
calc3:
push dx
xor ebx,ebx
mov bx,[xx]
mov dx,[yy]
shl dx,4
add bx,dx
add ebx,ebp
mov edx,ebx
shr edx,4*4
shl edx,4*3
mov gs,dx
pop dx
ret
asciihex2dec:
cmp al,'a'
jb nomin
cmp al,'f'
ja nomin
sub al,'a'-'A'
jmp ismaj
nomin:
cmp al,'A'
jb nomaj
cmp al,'F'
ja nomaj
ismaj:
mov cl,al
sub cl,'A'-10
jmp endt
nomaj:
mov cl,al
sub cl,'0'
endt:
ret
mov ax,0
int 16H
mov ch,cl
call AsciiHex2dec
cmp cl,15
ja writs
shl ch,4
add ch,cl
mov es:[bx+1],al
mov es:[si-1],ch
mov ax,bx
call calc3
mov gs:[bx],ch
pusha
popa
mov cl,gs:[bx]
cmp ch,cl
je no
push si ax
mov bh,0
mov bl,infos
mov ah,25
int 47h
push offset msg
call [print]
mov ax,0
int 16h
mov bh,0
mov bl,infos
mov ah,25
int 47h
push offset menu
call [print]
pop bx si
mov es:[bx-1],edi
mov es:[si-1],dx
no:
inc xx
cmp xx,16
jne pasde
inc yy
mov xx,0h
pasde:
call calc1
call calc2
jmp waitst
cursor:
call calc1
call calc2
jmp waitst
suit7:
cmp ax,4200h
jne adres
mov ah,29h
int 47h
retf
calc1:
push ax dx si
mov ax,xx
mov dx,xx
shl ax,2
shl dx,1
add ax,dx
add ax,27
mov bx,YY
mov dx,yy
shl bx,5
shl dx,7
add bx,dx
add bx,ax
mov byte ptr es:[bx],112
mov byte ptr es:[bx+2],112
mov si,xxyy
mov byte ptr es:[si],07
mov byte ptr es:[si+2],07
mov xxyy,bx
pop si dx ax
ret
calc2:
push ax bx dx
mov si,YY
mov dx,yy
shl si,5
shl dx,7
add si,dx
mov dx,xx
shl dx,1
add si,dx
add si,129
mov byte ptr es:[si],112
mov bx,xxyy2
mov byte ptr es:[bx],07
mov xxyy2,si
pop dx bx ax
ret
calc3:
push dx
xor ebx,ebx
mov bx,xx
mov dx,yy
shl dx,4
add bx,dx
add ebx,ebp
mov edx,ebx
shr edx,4*4
shl edx,4*3
mov gs,dx
pop dx
ret
asciihex2dec:
cmp al,'a'
jb nomin
cmp al,'f'
ja nomin
sub al,'a'-'A'
jmp ismaj
nomin:
cmp al,'A'
jb nomaj
cmp al,'F'
ja nomaj
ismaj:
mov cl,al
sub cl,'A'-10
jmp endt
nomaj:
mov cl,al
sub cl,'0'
endt:
ret
dep db ':',0
sect dw 0
xx dw 0
yy dw 0
xxyy dw 3
xxyy2 dw 3
lastline db 0
sizex db 0
sizex2 db 0
dep db ':',0
msg db '\c74Erreur : zone non modifiable (ROM) pressez une touche pour continuer ',0
menu db '\c70haut/bas [F1/2] Offset [F3/4] Segment [F5/6] Mode F7, Quitter F8 MODE '
pope db 'VUE ',0
pope db 'VUE ',0
spaces db '\c02%hW:%hW \c04| \c07',0
spaces2 db '\c04 | \c07',0
showbuffer db 35 dup (0FFh)
oldmode db 0
infos vgainf <>
infos db 40 dup (0)
importing
use VIDEO,setvideomode
use VIDEO,savestate
use VIDEO,restorestate
use VIDEO,setxy
use VIDEO,addline
use VIDEO,saveparamto
use VIDEO,disablescroll
use VIDEO,clearscreen
use VIDEO.LIB,print
use VIDEO.LIB,showhex
use VIDEO.LIB,showchar
endi
imports:
db "VIDEO.LIB::print",0
print dd 0
db "VIDEO.LIB::showhex",0
showhex dd 0
db "VIDEO.LIB::showchar",0
showchar dd 0
dw 0
end start

View File

@ -1,26 +1,29 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
.model small
.486
smart
.code
org 0h
include ..\include\mem.h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe <,1,0,,,offset imports,offset exports,>
realstart:
call [print],offset message
call [waitkey]
retf
push offset message
call [affiche]
call [waitkey]
retf
message db 'Appel de la librairie \c02video\c07 et de la librairie \c02EXEM-LIB.LIB\c07 !',0
message db 'Appel de la librairie video !',0
importing
use VIDEO.LIB,print
use EXEM-LIB.LIB,waitkey
endi
imports:
db "VIDEO.LIB::print",0
affiche dd 0
db "EXEM-LIB.LIB::waitkey",0
waitkey dd 0
dw 0
exports:
end start

View File

@ -1,24 +1,25 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
.model tiny
.486
smart
.code
org 0h
include ..\include\mem.h
start:
header exe <"CE",1,0,0,offset exports,,,>
header exe <,1,0,,,offset imports,offset exports,>
waitkey:
mov ax,0
int 16h
retf
exporting
getvar2:
mov ax,0
int 16h
retf
declare waitkey
ende
imports:
exports:
db "waitkey",0
dw getvar2
dw 0
end start

View File

@ -1,100 +1,94 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\fat.h"
include "..\include\divers.h"
include "..\include\graphic.h"
.model tiny
.486
smart
.code
org 0h
include ..\include\mem.h
include ..\include\fat.h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe <,1,0,,,offset imports,,>
realstart:
call [saveparamto],offset infos
call [print],offset msg1
call [initdrive]
xor bp,bp
call [findfirstfile],offset bufferentry
jc nofiles
realstart:
push offset msg1
call [print]
mov ah,3
int 48h
xor bp,bp
mov di,offset bufferentry
mov ah,7
int 48h
jc nofiles
go:
push [word bufferentry.result.fileattr]
push [bufferentry.result.filesize]
push [bufferentry.result.filetime]
push [bufferentry.result.filedate]
push [bufferentry.result.filetimecrea]
push [bufferentry.result.filedatecrea]
mov bx,offset bufferentry.result.filename
push bx
push offset line
call [print]
call [findnextfile],offset bufferentry
jc nofiles
inc bp
jmp go
push word ptr [di+Entries.FileAttr]
push dword ptr [di+Entries.FileSize]
push word ptr [di+Entries.FileTime]
push word ptr [di+Entries.FileDate]
push word ptr [di+Entries.FileTimeCrea]
push word ptr [di+Entries.FileDateCrea]
push di
push offset line
call [print]
inc bp
mov ah,8
int 48h
jnc go
nofiles:
call [print],offset menu
mov [xx],1
call changelineattr,[xx],112
push offset menu
call [print]
mov xx,1
mov xxold,2
call Select
endof:
mov ax,0
int 16h
cmp ah,50h
jne tre1
cmp [xx],bp
ja endof
call changelineattr,[xx],7
inc [xx]
call changelineattr,[xx],112
jmp endof
mov ax,0
int 16h
cmp ah,50h
jne tre1
cmp xx,bp
ja endof
inc xx
call select
jmp endof
tre1:
cmp ah,48h
jne tre2
cmp [xx],1
je endof
call changelineattr,[xx],7
dec [xx]
call changelineattr,[xx],112
jmp endof
cmp ah,48h
jne tre2
cmp xx,1
je endof
dec xx
call select
jmp endof
tre2:
cmp al,0Dh
jne tre3
cmp al,0Dh
jne tre3
tre3:
cmp ah,59
jne tre4
jmp realstart
cmp ah,59
jne tre4
jmp realstart
tre4:
cmp ah,67
jne endof
retf
cmp ah,67
jne endof
retf
;couleur al pour ligne %0 en %1
PROC changelineattr near
USES ax,bx,di,es
ARG @line:word,@attr:word
mov ax,0B800h
mov es,ax
mov ax,[@line]
add ax,3
mul [cs:infos.columns]
mov di,ax
shl di,1
mov al,[cs:infos.columns]
inc di
mov bx,[@attr]
@@popep:
mov [es:di],bl
add di,2
dec al
jnz @@popep
ret
endp changelineattr
;selectionne la ligne xx
Select:
push ax di
mov di,xxold
mov al,7
add di,3
mov ah,32
int 47h
mov ax,xx
mov xxold,ax
mov di,xx
mov ah,32
mov al,112
add di,3
int 47h
pop di ax
ret
xx dw 1
xxold dw 0
@ -102,16 +96,14 @@ menu db '\c70 [F1] Lire disque [F9] Quitter
msg1 db '\e\g00,00\c70 Gestionnaire de fichier Version 1.5 '
db '\g00,01\c07--------------------------------------------------------------------------------'
db '\g00,02Nom Ext. Date creation Date modification Taille Attributs'
db '\g00,03-------------------------------------------------------------------------------\l',0
db '\g00,03--------------------------------------------------------------------------------\l',0
line db '\c07%n %d %t %d %t %z %a\l',0
bufferentry find <>
infos vgainf <>
bufferentry db 512 dup (0)
importing
use VIDEO.LIB,print
use VIDEO,saveparamto
use DISQUE,initdrive
use DISQUE,findfirstfile
use DISQUE,findnextfile
endi
imports:
db "VIDEO.LIB::print",0
print dd 0
dw 0
end start

View File

@ -1,20 +1,11 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
.model tiny
.486
smart
.code
include "..\include\mem.h"
include "..\include\divers.h"
org 0h
org 0100h
start:
header exe <"CE",1,0,0,,,,offset realstart>
realstart:
retf
PNP_ADR_PORT equ 0x279
PNP_WRITE_PORT equ 0xA79
@ -32,15 +23,17 @@ IDENT_LEN equ 9
;renvoie le timer en ax
ctc:
cli
mov dx,043h
mov al,0
out dx,al
mov dx,40h
in al,dx
mov ah,al
in al,dx
mov dx,043h
mov al,0
out dx,al
mov dx,40h
in al,dx
mov ah,al
in al,dx
sti
ret
;attend pendant ax microsecondes
usleep:
end start

View File

@ -1,73 +1,100 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
.model tiny
.486
smart
.code
org 0h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
include ..\include\mem.h
realstart:
call [cs:mballoc],65535
jc problem3
push ax
pop es
call [cs:projfile],offset logo
jc problem
mov ecx,eax
call [cs:mbfind],offset logo
jc problem
call [cs:decompressrle],ax,0,es,0,cx
jc problem2
push es
pop ds
call [cs:savestate]
call [cs:setvideomode],word 8
call [cs:clearscreen]
call [cs:loadbmppalet],word 0
call [cs:showbmp],word 0,word 20,word 150
jc problem4
push cs
pop ds
call [cs:print],offset poper
start:
header exe <,1,0,,,offset imports,,>
realstart:
mov ah,7
mov cx,65535
int 49h
jc problem3
push gs
pop es
mov ah,7
mov cx,65535
int 49h
jc problem3
mov si,offset logo
mov ah,4
xor di,di
int 48h
jc problem
push es
pop ds
push gs
pop es
xor si,si
xor di,di
mov ah,6
int 48h
jc problem2
push es
pop ds
mov ah,28h
int 47h
mov ax,0008h
int 47h
mov ah,2
int 47h
push 0
call cs:[loadbmppalet]
push 150
push 20
push 0
call cs:[showbmp]
jc problem4
push cs
pop ds
push offset poper
call [print]
endofit:
xor ax,ax
int 16h
call [cs:restorestate]
retf
xor ax,ax
int 16h
mov ah,29h
int 47h
retf
problem:
push cs
pop ds
call [cs:print],offset error
jmp endofit
push cs
pop ds
push offset error
call [print]
jmp endofit
problem2:
push cs
pop ds
call [cs:print],offset error2
jmp endofit
push cs
pop ds
push offset error2
call [print]
jmp endofit
problem3:
push cs
pop ds
call [cs:print],offset error3
jmp endofit
push cs
pop ds
push offset error3
call [print]
jmp endofit
problem4:
push cs
pop ds
call [cs:print],offset error4
jmp endofit
push cs
pop ds
push offset error4
call [print]
jmp endofit
poper db '\c0BC\c0CO\c0DS\c0E2\c0E0\c0E0\c0F0 en mode graphique',0
logo db 'COS.RIP',0
logo db 'cos.rip',0
ok1 db 'Chargement de l''image OK',0
ok2 db 'Decompression de l''image OK',0
error3 db '\c04Une erreur est apparue lors de l''allocation de mémoire',0
@ -76,16 +103,12 @@ error2 db '\c04Une erreur est apparue lors de la decompression de l''image',0
error4 db '\c0FUne erreur est apparue lors de l''affichage de l''image',0
importing
use VIDEO,restorestate
use VIDEO,savestate
use VIDEO,setvideomode
use VIDEO,clearscreen
use DISQUE,decompressrle
use DISQUE,projfile
use SYSTEME,mbfind
use SYSTEME,mballoc
use VIDEO.LIB,print
use BMP.LIB,showbmp
use BMP.LIB,loadbmppalet
endi
imports:
db "VIDEO.LIB::print",0
print dd 0
db "BMP.LIB::showbmp",0
showbmp dd 0
db "BMP.LIB::loadbmppalet",0
loadbmppalet dd 0
dw 0
end start

82
programs/memoire.asm Normal file
View File

@ -0,0 +1,82 @@
.model tiny
.486
smart
.code
org 0h
include ..\include\mem.h
include ..\include\divers.h
start:
header exe <,1,0,,,offset imports,,>
realstart:
push offset msg
call [print]
xor cx,cx
listmcb:
mov ah,4
int 49h
jc fino
inc cx
;placement mémoire
mov dx,gs
inc dx
inc dx
push edx
;parent
cmp gs:[MB.Reference],0
je next
mov dx,gs:[MB.Reference]
dec dx
dec dx
push dx
push offset MB.Names
jmp suitemn
next:
push cs
push offset none
suitemn:
;Resident
cmp gs:[MB.IsResident],true
jne notresident
push offset resident
jmp suitelistmcb
notresident:
push offset nonresident
suitelistmcb:
;taille memoire
xor edx,edx
mov dx,gs:[MB.Sizes]
shl edx,4
push 6
push edx
;nom
push gs
push offset MB.Names
push offset line
call [print]
jmp listmcb
fino:
db 0CBh
resident db "oui",0
nonresident db "non",0
line db "%0P\h15%w\h24%0\h30%0P\h46%hW\l",0
msg db "Memory manager V1.5\lNom Taille Res Parent Mem\l",0
none db ".",0
imports:
db "VIDEO.LIB::print",0
print dd 0
dw 0
end start

View File

@ -1,22 +1,15 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
.model tiny
.486p
smart
.code
org 0h
start:
header exe <"CE",1,0,0,,,,offset realstart>
realstart:
mov eax,cr0
or al,1
mov cr0,eax
retf
mov eax,cr0
or al,1
mov cr0,eax
db 0CBh
end start

View File

@ -1,32 +1,27 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
.model tiny
.486
smart
.code
org 0h
include ..\include\mem.h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe <,1,0,,,offset imports,,>
realstart:
call [mouseon]
jc errormouse
call [print],offset message
retf
realstart:
mov ah,2
int 74h
push offset message
call [print]
retf
errormouse:
call [print],offset errormessage
retf
message db 'Activation de la souris',0
message db 'Activation de la souris\l',0
errormessage db 'impossible d''activer la souris\l',0
imports:
db "VIDEO.LIB::print",0
print dd 0
dw 0
importing
use VIDEO.LIB,print
use MOUSE.SYS,mouseon
endi
end start

Binary file not shown.

View File

@ -1,108 +1,164 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
.model tiny
.486
smart
.code
org 0h
include ..\include\mem.h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe <,1,0,,,offset imports,,>
realstart:
call [cs:randomize]
push 0FFFFh
pushd 652201
pushd 1545454545
push 1523
push 2041
push offset zero
push offset fixe
push 5
push 'i'
push 'a'
pushd 5041
pushd 125645
pushd 5041
pushd 125645
pushd 5041
pushd 125645
push offset message
call [print]
xor ax,ax
int 16h
call [clearscreen]
call [xchgpages]
call [clearscreen]
mov cx,200
go1:
call [xchgpages]
call [waitretrace]
call [print],offset textdemo1
call put
call [xchgpages]
call [waitretrace]
dec cx
jnz go1
mov cx,200
go2:
call [xchgpages]
call [waitretrace]
call [print],offset textdemo2
call put
call [xchgpages]
call [waitretrace]
dec cx
jnz go2
mov cx,200
go3:
call [xchgpages]
call [waitretrace]
call [print],offset textdemo3
call put
call [xchgpages]
call [waitretrace]
dec cx
jnz go3
call [clearscreen]
call [xchgpages]
call [clearscreen]
call [print],offset texte2
mov bp,255
xor edx,edx
go4:
call [xchgpages]
call [waitretrace]
inc edx
push edx
push offset texte3
call [print]
call [xchgpages]
call [waitretrace]
dec bp
jnz go4
push offset texte4
call [print]
mov ax,0
int 16h
call [restorestate]
retf
put:
call [cs:random]
mov di,ax
and di,4096-2
mov si,offset fond
call showstring2
ret
mov ah,28h
int 47h
push word ptr 0FFFFh
push dword ptr 652201
push dword ptr 1545454545
push word ptr 1523
push word ptr 2041
push offset zero
push offset fixe
push word ptr 5
push word ptr 'i'
push word ptr 'a'
push dword ptr 5041
push dword ptr 125645
push dword ptr 5041
push dword ptr 125645
push dword ptr 5041
push dword ptr 125645
push offset message
call [print]
mov ax,0
int 16h
mov ah,2
int 47h
mov ah,30
int 47h
mov ah,2
int 47h
mov cx,200
go1:
mov ah,30
int 47h
mov ah,33
int 47
push offset textdemo1
call [print]
call put
mov ah,30
int 47h
mov ah,33
int 47h
dec cx
jnz go1
mov cx,200
go2:
mov ah,30
int 47h
mov ah,33
int 47h
push offset textdemo2
call [print]
call put
mov ah,30
int 47h
mov ah,33
int 47h
dec cx
jnz go2
mov cx,200
go3:
mov ah,30
int 47h
mov ah,33
int 47h
push offset textdemo3
call [print]
call put
mov ah,30
int 47h
mov ah,33
int 47h
dec cx
jnz go3
mov ah,30
int 47h
mov ah,2
int 47h
push offset texte2
call [print]
mov ah,30
int 47h
mov ah,2
int 47h
mov ah,30
int 47h
mov bp,255
xor edx,edx
go4:
mov ah,30
int 47h
mov ah,33
int 47h
inc edx
push edx
push offset texte3
call [print]
mov ah,30
int 47h
mov ah,33
int 47h
dec bp
jnz go4
push offset texte4
call [print]
mov ax,0
int 16h
mov ah,29h
int 47h
retf
put:
call random
mov di,dx
and di,4096-2
mov si,offset fond
call showstring2
ret
Random:
push ax
MOV AX,cs:[RandSeed]
MOV DX,8405h
MUL DX
INC AX
MOV cs:[RandSeed],AX
pop ax
ret
randseed dw 1234h
Randomize:
push ax cx dx
mov ah,0
int 1ah
mov cs:randseed,dx
pop dx cx ax
ret
zero db 'Chaine a zro terminal',0
fixe db 20,'Chaine a taille fixe'
message db "\s\m01\e\c07\h01Dmonstration de la librairie VIDEO.LIB\l\l"
message db "\m01\e\c07\h01Dmonstration de la librairie VIDEO.LIB\l\l"
db "\c01Nombres entiers ou signs (%%u/%%i):\l%u\l%iD\l"
db "\c02Nombre hexadcimaux (%%h):\l%hD\l%hW\l"
db "\c03Nombres Binaires (%%b):\l%bD\l%bB\l"
@ -120,34 +176,28 @@ texte1 db 'Echange rapide de pages Vid
texte2 db '\g04,13Routine d''affichage Ultra Rapide Agissant sur le Matriel'
db '\g04,14Possibilit de raliser des effets de superposition',0
texte3 db '\c04%bD\l',0
texte4 db '\g01,00Sauvegarde et restauration de l''ecran (\\s/\\r)',0
texte4 db '\g01,00Sauvegarde et restauration de l''ecran (%%s/%%r)',0
showstring2:
push es bx cx si di
add di,4000
mov bx,0B800h
mov es,bx
mov bl,[si]
mov ch,3
push es bx cx si di
add di,4000
mov bx,0B800h
mov es,bx
mov bl,[si]
mov ch,3
strinaize4:
inc si
mov cl,[si]
mov [es:di],cx
add di,2
dec bl
jnz strinaize4
pop di si cx bx es
ret
inc si
mov cl,[si]
mov es:[di],cx
add di,2
dec bl
jnz strinaize4
pop di si cx bx es
ret
imports:
db "VIDEO.LIB::print",0
print dd 0
dw 0
importing
use MATH.LIB,randomize
use MATH.LIB,random
use VIDEO.LIB,print
use VIDEO,xchgpages
use VIDEO,setvideomode
use VIDEO,clearscreen
use VIDEO,savestate
use VIDEO,restorestate
use VIDEO,waitretrace
endi
end start

View File

@ -1,55 +0,0 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\fat.h"
include "..\include\divers.h"
include "..\include\3d.h"
org 0h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
realstart:
call [cs:randomize]
call [cs:savestate]
call [cs:setvideomode],10
call [cs:clearscreen]
mov cx,65535
show:
call [cs:random]
and ax,1111b
push ax
call [cs:random]
push ax
call [cs:random]
push ax
call [cs:random]
push ax
call [cs:random]
push ax
call [cs:line]
dec cx
jnz show
call [cs:bioswaitkey]
call [cs:restorestate]
retf
importing
use VIDEO.LIB,print
use VIDEO,savestate
use VIDEO,clearscreen
use VIDEO,setvideomode
use VIDEO,restorestate
use VIDEO,waitretrace
use GRAPHIC,line ;@x1:word,@y1:word,@x2:word,@y2:word,@color:word
use GRAPHIC,polyfill ;@pointer:word,@nbfaces:word,@color:word;
use SYSTEME,bioswaitkey
use MATH.LIB,randomize
use MATH.LIB,random
endi

View File

@ -1,245 +0,0 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\fat.h"
include "..\include\divers.h"
include "..\include\3d.h"
org 0h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
data:
camera vertex3d <320.0,240.0,70.0>
zoom dd 5.0
rot1 dd 0.1
rot2 dd -0.1
vertexnbp dw 15
dd 0.0,0.0,0.0
dd 20.0,0.0,0.0
dd 24.0,0.0,0.0
dd 20.0,-2.0,0.0
dd 20.0,2.0,0.0
dd 0.0,0.0,0.0
dd 0.0,20.0,0.0
dd 0.0,24.0,0.0
dd -2.0,20.0,0.0
dd 2.0,20.0,0.0
dd 0.0,0.0,0.0
dd 0.0,0.0,20.0
dd 0.0,0.0,24.0
dd -2.0,-2.0,20.0
dd 2.0,2.0,20.0
facenbp dw 6
dw 0,1,1
dw 2,4,3
dw 5,6,6
dw 7,9,8
dw 10,11,11
dw 12,14,13
vertexnbp2 dw 15
dd 0.0,0.0,0.0
dd 20.0,0.0,0.0
dd 24.0,0.0,0.0
dd 20.0,-2.0,0.0
dd 20.0,2.0,0.0
dd 0.0,0.0,0.0
dd 0.0,20.0,0.0
dd 0.0,24.0,0.0
dd -2.0,20.0,0.0
dd 2.0,20.0,0.0
dd 0.0,0.0,0.0
dd 0.0,0.0,20.0
dd 0.0,0.0,24.0
dd -2.0,-2.0,20.0
dd 2.0,2.0,20.0
mat1 mat <?>
mat2 mat <?>
mat3 mat <?>
matrixp mat <?>
mode db 0
objectp:
vertexp equ objectp+15
facep equ vertexp+20000
screen equ facep+20000
;typep db ?
;objectp db 15 dup (?)
;vertexp db 1000*4*3+2 dup (?)
;facep db 2000*3+2 dup (?)
;screen db 1000*2*2 dup (?)
realstart:
call [cs:savestate]
call [cs:setvideomode],10
call [cs:clearscreen]
call [cs:mballoc],65535
mov es,ax
mov si,offset data
mov di,si
mov ecx,(offset realstart-offset data)
shr ecx,2
inc ecx
cld
rep movsd
call [cs:projfile],offset filename
jc errorloading
call [cs:mbfind],offset filename
jc errorloading
push es
pop ds
mov es,ax
call [cs:load3ds],es,0,offset objectp,offset vertexp,offset matrixp,offset facep
call [cs:transform],offset vertexnbp,offset matrixp
call [cs:identity],offset mat1
jmp show
rool:
mov ah,1
int 16h
jz rool
xor ax,ax
int 16h
cmp ax,011Bh
je endee
cmp ax,3B00h
jne notmode
inc [mode]
cmp [mode],3
jb notmodify
mov [mode],0
jmp notmodify
notmode:
cmp ax,4800h
jne notup
call [cs:rotationx],offset mat1,[rot2]
jmp show
notup:
cmp ax,5000h
jne notdown
call [cs:rotationx],offset mat1,[rot1]
jmp show
notdown:
cmp ax,4B00h
jne notleft
call [cs:rotationy],offset mat1,[rot1]
jmp show
notleft:
cmp ax,4D00h
jne notright
call [cs:rotationy],offset mat1,[rot2]
jmp show
notright:
cmp ax,4900h
jne notupup
call [cs:rotationz],offset mat1,[rot1]
jmp show
notupup:
cmp ax,5100h
jne notdowndown
call [cs:rotationz],offset mat1,[rot2]
jmp show
notdowndown:
cmp ax,4A2Dh
jne notminus
fld [camera.tz]
fsub [zoom]
fstp [camera.tz]
jmp show
notminus:
cmp ax,4E2Bh
jne notmaxus
fld [camera.tz]
fadd [zoom]
fstp [camera.tz]
jmp show
notmaxus:
call [cs:identity],offset mat1
jmp rool
show:
call [cs:transform],offset vertexp,offset mat1
call [cs:transform],offset vertexnbp,offset mat1
notmodify:
call [cs:clearscreen]
call [cs:print],offset objectp
call [cs:draw3d_line],3,offset facenbp,offset vertexnbp,offset screen,offset camera,3
call [cs:draw3d_line],3,offset facenbp,offset vertexnbp2,offset screen,offset camera,3
cmp [mode],0
jne line
call [cs:draw3d_point],offset vertexp,offset screen,offset camera,4
jmp retrace
line:
cmp [mode],1
jne hidden
call [cs:draw3d_line],3,offset facep,offset vertexp,offset screen,offset camera,4
jmp retrace
hidden:
call [cs:draw3d_hidden],3,offset facep,offset vertexp,offset screen,offset camera,4
retrace:
call [cs:waitretrace]
call [cs:waitretrace]
jmp rool
endee:
call [cs:restorestate]
retf
errorloading:
push cs
pop ds
call [cs:print],offset errorload
call [cs:bioswaitkey]
jmp endee
errorload db '\c02Erreur au chargement du fichier 3D\l<Appuyez sur une touche>\c07',0
filename find <"SPHERE.3DS",0,0,0,1,>
importing
use 3D.LIB,draw3d_point
use 3D.LIB,draw3d_line
use 3D.LIB,draw3d_hidden
use 3D.LIB,draw3d_hidden_fill
use 3D.LIB,load3ds
use 3D.LIB,translate
use 3D.LIB,translatex
use 3D.LIB,translatey
use 3D.LIB,translatez
use 3D.LIB,scale
use 3D.LIB,rescale
use 3D.LIB,copy
use 3D.LIB,fill
use 3D.LIB,identity
use 3D.LIB,rotationx
use 3D.LIB,rotationy
use 3D.LIB,rotationz
use 3D.LIB,rotation
use 3D.LIB,project
use 3D.LIB,transform
use 3D.LIB,multiply
use VIDEO,savestate
use VIDEO,clearscreen
use VIDEO,setvideomode
use VIDEO,restorestate
use VIDEO,waitretrace
use SYSTEME,bioswaitkey
use SYSTEME,mbfind
use SYSTEME,mballoc
use VIDEO.LIB,print
use DISQUE,projfile
endi

View File

@ -1,73 +1,80 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
.model tiny
.386c
.code
org 0h
include ..\include\mem.h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe <,1,0,,,offset imports,,>
realstart:
call [savestate]
call [print],offset msg
mov bp,1000h
xor di,di
xor cx,cx
xor edx,edx
verifall:
mov ah,1
int 16h
jz nokey
cmp al,' '
je enend
mov ah,28h
int 47h
push offset msg
call [print]
mov bp,1000h
xor di,di
xor cx,cx
xor edx,edx
VerifAll:
mov ah,1
int 16h
jz nokey
cmp al,' '
je enend
nokey:
mov dx,di
push edx
mov dx,cx
inc dx
push edx
mov ax,cx
inc ax
mov si,100
mul si
mov si,2880
div si
mov dx,ax
push edx
call [print],offset msg2
call gauge
call [verifysector],cx
jc errors
je noprob
inc di
mov dx,di
push edx
mov dx,cx
inc dx
push edx
mov ax,cx
inc ax
mov si,100
mul si
mov si,2880
div si
mov dx,ax
push edx
push offset msg2
call [print]
call gauge
mov ah,2
int 48h
jc errors
je noprob
inc di
noprob:
inc cx
cmp cx,2880
jnz verifall
enend:
cmp di,0
je noatall
call [print],offset error2
jmp someof
inc cx
cmp cx,2880
jnz verifall
enend:
cmp di,0
je noatall
push offset error2
call [print]
jmp someof
noatall:
call [print],offset noerror
push offset noerror
call [print]
someof:
mov ah,0
int 16h
call [restorestate]
retf
mov ah,0
int 16h
mov ah,29h
int 47H
retf
errors:
call [print],offset error
mov ah,0
int 16h
call [restorestate]
retf
push offset error
call [print]
mov ah,0
int 16h
mov ah,29h
int 47H
retf
error db '\g10,10Erreur avec le lecteur de disquette !',0
error2 db '\g10,10Le disque est defectueux, appuyez sur une touche pour quitter',0
@ -76,31 +83,31 @@ msg db '\m02\e\c07\g29,00- Test de surface du disque -\g02,49<Pressez espace pou
msg2 db '\g10,20%u %%\g10,16%u cluster testes. \h34%u cluster defectueux. ',0
gauge:
push ax dx
mov ax,cx
mul [sizeof]
div [max]
xor edx,edx
mov dx,[sizeof]
sub dx,ax
push dx
push 'Û'
mov dx,ax
push dx
push 'Û'
push offset gauges
call [print]
pop dx ax
retn
push ax dx
mov ax,cx
mul sizeof
div max
xor edx,edx
mov dx,sizeof
sub dx,ax
push dx
push 'Û'
mov dx,ax
push dx
push 'Û'
push offset gauges
call [print]
pop dx ax
retn
max dw 2879
sizeof dw 50
gauges db '\g10,18\c05%cM\c07%cM',0
importing
use VIDEO.LIB,print
use VIDEO,savestate
use VIDEO,restorestate
use DISQUE,verifysector
endi
imports:
db "VIDEO.LIB::print",0
print dd 0
dw 0
End Start

View File

@ -1,98 +1,121 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
include "..\include\graphic.h"
.model tiny
.486
smart
.code
org 0h
include ..\include\mem.h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe <,1,0,,,offset imports,,>
realstart:
mov ax,0305h
mov bx,0008h
int 16h
call [savestate]
call [setvideomode],2
xor ebp,ebp
xor ax,ax
mov fs,ax
call [disablescroll]
adres:
call [saveparamto],offset infos
call [readsector],[sect],offset buffer
jnc adres2
errtr:
call [setxy],0,[word ptr lastline]
call [print],offset errordisk
xor ax,ax
mov ax,0305h
mov bx,0008h
int 16h
adres2:
call [saveparamto],offset infos
mov al,[infos.lines]
dec al
mov [lastline],al
mov al,[infos.columns]
sub al,16
mov bl,al
shr al,2
mov [sizex],al
and bl,11b
mov [sizex2],bl
mov al,[infos.mode]
cmp al,[oldmode]
je noinit
call [clearscreen]
mov [oldmode],al
noinit:
call [setxy],0,0
mov edi,ebp
mov bh,[lastline]
mov ah,28h
int 47H
mov ax,0002
int 47H
mov ah,2
int 47h
mov ah,43
int 47h
xor bp,bp
push cs
push cs
pop es
pop ds
Adres:
mov di,offset infos
mov ah,34
int 47h
dec infos
push cs
pop es
mov cx,sect
mov di,offset buffer
mov ah,0h
int 48h
jnc noerror
errtr:
mov ah,25
mov bl,infos
xor bh,bh
int 47h
push offset errordisk
call [print]
mov ax,0
int 16h
noerror:
adres2:
mov di,offset infos
mov ah,34
int 47h
dec byte ptr [di]
mov al,[di+1]
sub al,16
mov bl,al
shr al,2
mov [di+1],al
and bl,11b
mov [di+2],bl
mov al,[di+7]
cmp al,oldmode
je noinit
mov ah,2
int 47h
mov oldmode,al
noinit:
mov bx,0
mov ah,25
int 47h
mov bh,infos
mov di,bp
lines:
xor edx,edx
mov dx,di
push edx
mov edx,edi
mov dx,[sect]
push edx
push offset spaces
call [print]
mov dx,di
mov al,[sizex]
mov esi,edi
xor edx,edx
mov dx,di
push edx
mov dx,sect
push edx
push offset spaces
call [print]
mov al,infos+1
mov si,di
doaline:
push [dword ptr di+offset buffer]
push 8
call [showhex]
call [showchar],' '
inc edi
dec al
jnz doaline
mov edi,esi
push offset spaces2
call [print]
mov al,[sizex]
push dword ptr [di+offset buffer]
push 8
call [showhex]
push ' '
call [showchar]
inc di
dec al
jnz doaline
mov di,si
push offset spaces2
call [print]
mov al,infos+1
doaline2:
push [word ptr di+offset buffer]
call [showchar]
inc edi
dec al
jnz doaline2
dec bh
je outes
cmp [sizex2],0
je lines
call [addline]
jmp lines
outes:
call [setxy],0,[word ptr lastline]
call [print],offset menu
push word ptr [di+offset buffer]
call [showchar]
inc di
dec al
jnz doaline2
dec bh
je outes
cmp byte ptr infos+2,0
je lines
mov ah,6
int 47h
jmp lines
outes:
mov bh,0
mov bl,infos
mov ah,25
int 47h
push offset menu
call [print]
waitkey:
mov ax,0
int 16h
@ -112,16 +135,16 @@ call [print],offset menu
suit2:
cmp ax,3D00h
jne suit3
cmp [sect],2880
cmp sect,2880
ja waitkey
inc [sect]
inc sect
jmp adres
suit3:
cmp ax,3E00h
jne suit4
cmp [sect],0
cmp sect,0
je waitkey
dec [sect]
dec sect
jmp adres
suit4:
cmp ax,3F00h
@ -130,151 +153,165 @@ call [print],offset menu
suit5:
cmp ax,4000h
jne suit6
call [writesector],[sect],offset buffer
mov cx,sect
mov di,offset buffer
mov ah,1
int 48h
jnc waitkey
jmp errtr
suit6:
cmp ax,4100h
jne suit7
mov [dword ptr pope],'TIDE'
call [setxy],0,[word ptr lastline]
call [print],offset menu
mov ax,0B800h
mov es,ax
mov [xxyy2],3
mov [xxyy],3
call calc1
call calc2
cmp ax,4100h
jne suit7
mov dword ptr [pope],'TIDE'
mov bh,0
mov bl,infos
mov ah,25
int 47h
push offset menu
call [print]
mov ax,0B800h
mov es,ax
mov xxyy2,3
mov xxyy,3
call calc1
call calc2
waitst:
mov ax,0
int 16h
cmp ah,41h
jne tre
mov [dword ptr pope],' EUV'
push cs
pop es
call [writesector],[sect],offset buffer
jnc waitkey
mov ax,0
int 16h
cmp ah,41h
jne tre
mov dword ptr [pope],'WEIV'
push cs
pop ds
mov cx,sect
mov si,offset buffer
mov ah,1
int 48h
jnc adres
jmp errtr
tre:
cmp al,0
jne write
cmp ah,48h
jne tre1
cmp [yy],0
je waitst
dec [yy]
jmp cursor
cmp al,0
jne write
cmp ah,48h
jne tre1
cmp yy,0
je waitst
dec yy
jmp cursor
tre1:
cmp ah,50h
jne tre2
mov al,[lastline]
dec al
xor ah,ah
cmp [yy],ax
je waitst
inc [yy]
jmp cursor
cmp ah,50h
jne tre2
mov al,infos
dec al
xor ah,ah
cmp yy,ax
je waitst
inc yy
jmp cursor
tre2:
cmp ah,4Dh
jne tre4
cmp [xx],15
je waitst
inc [xx]
jmp cursor
tre4:
cmp ah,4Bh
jne waitst
cmp [xx],0
je waitst
dec [xx]
jmp cursor
cmp ah,4Dh
jne tre4
cmp xx,15
je waitst
inc xx
jmp cursor
tre4:
cmp ah,4Bh
jne waitst
cmp xx,0
je waitst
dec xx
jmp cursor
write:
call asciihex2dec
cmp cl,15
ja waitst
call calc1
call calc2
mov edi,[es:bx-1]
mov dx,[es:si-1]
mov [byte ptr es:bx],0112
mov [es:bx-1],al
call AsciiHex2dec
cmp cl,15
ja waitst
call calc1
call calc2
mov byte ptr es:[bx],0112
mov es:[bx-1],al
writs:
mov ax,0
int 16h
int 16H
mov ch,cl
call asciihex2dec
call AsciiHex2dec
cmp cl,15
ja writs
shl ch,4
add ch,cl
mov [es:bx+1],al
mov [es:si-1],ch
mov es:[bx+1],al
mov es:[si-1],ch
mov ax,bx
call calc3
mov [bx],ch
inc [xx]
cmp [xx],16
inc xx
cmp xx,16
jne pasde
inc [yy]
mov [xx],0h
inc yy
mov xx,0h
pasde:
call calc1
call calc2
jmp waitst
cursor:
call calc1
call calc2
jmp waitst
suit7:
cmp ax,4200h
jne adres
call [restorestate]
retf
call calc1
call calc2
jmp waitst
suit7:
cmp ax,4200h
jne adres2
mov ah,29h
int 47H
retf
calc1:
push ax dx si
mov ax,[xx]
mov dx,[xx]
shl ax,2
shl dx,1
add ax,dx
add ax,27
mov bx,[yy]
mov dx,[yy]
shl bx,5
shl dx,7
add bx,dx
add bx,ax
mov [byte ptr es:bx],112
mov [byte ptr es:bx+2],112
mov si,[xxyy]
mov [byte ptr es:si],07
mov [byte ptr es:si+2],07
mov [xxyy],bx
pop si dx ax
ret
push ax dx si
mov ax,xx
mov dx,xx
shl ax,2
shl dx,1
add ax,dx
add ax,27
mov bx,YY
mov dx,yy
shl bx,5
shl dx,7
add bx,dx
add bx,ax
mov byte ptr es:[bx],112
mov byte ptr es:[bx+2],112
mov si,xxyy
mov byte ptr es:[si],07
mov byte ptr es:[si+2],07
mov xxyy,bx
pop si dx ax
ret
calc2:
push ax bx dx
mov si,[yy]
mov dx,[yy]
shl si,5
shl dx,7
add si,dx
mov dx,[xx]
shl dx,1
add si,dx
add si,129
mov [byte ptr es:si],112
mov bx,[xxyy2]
mov [byte ptr es:bx],07
mov [xxyy2],si
pop dx bx ax
ret
push ax bx dx
mov si,YY
mov dx,yy
shl si,5
shl dx,7
add si,dx
add si,2
mov dx,xx
shl dx,1
add si,dx
add si,127
mov byte ptr es:[si],112
mov bx,xxyy2
mov byte ptr es:[bx],07
mov xxyy2,si
pop dx bx ax
ret
calc3:
push dx
xor bx,bx
mov bx,[xx]
mov dx,[yy]
mov bx,xx
mov dx,yy
shl dx,4
add bx,dx
add bx,bp
@ -282,39 +319,35 @@ calc3:
pop dx
ret
asciihex2dec:
cmp al,'a'
jb nomin
cmp al,'f'
ja nomin
sub al,'a'-'A'
jmp ismaj
nomin:
cmp al,'A'
jb nomaj
cmp al,'F'
ja nomaj
ismaj:
mov cl,al
sub cl,'A'-10
jmp endt
nomaj:
mov cl,al
sub cl,'0'
endt:
ret
asciihex2dec:
cmp al,'a'
jb nomin
cmp al,'f'
ja nomin
sub al,'a'-'A'
jmp ismaj
nomin:
cmp al,'A'
jb nomaj
cmp al,'F'
ja nomaj
ismaj:
mov cl,al
sub cl,'A'-10
jmp endt
nomaj:
mov cl,al
sub cl,'0'
endt:
ret
dep db ':',0
sect dw 0
xx dw 0
yy dw 0
xxyy dw 3
xxyy2 dw 3
lastline db 0
sizex db 0
sizex2 db 0
buffer db 2048 dup (0)
dep db ':',0
errordisk db '\c74Une erreur est apparue sur le lecteur, appuyez sur une touche ',0
menu db '\c70Haut&Bas [F1/2] Secteur [F3/4] Charger/Sauver [F5/6] Mode [F7] Quit. [F8] '
pope db 'VUE ',0
@ -322,25 +355,21 @@ spaces db '\c02%hW:%hW \c04| \c07',0
spaces2 db '\c04 | \c07',0
showbuffer db 35 dup (0FFh)
oldmode db 0
sect dw 0
infos vgainf <>
oldmode db 0
infos db 40 dup (0)
buffer db 2048 dup (0)
importing
use DISQUE,readsector
use DISQUE,writesector
use VIDEO,setvideomode
use VIDEO,savestate
use VIDEO,restorestate
use VIDEO,setxy
use VIDEO,addline
use VIDEO,saveparamto
use VIDEO,disablescroll
use VIDEO,clearscreen
use VIDEO.LIB,print
use VIDEO.LIB,showhex
use VIDEO.LIB,showchar
endi
imports:
db "VIDEO.LIB::print",0
print dd 0
db "VIDEO.LIB::showhex",0
showhex dd 0
db "VIDEO.LIB::showchar",0
showchar dd 0
dw 0
end start