Compare commits
No commits in common. "feature/build_on_linux" and "master" have entirely different histories.
feature/bu
...
master
Binary file not shown.
Before Width: | Height: | Size: 47 KiB |
Binary file not shown.
Before Width: | Height: | Size: 40 KiB |
29
MAKEFILE
Normal file
29
MAKEFILE
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
all:
|
||||||
|
cd lib
|
||||||
|
make
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd noyau
|
||||||
|
make
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd install
|
||||||
|
make
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
copy:
|
||||||
|
make all
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
cd lib
|
||||||
|
make clean
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd noyau
|
||||||
|
make clean
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd install
|
||||||
|
make clean
|
||||||
|
cd ..
|
@ -2,14 +2,12 @@
|
|||||||
|
|
||||||
## Copies d'écran de COS2000
|
## Copies d'écran de COS2000
|
||||||

|

|
||||||

|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
228
boot/boot12.asm
228
boot/boot12.asm
@ -1,228 +0,0 @@
|
|||||||
use16
|
|
||||||
align 1
|
|
||||||
|
|
||||||
include "..\include\mem.h"
|
|
||||||
include "..\include\fat.h"
|
|
||||||
include "..\include\divers.h"
|
|
||||||
|
|
||||||
org 7C00h
|
|
||||||
|
|
||||||
jmp Boot
|
|
||||||
|
|
||||||
bootsec bootinfo "COS2000A","COS2000 ","FAT12 "
|
|
||||||
|
|
||||||
Boot_Message db "Cos2000",0
|
|
||||||
Entre_Message db "Search",0
|
|
||||||
Loading_Message db "Load",0
|
|
||||||
System_File db "As",0,"y",0,"s",0,"t",0,"e",0,0x0F,0,0x38,"m",0,"e",0,".",0,"s",0,"y",0,"s",0,0,0,0,0,0xFF,0xFF
|
|
||||||
Is_Ok db " [ OK ]",0x0A,0x0D,0
|
|
||||||
Is_Failed db " [ERROR]",0x0A,0x0D,0
|
|
||||||
The_Dot db '.',0
|
|
||||||
|
|
||||||
Boot_Error:
|
|
||||||
mov si,Is_Failed
|
|
||||||
call ShowString
|
|
||||||
xor ax,ax
|
|
||||||
int 0x16
|
|
||||||
int 0x19
|
|
||||||
|
|
||||||
Boot_Ok:
|
|
||||||
mov si,Is_Ok
|
|
||||||
call ShowString
|
|
||||||
ret
|
|
||||||
|
|
||||||
Boot:
|
|
||||||
push cs
|
|
||||||
push cs
|
|
||||||
pop es
|
|
||||||
pop ds
|
|
||||||
mov [bootsec.bootdrive],dl
|
|
||||||
cli
|
|
||||||
mov ax,0x9000
|
|
||||||
mov ss,ax
|
|
||||||
mov sp,0xFFFF
|
|
||||||
sti
|
|
||||||
mov si,Boot_Message
|
|
||||||
call ShowString
|
|
||||||
xor ax,ax
|
|
||||||
int 0x13
|
|
||||||
jc Boot_Error
|
|
||||||
mov cx,[bootsec.reservedsectors]
|
|
||||||
add cx,[bootsec.hiddensectorsh]
|
|
||||||
adc cx,[bootsec.hiddensectorsl]
|
|
||||||
mov bx,[bootsec.sectorsperfat]
|
|
||||||
mov di,bufferfat
|
|
||||||
push bx
|
|
||||||
push cx
|
|
||||||
readfat:
|
|
||||||
call ReadSector
|
|
||||||
jc Boot_Error
|
|
||||||
inc cx
|
|
||||||
add di,[bootsec.sectorsize]
|
|
||||||
dec bx
|
|
||||||
jnz readfat
|
|
||||||
pop cx
|
|
||||||
pop bx
|
|
||||||
xor ax,ax
|
|
||||||
mov al,[bootsec.fatsperdrive]
|
|
||||||
mul bx
|
|
||||||
add cx,ax
|
|
||||||
mov ax,32
|
|
||||||
mul word [bootsec.directorysize]
|
|
||||||
div word [bootsec.sectorsize]
|
|
||||||
add ax,cx
|
|
||||||
sub ax,2
|
|
||||||
mov word [bootsec.reservedfornt],ax
|
|
||||||
xor dx,dx
|
|
||||||
call Boot_Ok
|
|
||||||
mov si,Loading_Message
|
|
||||||
call ShowString
|
|
||||||
Find_System:
|
|
||||||
mov di,buffer
|
|
||||||
call ReadSector
|
|
||||||
jc Near Boot_Error
|
|
||||||
xor bx,bx
|
|
||||||
Next_Root_Entrie:
|
|
||||||
cmp byte [di],0
|
|
||||||
je near Boot_Error
|
|
||||||
push di
|
|
||||||
push cx
|
|
||||||
mov si,System_File
|
|
||||||
mov cx,32
|
|
||||||
rep cmpsb
|
|
||||||
pop cx
|
|
||||||
pop di
|
|
||||||
je System_Found
|
|
||||||
add di,32
|
|
||||||
add bx,32
|
|
||||||
inc dx
|
|
||||||
cmp dx,[bootsec.directorysize]
|
|
||||||
ja near Boot_Error
|
|
||||||
cmp bx,[bootsec.sectorsize]
|
|
||||||
jb Next_Root_Entrie
|
|
||||||
inc cx
|
|
||||||
jmp Find_System
|
|
||||||
System_Found:
|
|
||||||
call Boot_Ok
|
|
||||||
mov si,Entre_Message
|
|
||||||
call ShowString
|
|
||||||
mov cx,[di+26+32]
|
|
||||||
mov ax,0x8000
|
|
||||||
mov es,ax
|
|
||||||
push es
|
|
||||||
mov di,0x0
|
|
||||||
push 0x10
|
|
||||||
mov si,The_Dot
|
|
||||||
Resume_Loading:
|
|
||||||
cmp cx,0x0FF0
|
|
||||||
jae Finish_Loading
|
|
||||||
push cx
|
|
||||||
add cx,word [bootsec.reservedfornt]
|
|
||||||
call ReadSector
|
|
||||||
pop cx
|
|
||||||
jc near Boot_Error
|
|
||||||
call ShowString
|
|
||||||
add di,[bootsec.sectorsize]
|
|
||||||
call NextFatGroup
|
|
||||||
jc near Boot_Error
|
|
||||||
jmp Resume_Loading
|
|
||||||
Finish_Loading:
|
|
||||||
call Boot_Ok
|
|
||||||
retf
|
|
||||||
|
|
||||||
;====================READSECTOR=======================
|
|
||||||
;Lit le secteur logique LBA CX et le met en es:di
|
|
||||||
;-> CX (limité à 65536 secteurs, soit 32 Mo avec secteur 512 octets)
|
|
||||||
;<- Flag Carry si erreur
|
|
||||||
;=====================================================
|
|
||||||
ReadSector:
|
|
||||||
pusha
|
|
||||||
mov ax,cx
|
|
||||||
xor dx,dx
|
|
||||||
div word [bootsec.sectorspertrack]
|
|
||||||
inc dl
|
|
||||||
mov bl,dl
|
|
||||||
xor dx,dx
|
|
||||||
div word [bootsec.headsperdrive]
|
|
||||||
mov dh, [bootsec.bootdrive]
|
|
||||||
xchg dl,dh
|
|
||||||
mov cx,ax
|
|
||||||
xchg cl,ch
|
|
||||||
shl cl,6
|
|
||||||
or cl, bl
|
|
||||||
mov bx,di
|
|
||||||
mov si, 4
|
|
||||||
mov al, 1
|
|
||||||
Read_Again:
|
|
||||||
mov ah, 2
|
|
||||||
int 0x13
|
|
||||||
jnc Read_Done
|
|
||||||
dec si
|
|
||||||
jnz Read_Again
|
|
||||||
Read_Done:
|
|
||||||
popa
|
|
||||||
ret
|
|
||||||
|
|
||||||
;===================NEXTFATGROUP======================
|
|
||||||
;Renvoie en CX le groupe qui succède dans la FAT le groupe CX
|
|
||||||
;-> CX
|
|
||||||
;<-
|
|
||||||
;=====================================================
|
|
||||||
NextFatGroup:
|
|
||||||
push bx
|
|
||||||
push dx
|
|
||||||
push di
|
|
||||||
mov ax,cx
|
|
||||||
mov bx,ax
|
|
||||||
and bx,0000000000000001b
|
|
||||||
shr ax,1
|
|
||||||
mov cx,3
|
|
||||||
mul cx
|
|
||||||
mov di,bufferfat
|
|
||||||
add di,ax
|
|
||||||
cmp bx,0
|
|
||||||
jnz Even_Group
|
|
||||||
Odd_Group:
|
|
||||||
mov dx,[di]
|
|
||||||
and dx,0x0FFF
|
|
||||||
mov cx,dx
|
|
||||||
jmp Next_Group_Found
|
|
||||||
Even_Group:
|
|
||||||
mov dx,[di+1]
|
|
||||||
and dx,0xFFF0
|
|
||||||
shr dx,4
|
|
||||||
mov cx,dx
|
|
||||||
Next_Group_Found:
|
|
||||||
pop di
|
|
||||||
pop dx
|
|
||||||
pop bx
|
|
||||||
ret
|
|
||||||
|
|
||||||
;======================SHOWSTR========================
|
|
||||||
;Affiche la chaine de caractère pointé par ds:si à l'écran
|
|
||||||
;-> DS, SI
|
|
||||||
;<- Flag Carry si erreur
|
|
||||||
;=====================================================
|
|
||||||
ShowString:
|
|
||||||
pusha
|
|
||||||
Next_Char:
|
|
||||||
lodsb
|
|
||||||
or al,al
|
|
||||||
jz End_Show
|
|
||||||
mov ah,0x0E
|
|
||||||
mov bx,0x07
|
|
||||||
int 0x10
|
|
||||||
jmp Next_Char
|
|
||||||
End_Show:
|
|
||||||
popa
|
|
||||||
ret
|
|
||||||
|
|
||||||
rb 7C00h+512-2-$
|
|
||||||
db 055h,0AAh
|
|
||||||
|
|
||||||
endof:
|
|
||||||
|
|
||||||
buffer:
|
|
||||||
rb 7C00h+512+2048-$
|
|
||||||
bufferfat:
|
|
||||||
rb 7C00h+512+4096-$
|
|
@ -1,11 +0,0 @@
|
|||||||
ASM=fasm
|
|
||||||
CLEAN=rm -rf
|
|
||||||
|
|
||||||
all: boot12.bin
|
|
||||||
sync
|
|
||||||
|
|
||||||
boot12.bin: boot12.asm
|
|
||||||
$(ASM) $<
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(CLEAN) *.bin
|
|
17
commande/MAKEFILE
Normal file
17
commande/MAKEFILE
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
lnk_boot = tlink /x
|
||||||
|
asm= tasm /t/m5/zi
|
||||||
|
lnk= tlink /x/t
|
||||||
|
|
||||||
|
all: commande.exe
|
||||||
|
|
||||||
|
commande.exe: commande.asm str0.asm
|
||||||
|
$(asm) commande
|
||||||
|
$(lnk) commande
|
||||||
|
ren commande.com commande.exe
|
||||||
|
|
||||||
|
clean:
|
||||||
|
del *.obj
|
||||||
|
del *.exe
|
||||||
|
del *.com
|
||||||
|
del *.sys
|
||||||
|
del *.err
|
542
commande/commande.asm
Normal file
542
commande/commande.asm
Normal file
@ -0,0 +1,542 @@
|
|||||||
|
.model tiny
|
||||||
|
.486
|
||||||
|
smart
|
||||||
|
.code
|
||||||
|
|
||||||
|
org 0h
|
||||||
|
|
||||||
|
include ..\include\fat.h
|
||||||
|
include ..\include\mem.h
|
||||||
|
include ..\include\divers.h
|
||||||
|
|
||||||
|
start:
|
||||||
|
header exe <,1,0,,,offset imports,,>
|
||||||
|
|
||||||
|
realstart:
|
||||||
|
push offset msginit
|
||||||
|
call [print]
|
||||||
|
xor bp,bp
|
||||||
|
mov dl,' '
|
||||||
|
call setdelimiter0
|
||||||
|
replay:
|
||||||
|
mov ah,6
|
||||||
|
int 47h
|
||||||
|
noret:
|
||||||
|
mov ah,6
|
||||||
|
int 47h
|
||||||
|
mov ah,16
|
||||||
|
mov di,offset dir
|
||||||
|
int 48h
|
||||||
|
push offset prompt
|
||||||
|
call [print]
|
||||||
|
mov di,offset buffer
|
||||||
|
waitchar:
|
||||||
|
mov ax,0
|
||||||
|
int 16h
|
||||||
|
call convertfr
|
||||||
|
cmp ah,59
|
||||||
|
jne norr
|
||||||
|
cmp bp,0
|
||||||
|
je waitchar
|
||||||
|
push word ptr cs: [bp-8]
|
||||||
|
call [print]
|
||||||
|
push cs
|
||||||
|
pop es
|
||||||
|
call copy0
|
||||||
|
call getlength0
|
||||||
|
add di,cx
|
||||||
|
jmp waitchar
|
||||||
|
norr:
|
||||||
|
cmp al,0dh ;entrée
|
||||||
|
je entere
|
||||||
|
cmp al,08h ;backspace
|
||||||
|
je backspace
|
||||||
|
cmp al,27 ;echap
|
||||||
|
je escape
|
||||||
|
cmp al,' '
|
||||||
|
jb waitchar
|
||||||
|
cmp di,offset buffer+256
|
||||||
|
je waitchar
|
||||||
|
mov [di],al
|
||||||
|
inc di
|
||||||
|
push ax
|
||||||
|
call [showchar]
|
||||||
|
jmp waitchar
|
||||||
|
escape:
|
||||||
|
cmp di,offset buffer
|
||||||
|
je waitchar
|
||||||
|
mov ah,24
|
||||||
|
int 47h
|
||||||
|
mov dx,offset buffer
|
||||||
|
mov cx,di
|
||||||
|
sub cx,dx
|
||||||
|
js waitchar
|
||||||
|
je waitchar
|
||||||
|
sub bh,cl
|
||||||
|
mov ah,25
|
||||||
|
int 47h
|
||||||
|
mov di,offset buffer
|
||||||
|
mov byte ptr [di],0
|
||||||
|
backspace:
|
||||||
|
cmp di,offset buffer
|
||||||
|
je waitchar
|
||||||
|
mov ah,24
|
||||||
|
int 47h
|
||||||
|
dec bh
|
||||||
|
mov ah,25
|
||||||
|
int 47h
|
||||||
|
push ' '
|
||||||
|
call [showchar]
|
||||||
|
mov ah,25
|
||||||
|
int 47h
|
||||||
|
dec di
|
||||||
|
mov byte ptr [di],0
|
||||||
|
jmp waitchar
|
||||||
|
|
||||||
|
entere:
|
||||||
|
mov byte ptr [di],0
|
||||||
|
mov si,offset buffer
|
||||||
|
cmp si,di
|
||||||
|
je noret
|
||||||
|
mov ah,6
|
||||||
|
int 47h
|
||||||
|
push cs
|
||||||
|
pop es
|
||||||
|
mov di,offset buffer2
|
||||||
|
xor cx,cx
|
||||||
|
call getitem0
|
||||||
|
mov si,di
|
||||||
|
call uppercase0
|
||||||
|
mov bx,offset commands
|
||||||
|
xor bp,bp
|
||||||
|
tre:
|
||||||
|
mov di,[bx]
|
||||||
|
add bx,8
|
||||||
|
cmp di,0
|
||||||
|
je error
|
||||||
|
push cs
|
||||||
|
pop es
|
||||||
|
call evalue0
|
||||||
|
cmp dx,bp
|
||||||
|
jb noadd
|
||||||
|
mov bp,dx
|
||||||
|
mov ax,bx
|
||||||
|
noadd:
|
||||||
|
call cmpstr0
|
||||||
|
jne tre
|
||||||
|
mov si,offset buffer
|
||||||
|
mov di,offset buffer2
|
||||||
|
call copy0
|
||||||
|
mov si,di
|
||||||
|
call uppercase0
|
||||||
|
xor cx,cx
|
||||||
|
inc cx
|
||||||
|
call getpointeritem0
|
||||||
|
cmp byte ptr [di-1],0
|
||||||
|
jne nopod
|
||||||
|
mov byte ptr [di],0
|
||||||
|
nopod:
|
||||||
|
mov si,di
|
||||||
|
mov di,[bx-4]
|
||||||
|
call checksyntax0
|
||||||
|
jc errorprec
|
||||||
|
mov bx,[bx-6]
|
||||||
|
call bx
|
||||||
|
jmp replay
|
||||||
|
error:
|
||||||
|
mov bp,ax
|
||||||
|
push cs
|
||||||
|
pop es
|
||||||
|
mov dl,'.'
|
||||||
|
call searchchar0
|
||||||
|
je noaddext
|
||||||
|
mov di,offset buffer
|
||||||
|
mov si,offset extcom
|
||||||
|
call concat0
|
||||||
|
noaddext:
|
||||||
|
mov si,offset buffer
|
||||||
|
mov ah,18
|
||||||
|
int 48h
|
||||||
|
jc reallyerror
|
||||||
|
xor bp,bp
|
||||||
|
jmp replay
|
||||||
|
reallyerror:
|
||||||
|
push offset error_syntax
|
||||||
|
call [print]
|
||||||
|
push word ptr cs: [bp-8]
|
||||||
|
call [print]
|
||||||
|
jmp replay
|
||||||
|
errorprec:
|
||||||
|
push offset derror
|
||||||
|
call [print]
|
||||||
|
jmp replay
|
||||||
|
|
||||||
|
code_exit:
|
||||||
|
pop ax
|
||||||
|
retf
|
||||||
|
|
||||||
|
code_version:
|
||||||
|
push offset version_text
|
||||||
|
call [print]
|
||||||
|
ret
|
||||||
|
|
||||||
|
version_text db 'Cos 2000 version 1.4Fr par \c04MrNop',0
|
||||||
|
|
||||||
|
code_cls:
|
||||||
|
mov ah,2
|
||||||
|
int 47h
|
||||||
|
ret
|
||||||
|
|
||||||
|
code_reboot:
|
||||||
|
push 0ffffh
|
||||||
|
push 00000h
|
||||||
|
retf
|
||||||
|
|
||||||
|
code_command:
|
||||||
|
push offset def
|
||||||
|
call [print]
|
||||||
|
mov bx,offset commands
|
||||||
|
showalls:
|
||||||
|
add bx,8
|
||||||
|
cmp word ptr [bx],0
|
||||||
|
je endoff
|
||||||
|
push word ptr [bx+4]
|
||||||
|
push word ptr [bx+6]
|
||||||
|
push word ptr [bx]
|
||||||
|
push offset commandes
|
||||||
|
call [print]
|
||||||
|
jmp showalls
|
||||||
|
endoff:
|
||||||
|
ret
|
||||||
|
|
||||||
|
def db 'Liste des commandes internes\l\l',0
|
||||||
|
commandes db '%0 \h10:\h12%0 \h70%0\l',0
|
||||||
|
|
||||||
|
code_mode:
|
||||||
|
mov cx,0
|
||||||
|
call gettypeditem0
|
||||||
|
mov ah,0
|
||||||
|
mov al,dl
|
||||||
|
and al,1111b
|
||||||
|
int 47h
|
||||||
|
mov ah,2
|
||||||
|
int 47h
|
||||||
|
ret
|
||||||
|
|
||||||
|
code_dir:
|
||||||
|
mov ah,12
|
||||||
|
int 48h
|
||||||
|
push edx
|
||||||
|
mov ah,11
|
||||||
|
mov di,offset nomdisque
|
||||||
|
int 48h
|
||||||
|
push di
|
||||||
|
push offset present
|
||||||
|
call [print]
|
||||||
|
xor bp,bp
|
||||||
|
mov di,offset bufferentry
|
||||||
|
mov ah,7
|
||||||
|
int 48h
|
||||||
|
jc nofiles
|
||||||
|
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:
|
||||||
|
push ebp
|
||||||
|
push offset filess
|
||||||
|
call [print]
|
||||||
|
ret
|
||||||
|
|
||||||
|
nomdisque db 13 dup (0)
|
||||||
|
bufferentry db 512 dup (0)
|
||||||
|
present db '\c02Le volume insere est nomme %0, Numero de serie : %hD\l\l',0
|
||||||
|
|
||||||
|
line db '\c07%n %d %t %d %t %z %a\l',0
|
||||||
|
filess db '\l\l\c02%u Fichier(s) au total\l',0
|
||||||
|
|
||||||
|
code_cd:
|
||||||
|
mov cx,0
|
||||||
|
call gettypeditem0
|
||||||
|
push di
|
||||||
|
push offset changing
|
||||||
|
call [print]
|
||||||
|
mov si,di
|
||||||
|
mov ah,13
|
||||||
|
int 48h
|
||||||
|
jnc okchange
|
||||||
|
push offset errorchanging
|
||||||
|
call [print]
|
||||||
|
okchange:
|
||||||
|
ret
|
||||||
|
|
||||||
|
changing db 'Changement de repertoire vers %0\l',0
|
||||||
|
errorchanging db '\c04Impossible d''atteindre ce dossier',0
|
||||||
|
|
||||||
|
code_kill:
|
||||||
|
mov cx,0
|
||||||
|
call gettypeditem0
|
||||||
|
push di
|
||||||
|
push offset killing
|
||||||
|
call [print]
|
||||||
|
mov si,di
|
||||||
|
mov ah,5
|
||||||
|
int 49h
|
||||||
|
jc nochanged
|
||||||
|
mov ah,1
|
||||||
|
int 49h
|
||||||
|
jnc okchanged
|
||||||
|
nochanged:
|
||||||
|
push offset errorkilling
|
||||||
|
call [print]
|
||||||
|
okchanged:
|
||||||
|
ret
|
||||||
|
|
||||||
|
killing db 'Fermeture du processus %0\l',0
|
||||||
|
errorkilling db '\c04Impossible de fermer ce processus',0
|
||||||
|
|
||||||
|
code_refresh:
|
||||||
|
mov ah,3
|
||||||
|
int 48h
|
||||||
|
jnc okrefresh
|
||||||
|
push offset errorrefreshing
|
||||||
|
call [print]
|
||||||
|
ret
|
||||||
|
okrefresh:
|
||||||
|
mov ah,12
|
||||||
|
int 48h
|
||||||
|
push edx
|
||||||
|
mov ah,11
|
||||||
|
mov di,offset nomdisque
|
||||||
|
int 48h
|
||||||
|
push di
|
||||||
|
push offset present
|
||||||
|
call [print]
|
||||||
|
ret
|
||||||
|
|
||||||
|
errorrefreshing db '\c04Impossible de lire le support',0
|
||||||
|
extcom db '.CE',0
|
||||||
|
|
||||||
|
code_mem:
|
||||||
|
push offset msg
|
||||||
|
call [print]
|
||||||
|
xor ebx,ebx
|
||||||
|
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
|
||||||
|
jne next
|
||||||
|
push cs
|
||||||
|
push offset none
|
||||||
|
add bx,gs:[mb.sizes]
|
||||||
|
jmp suitemn
|
||||||
|
next:
|
||||||
|
mov dx,gs: [mb.reference]
|
||||||
|
dec dx
|
||||||
|
dec dx
|
||||||
|
push dx
|
||||||
|
push offset mb.names
|
||||||
|
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 line2
|
||||||
|
call [print]
|
||||||
|
jmp listmcb
|
||||||
|
fino:
|
||||||
|
shl ebx,4
|
||||||
|
push ebx
|
||||||
|
push offset fin
|
||||||
|
call [print]
|
||||||
|
ret
|
||||||
|
resident db "oui",0
|
||||||
|
nonresident db "non",0
|
||||||
|
line2 db "%0P\h15%w\h24%0\h30%0P\h46%hW\l",0
|
||||||
|
fin db "\l\l\c02%u octets de memoire disponible\l",0
|
||||||
|
msg db "Plan de la memoire\l\lNom Taille Res Parent Mem\l",0
|
||||||
|
none db ".",0
|
||||||
|
|
||||||
|
|
||||||
|
;converti le jeux scancode/ascii en fr ax->ax
|
||||||
|
convertfr:
|
||||||
|
push dx si
|
||||||
|
mov si,offset fr
|
||||||
|
searchtouch:
|
||||||
|
mov dx,cs: [si]
|
||||||
|
cmp dx,0
|
||||||
|
je endofconv
|
||||||
|
add si,4
|
||||||
|
cmp dx,ax
|
||||||
|
jne searchtouch
|
||||||
|
mov ax,cs: [si-2]
|
||||||
|
endofconv:
|
||||||
|
pop dx si
|
||||||
|
ret
|
||||||
|
|
||||||
|
fr: db '1', 02, '&', 02
|
||||||
|
db '!', 02, '1', 02
|
||||||
|
db '2', 03, '‚', 03
|
||||||
|
db '@', 03, '2', 03
|
||||||
|
db '3', 04, '"', 04
|
||||||
|
db '#', 04, '3', 04
|
||||||
|
db '4', 05, 39, 05
|
||||||
|
db '$', 05, '4', 05
|
||||||
|
db '5', 06, '(', 06
|
||||||
|
db '%', 06, '5', 06
|
||||||
|
db '6', 07, '-', 07
|
||||||
|
db '^', 07, '6', 07
|
||||||
|
db '7', 08, 'Š', 08
|
||||||
|
db '&', 08, '7', 08
|
||||||
|
db '8', 09, '_', 09
|
||||||
|
db '*', 09, '8', 09
|
||||||
|
db '9', 10, '‡', 10
|
||||||
|
db '(', 10, '9', 10
|
||||||
|
db '0', 11, '…', 11
|
||||||
|
db ')', 11, '0', 11
|
||||||
|
db '-', 12, ')', 12
|
||||||
|
db '_', 12, 'ø', 12
|
||||||
|
db 'Q', 16, 'A', 16
|
||||||
|
db 'q', 16, 'a', 16
|
||||||
|
db 'W', 17, 'Z', 17
|
||||||
|
db 'w', 17, 'z', 17
|
||||||
|
db '{', 26, '‰', 26
|
||||||
|
db '[', 26, 'ˆ', 26
|
||||||
|
db ']', 27, '$', 27
|
||||||
|
db '}', 27, 'œ', 27
|
||||||
|
db 'A', 30, 'Q', 30
|
||||||
|
db 'a', 30, 'q', 30
|
||||||
|
db ':', 39, 'M', 39
|
||||||
|
db ';', 39, 'm', 39
|
||||||
|
db 39, 40, '—', 40
|
||||||
|
db '"', 40, '%', 40
|
||||||
|
db 00, 40, '%', 40
|
||||||
|
db '\', 43, '*', 43
|
||||||
|
db '|', 43, 'æ', 43
|
||||||
|
db 'Z', 44, 'W', 44
|
||||||
|
db 'z', 44, 'w', 44
|
||||||
|
db 'm', 50, ',', 50
|
||||||
|
db 'M', 50, '?', 50
|
||||||
|
db ',', 51, ';', 51
|
||||||
|
db '<', 51, '.', 51
|
||||||
|
db '.', 52, ':', 52
|
||||||
|
db '>', 52, '/', 52
|
||||||
|
db '?', 53, 'õ', 53
|
||||||
|
db '/', 53, '!', 53
|
||||||
|
db '\', 86, '<', 86
|
||||||
|
db '|', 86, '>', 86
|
||||||
|
db 00, 79h, '~', 03
|
||||||
|
db 00, 7ah, '#', 04
|
||||||
|
db 00, 7bh, '{', 05
|
||||||
|
db 00, 7ch, '[', 06
|
||||||
|
db 00, 7dh, '|', 07
|
||||||
|
db 00, 7eh, '`', 08
|
||||||
|
db 00, 7fh, '\', 09
|
||||||
|
db 00, 80h, '^', 10
|
||||||
|
db 00, 81h, '@', 11
|
||||||
|
db 00, 82h, ']', 12
|
||||||
|
db 00, 83h, '}', 13
|
||||||
|
db 00, 00, 00, 00
|
||||||
|
|
||||||
|
commands dw str_exit ,code_exit ,syn_exit ,help_exit
|
||||||
|
dw str_version,code_version,syn_version,help_version
|
||||||
|
dw str_cls ,code_cls ,syn_cls ,help_cls
|
||||||
|
dw str_reboot ,code_reboot ,syn_reboot ,help_reboot
|
||||||
|
dw str_command,code_command,syn_command,help_command
|
||||||
|
dw str_mode ,code_mode ,syn_mode ,help_mode
|
||||||
|
dw str_dir ,code_dir ,syn_dir ,help_dir
|
||||||
|
dw str_refresh ,code_refresh ,syn_refresh ,help_refresh
|
||||||
|
dw str_cd ,code_cd ,syn_cd ,help_cd
|
||||||
|
dw str_mem ,code_mem ,syn_mem ,help_mem
|
||||||
|
dw str_kill ,code_kill ,syn_kill ,help_kill
|
||||||
|
dw 0
|
||||||
|
|
||||||
|
str_exit db 'QUIT',0
|
||||||
|
str_version db 'VERS',0
|
||||||
|
str_cls db 'CLEAR',0
|
||||||
|
str_reboot db 'REBOOT',0
|
||||||
|
str_command db 'CMDS',0
|
||||||
|
str_mode db 'MODE',0
|
||||||
|
str_dir db 'DIR',0
|
||||||
|
str_refresh db 'DISK',0
|
||||||
|
str_cd db 'CD',0
|
||||||
|
str_mem db 'MEM',0
|
||||||
|
str_kill db 'KILL',0
|
||||||
|
|
||||||
|
syn_exit db 0
|
||||||
|
syn_version db 0
|
||||||
|
syn_cls db 0
|
||||||
|
syn_reboot db 0
|
||||||
|
syn_command db 0
|
||||||
|
syn_mode db 'FFH',0
|
||||||
|
syn_dir db 0
|
||||||
|
syn_refresh db 0
|
||||||
|
syn_cd db '@',0
|
||||||
|
syn_mem db 0
|
||||||
|
syn_kill db '@',0
|
||||||
|
|
||||||
|
help_exit db 'Permet de quitter l''interpreteur',0
|
||||||
|
help_version db 'Affiche la version de COS',0
|
||||||
|
help_cls db 'Efface l''ecran',0
|
||||||
|
help_reboot db 'Redemarre l''ordinateur',0
|
||||||
|
help_command db 'Affiche le detail des commandes',0
|
||||||
|
help_mode db 'Modifie le mode video en cours',0
|
||||||
|
help_dir db 'Affiche le contenu du repertoire courant',0
|
||||||
|
help_refresh db 'Lit le support disquette insere',0
|
||||||
|
help_cd db 'Change le repertoire courant',0
|
||||||
|
help_mem db 'Affiche le plan de la memoire',0
|
||||||
|
help_kill db 'Termine le processus cible',0
|
||||||
|
|
||||||
|
derror db '\c04Erreur de Syntaxe !',0
|
||||||
|
error_syntax db '\c04La commande ou l''executable n''existe pas ! F1 pour ',0
|
||||||
|
prompt db '\c07>',0
|
||||||
|
msginit db '\m02\e\c07\l\lInterpreteur de commande COS V1.9\lSous license \c05GPL\c07 - Ecrit par \c04MrNop\l\c07Utilisez la commande CMDS pour connaitres les commandes disponibles\l',0
|
||||||
|
|
||||||
|
include str0.asm
|
||||||
|
|
||||||
|
dir db 32 dup (0)
|
||||||
|
buffer db 128 dup (0)
|
||||||
|
buffer2 db 128 dup (0)
|
||||||
|
|
||||||
|
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
|
857
commande/str0.asm
Normal file
857
commande/str0.asm
Normal 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 ‚l‚ments 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'‚l‚ment 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 point‚e par ds:si ‚l‚ment 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 point‚e 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 point‚e 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 point‚e 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 point‚e 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 d‚limiteur par d‚faut
|
||||||
|
SetDelimiter0:
|
||||||
|
mov cs:delim,dl
|
||||||
|
ret
|
||||||
|
|
||||||
|
;Renvoie le d‚limiteur par d‚faut dans dl
|
||||||
|
GetDelimiter0:
|
||||||
|
mov dl,cs:delim
|
||||||
|
ret
|
||||||
|
delim db 0
|
||||||
|
|
||||||
|
;D‚truit les d‚limiteur qui sont cons‚cutifs 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'‚l‚ments … 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'‚l‚ment 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'‚l‚ment 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'‚l‚ment 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'‚l‚ments 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 point‚e 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 point‚e 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
25
commande/test.asm
Normal 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
|
20
contribs/MAKEFILE
Normal file
20
contribs/MAKEFILE
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
lnk_boot = tlink /x
|
||||||
|
asm= tasm /t/m5/zi
|
||||||
|
lnk= tlink /x/t
|
||||||
|
|
||||||
|
all: ex-tasm.com ex-nasm.com
|
||||||
|
|
||||||
|
ex-tasm.com: ex-tasm.asm
|
||||||
|
$(asm) ex-tasm
|
||||||
|
$(lnk) ex-tasm
|
||||||
|
ren ex-tasm.com ex-tasm.com
|
||||||
|
|
||||||
|
ex-nasm.com: ex-nasm.asm
|
||||||
|
nasm ex-nasm.asm -o ex-nasm.com
|
||||||
|
|
||||||
|
clean:
|
||||||
|
del *.obj
|
||||||
|
del *.exe
|
||||||
|
del *.com
|
||||||
|
del *.sys
|
||||||
|
del *.err
|
14
contribs/ex-nasm.asm
Normal file
14
contribs/ex-nasm.asm
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[bits 16] ;16 bits
|
||||||
|
[org 0x0100] ;Point d'entré en 0100h
|
||||||
|
section .text ;Segment de code
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
msg db 'Hello World',0
|
||||||
|
|
19
contribs/ex-tasm.asm
Normal file
19
contribs/ex-tasm.asm
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
.model tiny ;model tiny (.com)
|
||||||
|
.486 ;Pour processeur 80486
|
||||||
|
Smart ;Optimisations
|
||||||
|
.code ;Segment de code
|
||||||
|
|
||||||
|
org 0100h ;Point d'entré en 0100h
|
||||||
|
|
||||||
|
start:
|
||||||
|
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
|
||||||
|
|
||||||
|
end start
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
target remote localhost:1234
|
|
||||||
set disassembly-flavor intel
|
|
||||||
set architecture i8086
|
|
||||||
display/20i $pc+$cs*16
|
|
||||||
break *0x7c00
|
|
||||||
cont
|
|
||||||
clear *0x7c00
|
|
||||||
|
|
@ -1,527 +0,0 @@
|
|||||||
# Modified by Nicolas Horde
|
|
||||||
# Special mode for GDB that allows to debug/disassemble FLAT OR UNREAL MODE x86 code
|
|
||||||
#
|
|
||||||
# It has been designed to be used with QEMU or BOCHS gdb-stub
|
|
||||||
#
|
|
||||||
# 08/2011 Hugo Mercier - GPL v3 license
|
|
||||||
#
|
|
||||||
# Freely inspired from "A user-friendly gdb configuration file" widely available
|
|
||||||
# on the Internet
|
|
||||||
|
|
||||||
set confirm off
|
|
||||||
set verbose off
|
|
||||||
set prompt \033[31mreal-mode-gdb$ \033[0m
|
|
||||||
|
|
||||||
set output-radix 0d10
|
|
||||||
set input-radix 0d10
|
|
||||||
|
|
||||||
# These make gdb never pause in its output
|
|
||||||
set height 0
|
|
||||||
set width 0
|
|
||||||
|
|
||||||
# Intel syntax
|
|
||||||
set disassembly-flavor intel
|
|
||||||
# Real mode
|
|
||||||
set architecture i8086
|
|
||||||
|
|
||||||
set $SHOW_CONTEXT = 1
|
|
||||||
|
|
||||||
set $REAL_MODE = 1
|
|
||||||
|
|
||||||
# By default A20 is present
|
|
||||||
set $ADDRESS_MASK = 0x1FFFFF
|
|
||||||
|
|
||||||
# nb of instructions to display
|
|
||||||
set $CODE_SIZE = 20
|
|
||||||
|
|
||||||
define enable-a20
|
|
||||||
set $ADDRESS_MASK = 0x1FFFFF
|
|
||||||
end
|
|
||||||
define disable-a20
|
|
||||||
set $ADDRESS_MASK = 0x0FFFFF
|
|
||||||
end
|
|
||||||
|
|
||||||
# convert segment:offset address to physical address
|
|
||||||
define r2p
|
|
||||||
if $argc < 2
|
|
||||||
printf "Arguments: segment offset\n"
|
|
||||||
else
|
|
||||||
set $ADDR = (((unsigned long)$arg0 & 0xFFFF) << 4) + (((unsigned long)$arg1 & 0xFFFF) & $ADDRESS_MASK)
|
|
||||||
printf "0x%05X\n", $ADDR
|
|
||||||
end
|
|
||||||
end
|
|
||||||
document r2p
|
|
||||||
Convert segment:offset address to physical address
|
|
||||||
Set the global variable $ADDR to the computed one
|
|
||||||
end
|
|
||||||
|
|
||||||
# get address of Interruption
|
|
||||||
define int_addr
|
|
||||||
if $argc < 1
|
|
||||||
printf "Argument: interruption_number\n"
|
|
||||||
else
|
|
||||||
set $offset = (unsigned short)*($arg0 * 4)
|
|
||||||
set $segment = (unsigned short)*($arg0 * 4 + 2)
|
|
||||||
r2p $segment $offset
|
|
||||||
printf "%04X:%04X\n", $segment, $offset
|
|
||||||
end
|
|
||||||
end
|
|
||||||
document int_addr
|
|
||||||
Get address of interruption
|
|
||||||
end
|
|
||||||
|
|
||||||
define compute_regs
|
|
||||||
set $rax = ((unsigned long)$eax & 0xFFFFFFFF)
|
|
||||||
set $rbx = ((unsigned long)$ebx & 0xFFFFFFFF)
|
|
||||||
set $rcx = ((unsigned long)$ecx & 0xFFFFFFFF)
|
|
||||||
set $rdx = ((unsigned long)$edx & 0xFFFFFFFF)
|
|
||||||
set $rsi = ((unsigned long)$esi & 0xFFFFFFFF)
|
|
||||||
set $rdi = ((unsigned long)$edi & 0xFFFFFFFF)
|
|
||||||
set $rbp = ((unsigned long)$ebp & 0xFFFFFFFF)
|
|
||||||
set $rsp = ((unsigned long)$esp & 0xFFFFFFFF)
|
|
||||||
set $rcs = ((unsigned long)$cs & 0xFFFF)
|
|
||||||
set $rds = ((unsigned long)$ds & 0xFFFF)
|
|
||||||
set $res = ((unsigned long)$es & 0xFFFF)
|
|
||||||
set $rss = ((unsigned long)$ss & 0xFFFF)
|
|
||||||
set $rfs = ((unsigned long)$fs & 0xFFFF)
|
|
||||||
set $rgs = ((unsigned long)$gs & 0xFFFF)
|
|
||||||
set $rip = ((((unsigned long)$cs & 0xFFFF) << 4) + ((unsigned long)$eip & 0xFFFFFFFF)) & $ADDRESS_MASK
|
|
||||||
set $r_ss_sp = ((((unsigned long)$ss & 0xFFFF) << 4) + ((unsigned long)$esp & 0xFFFFFFFF)) & $ADDRESS_MASK
|
|
||||||
set $r_ss_bp = ((((unsigned long)$ss & 0xFFFF) << 4) + ((unsigned long)$ebp & 0xFFFFFFFF)) & $ADDRESS_MASK
|
|
||||||
end
|
|
||||||
|
|
||||||
define print_regs
|
|
||||||
printf "EAX: %08X EBX: %08X ", $rax, $rbx
|
|
||||||
printf "ECX: %08X EDX: %08X\n", $rcx, $rdx
|
|
||||||
printf "ESI: %08X EDI: %08X ", $rsi, $rdi
|
|
||||||
printf "ESP: %08X EBP: %08X\n", $rsp, $rbp
|
|
||||||
printf " CS: %04X DS: %04X ", $rcs, $rds
|
|
||||||
printf " ES: %04X SS: %04X ", $res, $rss
|
|
||||||
printf " FS: %04X GS: %04X ", $rfs, $rgs
|
|
||||||
printf "\n"
|
|
||||||
printf "CS:IP: %04X:%08X (0x%05X)\n", $rcs, ((unsigned long)$eip), $rip
|
|
||||||
printf "SS:SP: %04X:%08X (0x%05X)\n", $rss, $rsp, $r_ss_sp
|
|
||||||
printf "SS:BP: %04X:%08X (0x%05X)\n", $rss, $rbp, $r_ss_bp
|
|
||||||
end
|
|
||||||
document print_regs
|
|
||||||
Print CPU registers
|
|
||||||
end
|
|
||||||
|
|
||||||
define print_eflags
|
|
||||||
printf "EFLAGS: %08X [",$eflags
|
|
||||||
if ($eflags & 1)
|
|
||||||
printf "C"
|
|
||||||
else
|
|
||||||
printf "-"
|
|
||||||
end
|
|
||||||
printf "-"
|
|
||||||
if (($eflags >> 2) & 1)
|
|
||||||
printf "P"
|
|
||||||
else
|
|
||||||
printf "-"
|
|
||||||
end
|
|
||||||
printf "-"
|
|
||||||
if (($eflags >> 4) & 1)
|
|
||||||
printf "A"
|
|
||||||
else
|
|
||||||
printf "-"
|
|
||||||
end
|
|
||||||
printf "-"
|
|
||||||
if (($eflags >> 6) & 1)
|
|
||||||
printf "Z"
|
|
||||||
else
|
|
||||||
printf "-"
|
|
||||||
end
|
|
||||||
if (($eflags >> 7) & 1)
|
|
||||||
printf "S"
|
|
||||||
else
|
|
||||||
printf "-"
|
|
||||||
end
|
|
||||||
if (($eflags >> 8) & 1)
|
|
||||||
printf "T"
|
|
||||||
else
|
|
||||||
printf "-"
|
|
||||||
if (($eflags >> 9) & 1)
|
|
||||||
printf "I"
|
|
||||||
else
|
|
||||||
printf "-"
|
|
||||||
end
|
|
||||||
if (($eflags >> 0xA) & 1)
|
|
||||||
printf "D"
|
|
||||||
else
|
|
||||||
printf "-"
|
|
||||||
end
|
|
||||||
if (($eflags >> 0xB) & 1)
|
|
||||||
printf "O"
|
|
||||||
else
|
|
||||||
printf "-"
|
|
||||||
end
|
|
||||||
printf "]\n"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
document print_eflags
|
|
||||||
Print eflags register.
|
|
||||||
end
|
|
||||||
|
|
||||||
# dump content of bytes in memory
|
|
||||||
# arg0 : addr
|
|
||||||
# arg1 : nb of bytes
|
|
||||||
define _dump_memb
|
|
||||||
if $argc < 2
|
|
||||||
printf "Arguments: address number_of_bytes\n"
|
|
||||||
else
|
|
||||||
set $_nb = $arg1
|
|
||||||
set $_i = 0
|
|
||||||
set $_addr = $arg0
|
|
||||||
while ($_i < $_nb)
|
|
||||||
printf "%02X ", *((unsigned char*)$_addr + $_i)
|
|
||||||
set $_i++
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# dump content of memory in words
|
|
||||||
# arg0 : addr
|
|
||||||
# arg1 : nb of words
|
|
||||||
define _dump_memw
|
|
||||||
if $argc < 2
|
|
||||||
printf "Arguments: address number_of_words\n"
|
|
||||||
else
|
|
||||||
set $_nb = $arg1
|
|
||||||
set $_i = 0
|
|
||||||
set $_addr = $arg0
|
|
||||||
while ($_i < $_nb)
|
|
||||||
printf "%04X ", *((unsigned short*)$_addr + $_i)
|
|
||||||
set $_i++
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# display data at given address
|
|
||||||
define print_data
|
|
||||||
if ($argc > 0)
|
|
||||||
set $seg = $arg0
|
|
||||||
set $off = $arg1
|
|
||||||
set $maddr = ($arg0 << 4) + $arg1
|
|
||||||
|
|
||||||
set $w = 16
|
|
||||||
set $i = (int)0
|
|
||||||
while ($i < 2)
|
|
||||||
printf "%08X: ", ($maddr + $i * $w)
|
|
||||||
set $j = (int)0
|
|
||||||
while ($j < $w)
|
|
||||||
printf "%02X ", *(unsigned char*)($maddr + $i * $w + $j)
|
|
||||||
set $j++
|
|
||||||
end
|
|
||||||
printf " "
|
|
||||||
set $j = (int)0
|
|
||||||
while ($j < $w)
|
|
||||||
set $c = *(unsigned char*)($maddr + $i * $w + $j)
|
|
||||||
if ($c > 32) && ($c < 128)
|
|
||||||
printf "%c", $c
|
|
||||||
else
|
|
||||||
printf "."
|
|
||||||
end
|
|
||||||
set $j++
|
|
||||||
end
|
|
||||||
printf "\n"
|
|
||||||
set $i++
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# affiche les mb
|
|
||||||
define print_mb
|
|
||||||
set $mem=1280
|
|
||||||
set $verif = *(unsigned char*)($mem)
|
|
||||||
set $verif2 = *(unsigned char*)($mem+1)
|
|
||||||
set $stop = 0x01
|
|
||||||
while ($verif == 0x4E && $verif2 == 0x48 && $stop == 0x01)
|
|
||||||
set $stop = *(unsigned char*)($mem+2)
|
|
||||||
set $size = *(unsigned short*)($mem+6)
|
|
||||||
set $name = (unsigned char*)($mem+8)
|
|
||||||
printf "%s:%4X:%4X\n",$name,$mem,$size
|
|
||||||
set $mem=$mem+($size+2)*16
|
|
||||||
set $verif = *(unsigned char*)($mem)
|
|
||||||
set $verif2 = *(unsigned char*)($mem+1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
define context
|
|
||||||
printf "---------------------------[ STACK ]---------------------------\n"
|
|
||||||
_dump_memw $r_ss_sp 8
|
|
||||||
printf "\n"
|
|
||||||
set $_a = $r_ss_sp + 16
|
|
||||||
_dump_memw $_a 8
|
|
||||||
printf "\n"
|
|
||||||
printf "---------------------------[ DS:ESI ]---------------------------\n"
|
|
||||||
print_data $ds $rsi
|
|
||||||
printf "---------------------------[ ES:EDI ]---------------------------\n"
|
|
||||||
print_data $es $rdi
|
|
||||||
printf "----------------------------[ CPU ]---------------------------\n"
|
|
||||||
print_regs
|
|
||||||
print_eflags
|
|
||||||
printf "----------------------------[ MB ]---------------------------\n"
|
|
||||||
print_mb
|
|
||||||
printf "---------------------------[ CODE ]---------------------------\n"
|
|
||||||
|
|
||||||
set $_code_size = $CODE_SIZE
|
|
||||||
|
|
||||||
# disassemble
|
|
||||||
# first call x/i with an address
|
|
||||||
# subsequent calls to x/i will increment address
|
|
||||||
if ($_code_size > 0)
|
|
||||||
x /i $rip
|
|
||||||
set $_code_size--
|
|
||||||
end
|
|
||||||
while ($_code_size > 0)
|
|
||||||
x /i
|
|
||||||
set $_code_size--
|
|
||||||
end
|
|
||||||
end
|
|
||||||
document context
|
|
||||||
Print context window, i.e. regs, stack, ds:esi and disassemble cs:eip.
|
|
||||||
end
|
|
||||||
|
|
||||||
define hook-stop
|
|
||||||
compute_regs
|
|
||||||
if ($SHOW_CONTEXT > 0)
|
|
||||||
context
|
|
||||||
end
|
|
||||||
end
|
|
||||||
document hook-stop
|
|
||||||
!!! FOR INTERNAL USE ONLY - DO NOT CALL !!!
|
|
||||||
end
|
|
||||||
|
|
||||||
# add a breakpoint on an interrupt
|
|
||||||
define break_int
|
|
||||||
set $offset = (unsigned short)*($arg0 * 4)
|
|
||||||
set $segment = (unsigned short)*($arg0 * 4 + 2)
|
|
||||||
|
|
||||||
break *$offset
|
|
||||||
end
|
|
||||||
|
|
||||||
define break_int_if_ah
|
|
||||||
if ($argc < 2)
|
|
||||||
printf "Arguments: INT_N AH\n"
|
|
||||||
else
|
|
||||||
set $addr = (unsigned short)*($arg0 * 4)
|
|
||||||
set $segment = (unsigned short)*($arg0 * 4 + 2)
|
|
||||||
break *$addr if ((unsigned long)$eax & 0xFF00) == ($arg1 << 8)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
document break_int_if_ah
|
|
||||||
Install a breakpoint on INT N only if AH is equal to the expected value
|
|
||||||
end
|
|
||||||
|
|
||||||
define break_int_if_ax
|
|
||||||
if ($argc < 2)
|
|
||||||
printf "Arguments: INT_N AX\n"
|
|
||||||
else
|
|
||||||
set $addr = (unsigned short)*($arg0 * 4)
|
|
||||||
set $segment = (unsigned short)*($arg0 * 4 + 2)
|
|
||||||
break *$addr if ((unsigned long)$eax & 0xFFFF) == $arg1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
document break_int_if_ax
|
|
||||||
Install a breakpoint on INT N only if AX is equal to the expected value
|
|
||||||
end
|
|
||||||
|
|
||||||
define so
|
|
||||||
## we know that an opcode starting by 0xE8 has a fixed length
|
|
||||||
## for the 0xFF opcodes, we can enumerate what is possible to have
|
|
||||||
|
|
||||||
set $lip = $rip
|
|
||||||
set $offset = 0
|
|
||||||
|
|
||||||
# first, get rid of segment prefixes, if any
|
|
||||||
set $_byte1 = *(unsigned char *)$rip
|
|
||||||
# CALL DS:xx CS:xx, etc.
|
|
||||||
if ($_byte1 == 0x3E || $_byte1 == 0x26 || $_byte1 == 0x2E || $_byte1 == 0x36 || $_byte1 == 0x3E || $_byte1 == 0x64 || $_byte1 == 0x65)
|
|
||||||
set $lip = $rip + 1
|
|
||||||
set $_byte1 = *(unsigned char*)$lip
|
|
||||||
set $offset = 1
|
|
||||||
end
|
|
||||||
set $_byte2 = *(unsigned char *)($lip+1)
|
|
||||||
set $_byte3 = *(unsigned char *)($lip+2)
|
|
||||||
|
|
||||||
set $noffset = 0
|
|
||||||
|
|
||||||
if ($_byte1 == 0xE8)
|
|
||||||
# call near
|
|
||||||
set $noffset = 3
|
|
||||||
else
|
|
||||||
if ($_byte1 == 0xFF)
|
|
||||||
# A "ModR/M" byte follows
|
|
||||||
set $_mod = ($_byte2 & 0xC0) >> 6
|
|
||||||
set $_reg = ($_byte2 & 0x38) >> 3
|
|
||||||
set $_rm = ($_byte2 & 7)
|
|
||||||
#printf "mod: %d reg: %d rm: %d\n", $_mod, $_reg, $_rm
|
|
||||||
|
|
||||||
# only for CALL instructions
|
|
||||||
if ($_reg == 2 || $_reg == 3)
|
|
||||||
|
|
||||||
# default offset
|
|
||||||
set $noffset = 2
|
|
||||||
|
|
||||||
if ($_mod == 0)
|
|
||||||
if ($_rm == 6)
|
|
||||||
# a 16bit address follows
|
|
||||||
set $noffset = 4
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if ($_mod == 1)
|
|
||||||
# a 8bit displacement follows
|
|
||||||
set $noffset = 3
|
|
||||||
else
|
|
||||||
if ($_mod == 2)
|
|
||||||
# 16bit displacement
|
|
||||||
set $noffset = 4
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
# end of _reg == 2 or _reg == 3
|
|
||||||
|
|
||||||
else
|
|
||||||
# else byte1 != 0xff
|
|
||||||
if ($_byte1 == 0x9A)
|
|
||||||
# call far
|
|
||||||
set $noffset = 5
|
|
||||||
else
|
|
||||||
if ($_byte1 == 0xCD)
|
|
||||||
# INTERRUPT CASE
|
|
||||||
set $noffset = 2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
# end of byte1 == 0xff
|
|
||||||
end
|
|
||||||
# else byte1 != 0xe8
|
|
||||||
|
|
||||||
# if we have found a call to bypass we set a temporary breakpoint on next instruction and continue
|
|
||||||
if ($noffset != 0)
|
|
||||||
set $_nextaddress = $eip + $offset + $noffset+$cs*16
|
|
||||||
printf "Setting BP to %04X\n", $_nextaddress
|
|
||||||
break *$_nextaddress
|
|
||||||
continue
|
|
||||||
cl *$_nextaddress
|
|
||||||
# else we just single step
|
|
||||||
else
|
|
||||||
nexti
|
|
||||||
end
|
|
||||||
end
|
|
||||||
document so
|
|
||||||
Step over calls
|
|
||||||
This function will set a temporary breakpoint on next instruction after the call so the call will be bypassed
|
|
||||||
You can safely use it instead nexti since it will single step code if it's not a call instruction (unless you want to go into the call function)
|
|
||||||
end
|
|
||||||
|
|
||||||
define step_until_iret
|
|
||||||
set $SHOW_CONTEXT=0
|
|
||||||
set $_found = 0
|
|
||||||
while (!$_found)
|
|
||||||
if (*(unsigned char*)$rip == 0xCF)
|
|
||||||
set $_found = 1
|
|
||||||
else
|
|
||||||
stepo
|
|
||||||
end
|
|
||||||
end
|
|
||||||
set $SHOW_CONTEXT=1
|
|
||||||
context
|
|
||||||
end
|
|
||||||
|
|
||||||
define step_until_ret
|
|
||||||
set $SHOW_CONTEXT=0
|
|
||||||
set $_found = 0
|
|
||||||
while (!$_found)
|
|
||||||
set $_p = *(unsigned char*)$rip
|
|
||||||
if ($_p == 0xC3 || $_p == 0xCB || $_p == 0xC2 || $_p == 0xCA)
|
|
||||||
set $_found = 1
|
|
||||||
else
|
|
||||||
stepo
|
|
||||||
end
|
|
||||||
end
|
|
||||||
set $SHOW_CONTEXT=1
|
|
||||||
context
|
|
||||||
end
|
|
||||||
|
|
||||||
define step_until_int
|
|
||||||
set $SHOW_CONTEXT = 0
|
|
||||||
|
|
||||||
while (*(unsigned char*)$rip != 0xCD)
|
|
||||||
stepo
|
|
||||||
end
|
|
||||||
set $SHOW_CONTEXT = 1
|
|
||||||
context
|
|
||||||
end
|
|
||||||
|
|
||||||
# Find a pattern in memory
|
|
||||||
# The pattern is given by a string as arg0
|
|
||||||
# If another argument is present it gives the starting address (0 otherwise)
|
|
||||||
define find_in_mem
|
|
||||||
if ($argc >= 2)
|
|
||||||
set $_addr = $arg1
|
|
||||||
else
|
|
||||||
set $_addr = 0
|
|
||||||
end
|
|
||||||
set $_found = 0
|
|
||||||
set $_tofind = $arg0
|
|
||||||
while ($_addr < $ADDRESS_MASK) && (!$_found)
|
|
||||||
if ($_addr % 0x100 == 0)
|
|
||||||
printf "%08X\n", $_addr
|
|
||||||
end
|
|
||||||
set $_i = 0
|
|
||||||
set $_found = 1
|
|
||||||
while ($_tofind[$_i] != 0 && $_found == 1)
|
|
||||||
set $_b = *((char*)$_addr + $_i)
|
|
||||||
set $_t = (char)$_tofind[$_i]
|
|
||||||
if ($_t != $_b)
|
|
||||||
set $_found = 0
|
|
||||||
end
|
|
||||||
set $_i++
|
|
||||||
end
|
|
||||||
if ($_found == 1)
|
|
||||||
printf "Code found at 0x%05X\n", $_addr
|
|
||||||
end
|
|
||||||
set $_addr++
|
|
||||||
end
|
|
||||||
end
|
|
||||||
document find_in_mem
|
|
||||||
Find a pattern in memory
|
|
||||||
The pattern is given by a string as arg0
|
|
||||||
If another argument is present it gives the starting address (0 otherwise)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
define step_until_code
|
|
||||||
set $_tofind = $arg0
|
|
||||||
set $SHOW_CONTEXT = 0
|
|
||||||
|
|
||||||
set $_found = 0
|
|
||||||
while (!$_found)
|
|
||||||
set $_i = 0
|
|
||||||
set $_found = 1
|
|
||||||
|
|
||||||
while ($_tofind[$_i] != 0 && $_found == 1)
|
|
||||||
set $_b = *((char*)$rip + $_i)
|
|
||||||
set $_t = (char)$_tofind[$_i]
|
|
||||||
if ($_t != $_b)
|
|
||||||
set $_found = 0
|
|
||||||
end
|
|
||||||
set $_i++
|
|
||||||
end
|
|
||||||
|
|
||||||
if ($_found == 0)
|
|
||||||
stepo
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
set $SHOW_CONTEXT = 1
|
|
||||||
context
|
|
||||||
end
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
target remote localhost:1234
|
|
||||||
set disassembly-flavor intel
|
|
||||||
set architecture i8086
|
|
||||||
set tdesc filename ./debug/target.xml
|
|
||||||
break *0x80010
|
|
||||||
continue
|
|
||||||
clear *0x80010
|
|
||||||
|
|
||||||
|
|
112
debug/target.xml
112
debug/target.xml
@ -1,112 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<!-- Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Copying and distribution of this file, with or without modification,
|
|
||||||
are permitted in any medium without royalty provided the copyright
|
|
||||||
notice and this notice are preserved. -->
|
|
||||||
|
|
||||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
|
||||||
<target>
|
|
||||||
<architecture>i8086</architecture>
|
|
||||||
<feature name="org.gnu.gdb.i386.core">
|
|
||||||
<flags id="i386_eflags" size="4">
|
|
||||||
<field name="CF" start="0" end="0"/>
|
|
||||||
<field name="" start="1" end="1"/>
|
|
||||||
<field name="PF" start="2" end="2"/>
|
|
||||||
<field name="AF" start="4" end="4"/>
|
|
||||||
<field name="ZF" start="6" end="6"/>
|
|
||||||
<field name="SF" start="7" end="7"/>
|
|
||||||
<field name="TF" start="8" end="8"/>
|
|
||||||
<field name="IF" start="9" end="9"/>
|
|
||||||
<field name="DF" start="10" end="10"/>
|
|
||||||
<field name="OF" start="11" end="11"/>
|
|
||||||
<field name="NT" start="14" end="14"/>
|
|
||||||
<field name="RF" start="16" end="16"/>
|
|
||||||
<field name="VM" start="17" end="17"/>
|
|
||||||
<field name="AC" start="18" end="18"/>
|
|
||||||
<field name="VIF" start="19" end="19"/>
|
|
||||||
<field name="VIP" start="20" end="20"/>
|
|
||||||
<field name="ID" start="21" end="21"/>
|
|
||||||
</flags>
|
|
||||||
|
|
||||||
<reg name="eax" bitsize="32" type="int32"/>
|
|
||||||
<reg name="ecx" bitsize="32" type="int32"/>
|
|
||||||
<reg name="edx" bitsize="32" type="int32"/>
|
|
||||||
<reg name="ebx" bitsize="32" type="int32"/>
|
|
||||||
<reg name="esp" bitsize="32" type="data_ptr"/>
|
|
||||||
<reg name="ebp" bitsize="32" type="data_ptr"/>
|
|
||||||
<reg name="esi" bitsize="32" type="int32"/>
|
|
||||||
<reg name="edi" bitsize="32" type="int32"/>
|
|
||||||
|
|
||||||
<reg name="eip" bitsize="32" type="code_ptr"/>
|
|
||||||
<reg name="eflags" bitsize="32" type="i386_eflags"/>
|
|
||||||
<reg name="cs" bitsize="32" type="int32"/>
|
|
||||||
<reg name="ss" bitsize="32" type="int32"/>
|
|
||||||
<reg name="ds" bitsize="32" type="int32"/>
|
|
||||||
<reg name="es" bitsize="32" type="int32"/>
|
|
||||||
<reg name="fs" bitsize="32" type="int32"/>
|
|
||||||
<reg name="gs" bitsize="32" type="int32"/>
|
|
||||||
|
|
||||||
<reg name="st0" bitsize="80" type="i387_ext"/>
|
|
||||||
<reg name="st1" bitsize="80" type="i387_ext"/>
|
|
||||||
<reg name="st2" bitsize="80" type="i387_ext"/>
|
|
||||||
<reg name="st3" bitsize="80" type="i387_ext"/>
|
|
||||||
<reg name="st4" bitsize="80" type="i387_ext"/>
|
|
||||||
<reg name="st5" bitsize="80" type="i387_ext"/>
|
|
||||||
<reg name="st6" bitsize="80" type="i387_ext"/>
|
|
||||||
<reg name="st7" bitsize="80" type="i387_ext"/>
|
|
||||||
|
|
||||||
<reg name="fctrl" bitsize="32" type="int" group="float"/>
|
|
||||||
<reg name="fstat" bitsize="32" type="int" group="float"/>
|
|
||||||
<reg name="ftag" bitsize="32" type="int" group="float"/>
|
|
||||||
<reg name="fiseg" bitsize="32" type="int" group="float"/>
|
|
||||||
<reg name="fioff" bitsize="32" type="int" group="float"/>
|
|
||||||
<reg name="foseg" bitsize="32" type="int" group="float"/>
|
|
||||||
<reg name="fooff" bitsize="32" type="int" group="float"/>
|
|
||||||
<reg name="fop" bitsize="32" type="int" group="float"/>
|
|
||||||
</feature>
|
|
||||||
<feature name="org.gnu.gdb.i386.32bit.sse">
|
|
||||||
<vector id="v4f" type="ieee_single" count="4"/>
|
|
||||||
<vector id="v2d" type="ieee_double" count="2"/>
|
|
||||||
<vector id="v16i8" type="int8" count="16"/>
|
|
||||||
<vector id="v8i16" type="int16" count="8"/>
|
|
||||||
<vector id="v4i32" type="int32" count="4"/>
|
|
||||||
<vector id="v2i64" type="int64" count="2"/>
|
|
||||||
<union id="vec128">
|
|
||||||
<field name="v4_float" type="v4f"/>
|
|
||||||
<field name="v2_double" type="v2d"/>
|
|
||||||
<field name="v16_int8" type="v16i8"/>
|
|
||||||
<field name="v8_int16" type="v8i16"/>
|
|
||||||
<field name="v4_int32" type="v4i32"/>
|
|
||||||
<field name="v2_int64" type="v2i64"/>
|
|
||||||
<field name="uint128" type="uint128"/>
|
|
||||||
</union>
|
|
||||||
<flags id="i386_mxcsr" size="4">
|
|
||||||
<field name="IE" start="0" end="0"/>
|
|
||||||
<field name="DE" start="1" end="1"/>
|
|
||||||
<field name="ZE" start="2" end="2"/>
|
|
||||||
<field name="OE" start="3" end="3"/>
|
|
||||||
<field name="UE" start="4" end="4"/>
|
|
||||||
<field name="PE" start="5" end="5"/>
|
|
||||||
<field name="DAZ" start="6" end="6"/>
|
|
||||||
<field name="IM" start="7" end="7"/>
|
|
||||||
<field name="DM" start="8" end="8"/>
|
|
||||||
<field name="ZM" start="9" end="9"/>
|
|
||||||
<field name="OM" start="10" end="10"/>
|
|
||||||
<field name="UM" start="11" end="11"/>
|
|
||||||
<field name="PM" start="12" end="12"/>
|
|
||||||
<field name="FZ" start="15" end="15"/>
|
|
||||||
</flags>
|
|
||||||
|
|
||||||
<reg name="xmm0" bitsize="128" type="vec128" regnum="32"/>
|
|
||||||
<reg name="xmm1" bitsize="128" type="vec128"/>
|
|
||||||
<reg name="xmm2" bitsize="128" type="vec128"/>
|
|
||||||
<reg name="xmm3" bitsize="128" type="vec128"/>
|
|
||||||
<reg name="xmm4" bitsize="128" type="vec128"/>
|
|
||||||
<reg name="xmm5" bitsize="128" type="vec128"/>
|
|
||||||
<reg name="xmm6" bitsize="128" type="vec128"/>
|
|
||||||
<reg name="xmm7" bitsize="128" type="vec128"/>
|
|
||||||
|
|
||||||
<reg name="mxcsr" bitsize="32" type="i386_mxcsr" group="vector"/>
|
|
||||||
</feature>
|
|
||||||
</target>
|
|
BIN
doc_origine.pdf
Normal file
BIN
doc_origine.pdf
Normal file
Binary file not shown.
@ -1,17 +0,0 @@
|
|||||||
all: cos2000.img
|
|
||||||
|
|
||||||
cos2000.img:
|
|
||||||
(dd if=/dev/zero of=cos2000.img count=2880 bs=512)
|
|
||||||
(mkfs.msdos -F 12 -n "COS2000" cos2000.img)
|
|
||||||
(fusermount ./mnt -u;mkdir -p ./mnt;rm -rf ./mnt/*;fusefat cos2000.img ./mnt -o rw+)
|
|
||||||
(cp ../noyau/systeme.sys ./mnt/)
|
|
||||||
(cp ../noyau/systeme.ini ./mnt/)
|
|
||||||
(cp ../programs/*.ce ./mnt/)
|
|
||||||
(cp ../programs/*.rip ./mnt/)
|
|
||||||
(cp ../lib/*.lib ./mnt/)
|
|
||||||
(sync)
|
|
||||||
(fusermount ./mnt -u)
|
|
||||||
(dd if=../boot/boot12.bin of=cos2000.img seek=0 count=1 conv=notrunc;sync)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.img
|
|
37
include/3d.h
37
include/3d.h
@ -1,37 +0,0 @@
|
|||||||
struc vertex3d tx,ty,tz
|
|
||||||
{
|
|
||||||
.tx dd ?
|
|
||||||
.ty dd ?
|
|
||||||
.tz dd ?
|
|
||||||
.sizeof = $ - .tx
|
|
||||||
}
|
|
||||||
|
|
||||||
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 ?
|
|
||||||
.sizeof = $ - .p1
|
|
||||||
}
|
|
||||||
|
|
||||||
main equ 4D4Dh
|
|
||||||
edit equ 3D3Dh
|
|
||||||
object equ 4000h
|
|
||||||
mesh equ 4100h
|
|
||||||
vertex equ 4110h
|
|
||||||
face equ 4120h
|
|
||||||
locale equ 4160h
|
|
||||||
|
|
@ -1,42 +1,40 @@
|
|||||||
struc bmp_file
|
BMP_File struc
|
||||||
{
|
BMP_FileType db 'BM'
|
||||||
.bmp_filetype db 'bm'
|
BMP_FileSize dd ? ; taille du fichier
|
||||||
.bmp_filesize dd ? ; taille du fichier
|
BMP_Reserved dd 0 ; toujours 0
|
||||||
.bmp_reserved dd 0 ; toujours 0
|
BMP_BitMapOffset dd ? ; offset de l'image
|
||||||
.bmp_bitmapoffset dd ? ; offset de l'image
|
BMP_HeaderSize dd ? ; taille de l'entete en octects
|
||||||
.bmp_headersize dd ? ; taille de l'entete en octects
|
BMP_Width dd ? ; largeur en pixels de l'image
|
||||||
.bmp_width dd ? ; largeur en pixels de l'image
|
BMP_Height dd ? ; hauteur en pixels de l'image
|
||||||
.bmp_height dd ? ; hauteur en pixels de l'image
|
BMP_Planes dw 1 ; nombre de plan utilisés
|
||||||
.bmp_planes dw 1 ; nombre de plan utilisés
|
BMP_BitsPerPixel dw ? ; nombre de bits par pixels
|
||||||
.bmp_bitsperpixel dw ? ; nombre de bits par pixels
|
BMP_Compression dd ? ; méthode de compression
|
||||||
.bmp_compression dd ? ; méthode de compression
|
BMP_SizeOfBitMap dd ? ; taille de l'image en octects
|
||||||
.bmp_sizeofbitmap dd ? ; taille de l'image en octects
|
BMP_HorzResolution dd ? ; resolution horizontale en pixels par mètre
|
||||||
.bmp_horzresolution dd ? ; resolution horizontale en pixels par mètre
|
BMP_VertResolution dd ? ; resolution verticale 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_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_colorsimportant dd ? ; nombre de couleurs importantes masques pour les modes de plus de 8 bits par pixels
|
BMP_RedMask dd ?
|
||||||
.bmp_redmask dd ?
|
BMP_GreenMask dd ?
|
||||||
.bmp_greenmask dd ?
|
BMP_BlueMask dd ?
|
||||||
.bmp_bluemask dd ?
|
BMP_AlphaMask dd ?
|
||||||
.bmp_alphamask dd ?
|
BMP_ColorSpaceType dd ?
|
||||||
.bmp_colorspacetype dd ?
|
BMP_RedX dd ?
|
||||||
.bmp_redx dd ?
|
BMP_RedY dd ?
|
||||||
.bmp_redy dd ?
|
BMP_RedZ dd ?
|
||||||
.bmp_redz dd ?
|
BMP_GreenX dd ?
|
||||||
.bmp_greenx dd ?
|
BMP_GreenY dd ?
|
||||||
.bmp_greeny dd ?
|
BMP_GreenZ dd ?
|
||||||
.bmp_greenz dd ?
|
BMP_BlueX dd ?
|
||||||
.bmp_bluex dd ?
|
BMP_BlueY dd ?
|
||||||
.bmp_bluey dd ?
|
BMP_BlueZ dd ?
|
||||||
.bmp_bluez dd ?
|
BMP_GammaRed dd ?
|
||||||
.bmp_gammared dd ?
|
BMP_GammaGreen dd ?
|
||||||
.bmp_gammagreen dd ?
|
BMP_GammeBlue dd ?
|
||||||
.bmp_gammeblue dd ?
|
BMP_file ends
|
||||||
.sizeof = $ - .bmp_filetype
|
|
||||||
}
|
|
||||||
|
|
||||||
;.bmp_compression peut prendre les valeurs suivantes:
|
;BMP_Compression peut prendre les valeurs suivantes:
|
||||||
bmp_comp_uncomp equ 0 ; pas de compression
|
BMP_COMP_UNCOMP equ 0 ; pas de compression
|
||||||
bmp_comp_rle8 equ 1 ; 8-bit run length encoding
|
BMP_COMP_RLE8 equ 1 ; 8-bit run length encoding
|
||||||
bmp_comp_rle4 equ 2 ; 4-bit tun length encoding
|
BMP_COMP_RLE4 equ 2 ; 4-bit tun length encoding
|
||||||
bmp_comp_bfe equ 3 ; bitfields encoding
|
BMP_COMP_BFE equ 3 ; bitfields encoding
|
||||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.9 KiB |
@ -1,25 +1,20 @@
|
|||||||
struc cpu
|
struc cpu
|
||||||
{
|
vendor db 13 dup(0) ;Chaine 0 du fabriquant
|
||||||
.vendor db 13 dup(0) ;Chaine 0 du fabriquant
|
names db 32 dup(0)
|
||||||
.names db 32 dup(0)
|
stepping db 0
|
||||||
.stepping db 0
|
models db 0
|
||||||
.models db 0
|
family db 0
|
||||||
.family db 0
|
types db 0
|
||||||
.types db 0
|
emodels db 0
|
||||||
.emodels db 0
|
efamily db 0
|
||||||
.efamily db 0
|
mmx db 0
|
||||||
.mmx db 0
|
mmx2 db 0
|
||||||
.mmx2 db 0
|
sse db 0
|
||||||
.sse db 0
|
sse2 db 0
|
||||||
.sse2 db 0
|
sse3 db 0
|
||||||
.sse3 db 0
|
fpu db 0
|
||||||
.fpu db 0
|
now3d db 0
|
||||||
.now3d db 0
|
now3d2 db 0
|
||||||
.now3d2 db 0
|
htt db 0
|
||||||
.htt db 0
|
apic db 0
|
||||||
.apic db 0
|
ends cpu
|
||||||
.sizeof = $ - .vendor
|
|
||||||
}
|
|
||||||
virtual at 0
|
|
||||||
cpu cpu
|
|
||||||
end virtual
|
|
||||||
|
124
include/fat.h
124
include/fat.h
@ -1,80 +1,52 @@
|
|||||||
struc diskbuffer
|
|
||||||
{
|
|
||||||
.size dw 12
|
|
||||||
.current dw 0FFFFh
|
|
||||||
.chain dw 128 dup (0FFFFh)
|
|
||||||
.sizeof = $ - .size
|
|
||||||
}
|
|
||||||
|
|
||||||
struc dpt
|
struc dpt
|
||||||
{
|
steprate&headunload db 0DFh ;Vitesse de progression & mont‚e de la tˆte
|
||||||
.steprateheadunload db 0DFh ;Vitesse de progression & montee de la tete
|
dmaflag&headload db 002h ;Etat Dma et temps de descente de la tˆte
|
||||||
.dmaflagheadload db 002h ;Etat Dma et temps de descente de la tete
|
delaymotoroff db 025h ;Temps avant extinction moteur
|
||||||
.delaymotoroff db 025h ;Temps avant extinction moteur
|
bytepersector db 002h ;Taille des secteurs
|
||||||
.bytepersector db 002h ;Taille des secteurs
|
sectorpertracks db 000h ;Nombre de secteur par piste
|
||||||
.sectorpertracks db 000h ;Nombre de secteur par piste
|
intersectgaplength db 01Bh ;Taille du GAP3 en lecture/‚criture
|
||||||
.intersectgaplength db 01Bh ;Taille du GAP3 en lecture/‚criture
|
datalength db 0FFh ;Longueur du transfert de donn‚es
|
||||||
.datalength db 0FFh ;Longueur du transfert de donn‚es
|
intersectgaplengthf db 054h ;Taille du GAP3 en formatage
|
||||||
.intersectgaplengthf db 054h ;Taille du GAP3 en formatage
|
formatbyte db 0F6h ;Octet de formatage
|
||||||
.formatbyte db 0F6h ;Octet de formatage
|
headsettlingtime db 000h ;Temps de repos des tˆtes
|
||||||
.headsettlingtime db 000h ;Temps de repos des tˆtes
|
delaymotornormspeed db 008h ;Temps de mont‚e en vitesse du moteur
|
||||||
.delaymotornormspeed db 008h ;Temps de mont‚e en vitesse du moteur
|
ends dpt
|
||||||
.sizeof = $ - .steprateheadunload
|
|
||||||
}
|
|
||||||
|
|
||||||
struc entries
|
struc entries
|
||||||
{
|
filename db 8 dup (0)
|
||||||
.filename db 8 dup (0)
|
filext db 3 dup (0)
|
||||||
.filext db 3 dup (0)
|
fileattr db 0
|
||||||
.fileattr db 0
|
filereserved db 0
|
||||||
.filereserved db 0
|
filetimecreams db 0 ;(*10 ms)
|
||||||
.filetimecreams db 0 ;(*10 ms)
|
filetimecrea dw 0
|
||||||
.filetimecrea dw 0
|
filedatecrea dw 0
|
||||||
.filedatecrea dw 0
|
filedateacc dw 0
|
||||||
.filedateacc dw 0
|
filenotused dw 0
|
||||||
.filenotused dw 0
|
filetime dw 0
|
||||||
.filetime dw 0
|
filedate dw 0
|
||||||
.filedate dw 0
|
filegroup dw 0
|
||||||
.filegroup dw 0
|
filesize dd 0
|
||||||
.filesize dd 0
|
ends entries
|
||||||
.sizeof = $ - .filename
|
|
||||||
}
|
|
||||||
virtual at 0
|
|
||||||
entries entries
|
|
||||||
end virtual
|
|
||||||
|
|
||||||
;Pour recherches
|
struc bootinfo
|
||||||
struc find files
|
vendor db 'COS2000A' ;Fabricant + n°série Formatage
|
||||||
{
|
sectorsize dw 512 ;octet/secteur
|
||||||
.files db 13 dup (0) ;le fichier
|
sectorspercluster db 1 ;secteur/cluster
|
||||||
.entryplace dw 0 ;En octet
|
reservedsectors dw 1 ;secteur reserv‚
|
||||||
.adressdirectory dw 0 ;En cluster
|
fatsperdrive db 2 ;nb de copie de la FAT
|
||||||
.firstsearch db 1 ;Premiere requete ?
|
directorysize dw 224 ;taille rep racine
|
||||||
.result entries
|
sectorsperdrive dw 2880 ;nb secteur du volume si < 32 még
|
||||||
.sizeof = $ - .files
|
mediadescriptor db 0F0h ;Descripteur de média
|
||||||
}
|
sectorsperfat dw 9 ;secteur/FAT
|
||||||
|
sectorspertrack dw 18 ;secteur/piste
|
||||||
struc bootinfo vendor,drivename,serialnumber
|
headsperdrive dw 2 ;nb de tˆteb de lecture/écriture
|
||||||
{
|
hiddensectorsh dw 0 ;nombre de secteur cach‚s
|
||||||
.vendor db 'COS2000A' ;Fabricant + n°série Formatage
|
hiddensectorsl dw 0 ;
|
||||||
.sectorsize dw 512 ;octet/secteur
|
sectorperdisk2 dd 0 ;Nombre secteur du volume si > 32 Mo+20h ; the number of sectors
|
||||||
.sectorspercluster db 1 ;secteur/cluster
|
bootdrive db 0 ;Lecteur de d‚marrage
|
||||||
.reservedsectors dw 1 ;secteur reserv‚
|
reservedfornt db 0 ;NA
|
||||||
.fatsperdrive db 2 ;nb de copie de la FAT
|
bootsign db 29h ;boot signature 29h
|
||||||
.directorysize dw 224 ;taille rep racine
|
serialnumber dd 01020304h ;no de serie
|
||||||
.sectorsperdrive dw 2880 ;nb secteur du volume si < 32 még
|
drivename db 'COS2000 ' ;nom de volume
|
||||||
.mediadescriptor db 0F0h ;Descripteur de média
|
typeoffat db 'FAT16 ' ;FAT
|
||||||
.sectorsperfat dw 9 ;secteur/FAT
|
ends bootinfo
|
||||||
.sectorspertrack dw 18 ;secteur/piste
|
|
||||||
.headsperdrive dw 2 ;nb de tˆteb de lecture/écriture
|
|
||||||
.hiddensectorsh dw 0 ;nombre de secteur cach‚s
|
|
||||||
.hiddensectorsl dw 0 ;
|
|
||||||
.sectorperdisk2 dd 0 ;Nombre secteur du volume si > 32 Mo+20h ; the number of sectors
|
|
||||||
.bootdrive db 0 ;Lecteur de d‚marrage
|
|
||||||
.reservedfornt db 0 ;NA
|
|
||||||
.bootsign db 29h ;boot signature 29h
|
|
||||||
.serialnumber dd 01020304h ;no de serie
|
|
||||||
.drivename db 'COS2000 ' ;nom de volume
|
|
||||||
.typeoffat db 'FAT12 ' ;FAT
|
|
||||||
.sizeof = $ - .vendor
|
|
||||||
}
|
|
||||||
|
@ -1,38 +1,4 @@
|
|||||||
struc point
|
struc point
|
||||||
{
|
coordx db 0
|
||||||
.coordx db 0
|
coordy db 0
|
||||||
.coordy db 0
|
ends point
|
||||||
.sizeof = $ - .coordx
|
|
||||||
}
|
|
||||||
|
|
||||||
struc vgainf
|
|
||||||
{
|
|
||||||
.lines db 0
|
|
||||||
.columns db 0
|
|
||||||
.x db 0
|
|
||||||
.y db 0
|
|
||||||
.xy dw 0
|
|
||||||
.colors db 7
|
|
||||||
.modenum 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
|
|
||||||
.sizeof = $ - .lines
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struc vertex2d
|
|
||||||
{
|
|
||||||
.px dw ?
|
|
||||||
.py dw ?
|
|
||||||
.sizeof = $ - .px
|
|
||||||
}
|
|
||||||
|
432
include/mem.h
432
include/mem.h
@ -1,410 +1,32 @@
|
|||||||
struc regs
|
struc mb ;Bloc de mémoire
|
||||||
{
|
check db "NH" ;signature du bloc de mémoire
|
||||||
.seip dd 0
|
isnotlast db 0 ;flag indiquant le dernier bloc
|
||||||
.seax dd 0
|
isresident db 0 ;flag indiquant que le bloc est resident
|
||||||
.sebx dd 0
|
reference dw 0 ;pointeur vers le bloc parent
|
||||||
.secx dd 0
|
sizes dw 0 ;taille du bloc en paragraphe de 16 octet
|
||||||
.sedx dd 0
|
names db 24 dup (0) ;nom du bloc
|
||||||
.sesi dd 0
|
ends mb
|
||||||
.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
|
|
||||||
}
|
|
||||||
virtual at 0
|
|
||||||
regs regs
|
|
||||||
end virtual
|
|
||||||
|
|
||||||
struc tuple off,seg
|
struc exe ;Executable COS
|
||||||
{
|
checks db "CE" ;signature de l'exe
|
||||||
.off dw 0 ;adresse
|
major db 1 ;N° version
|
||||||
.seg dw 0 ;segment
|
checksum dd 0 ;Checksum de l'exe
|
||||||
}
|
compressed db 0 ;a 1 si compressé par RLE
|
||||||
virtual at 0
|
exports dw 0 ;importation de fonctions
|
||||||
tuple tuple ?,?
|
imports dw 0 ;exportation de fonctions
|
||||||
end virtual
|
sections dw 0 ;sections des blocs mémoire
|
||||||
|
starting dw 15
|
||||||
|
ends exe
|
||||||
|
|
||||||
struc vector off,seg
|
struc descriptor
|
||||||
{
|
limit_low dw 0
|
||||||
.data tuple off,seg
|
base_low dw 0
|
||||||
virtual at .data
|
base_middle db 0
|
||||||
.content dd 0
|
dpltype db 0
|
||||||
.sizeof = $ - .data
|
limit_high db 0
|
||||||
end virtual
|
base_high db 0
|
||||||
}
|
ends descriptor
|
||||||
virtual at 0
|
|
||||||
vector vector ?,?
|
|
||||||
end virtual
|
|
||||||
|
|
||||||
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 ?
|
|
||||||
.sizeof = $ - .number
|
|
||||||
}
|
|
||||||
virtual at 0
|
|
||||||
ints ints
|
|
||||||
end virtual
|
|
||||||
|
|
||||||
struc mb asize,aname ;Bloc de mémoire
|
|
||||||
{
|
|
||||||
.check db "NH" ;signature du bloc de mémoire.
|
|
||||||
.isnotlast db 0 ;flag indiquant le dernier bloc
|
|
||||||
.isresident db 0 ;flag indiquant que le bloc est resident
|
|
||||||
.reference dw 0 ;pointeur vers le bloc parent
|
|
||||||
.sizes dw asize ;taille du bloc en paragraphe de 16 octet
|
|
||||||
.names db aname ;nom du bloc
|
|
||||||
.endofstr db 0
|
|
||||||
.sizeof = 32
|
|
||||||
}
|
|
||||||
virtual at 0
|
|
||||||
mb mb ?,?
|
|
||||||
end virtual
|
|
||||||
|
|
||||||
struc exe major,exports,imports,sections,starting
|
|
||||||
;Executable COS
|
|
||||||
{
|
|
||||||
.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 exports ;importation de fonctions
|
|
||||||
.imports dw imports ;exportation de fonctions
|
|
||||||
.sections dw sections ;sections des blocs mémoire
|
|
||||||
.starting dw starting
|
|
||||||
}
|
|
||||||
virtual at 0
|
|
||||||
exe exe ?,?,?,?,?
|
|
||||||
end virtual
|
|
||||||
|
|
||||||
struc descriptor limit_low,base_low,base_middle,dpltype,limit_high,base_high
|
|
||||||
{
|
|
||||||
.limit_low dw 0
|
|
||||||
.base_low dw 0
|
|
||||||
.base_middle db 0
|
|
||||||
.dpltype db 0
|
|
||||||
.limit_high db 0
|
|
||||||
.base_high db 0
|
|
||||||
.sizeof = $ - .limit_low
|
|
||||||
}
|
|
||||||
virtual at 0
|
|
||||||
descriptor descriptor ?,?,?,?,?,?
|
|
||||||
end virtual
|
|
||||||
|
|
||||||
free equ 0 ;Reference quand libre
|
free equ 0 ;Reference quand libre
|
||||||
|
memorystart equ 0052h ;premier bloc de la mémoire
|
||||||
macro exporting
|
|
||||||
{
|
|
||||||
exports:
|
|
||||||
}
|
|
||||||
|
|
||||||
macro importing
|
|
||||||
{
|
|
||||||
imports:
|
|
||||||
}
|
|
||||||
|
|
||||||
macro noimporting
|
|
||||||
{
|
|
||||||
imports:
|
|
||||||
ende
|
|
||||||
}
|
|
||||||
|
|
||||||
macro noexporting
|
|
||||||
{
|
|
||||||
imports:
|
|
||||||
ende
|
|
||||||
}
|
|
||||||
|
|
||||||
macro ende
|
|
||||||
{
|
|
||||||
dd 0
|
|
||||||
}
|
|
||||||
|
|
||||||
macro endi
|
|
||||||
{
|
|
||||||
dd 0
|
|
||||||
}
|
|
||||||
|
|
||||||
macro use lib*,fonction*
|
|
||||||
{
|
|
||||||
db `lib,"::",`fonction,0
|
|
||||||
fonction:
|
|
||||||
dd 0
|
|
||||||
dw 0
|
|
||||||
}
|
|
||||||
|
|
||||||
macro declare fonction*
|
|
||||||
{
|
|
||||||
db `fonction,0
|
|
||||||
dw fonction
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
; Macroinstructions for defining and calling procedures
|
|
||||||
|
|
||||||
macro stdcall proc,[arg] ; directly call STDCALL procedure
|
|
||||||
{
|
|
||||||
common
|
|
||||||
size@ccall = 0
|
|
||||||
if ~ arg eq
|
|
||||||
reverse
|
|
||||||
push arg
|
|
||||||
size@ccall = size@ccall+2
|
|
||||||
common
|
|
||||||
end if
|
|
||||||
push cs
|
|
||||||
call proc
|
|
||||||
}
|
|
||||||
|
|
||||||
macro invoke proc,[arg] ; directly call STDCALL procedure
|
|
||||||
{
|
|
||||||
common
|
|
||||||
size@ccall = 0
|
|
||||||
if ~ arg eq
|
|
||||||
reverse
|
|
||||||
push arg
|
|
||||||
size@ccall = size@ccall+2
|
|
||||||
common
|
|
||||||
end if
|
|
||||||
call far [cs:proc] }
|
|
||||||
|
|
||||||
macro proc [args] ; define procedure
|
|
||||||
{ common
|
|
||||||
match name params, args>
|
|
||||||
\{ define@proc name,<params \} }
|
|
||||||
|
|
||||||
prologue@proc equ prologuedef
|
|
||||||
|
|
||||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
|
||||||
{ if parmbytes | localbytes
|
|
||||||
push bp
|
|
||||||
mov bp,sp
|
|
||||||
if localbytes
|
|
||||||
sub sp,localbytes
|
|
||||||
end if
|
|
||||||
end if
|
|
||||||
irps reg, reglist \{ push reg \} }
|
|
||||||
|
|
||||||
epilogue@proc equ epiloguedef
|
|
||||||
|
|
||||||
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
|
||||||
{ irps reg, reglist \{ reverse pop reg \}
|
|
||||||
if parmbytes | localbytes
|
|
||||||
leave
|
|
||||||
end if
|
|
||||||
retf parmbytes }
|
|
||||||
|
|
||||||
macro define@proc name,statement
|
|
||||||
{ local params,flag,regs,parmbytes,localbytes,current
|
|
||||||
if used name
|
|
||||||
name:
|
|
||||||
match =stdcall args, statement \{ params equ args
|
|
||||||
flag = 11b \}
|
|
||||||
match =stdcall, statement \{ params equ
|
|
||||||
flag = 11b \}
|
|
||||||
match =params, params \{ params equ statement
|
|
||||||
flag = 0 \}
|
|
||||||
virtual at bp+6
|
|
||||||
match =uses reglist=,args, params \{ regs equ reglist
|
|
||||||
params equ args \}
|
|
||||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
|
||||||
params equ \}
|
|
||||||
match =regs, regs \{ regs equ \}
|
|
||||||
match =,args, params \{ defargs@proc args \}
|
|
||||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
|
||||||
parmbytes = $ - (bp+6)
|
|
||||||
end virtual
|
|
||||||
name # % = parmbytes/2
|
|
||||||
all@vars equ
|
|
||||||
current = 0
|
|
||||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
|
||||||
macro locals
|
|
||||||
\{ virtual at bp-localbytes+current
|
|
||||||
macro label . \\{ deflocal@proc .,:, \\}
|
|
||||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
|
||||||
struc du [val] \\{ \common deflocal@proc .,du,val \\}
|
|
||||||
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
|
||||||
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
|
||||||
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
|
||||||
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
|
|
||||||
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
|
|
||||||
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
|
|
||||||
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
|
|
||||||
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
|
|
||||||
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
|
|
||||||
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
|
|
||||||
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
|
||||||
macro endl
|
|
||||||
\{ purge label
|
|
||||||
restruc db,du,dw,dp,dd,dt,dq
|
|
||||||
restruc rb,rw,rp,rd,rt,rq
|
|
||||||
current = $-(bp-localbytes)
|
|
||||||
end virtual \}
|
|
||||||
macro ret operand
|
|
||||||
\{ match any, operand \\{ retf operand \\}
|
|
||||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
|
||||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
|
||||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
|
||||||
end if \} }
|
|
||||||
|
|
||||||
macro defargs@proc [arg]
|
|
||||||
{ common
|
|
||||||
if ~ arg eq
|
|
||||||
forward
|
|
||||||
local ..arg,current@arg
|
|
||||||
match argname:type, arg
|
|
||||||
\{ current@arg equ argname
|
|
||||||
label ..arg type
|
|
||||||
argname equ ..arg
|
|
||||||
if dqword eq type
|
|
||||||
dw ?,?,?,?,?,?,?,?
|
|
||||||
else if tbyte eq type
|
|
||||||
dw ?,?,?,?,?
|
|
||||||
else if qword eq type | pword eq type
|
|
||||||
dw ?,?,?,?
|
|
||||||
else if dword eq type
|
|
||||||
dw ?,?
|
|
||||||
else
|
|
||||||
dw ?
|
|
||||||
end if \}
|
|
||||||
match =current@arg,current@arg
|
|
||||||
\{ current@arg equ arg
|
|
||||||
arg equ ..arg
|
|
||||||
..arg dw ? \}
|
|
||||||
common
|
|
||||||
args@proc equ current@arg
|
|
||||||
forward
|
|
||||||
restore current@arg
|
|
||||||
common
|
|
||||||
end if }
|
|
||||||
|
|
||||||
macro deflocal@proc name,def,[val]
|
|
||||||
{ common
|
|
||||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
|
||||||
all@vars equ all@vars name
|
|
||||||
forward
|
|
||||||
local ..var,..tmp
|
|
||||||
..var def val
|
|
||||||
match =?, val \{ ..tmp equ \}
|
|
||||||
match any =dup (=?), val \{ ..tmp equ \}
|
|
||||||
match tmp : value, ..tmp : val
|
|
||||||
\{ tmp: end virtual
|
|
||||||
initlocal@proc ..var,def value
|
|
||||||
virtual at tmp\}
|
|
||||||
common
|
|
||||||
match first rest, ..var, \{ name equ first \} }
|
|
||||||
|
|
||||||
macro initlocal@proc name,def
|
|
||||||
{ virtual at name
|
|
||||||
def
|
|
||||||
size@initlocal = $ - name
|
|
||||||
end virtual
|
|
||||||
position@initlocal = 0
|
|
||||||
while size@initlocal > position@initlocal
|
|
||||||
virtual at name
|
|
||||||
def
|
|
||||||
if size@initlocal - position@initlocal < 2
|
|
||||||
current@initlocal = 1
|
|
||||||
load byte@initlocal byte from name+position@initlocal
|
|
||||||
else if size@initlocal - position@initlocal < 4
|
|
||||||
current@initlocal = 2
|
|
||||||
load word@initlocal word from name+position@initlocal
|
|
||||||
else
|
|
||||||
current@initlocal = 4
|
|
||||||
load dword@initlocal dword from name+position@initlocal
|
|
||||||
end if
|
|
||||||
end virtual
|
|
||||||
if current@initlocal = 1
|
|
||||||
mov byte [name+position@initlocal],byte@initlocal
|
|
||||||
else if current@initlocal = 2
|
|
||||||
mov word [name+position@initlocal],word@initlocal
|
|
||||||
else
|
|
||||||
mov dword [name+position@initlocal],dword@initlocal
|
|
||||||
end if
|
|
||||||
position@initlocal = position@initlocal + current@initlocal
|
|
||||||
end while }
|
|
||||||
|
|
||||||
macro endp
|
|
||||||
{ purge ret,locals,endl
|
|
||||||
finish@proc
|
|
||||||
purge finish@proc
|
|
||||||
restore regs@proc
|
|
||||||
match all,args@proc \{ restore all \}
|
|
||||||
restore args@proc
|
|
||||||
match all,all@vars \{ restore all \} }
|
|
||||||
|
|
||||||
macro local [var]
|
|
||||||
{ common
|
|
||||||
locals
|
|
||||||
forward done@local equ
|
|
||||||
match varname[count]:vartype, var
|
|
||||||
\{ match =BYTE, vartype \\{ varname rb count
|
|
||||||
restore done@local \\}
|
|
||||||
match =WORD, vartype \\{ varname rw count
|
|
||||||
restore done@local \\}
|
|
||||||
match =DWORD, vartype \\{ varname rd count
|
|
||||||
restore done@local \\}
|
|
||||||
match =PWORD, vartype \\{ varname rp count
|
|
||||||
restore done@local \\}
|
|
||||||
match =QWORD, vartype \\{ varname rq count
|
|
||||||
restore done@local \\}
|
|
||||||
match =TBYTE, vartype \\{ varname rt count
|
|
||||||
restore done@local \\}
|
|
||||||
match =DQWORD, vartype \\{ label varname dqword
|
|
||||||
rq count+count
|
|
||||||
restore done@local \\}
|
|
||||||
match , done@local \\{ virtual
|
|
||||||
varname vartype
|
|
||||||
end virtual
|
|
||||||
rb count*sizeof.\#vartype
|
|
||||||
restore done@local \\} \}
|
|
||||||
match :varname:vartype, done@local:var
|
|
||||||
\{ match =BYTE, vartype \\{ varname db ?
|
|
||||||
restore done@local \\}
|
|
||||||
match =WORD, vartype \\{ varname dw ?
|
|
||||||
restore done@local \\}
|
|
||||||
match =DWORD, vartype \\{ varname dd ?
|
|
||||||
restore done@local \\}
|
|
||||||
match =PWORD, vartype \\{ varname dp ?
|
|
||||||
restore done@local \\}
|
|
||||||
match =QWORD, vartype \\{ varname dq ?
|
|
||||||
restore done@local \\}
|
|
||||||
match =TBYTE, vartype \\{ varname dt ?
|
|
||||||
restore done@local \\}
|
|
||||||
match =DQWORD, vartype \\{ label varname dqword
|
|
||||||
dq ?,?
|
|
||||||
restore done@local \\}
|
|
||||||
match , done@local \\{ varname vartype
|
|
||||||
restore done@local \\} \}
|
|
||||||
match ,done@local
|
|
||||||
\{ var
|
|
||||||
restore done@local \}
|
|
||||||
common
|
|
||||||
endl }
|
|
||||||
|
@ -1,34 +1,29 @@
|
|||||||
struc pcidata
|
struc pcidata
|
||||||
{
|
vendor dw 0 ;vendor ID (read-only), FFFFh returned if requested device non-existent
|
||||||
.vendor dw 0 ;vendor ID (read-only), FFFFh returned if requested device non-existent
|
device dw 0 ;device ID (read-only)
|
||||||
.device dw 0 ;device ID (read-only)
|
command dw 0 ;command register
|
||||||
.command dw 0 ;command register
|
status dw 0 ;status register
|
||||||
.status dw 0 ;status register
|
revision db 0 ;revision ID
|
||||||
.revision db 0 ;revision ID
|
interface db 0 ;programming interface
|
||||||
.interface db 0 ;programming interface
|
subclass db 0 ;sub-class
|
||||||
.subclass db 0 ;sub-class
|
class db 0 ;class code
|
||||||
.class db 0 ;class code
|
cache db 0 ;cache line size
|
||||||
.cache db 0 ;cache line size
|
timer db 0 ;latency timer
|
||||||
.timer db 0 ;latency timer
|
typed db 0 ;header type
|
||||||
.typed db 0 ;header type
|
|
||||||
;bits 6-0: header format
|
;bits 6-0: header format
|
||||||
;00h other
|
;00h other
|
||||||
;01h PCI-to-PCI bridge
|
;01h PCI-to-PCI bridge
|
||||||
;02h PCI-to-CardBus bridge
|
;02h PCI-to-CardBus bridge
|
||||||
;bit 7: multi-function device
|
;bit 7: multi-function device
|
||||||
.result db 0 ;Built-In Self-Test result
|
result db 0 ;Built-In Self-Test result
|
||||||
}
|
ends pcidata
|
||||||
virtual at 0
|
|
||||||
pcidata pcidata
|
|
||||||
end virtual
|
|
||||||
|
|
||||||
struc pciinf
|
struc pciinf
|
||||||
{
|
version_major db 0
|
||||||
.version_major db 0
|
version_minor db 0
|
||||||
.version_minor db 0
|
types db 0
|
||||||
.types db 0
|
maxbus db 0
|
||||||
.maxbus db 0
|
ends pciinf
|
||||||
}
|
|
||||||
|
|
||||||
multifunction equ 80h
|
multifunction equ 80h
|
||||||
othercard equ 00h
|
othercard equ 00h
|
||||||
|
20
install/MAKEFILE
Normal file
20
install/MAKEFILE
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
asm= lzasm
|
||||||
|
lnk= elink
|
||||||
|
|
||||||
|
all: setup.com
|
||||||
|
|
||||||
|
setup.com: setup.obj
|
||||||
|
$(lnk) setup.obj setup.com
|
||||||
|
|
||||||
|
setup.obj:
|
||||||
|
$(asm) setup.asm
|
||||||
|
|
||||||
|
clean:
|
||||||
|
del *.obj
|
||||||
|
del *.exe
|
||||||
|
del *.bak
|
||||||
|
del *.lib
|
||||||
|
del *.com
|
||||||
|
del *.bin
|
||||||
|
del *.sys
|
||||||
|
del *.err
|
164
install/setup.asm
Normal file
164
install/setup.asm
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
model tiny,stdcall
|
||||||
|
p486
|
||||||
|
locals
|
||||||
|
jumps
|
||||||
|
codeseg
|
||||||
|
option procalign:byte
|
||||||
|
|
||||||
|
org 0100h
|
||||||
|
|
||||||
|
ent equ 32h
|
||||||
|
|
||||||
|
jmp copycos
|
||||||
|
|
||||||
|
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,'$'
|
||||||
|
ok db 0Dh,0AH,'COS2000 a ete correctement installe, veuillez redemarrer votre PC',0Dh,0AH,'$'
|
||||||
|
files db '*.*',0
|
||||||
|
boot db 'boot.bin',0
|
||||||
|
dat db 'data',0
|
||||||
|
retu db 0Dh,0AH,'$'
|
||||||
|
dta db 43 dup (0)
|
||||||
|
|
||||||
|
copycos:
|
||||||
|
mov ah,9
|
||||||
|
mov dx,offset message
|
||||||
|
int 21h
|
||||||
|
xor ax,ax
|
||||||
|
int 16h
|
||||||
|
mov ah,4ah
|
||||||
|
mov bx,1000h
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
mov ah,48h
|
||||||
|
mov bx,65536/16
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
mov fs,ax
|
||||||
|
mov ah,3Bh
|
||||||
|
mov dx,offset dat
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
mov ah,1Ah
|
||||||
|
mov dx,offset dta
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
mov ah,4eh
|
||||||
|
xor cx,cx
|
||||||
|
mov dx,offset files
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
mov ah,09
|
||||||
|
mov dx,offset message3
|
||||||
|
int 21h
|
||||||
|
allfile:
|
||||||
|
mov [byte ptr offset dta+43],'$'
|
||||||
|
mov ah,9
|
||||||
|
mov dx,offset dta+30
|
||||||
|
int 21h
|
||||||
|
push dx
|
||||||
|
mov ah,09
|
||||||
|
mov dx,offset retu
|
||||||
|
int 21h
|
||||||
|
pop dx
|
||||||
|
mov ax,3D00h
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
mov bx,ax
|
||||||
|
mov ax,4202h
|
||||||
|
xor cx,cx
|
||||||
|
xor dx,dx
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
cmp dx,0
|
||||||
|
jne error
|
||||||
|
cmp ax,0
|
||||||
|
je error
|
||||||
|
mov bp,ax
|
||||||
|
mov ax,4200h
|
||||||
|
xor cx,cx
|
||||||
|
xor dx,dx
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
push fs
|
||||||
|
pop ds
|
||||||
|
mov ah,3fh
|
||||||
|
mov cx,0FFFFh
|
||||||
|
xor dx,dx
|
||||||
|
int 21h
|
||||||
|
push cs
|
||||||
|
pop ds
|
||||||
|
jc error
|
||||||
|
mov ah,3eh
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
mov ah,3ch
|
||||||
|
push cs
|
||||||
|
pop es
|
||||||
|
mov di,offset dta+30-3
|
||||||
|
mov [word ptr di],":a"
|
||||||
|
mov [byte ptr di+2],"\"
|
||||||
|
xor cx,cx
|
||||||
|
mov dx,di
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
mov bx,ax
|
||||||
|
push fs
|
||||||
|
pop ds
|
||||||
|
xor dx,dx
|
||||||
|
mov ah,40h
|
||||||
|
mov cx,bp
|
||||||
|
int 21h
|
||||||
|
push cs
|
||||||
|
pop ds
|
||||||
|
jc error
|
||||||
|
mov ah,3eh
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
mov ah,4fh
|
||||||
|
int 21h
|
||||||
|
jnc allfile
|
||||||
|
mov ah,09
|
||||||
|
mov dx,offset message2
|
||||||
|
int 21h
|
||||||
|
mov ax,3D00h
|
||||||
|
mov dx,offset boot
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
push fs
|
||||||
|
pop ds
|
||||||
|
mov ah,3fh
|
||||||
|
mov cx,0FFFFh
|
||||||
|
xor dx,dx
|
||||||
|
int 21h
|
||||||
|
push cs
|
||||||
|
pop ds
|
||||||
|
jc error
|
||||||
|
mov ah,3eh
|
||||||
|
int 21h
|
||||||
|
jc error
|
||||||
|
push fs
|
||||||
|
pop es
|
||||||
|
mov ax,0301h
|
||||||
|
mov dx,0
|
||||||
|
mov cx,0001h
|
||||||
|
xor bx,bx
|
||||||
|
int 13h
|
||||||
|
mov ah,09
|
||||||
|
mov dx,offset ok
|
||||||
|
int 21h
|
||||||
|
xor ax,ax
|
||||||
|
int 16h
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
error:
|
||||||
|
mov ah,09
|
||||||
|
mov dx,offset errormsg
|
||||||
|
int 21h
|
||||||
|
xor ax,ax
|
||||||
|
int 16h
|
||||||
|
ret
|
||||||
|
|
BIN
install/setup.sh
Executable file
BIN
install/setup.sh
Executable file
Binary file not shown.
121
install/winNT gui/setup.bpr
Normal file
121
install/winNT gui/setup.bpr
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8' ?>
|
||||||
|
<!-- C++Builder XML Project -->
|
||||||
|
<PROJECT>
|
||||||
|
<MACROS>
|
||||||
|
<VERSION value="BCB.06.00"/>
|
||||||
|
<PROJECT value="setup.exe"/>
|
||||||
|
<OBJFILES value="setup.obj Unit1.obj"/>
|
||||||
|
<RESFILES value="setup.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
|
||||||
|
vcldbx.bpi ibxpress.bpi dsnap.bpi cds.bpi bdecds.bpi qrpt.bpi teeui.bpi
|
||||||
|
teedb.bpi tee.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 pop.bpi IcsBcb50.bpi bcbshlctrls.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="setup.cpp"/>
|
||||||
|
<INCLUDEPATH value="E:\CBuilder6\Projects;"C:\Documents and Settings\niko\Bureau\Nouveau dossier";$(BCB)\include;$(BCB)\include\vcl"/>
|
||||||
|
<LIBPATH value="E:\CBuilder6\Projects;"C:\Documents and Settings\niko\Bureau\Nouveau dossier";$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib"/>
|
||||||
|
<WARNINGS value="-w-par"/>
|
||||||
|
<OTHERFILES value=""/>
|
||||||
|
</MACROS>
|
||||||
|
<OPTIONS>
|
||||||
|
<IDLCFLAGS value="-IE:\CBuilder6\Projects
|
||||||
|
-I"C:\Documents and Settings\niko\Bureau\Nouveau dossier" -I$(BCB)\include
|
||||||
|
-I$(BCB)\include\vcl -src_suffix cpp -boa"/>
|
||||||
|
<CFLAG1 value="-O2 -H=$(BCB)\lib\vcl60.csm -Hc -w- -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"" -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="setup.res" FORMNAME="" UNITNAME="setup.res" CONTAINERID="ResTool" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||||
|
<FILE FILENAME="setup.cpp" FORMNAME="" UNITNAME="setup" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||||
|
<FILE FILENAME="Unit1.cpp" FORMNAME="Form1" UNITNAME="Unit1" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||||
|
</FILELIST>
|
||||||
|
<BUILDTOOLS>
|
||||||
|
</BUILDTOOLS>
|
||||||
|
|
||||||
|
<IDEOPTIONS>
|
||||||
|
[Version Info]
|
||||||
|
IncludeVerInfo=0
|
||||||
|
AutoIncBuild=0
|
||||||
|
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=
|
||||||
|
FileDescription=
|
||||||
|
FileVersion=1.0.0.0
|
||||||
|
InternalName=
|
||||||
|
LegalCopyright=
|
||||||
|
LegalTrademarks=
|
||||||
|
OriginalFilename=
|
||||||
|
ProductName=
|
||||||
|
ProductVersion=1.0.0.0
|
||||||
|
Comments=
|
||||||
|
|
||||||
|
[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
|
||||||
|
|
||||||
|
[Language]
|
||||||
|
ActiveLang=
|
||||||
|
ProjectLang=
|
||||||
|
RootDir=
|
||||||
|
</IDEOPTIONS>
|
||||||
|
</PROJECT>
|
33
install/winNT gui/setup.cpp
Normal file
33
install/winNT gui/setup.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <vcl.h>
|
||||||
|
#pragma hdrstop
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
USEFORM("Unit1.cpp", Form1);
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Application->Initialize();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
BIN
install/winNT gui/setup.res
Normal file
BIN
install/winNT gui/setup.res
Normal file
Binary file not shown.
BIN
install/winNT gui/setup.tds
Normal file
BIN
install/winNT gui/setup.tds
Normal file
Binary file not shown.
166
install/winNT gui/unit1.cpp
Normal file
166
install/winNT gui/unit1.cpp
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <vcl.h>
|
||||||
|
#include <winioctl.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <dir.h>
|
||||||
|
#pragma hdrstop
|
||||||
|
|
||||||
|
#include "Unit1.h"
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#pragma package(smart_init)
|
||||||
|
#pragma resource "*.dfm"
|
||||||
|
TForm1 *Form1;
|
||||||
|
HANDLE hDrive;
|
||||||
|
DISK_GEOMETRY dg_flop_geom;
|
||||||
|
AnsiString lecteur="b:";
|
||||||
|
AnsiString device="\\\\.\\"+lecteur;
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
__fastcall TForm1::TForm1(TComponent* Owner)
|
||||||
|
: TForm(Owner)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
char * GetLastErrorString(void)
|
||||||
|
{
|
||||||
|
LPVOID lpMsgBuf;
|
||||||
|
|
||||||
|
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
|
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
(LPTSTR) &lpMsgBuf, 0, NULL);
|
||||||
|
|
||||||
|
return (char *)lpMsgBuf;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
ShowMessages(AnsiString msg)
|
||||||
|
{
|
||||||
|
Form1->Memo1->Lines->Add(msg);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TForm1::FormShow(TObject *Sender)
|
||||||
|
{
|
||||||
|
DWORD dwNotUsed;
|
||||||
|
DWORD error=0;
|
||||||
|
|
||||||
|
hDrive = CreateFile(device.c_str(), GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);
|
||||||
|
ShowMessages("Ouverture du peripherique "+lecteur);
|
||||||
|
if (hDrive == INVALID_HANDLE_VALUE) {
|
||||||
|
ShowMessages("Erreur : "+AnsiString(GetLastErrorString()));
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if(error!=1&&ShowMessages("Determination de la geometrie ")&&DeviceIoControl(hDrive, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL,0, &dg_flop_geom, sizeof(dg_flop_geom),&dwNotUsed, NULL) == FALSE) {
|
||||||
|
ShowMessages("Erreur : "+AnsiString(GetLastErrorString()));
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if(error!=1&&(dg_flop_geom.MediaType==FixedMedia||dg_flop_geom.MediaType==RemovableMedia||dg_flop_geom.MediaType==Unknown))
|
||||||
|
{
|
||||||
|
ShowMessages("Erreur : Ceci n'est pas une disquette !");
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1&&ShowMessages("Positionnement sur le secteur 0")&&SetFilePointer(hDrive, 0, NULL, FILE_BEGIN) == -1) {
|
||||||
|
ShowMessages("Erreur : "+AnsiString(GetLastErrorString()));
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1)
|
||||||
|
{
|
||||||
|
drive->Caption=lecteur.UpperCase();
|
||||||
|
track->Caption=IntToStr(dg_flop_geom.Cylinders.LowPart);
|
||||||
|
sector->Caption=IntToStr(dg_flop_geom.SectorsPerTrack);
|
||||||
|
size->Caption=IntToStr(dg_flop_geom.BytesPerSector);
|
||||||
|
head->Caption=IntToStr(dg_flop_geom.TracksPerCylinder);
|
||||||
|
allsize->Caption=IntToStr(dg_flop_geom.BytesPerSector*dg_flop_geom.Cylinders.LowPart*dg_flop_geom.SectorsPerTrack*dg_flop_geom.TracksPerCylinder);
|
||||||
|
allsector->Caption=IntToStr(dg_flop_geom.Cylinders.LowPart*dg_flop_geom.SectorsPerTrack*dg_flop_geom.TracksPerCylinder);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CloseHandle(hDrive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TForm1::Button1Click(TObject *Sender)
|
||||||
|
{
|
||||||
|
if (hDrive == NULL||dg_flop_geom.TracksPerCylinder>2||dg_flop_geom.TracksPerCylinder==0)
|
||||||
|
|
||||||
|
{
|
||||||
|
ShowMessages("Aucun support valide detecté !");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int fdboot;
|
||||||
|
DWORD error=0;
|
||||||
|
DWORD dwBsWritten;
|
||||||
|
char * buffer;
|
||||||
|
AnsiString bootfile="data/boot.bin";
|
||||||
|
ShowMessages("Allocation de mémoire ");
|
||||||
|
buffer = (char *)malloc(dg_flop_geom.BytesPerSector);
|
||||||
|
ShowMessages("Ouverture et installation du fichier de boot "+bootfile);
|
||||||
|
if ((fdboot = _rtl_open(bootfile.c_str(),O_RDONLY | O_BINARY)) == -1 )
|
||||||
|
{
|
||||||
|
ShowMessages("Erreur : Fichier de boot introuvable");
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1&&_read(fdboot, buffer, dg_flop_geom.BytesPerSector)!= dg_flop_geom.BytesPerSector)
|
||||||
|
{
|
||||||
|
ShowMessages("Erreur : Fichier de boot de taille incorrecte !");
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1&&WriteFile(hDrive, buffer, dg_flop_geom.BytesPerSector, &dwBsWritten, NULL) == 0)
|
||||||
|
{
|
||||||
|
ShowMessages("Ecriture impossible sur le secteur de boot !");
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
_rtl_close(fdboot);
|
||||||
|
if (error!=1)
|
||||||
|
{
|
||||||
|
struct ffblk files;
|
||||||
|
int done;
|
||||||
|
int number=0;
|
||||||
|
ShowMessages("Détermination des fichiers a copier");
|
||||||
|
done = findfirst("data/*.*",&files,0);
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
number++;
|
||||||
|
done = findnext(&files);
|
||||||
|
}
|
||||||
|
install->Max=number;
|
||||||
|
install->Min=0;
|
||||||
|
install->Position=0;
|
||||||
|
ShowMessages("Copie des fichiers de cos2000");
|
||||||
|
done = findfirst("data/*.*",&files,0);
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
ShowMessages(AnsiString(files.ff_name).LowerCase());
|
||||||
|
if (!CopyFile((AnsiString("data/")+AnsiString(files.ff_name)).c_str(),(lecteur+"\\"+AnsiString(files.ff_name)).c_str(),false))
|
||||||
|
{
|
||||||
|
ShowMessages("Erreur : fichier impossible a copier"+AnsiString(GetLastErrorString()));
|
||||||
|
error=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
done = findnext(&files);
|
||||||
|
install->Position++;
|
||||||
|
}
|
||||||
|
if (!error)
|
||||||
|
{
|
||||||
|
ShowMessages("Installation terminée !");
|
||||||
|
Button2->Visible=false;
|
||||||
|
Button1->Visible=false;
|
||||||
|
Button3->Visible=true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ShowMessages("Installation echoué !");
|
||||||
|
}
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
|
||||||
|
{
|
||||||
|
CloseHandle(hDrive);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
void __fastcall TForm1::Button3Click(TObject *Sender)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
BIN
install/winNT gui/unit1.ddp
Normal file
BIN
install/winNT gui/unit1.ddp
Normal file
Binary file not shown.
184
install/winNT gui/unit1.dfm
Normal file
184
install/winNT gui/unit1.dfm
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
object Form1: TForm1
|
||||||
|
Left = 418
|
||||||
|
Top = 273
|
||||||
|
Width = 599
|
||||||
|
Height = 371
|
||||||
|
Caption = 'Installation de COS2000'
|
||||||
|
Color = clBtnFace
|
||||||
|
Font.Charset = DEFAULT_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'MS Sans Serif'
|
||||||
|
Font.Style = []
|
||||||
|
OldCreateOrder = False
|
||||||
|
Position = poScreenCenter
|
||||||
|
OnClose = FormClose
|
||||||
|
OnShow = FormShow
|
||||||
|
PixelsPerInch = 96
|
||||||
|
TextHeight = 13
|
||||||
|
object Button1: TButton
|
||||||
|
Left = 288
|
||||||
|
Top = 304
|
||||||
|
Width = 75
|
||||||
|
Height = 25
|
||||||
|
Caption = 'installer...'
|
||||||
|
TabOrder = 0
|
||||||
|
OnClick = Button1Click
|
||||||
|
end
|
||||||
|
object install: TProgressBar
|
||||||
|
Left = 16
|
||||||
|
Top = 264
|
||||||
|
Width = 553
|
||||||
|
Height = 25
|
||||||
|
Min = 0
|
||||||
|
Max = 100
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object Button2: TButton
|
||||||
|
Left = 208
|
||||||
|
Top = 304
|
||||||
|
Width = 75
|
||||||
|
Height = 25
|
||||||
|
Caption = 'support'
|
||||||
|
TabOrder = 2
|
||||||
|
OnClick = FormShow
|
||||||
|
end
|
||||||
|
object Memo1: TMemo
|
||||||
|
Left = 192
|
||||||
|
Top = 24
|
||||||
|
Width = 377
|
||||||
|
Height = 225
|
||||||
|
ReadOnly = True
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
object GroupBox1: TGroupBox
|
||||||
|
Left = 16
|
||||||
|
Top = 120
|
||||||
|
Width = 161
|
||||||
|
Height = 129
|
||||||
|
Caption = 'G'#233'om'#233'trie'
|
||||||
|
Font.Charset = DEFAULT_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'MS Sans Serif'
|
||||||
|
Font.Style = []
|
||||||
|
ParentFont = False
|
||||||
|
TabOrder = 4
|
||||||
|
object track: TLabel
|
||||||
|
Left = 96
|
||||||
|
Top = 60
|
||||||
|
Width = 31
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Aucun'
|
||||||
|
end
|
||||||
|
object Label4: TLabel
|
||||||
|
Left = 24
|
||||||
|
Top = 60
|
||||||
|
Width = 34
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Pistes :'
|
||||||
|
end
|
||||||
|
object Label5: TLabel
|
||||||
|
Left = 24
|
||||||
|
Top = 28
|
||||||
|
Width = 48
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Secteurs :'
|
||||||
|
end
|
||||||
|
object sector: TLabel
|
||||||
|
Left = 96
|
||||||
|
Top = 28
|
||||||
|
Width = 31
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Aucun'
|
||||||
|
end
|
||||||
|
object head: TLabel
|
||||||
|
Left = 96
|
||||||
|
Top = 44
|
||||||
|
Width = 31
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Aucun'
|
||||||
|
end
|
||||||
|
object Label6: TLabel
|
||||||
|
Left = 24
|
||||||
|
Top = 44
|
||||||
|
Width = 33
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Tetes :'
|
||||||
|
end
|
||||||
|
object Label8: TLabel
|
||||||
|
Left = 24
|
||||||
|
Top = 84
|
||||||
|
Width = 69
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Taille secteur :'
|
||||||
|
end
|
||||||
|
object size: TLabel
|
||||||
|
Left = 96
|
||||||
|
Top = 84
|
||||||
|
Width = 31
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Aucun'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object GroupBox2: TGroupBox
|
||||||
|
Left = 16
|
||||||
|
Top = 16
|
||||||
|
Width = 161
|
||||||
|
Height = 97
|
||||||
|
Caption = 'Support'
|
||||||
|
TabOrder = 5
|
||||||
|
object Label1: TLabel
|
||||||
|
Left = 24
|
||||||
|
Top = 24
|
||||||
|
Width = 42
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Lecteur :'
|
||||||
|
end
|
||||||
|
object drive: TLabel
|
||||||
|
Left = 88
|
||||||
|
Top = 24
|
||||||
|
Width = 31
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Aucun'
|
||||||
|
end
|
||||||
|
object Label2: TLabel
|
||||||
|
Left = 24
|
||||||
|
Top = 40
|
||||||
|
Width = 31
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Taille :'
|
||||||
|
end
|
||||||
|
object allsize: TLabel
|
||||||
|
Left = 88
|
||||||
|
Top = 40
|
||||||
|
Width = 31
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Aucun'
|
||||||
|
end
|
||||||
|
object Label3: TLabel
|
||||||
|
Left = 24
|
||||||
|
Top = 56
|
||||||
|
Width = 58
|
||||||
|
Height = 13
|
||||||
|
Caption = 'N'#176'secteurs :'
|
||||||
|
end
|
||||||
|
object allsector: TLabel
|
||||||
|
Left = 88
|
||||||
|
Top = 56
|
||||||
|
Width = 31
|
||||||
|
Height = 13
|
||||||
|
Caption = 'Aucun'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Button3: TButton
|
||||||
|
Left = 248
|
||||||
|
Top = 304
|
||||||
|
Width = 75
|
||||||
|
Height = 25
|
||||||
|
Caption = 'Quitter'
|
||||||
|
TabOrder = 6
|
||||||
|
Visible = False
|
||||||
|
OnClick = Button3Click
|
||||||
|
end
|
||||||
|
end
|
47
install/winNT gui/unit1.h
Normal file
47
install/winNT gui/unit1.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef Unit1H
|
||||||
|
#define Unit1H
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#include <Classes.hpp>
|
||||||
|
#include <Controls.hpp>
|
||||||
|
#include <StdCtrls.hpp>
|
||||||
|
#include <Forms.hpp>
|
||||||
|
#include <ComCtrls.hpp>
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
class TForm1 : public TForm
|
||||||
|
{
|
||||||
|
__published: // IDE-managed Components
|
||||||
|
TButton *Button1;
|
||||||
|
TProgressBar *install;
|
||||||
|
TButton *Button2;
|
||||||
|
TMemo *Memo1;
|
||||||
|
TGroupBox *GroupBox1;
|
||||||
|
TLabel *track;
|
||||||
|
TLabel *Label4;
|
||||||
|
TLabel *Label5;
|
||||||
|
TLabel *sector;
|
||||||
|
TLabel *head;
|
||||||
|
TLabel *Label6;
|
||||||
|
TLabel *Label8;
|
||||||
|
TLabel *size;
|
||||||
|
TGroupBox *GroupBox2;
|
||||||
|
TLabel *Label1;
|
||||||
|
TLabel *drive;
|
||||||
|
TLabel *Label2;
|
||||||
|
TLabel *allsize;
|
||||||
|
TLabel *Label3;
|
||||||
|
TLabel *allsector;
|
||||||
|
TButton *Button3;
|
||||||
|
void __fastcall FormShow(TObject *Sender);
|
||||||
|
void __fastcall Button1Click(TObject *Sender);
|
||||||
|
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
|
||||||
|
void __fastcall Button3Click(TObject *Sender);
|
||||||
|
private: // User declarations
|
||||||
|
public: // User declarations
|
||||||
|
__fastcall TForm1(TComponent* Owner);
|
||||||
|
};
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
extern PACKAGE TForm1 *Form1;
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#endif
|
4
install/winNT/setup.bpf
Normal file
4
install/winNT/setup.bpf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
This file is used by the project manager only and should be treated like the project file
|
||||||
|
|
||||||
|
|
||||||
|
main
|
120
install/winNT/setup.bpr
Normal file
120
install/winNT/setup.bpr
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8' ?>
|
||||||
|
<!-- C++Builder XML Project -->
|
||||||
|
<PROJECT>
|
||||||
|
<MACROS>
|
||||||
|
<VERSION value="BCB.06.00"/>
|
||||||
|
<PROJECT value="setup.exe"/>
|
||||||
|
<OBJFILES value="Unit1.obj"/>
|
||||||
|
<RESFILES value="Setup.res"/>
|
||||||
|
<IDLFILES value=""/>
|
||||||
|
<IDLGENFILES value=""/>
|
||||||
|
<DEFFILE value=""/>
|
||||||
|
<RESDEPEN value="$(RESFILES)"/>
|
||||||
|
<LIBFILES value=""/>
|
||||||
|
<LIBRARIES value=""/>
|
||||||
|
<SPARELIBS value=""/>
|
||||||
|
<PACKAGES value="vcl.bpi rtl.bpi dbrtl.bpi adortl.bpi vcldb.bpi vclx.bpi bdertl.bpi
|
||||||
|
vcldbx.bpi ibxpress.bpi dsnap.bpi cds.bpi bdecds.bpi qrpt.bpi teeui.bpi
|
||||||
|
teedb.bpi tee.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 pop.bpi IcsBcb50.bpi bcbshlctrls.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="NO_STRICT;_NO_VCL;_RTLDLL"/>
|
||||||
|
<MAINSOURCE value="Setup.bpf"/>
|
||||||
|
<INCLUDEPATH value=""..\Nouveau dossier (2)";$(BCB)\include;$(BCB)\include\vcl"/>
|
||||||
|
<LIBPATH value=""..\Nouveau dossier (2)";$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib"/>
|
||||||
|
<WARNINGS value="-w-par"/>
|
||||||
|
<OTHERFILES value=""/>
|
||||||
|
</MACROS>
|
||||||
|
<OPTIONS>
|
||||||
|
<IDLCFLAGS value="-I"..\Nouveau dossier (2)" -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 -tWC -tWM- -c"/>
|
||||||
|
<PFLAGS value="-$Y- -$L- -$D- -$A8 -v -JPHNE -M"/>
|
||||||
|
<RFLAGS value=""/>
|
||||||
|
<AFLAGS value="/mx /w2 /zn"/>
|
||||||
|
<LFLAGS value="-D"" -ap -Tpe -x -Gn"/>
|
||||||
|
<OTHERFILES value=""/>
|
||||||
|
</OPTIONS>
|
||||||
|
<LINKER>
|
||||||
|
<ALLOBJ value="c0x32.obj $(OBJFILES)"/>
|
||||||
|
<ALLRES value="$(RESFILES)"/>
|
||||||
|
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32i.lib"/>
|
||||||
|
<OTHERFILES value=""/>
|
||||||
|
</LINKER>
|
||||||
|
<FILELIST>
|
||||||
|
<FILE FILENAME="Setup.res" FORMNAME="" UNITNAME="Setup.res" CONTAINERID="ResTool" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||||
|
<FILE FILENAME="Setup.bpf" FORMNAME="" UNITNAME="Setup" CONTAINERID="BPF" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||||
|
<FILE FILENAME="Unit1.cpp" FORMNAME="" UNITNAME="Unit1" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
|
||||||
|
</FILELIST>
|
||||||
|
<BUILDTOOLS>
|
||||||
|
</BUILDTOOLS>
|
||||||
|
|
||||||
|
<IDEOPTIONS>
|
||||||
|
[Version Info]
|
||||||
|
IncludeVerInfo=0
|
||||||
|
AutoIncBuild=0
|
||||||
|
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=
|
||||||
|
FileDescription=
|
||||||
|
FileVersion=1.0.0.0
|
||||||
|
InternalName=
|
||||||
|
LegalCopyright=
|
||||||
|
LegalTrademarks=
|
||||||
|
OriginalFilename=
|
||||||
|
ProductName=
|
||||||
|
ProductVersion=1.0.0.0
|
||||||
|
Comments=
|
||||||
|
|
||||||
|
[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
|
||||||
|
|
||||||
|
[Language]
|
||||||
|
ActiveLang=
|
||||||
|
ProjectLang=
|
||||||
|
RootDir=
|
||||||
|
</IDEOPTIONS>
|
||||||
|
</PROJECT>
|
BIN
install/winNT/setup.res
Normal file
BIN
install/winNT/setup.res
Normal file
Binary file not shown.
BIN
install/winNT/setup.tds
Normal file
BIN
install/winNT/setup.tds
Normal file
Binary file not shown.
135
install/winNT/unit1.cpp
Normal file
135
install/winNT/unit1.cpp
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
//---------------------------------------------------------------------------
|
||||||
|
#include <windows.h>
|
||||||
|
#include <winbase.h>
|
||||||
|
#include <winioctl.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <dir.h>
|
||||||
|
#pragma hdrstop
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
char * GetLastErrorString(void)
|
||||||
|
{
|
||||||
|
LPVOID lpMsgBuf;
|
||||||
|
|
||||||
|
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
|
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
(LPTSTR) &lpMsgBuf, 0, NULL);
|
||||||
|
|
||||||
|
return (char *)lpMsgBuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma argsused
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
DWORD dwNotUsed;
|
||||||
|
DWORD error=0;
|
||||||
|
HANDLE hDrive;
|
||||||
|
DISK_GEOMETRY dg_flop_geom;
|
||||||
|
char lecteur[4]="a:\0";
|
||||||
|
char device[7]="\\\\.\\a:\0";
|
||||||
|
int fdboot;
|
||||||
|
DWORD dwBsWritten;
|
||||||
|
char * buffer;
|
||||||
|
char bootfile[14]="data/boot.bin\0";
|
||||||
|
struct ffblk files;
|
||||||
|
int done;
|
||||||
|
int number=0;
|
||||||
|
char src[80];
|
||||||
|
char dest[80];
|
||||||
|
printf("Installation de COS2000\nInserez une disquette et appuyer sur une touche...\n");
|
||||||
|
getchar();
|
||||||
|
hDrive = CreateFile(device, GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);
|
||||||
|
printf("Ouverture du peripherique %s\n",lecteur);
|
||||||
|
if (hDrive == INVALID_HANDLE_VALUE) {
|
||||||
|
printf("Erreur : %s\n",GetLastErrorString());
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if(error!=1&&printf("Determination de la geometrie \n")&&DeviceIoControl(hDrive, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL,0, &dg_flop_geom, sizeof(dg_flop_geom),&dwNotUsed, NULL) == FALSE) {
|
||||||
|
printf("Erreur : %s\n",GetLastErrorString());
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if(error!=1&&(dg_flop_geom.MediaType==FixedMedia||dg_flop_geom.MediaType==RemovableMedia||dg_flop_geom.MediaType==Unknown))
|
||||||
|
{
|
||||||
|
printf("Erreur : Ceci n'est pas une disquette !\n");
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1&&printf("Positionnement sur le secteur 0\n")&&SetFilePointer(hDrive, 0, NULL, FILE_BEGIN) == -1) {
|
||||||
|
printf("Erreur : %s\n",GetLastErrorString());
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1)
|
||||||
|
{
|
||||||
|
printf("Pistes :%u Secteurs:%u Tetes:%u Taille:%u\n",dg_flop_geom.Cylinders.LowPart,dg_flop_geom.SectorsPerTrack,dg_flop_geom.TracksPerCylinder,dg_flop_geom.BytesPerSector);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CloseHandle(hDrive);
|
||||||
|
}
|
||||||
|
if (hDrive == NULL||dg_flop_geom.TracksPerCylinder>2||dg_flop_geom.TracksPerCylinder==0)
|
||||||
|
{
|
||||||
|
printf("Aucun support valide detecte !");
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1)
|
||||||
|
{
|
||||||
|
printf("Allocation de memoire\n");
|
||||||
|
buffer = (char *)malloc(dg_flop_geom.BytesPerSector);
|
||||||
|
printf("Ouverture et installation du fichier de boot %s\n",bootfile);
|
||||||
|
}
|
||||||
|
if (error!=1&&(fdboot = _rtl_open(bootfile,O_RDONLY | O_BINARY)) == -1 )
|
||||||
|
{
|
||||||
|
printf("Erreur : Fichier de boot introuvable\n");
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1&&_read(fdboot, buffer, dg_flop_geom.BytesPerSector)!= dg_flop_geom.BytesPerSector)
|
||||||
|
{
|
||||||
|
printf("Erreur : Fichier de boot de taille incorrecte !\n");
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1&&WriteFile(hDrive, buffer, dg_flop_geom.BytesPerSector, &dwBsWritten, NULL) == 0)
|
||||||
|
{
|
||||||
|
printf("Ecriture impossible sur le secteur de boot !\n");
|
||||||
|
error=1;
|
||||||
|
}
|
||||||
|
if (error!=1)
|
||||||
|
{
|
||||||
|
_rtl_close(fdboot);
|
||||||
|
printf("Determination des fichiers a copier\n\n");
|
||||||
|
done = findfirst("data\\*.*",&files,0);
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
number++;
|
||||||
|
done = findnext(&files);
|
||||||
|
}
|
||||||
|
printf("Copie des fichiers de cos2000\n");
|
||||||
|
done = findfirst("data\\*.*",&files,0);
|
||||||
|
while (!done)
|
||||||
|
{
|
||||||
|
printf("%s\n",files.ff_name);
|
||||||
|
sprintf(src, "data\\%s",files.ff_name);
|
||||||
|
sprintf(dest, "%s\\%s",lecteur,files.ff_name);
|
||||||
|
if (!CopyFile(src,dest,false))
|
||||||
|
{
|
||||||
|
printf("Erreur : fichier impossible a copier %s\n",GetLastErrorString());
|
||||||
|
error=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
done = findnext(&files);
|
||||||
|
}
|
||||||
|
if (!error)
|
||||||
|
{
|
||||||
|
printf("Installation terminee !\nVeuillez redemarrer votre PC afin de charger le systeme");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Installation echoué !");
|
||||||
|
}
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
getchar();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
1215
lib/3d.asm
1215
lib/3d.asm
File diff suppressed because it is too large
Load Diff
26
lib/MAKEFILE
Normal file
26
lib/MAKEFILE
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
asm= lzasm
|
||||||
|
lnk= elink
|
||||||
|
|
||||||
|
all: detect.lib video.lib
|
||||||
|
|
||||||
|
detect.lib: detect.obj
|
||||||
|
$(lnk) detect.obj detect.lib
|
||||||
|
|
||||||
|
video.lib: video.obj
|
||||||
|
$(lnk) video.obj video.lib
|
||||||
|
|
||||||
|
detect.obj:
|
||||||
|
$(asm) detect.asm
|
||||||
|
|
||||||
|
video.obj:
|
||||||
|
$(asm) video.asm
|
||||||
|
|
||||||
|
clean:
|
||||||
|
del *.obj
|
||||||
|
del *.exe
|
||||||
|
del *.bak
|
||||||
|
del *.lib
|
||||||
|
del *.com
|
||||||
|
del *.bin
|
||||||
|
del *.sys
|
||||||
|
del *.err
|
111
lib/bmp.asm
111
lib/bmp.asm
@ -1,68 +1,77 @@
|
|||||||
use16
|
.model tiny
|
||||||
align 1
|
.486
|
||||||
|
smart
|
||||||
include "..\include\mem.h"
|
locals
|
||||||
include "..\include\divers.h"
|
.code
|
||||||
include "..\include\bmp.h"
|
|
||||||
|
|
||||||
org 0h
|
org 0h
|
||||||
|
|
||||||
header exe 1,exports,imports,0,0
|
include ..\include\mem.h
|
||||||
|
include ..\include\bmp.h
|
||||||
exporting
|
|
||||||
declare showbmp
|
|
||||||
declare loadbmppalet
|
|
||||||
ende
|
|
||||||
|
|
||||||
importing
|
start:
|
||||||
use VIDEO,showpixel
|
header exe <,1,0,,,,offset exports,>
|
||||||
endi
|
|
||||||
|
exports:
|
||||||
|
db "showbmp",0
|
||||||
|
dw showbmp
|
||||||
|
db "loadbmppalet",0
|
||||||
|
dw loadbmppalet
|
||||||
|
dw 0
|
||||||
|
|
||||||
|
|
||||||
;==========SHOWBMP=========
|
;==========SHOWBMP=========
|
||||||
;Affiche le BMP pointée par DS:%0 en %1, %2
|
;Affiche le BMP pointée par DS:%0 en %1, %2
|
||||||
;<- DS:%0 BMP, %1 coordonnées X, %2 coordonnées Y
|
;<- DS:%0 BMP, %1 coordonnées X, %2 coordonnées Y
|
||||||
;->
|
;->
|
||||||
;==========================
|
;==========================
|
||||||
proc showbmp uses ax bx cx dx si di, pointer:word, x:word, y:word
|
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]
|
mov si,[pointer]
|
||||||
virtual at si
|
cmp word ptr [si+BMP_file.BMP_FileType],"MB"
|
||||||
.bmp_file bmp_file
|
jne @@errorshowing
|
||||||
end virtual
|
mov edi,[si+BMP_BitMapOffset]
|
||||||
cmp word [.bmp_file.bmp_filetype],"MB"
|
|
||||||
jne .errorshowing
|
|
||||||
mov edi,[.bmp_file.bmp_bitmapoffset]
|
|
||||||
add di,400h
|
|
||||||
add di,si
|
add di,si
|
||||||
|
mov ah,8
|
||||||
xor ebx,ebx
|
xor ebx,ebx
|
||||||
mov ecx,[.bmp_file.bmp_height]
|
mov ecx,[si+offset BMP_File.BMP_height]
|
||||||
mov edx,[.bmp_file.bmp_width]
|
mov edx,[si+offset BMP_File.BMP_width]
|
||||||
;and dx,11111100b
|
and dx,11111100b
|
||||||
cmp edx,[.bmp_file.bmp_width]
|
cmp edx,[si+offset BMP_File.BMP_width]
|
||||||
;jae .noadjust
|
jae @@noadjust
|
||||||
;add dx,4
|
add dx,4
|
||||||
.noadjust:
|
@@noadjust:
|
||||||
sub edx,[.bmp_file.bmp_width]
|
sub dx,[si+offset BMP_File.BMP_width]
|
||||||
.bouclette:
|
@@bouclette:
|
||||||
|
mov al,[di]
|
||||||
push bx cx
|
push bx cx
|
||||||
add bx,[x]
|
add bx,[x]
|
||||||
add cx,[y]
|
add cx,[y]
|
||||||
invoke showpixel,bx,cx,word [di]
|
int 47h
|
||||||
pop cx bx
|
pop cx bx
|
||||||
inc bx
|
inc bx
|
||||||
inc di
|
inc di
|
||||||
cmp ebx,[.bmp_file.bmp_width]
|
cmp ebx,[si+offset BMP_File.BMP_width]
|
||||||
jb .bouclette
|
jb @@bouclette
|
||||||
xor bx,bx
|
xor bx,bx
|
||||||
;add di,dx
|
add di,dx
|
||||||
dec cx
|
dec cx
|
||||||
cmp cx,0
|
cmp cx,0
|
||||||
jne .bouclette
|
jne @@bouclette
|
||||||
clc
|
clc
|
||||||
ret
|
pop di si dx cx bx ax
|
||||||
.errorshowing:
|
pop bp
|
||||||
|
retf taille
|
||||||
|
|
||||||
|
@@errorshowing:
|
||||||
stc
|
stc
|
||||||
ret
|
pop di si cx bx ax
|
||||||
endp
|
pop bp
|
||||||
|
retf taille
|
||||||
|
|
||||||
|
showbmp ENDP
|
||||||
|
|
||||||
|
|
||||||
;==========LOADBMPPALET=========
|
;==========LOADBMPPALET=========
|
||||||
@ -70,12 +79,16 @@ endp
|
|||||||
;-> DS:%0 BMP
|
;-> DS:%0 BMP
|
||||||
;<-
|
;<-
|
||||||
;===============================
|
;===============================
|
||||||
proc loadbmppalet uses ax bx cx dx si, pointer:word
|
loadbmppalet PROC FAR
|
||||||
|
ARG pointer:word=taille
|
||||||
|
push bp
|
||||||
|
mov bp,sp
|
||||||
|
push ax bx cx dx si
|
||||||
mov si,[pointer]
|
mov si,[pointer]
|
||||||
mov bx,0400h+36h-4
|
mov bx,0400h+36h-4
|
||||||
mov cx,100h
|
mov cx,100h
|
||||||
mov dx, 3c8h
|
mov dx, 3c8h
|
||||||
.paletteload:
|
paletteload:
|
||||||
mov al, cl
|
mov al, cl
|
||||||
dec al
|
dec al
|
||||||
out dx, al
|
out dx, al
|
||||||
@ -92,8 +105,10 @@ proc loadbmppalet uses ax bx cx dx si, pointer:word
|
|||||||
sub bx,4
|
sub bx,4
|
||||||
dec dx
|
dec dx
|
||||||
dec cl
|
dec cl
|
||||||
jnz .paletteload
|
jnz paletteload
|
||||||
ret
|
pop si dx cx bx ax
|
||||||
endp
|
pop bp
|
||||||
|
retf taille
|
||||||
|
loadbmppalet ENDP
|
||||||
|
|
||||||
|
end start
|
||||||
|
626
lib/detect.asm
626
lib/detect.asm
@ -1,5 +1,9 @@
|
|||||||
use16
|
model tiny,stdcall
|
||||||
align 1
|
p586
|
||||||
|
locals
|
||||||
|
jumps
|
||||||
|
codeseg
|
||||||
|
option procalign:byte
|
||||||
|
|
||||||
include "..\include\mem.h"
|
include "..\include\mem.h"
|
||||||
include "..\include\cpu.h"
|
include "..\include\cpu.h"
|
||||||
@ -7,22 +11,33 @@ include "..\include\pci.h"
|
|||||||
|
|
||||||
org 0h
|
org 0h
|
||||||
|
|
||||||
header exe 1,exports,0,0,0
|
header exe <"CE",1,0,0,offset exports,,,>
|
||||||
|
|
||||||
exporting
|
exports:
|
||||||
declare cpuinfo
|
db "cpuinfo",0
|
||||||
declare setinfo
|
dw cpuinfo
|
||||||
declare pciinfo
|
db "setinfo",0
|
||||||
declare getpciclass
|
dw setinfo
|
||||||
declare getpcisubclass
|
db "pciinfo",0
|
||||||
declare getcardinfo
|
dw pciinfo
|
||||||
declare pcireadbyte
|
db "getpciclass",0
|
||||||
declare pcireadword
|
dw getpciclass
|
||||||
declare pcireaddword
|
db "getpcisubclass",0
|
||||||
declare detectvmware
|
dw getpcisubclass
|
||||||
ende
|
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 uses eax ebx ecx edx
|
PROC detectvmware FAR
|
||||||
|
USES eax,ebx,ecx,edx
|
||||||
mov eax,564D5868h
|
mov eax,564D5868h
|
||||||
mov ebx,12345h
|
mov ebx,12345h
|
||||||
mov ecx,00Ah
|
mov ecx,00Ah
|
||||||
@ -30,60 +45,64 @@ proc detectvmware uses eax ebx ecx edx
|
|||||||
in ax,dx
|
in ax,dx
|
||||||
cmp ebx,564D5868h
|
cmp ebx,564D5868h
|
||||||
ret
|
ret
|
||||||
endp
|
endp detectvmware
|
||||||
|
|
||||||
;renvoie un pointer dx:ax vers la classe %0
|
;renvoie un pointer dx:ax vers la classe %0
|
||||||
proc getpciclass uses di, class:word
|
PROC getpciclass FAR
|
||||||
mov di,[class]
|
ARG @class:word
|
||||||
|
USES di
|
||||||
|
mov di,[@class]
|
||||||
and di,0FFh
|
and di,0FFh
|
||||||
shl di,1
|
shl di,1
|
||||||
mov ax,[cs:classes+di]
|
mov ax,[cs:offset classes+di]
|
||||||
mov dx,cs
|
mov dx,cs
|
||||||
ret
|
ret
|
||||||
endp
|
endp getpciclass
|
||||||
|
|
||||||
;renvoie un pointer dx:ax vers la sous-classe de %1 et de classe %0
|
;renvoie un pointer dx:ax vers la sous-classe de %1 et de classe %0
|
||||||
proc getpcisubclass uses di, class:word,subclass:word
|
PROC getpcisubclass FAR
|
||||||
mov di,[class]
|
ARG @class:word,@subclass:word
|
||||||
|
USES di
|
||||||
|
mov di,[@class]
|
||||||
and di,0FFh
|
and di,0FFh
|
||||||
shl di,1
|
shl di,1
|
||||||
mov di,[cs:classesd+di]
|
mov di,[cs:offset classesd+di]
|
||||||
mov dx,[subclass]
|
mov dx,[@subclass]
|
||||||
and dx,0FFh
|
and dx,0FFh
|
||||||
cmp dx,80h
|
cmp dx,80h
|
||||||
jne .suiteac
|
jne @@suiteac
|
||||||
mov ax,divers
|
mov ax,offset divers
|
||||||
jmp .found
|
jmp @@found
|
||||||
.suiteac:
|
@@suiteac:
|
||||||
shl dx,1
|
shl dx,1
|
||||||
add di,dx
|
add di,dx
|
||||||
mov ax,[cs:di]
|
mov ax,[cs:di]
|
||||||
.found:
|
@@found:
|
||||||
mov dx,cs
|
mov dx,cs
|
||||||
ret
|
ret
|
||||||
endp
|
endp getpcisubclass
|
||||||
|
|
||||||
divers db 'divers',0
|
divers db 'divers',0
|
||||||
|
|
||||||
classes:
|
classes:
|
||||||
dw class0
|
dw offset class0
|
||||||
dw class1
|
dw offset class1
|
||||||
dw class2
|
dw offset class2
|
||||||
dw class3
|
dw offset class3
|
||||||
dw class4
|
dw offset class4
|
||||||
dw class5
|
dw offset class5
|
||||||
dw class6
|
dw offset class6
|
||||||
dw class7
|
dw offset class7
|
||||||
dw class8
|
dw offset class8
|
||||||
dw class9
|
dw offset class9
|
||||||
dw class10
|
dw offset class10
|
||||||
dw class11
|
dw offset class11
|
||||||
dw class12
|
dw offset class12
|
||||||
dw class13
|
dw offset class13
|
||||||
dw class14
|
dw offset class14
|
||||||
dw class15
|
dw offset class15
|
||||||
dw class16
|
dw offset class16
|
||||||
dw class17
|
dw offset class17
|
||||||
class0 db 'ancien',0
|
class0 db 'ancien',0
|
||||||
class1 db 'stockage',0
|
class1 db 'stockage',0
|
||||||
class2 db 'reseau',0
|
class2 db 'reseau',0
|
||||||
@ -106,37 +125,37 @@ class17 db 'traitement signal',0
|
|||||||
|
|
||||||
;Classes et sous classes
|
;Classes et sous classes
|
||||||
classesd:
|
classesd:
|
||||||
dw class0d
|
dw offset class0d
|
||||||
dw class1d
|
dw offset class1d
|
||||||
dw class2d
|
dw offset class2d
|
||||||
dw class3d
|
dw offset class3d
|
||||||
dw class4d
|
dw offset class4d
|
||||||
dw class5d
|
dw offset class5d
|
||||||
dw class6d
|
dw offset class6d
|
||||||
dw class7d
|
dw offset class7d
|
||||||
dw class8d
|
dw offset class8d
|
||||||
dw class9d
|
dw offset class9d
|
||||||
dw class10d
|
dw offset class10d
|
||||||
dw class11d
|
dw offset class11d
|
||||||
dw class12d
|
dw offset class12d
|
||||||
dw class13d
|
dw offset class13d
|
||||||
dw class14d
|
dw offset class14d
|
||||||
dw class15d
|
dw offset class15d
|
||||||
dw class16d
|
dw offset class16d
|
||||||
dw class17d
|
dw offset class17d
|
||||||
|
|
||||||
class0d:
|
class0d:
|
||||||
dw subclass00
|
dw offset subclass00
|
||||||
dw subclass01
|
dw offset subclass01
|
||||||
subclass00 db 'divers',0
|
subclass00 db 'divers',0
|
||||||
subclass01 db 'vga',0
|
subclass01 db 'vga',0
|
||||||
|
|
||||||
class1d:
|
class1d:
|
||||||
dw subclass10
|
dw offset subclass10
|
||||||
dw subclass11
|
dw offset subclass11
|
||||||
dw subclass12
|
dw offset subclass12
|
||||||
dw subclass13
|
dw offset subclass13
|
||||||
dw subclass14
|
dw offset subclass14
|
||||||
subclass10 db 'scsi',0
|
subclass10 db 'scsi',0
|
||||||
subclass11 db 'ide',0
|
subclass11 db 'ide',0
|
||||||
subclass12 db 'disquette',0
|
subclass12 db 'disquette',0
|
||||||
@ -144,11 +163,11 @@ subclass13 db 'ipi',0
|
|||||||
subclass14 db 'raid',0
|
subclass14 db 'raid',0
|
||||||
|
|
||||||
class2d:
|
class2d:
|
||||||
dw subclass20
|
dw offset subclass20
|
||||||
dw subclass21
|
dw offset subclass21
|
||||||
dw subclass22
|
dw offset subclass22
|
||||||
dw subclass23
|
dw offset subclass23
|
||||||
dw subclass24
|
dw offset subclass24
|
||||||
subclass20 db 'ethernet',0
|
subclass20 db 'ethernet',0
|
||||||
subclass21 db 'token ring',0
|
subclass21 db 'token ring',0
|
||||||
subclass22 db 'fddi',0
|
subclass22 db 'fddi',0
|
||||||
@ -156,37 +175,37 @@ subclass23 db 'atm',0
|
|||||||
subclass24 db 'isdn',0
|
subclass24 db 'isdn',0
|
||||||
|
|
||||||
class3d:
|
class3d:
|
||||||
dw subclass30
|
dw offset subclass30
|
||||||
dw subclass31
|
dw offset subclass31
|
||||||
dw subclass32
|
dw offset subclass32
|
||||||
subclass30 db 'vga',0
|
subclass30 db 'vga',0
|
||||||
subclass31 db 'xga',0
|
subclass31 db 'xga',0
|
||||||
subclass32 db '3D',0
|
subclass32 db '3D',0
|
||||||
|
|
||||||
class4d:
|
class4d:
|
||||||
dw subclass40
|
dw offset subclass40
|
||||||
dw subclass41
|
dw offset subclass41
|
||||||
dw subclass42
|
dw offset subclass42
|
||||||
subclass40 db 'video',0
|
subclass40 db 'video',0
|
||||||
subclass41 db 'audio',0
|
subclass41 db 'audio',0
|
||||||
subclass42 db 'telephonie',0
|
subclass42 db 'telephonie',0
|
||||||
|
|
||||||
class5d:
|
class5d:
|
||||||
dw subclass50
|
dw offset subclass50
|
||||||
dw subclass51
|
dw offset subclass51
|
||||||
subclass50 db 'ram',0
|
subclass50 db 'ram',0
|
||||||
subclass51 db 'flash',0
|
subclass51 db 'flash',0
|
||||||
|
|
||||||
class6d:
|
class6d:
|
||||||
dw subclass60
|
dw offset subclass60
|
||||||
dw subclass61
|
dw offset subclass61
|
||||||
dw subclass62
|
dw offset subclass62
|
||||||
dw subclass63
|
dw offset subclass63
|
||||||
dw subclass64
|
dw offset subclass64
|
||||||
dw subclass65
|
dw offset subclass65
|
||||||
dw subclass66
|
dw offset subclass66
|
||||||
dw subclass67
|
dw offset subclass67
|
||||||
dw subclass68
|
dw offset subclass68
|
||||||
subclass60 db 'hote',0
|
subclass60 db 'hote',0
|
||||||
subclass61 db 'isa',0
|
subclass61 db 'isa',0
|
||||||
subclass62 db 'eisa',0
|
subclass62 db 'eisa',0
|
||||||
@ -198,21 +217,21 @@ subclass67 db 'cardbus',0
|
|||||||
subclass68 db 'RACEway',0
|
subclass68 db 'RACEway',0
|
||||||
|
|
||||||
class7d:
|
class7d:
|
||||||
dw subclass70
|
dw offset subclass70
|
||||||
dw subclass71
|
dw offset subclass71
|
||||||
dw subclass72
|
dw offset subclass72
|
||||||
dw subclass73
|
dw offset subclass73
|
||||||
subclass70 db 'serie',0
|
subclass70 db 'serie',0
|
||||||
subclass71 db 'parallele',0
|
subclass71 db 'parallele',0
|
||||||
subclass72 db 'serie multiport',0
|
subclass72 db 'serie multiport',0
|
||||||
subclass73 db 'modem',0
|
subclass73 db 'modem',0
|
||||||
|
|
||||||
class8d:
|
class8d:
|
||||||
dw subclass80
|
dw offset subclass80
|
||||||
dw subclass81
|
dw offset subclass81
|
||||||
dw subclass82
|
dw offset subclass82
|
||||||
dw subclass83
|
dw offset subclass83
|
||||||
dw subclass84
|
dw offset subclass84
|
||||||
subclass80 db 'pic',0
|
subclass80 db 'pic',0
|
||||||
subclass81 db 'dma',0
|
subclass81 db 'dma',0
|
||||||
subclass82 db 'timer',0
|
subclass82 db 'timer',0
|
||||||
@ -220,11 +239,11 @@ subclass83 db 'rtc',0
|
|||||||
subclass84 db 'hotplug',0
|
subclass84 db 'hotplug',0
|
||||||
|
|
||||||
class9d:
|
class9d:
|
||||||
dw subclass90
|
dw offset subclass90
|
||||||
dw subclass91
|
dw offset subclass91
|
||||||
dw subclass92
|
dw offset subclass92
|
||||||
dw subclass93
|
dw offset subclass93
|
||||||
dw subclass94
|
dw offset subclass94
|
||||||
subclass90 db 'clavier',0
|
subclass90 db 'clavier',0
|
||||||
subclass91 db 'stylo',0
|
subclass91 db 'stylo',0
|
||||||
subclass92 db 'souris',0
|
subclass92 db 'souris',0
|
||||||
@ -232,15 +251,15 @@ subclass93 db 'scanner',0
|
|||||||
subclass94 db 'joystick',0
|
subclass94 db 'joystick',0
|
||||||
|
|
||||||
class10d:
|
class10d:
|
||||||
dw subclass100
|
dw offset subclass100
|
||||||
subclass100 db 'station',0
|
subclass100 db 'station',0
|
||||||
|
|
||||||
class11d:
|
class11d:
|
||||||
dw subclass110
|
dw offset subclass110
|
||||||
dw subclass111
|
dw offset subclass111
|
||||||
dw subclass112
|
dw offset subclass112
|
||||||
dw subclass113
|
dw offset subclass113
|
||||||
dw subclass114
|
dw offset subclass114
|
||||||
subclass110 db '386',0
|
subclass110 db '386',0
|
||||||
subclass111 db '486',0
|
subclass111 db '486',0
|
||||||
subclass112 db 'pentium',0
|
subclass112 db 'pentium',0
|
||||||
@ -248,12 +267,12 @@ subclass113 db 'alpha',0
|
|||||||
subclass114 db 'coprocesseur',0
|
subclass114 db 'coprocesseur',0
|
||||||
|
|
||||||
class12d:
|
class12d:
|
||||||
dw subclass120
|
dw offset subclass120
|
||||||
dw subclass121
|
dw offset subclass121
|
||||||
dw subclass122
|
dw offset subclass122
|
||||||
dw subclass123
|
dw offset subclass123
|
||||||
dw subclass124
|
dw offset subclass124
|
||||||
dw subclass125
|
dw offset subclass125
|
||||||
subclass120 db 'firewire',0
|
subclass120 db 'firewire',0
|
||||||
subclass121 db 'access',0
|
subclass121 db 'access',0
|
||||||
subclass122 db 'ssa',0
|
subclass122 db 'ssa',0
|
||||||
@ -262,83 +281,87 @@ subclass124 db 'fibre',0
|
|||||||
subclass125 db 'smbus',0
|
subclass125 db 'smbus',0
|
||||||
|
|
||||||
class13d:
|
class13d:
|
||||||
dw subclass130
|
dw offset subclass130
|
||||||
dw subclass131
|
dw offset subclass131
|
||||||
dw subclass132
|
dw offset subclass132
|
||||||
subclass130 db 'irda',0
|
subclass130 db 'irda',0
|
||||||
subclass131 db 'ir',0
|
subclass131 db 'ir',0
|
||||||
subclass132 db 'rf',0
|
subclass132 db 'rf',0
|
||||||
|
|
||||||
class14d:
|
class14d:
|
||||||
dw subclass140
|
dw offset subclass140
|
||||||
subclass140 db 'IO arch',0
|
subclass140 db 'IO arch',0
|
||||||
|
|
||||||
class15d:
|
class15d:
|
||||||
dw subclass150
|
dw offset subclass150
|
||||||
dw subclass151
|
dw offset subclass151
|
||||||
dw subclass152
|
dw offset subclass152
|
||||||
dw subclass153
|
dw offset subclass153
|
||||||
subclass150 db 'tv',0
|
subclass150 db 'tv',0
|
||||||
subclass151 db 'audio',0
|
subclass151 db 'audio',0
|
||||||
subclass152 db 'voix',0
|
subclass152 db 'voix',0
|
||||||
subclass153 db 'donnees',0
|
subclass153 db 'donnees',0
|
||||||
|
|
||||||
class16d:
|
class16d:
|
||||||
dw subclass160
|
dw offset subclass160
|
||||||
dw subclass161
|
dw offset subclass161
|
||||||
subclass160 db 'reseau',0
|
subclass160 db 'reseau',0
|
||||||
subclass161 db 'jeux',0
|
subclass161 db 'jeux',0
|
||||||
|
|
||||||
class17d:
|
class17d:
|
||||||
dw subclass170
|
dw offset subclass170
|
||||||
subclass170 db 'dpio',0
|
subclass170 db 'dpio',0
|
||||||
|
|
||||||
|
|
||||||
;al=bus cl=deviceid ch=func es:di
|
;al=bus cl=deviceid ch=func es:di
|
||||||
proc getcardinfo uses eax bx di, bus:word,device:word,function:word,pointer:word
|
PROC getcardinfo FAR
|
||||||
mov di,[pointer]
|
ARG @bus:word,@device:word,@function:word,@pointer:word
|
||||||
cmp [function],0
|
USES eax,bx,di
|
||||||
je .amultiorfirst
|
cmp [@function],0
|
||||||
stdcall pcireadbyte,[bus],[device],0,pcidata.typed
|
je @@amultiorfirst
|
||||||
|
call pcireadbyte,[@bus],[@device],0,offset (pcidata).typed
|
||||||
and al,multifunction
|
and al,multifunction
|
||||||
cmp al,0
|
cmp al,0
|
||||||
jne .amultiorfirst
|
jne @@amultiorfirst
|
||||||
mov word [di],0000h
|
mov [word ptr di],0000h
|
||||||
jmp .notexist
|
jmp @@notexist
|
||||||
.amultiorfirst:
|
@@amultiorfirst:
|
||||||
xor bx,bx
|
xor bx,bx
|
||||||
.goinfos:
|
mov di,[@pointer]
|
||||||
stdcall pcireadword,[bus],[device],[function],bx
|
@@goinfos:
|
||||||
|
call pcireadword,[@bus],[@device],[@function],bx
|
||||||
inc bl
|
inc bl
|
||||||
inc bl
|
inc bl
|
||||||
cmp bl,2
|
cmp bl,2
|
||||||
ja .notzarb
|
ja @@notzarb
|
||||||
cmp ax,0FFFFh
|
cmp ax,0FFFFh
|
||||||
je .notexist
|
je @@notexist
|
||||||
cmp ax,00000h
|
cmp ax,00000h
|
||||||
je .notexist
|
je @@notexist
|
||||||
.notzarb:
|
@@notzarb:
|
||||||
mov [ds:di],ax
|
mov [ds:di],ax
|
||||||
inc di
|
inc di
|
||||||
inc di
|
inc di
|
||||||
cmp bl,40h
|
cmp bl,40h
|
||||||
jbe .goinfos
|
jbe @@goinfos
|
||||||
clc
|
clc
|
||||||
ret
|
ret
|
||||||
.notexist:
|
@@notexist:
|
||||||
stc
|
stc
|
||||||
ret
|
ret
|
||||||
endp
|
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 uses bx dx, bus:word,device:word,function:word,pointer:word
|
PROC pcireadbyte FAR
|
||||||
mov al,byte [bus]
|
ARG @bus:word,@device:word,@function:word,@pointer:word
|
||||||
|
USES bx,dx
|
||||||
|
mov al,[byte ptr @bus]
|
||||||
mov ah,80h
|
mov ah,80h
|
||||||
shl eax,16
|
shl eax,16
|
||||||
mov ah,byte [device]
|
mov ah,[byte ptr @device]
|
||||||
shl ah,3
|
shl ah,3
|
||||||
or ah,byte [function]
|
or ah,[byte ptr @function]
|
||||||
mov bl,byte [pointer]
|
mov bl,[byte ptr @pointer]
|
||||||
mov al,bl
|
mov al,bl
|
||||||
and al,0fch
|
and al,0fch
|
||||||
mov dx,config1addr
|
mov dx,config1addr
|
||||||
@ -348,17 +371,19 @@ proc pcireadbyte uses bx dx, bus:word,device:word,function:word,pointer:word
|
|||||||
or dl,bl
|
or dl,bl
|
||||||
in al,dx
|
in al,dx
|
||||||
ret
|
ret
|
||||||
endp
|
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 uses bx dx, bus:word,device:word,function:word,pointer:word
|
PROC pcireadword FAR
|
||||||
mov al,byte [bus]
|
ARG @bus:word,@device:word,@function:word,@pointer:word
|
||||||
|
USES bx,dx
|
||||||
|
mov al,[byte ptr @bus]
|
||||||
mov ah,80h
|
mov ah,80h
|
||||||
shl eax,16
|
shl eax,16
|
||||||
mov ah,byte [device]
|
mov ah,[byte ptr @device]
|
||||||
shl ah,3
|
shl ah,3
|
||||||
or ah,byte [function]
|
or ah,[byte ptr @function]
|
||||||
mov bl,byte [pointer]
|
mov bl,[byte ptr @pointer]
|
||||||
mov al,bl
|
mov al,bl
|
||||||
and al,0fch
|
and al,0fch
|
||||||
mov dx,config1addr
|
mov dx,config1addr
|
||||||
@ -368,17 +393,19 @@ proc pcireadword uses bx dx, bus:word,device:word,function:word,pointer:word
|
|||||||
or dl,bl
|
or dl,bl
|
||||||
in ax,dx
|
in ax,dx
|
||||||
ret
|
ret
|
||||||
endp
|
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 uses bx dx, bus:word,device:word,function:word,pointer:word
|
PROC pcireaddword FAR
|
||||||
mov al,byte [bus]
|
ARG @bus:word,@device:word,@function:word,@pointer:word
|
||||||
|
USES bx,dx
|
||||||
|
mov al,[byte ptr @bus]
|
||||||
mov ah,80h
|
mov ah,80h
|
||||||
shl eax,16
|
shl eax,16
|
||||||
mov ah,byte [device]
|
mov ah,[byte ptr @device]
|
||||||
shl ah,3
|
shl ah,3
|
||||||
or ah,byte [function]
|
or ah,[byte ptr @function]
|
||||||
mov bl,byte [pointer]
|
mov bl,[byte ptr @pointer]
|
||||||
mov al,bl
|
mov al,bl
|
||||||
and al,0fch
|
and al,0fch
|
||||||
mov dx,config1addr
|
mov dx,config1addr
|
||||||
@ -388,259 +415,262 @@ proc pcireaddword uses bx dx, bus:word,device:word,function:word,pointer:word
|
|||||||
or dl,bl
|
or dl,bl
|
||||||
in eax,dx
|
in eax,dx
|
||||||
ret
|
ret
|
||||||
endp
|
endp pcireaddword
|
||||||
|
|
||||||
;Prob avec str pci
|
;Prob avec str pci
|
||||||
;renvoie en %0 la structure pciinf carry if error
|
;renvoie en %0 la structure pciinf carry if error
|
||||||
proc pciinfo uses ax bx cx edx edi, pointer:word
|
PROC pciinfo FAR
|
||||||
|
ARG @pointer:word
|
||||||
|
USES ax,bx,cx,edx,edi
|
||||||
mov ax,0B101h
|
mov ax,0B101h
|
||||||
xor edi,edi
|
xor edi,edi
|
||||||
mov edx," PCI"
|
mov edx," PCI"
|
||||||
int 1Ah
|
int 1Ah
|
||||||
jc .errorpci
|
jc @@errorpci
|
||||||
cmp dx,04350h
|
cmp dx,04350h
|
||||||
jne .errorpci
|
jne @@errorpci
|
||||||
cmp ah,0
|
cmp ah,0
|
||||||
jne .errorpci
|
jne @@errorpci
|
||||||
mov di,[pointer]
|
mov di,[@pointer]
|
||||||
virtual at di
|
mov [(pciinf di).version_major],bh
|
||||||
.pciinf pciinf
|
mov [(pciinf di).version_minor],bl
|
||||||
end virtual
|
mov [(pciinf di).types],al
|
||||||
mov [.pciinf.version_major],bh
|
mov [(pciinf di).maxbus],cl
|
||||||
mov [.pciinf.version_minor],bl
|
|
||||||
mov [.pciinf.types],al
|
|
||||||
mov [.pciinf.maxbus],cl
|
|
||||||
clc
|
clc
|
||||||
ret
|
ret
|
||||||
.errorpci:
|
@@errorpci:
|
||||||
stc
|
stc
|
||||||
ret
|
ret
|
||||||
endp
|
endp pciinfo
|
||||||
|
|
||||||
|
|
||||||
;retourne en DS:%1 les set supporté du processeur par rapport a la struct %0
|
;retourne en DS:%1 les set supporté du processeur par rapport a la struct %0
|
||||||
proc setinfo uses bx si di, pointer:word,set:word
|
PROC setinfo FAR
|
||||||
mov di,[set]
|
ARG @pointer:word,@set:word
|
||||||
|
USES bx,si,di
|
||||||
|
mov di,[@set]
|
||||||
lea si,[ds:cpu.mmx]
|
lea si,[ds:cpu.mmx]
|
||||||
add si,[pointer]
|
add si,[@pointer]
|
||||||
mov bx,.theset
|
mov bx,offset @@theset
|
||||||
.set:
|
@@set:
|
||||||
cmp word [cs:bx],0FFFFh
|
cmp [word ptr cs:bx],0FFFFh
|
||||||
je .endofset
|
je @@endofset
|
||||||
cmp byte [si],1
|
cmp [byte ptr si],1
|
||||||
jne .nextset
|
jne @@nextset
|
||||||
push bx
|
push bx
|
||||||
mov bx,[cs:bx]
|
mov bx,[cs:bx]
|
||||||
.put:
|
@@put:
|
||||||
mov al,[cs:bx]
|
mov al,[cs:bx]
|
||||||
cmp al,0
|
cmp al,0
|
||||||
je .enofput
|
je @@enofput
|
||||||
mov [di],al
|
mov [di],al
|
||||||
inc bx
|
inc bx
|
||||||
inc di
|
inc di
|
||||||
jmp .put
|
jmp @@put
|
||||||
.enofput:
|
@@enofput:
|
||||||
pop bx
|
pop bx
|
||||||
.nextset:
|
@@nextset:
|
||||||
inc bx
|
inc bx
|
||||||
inc bx
|
inc bx
|
||||||
inc si
|
inc si
|
||||||
jmp .set
|
jmp @@set
|
||||||
.endofset:
|
@@endofset:
|
||||||
mov byte [di],0
|
mov [byte ptr di],0
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.theset dw .mmx
|
@@theset dw offset @@mmx
|
||||||
dw .mmx2
|
dw offset @@mmx2
|
||||||
dw .sse
|
dw offset @@sse
|
||||||
dw .sse2
|
dw offset @@sse2
|
||||||
dw .sse3
|
dw offset @@sse3
|
||||||
dw .fpu
|
dw offset @@fpu
|
||||||
dw .now3d
|
dw offset @@now3d
|
||||||
dw .now3d2
|
dw offset @@now3d2
|
||||||
dw .htt
|
dw offset @@htt
|
||||||
dw .apic
|
dw offset @@apic
|
||||||
dw 0FFFFh
|
dw 0FFFFh
|
||||||
|
|
||||||
.mmx db "MMX ",0
|
@@mmx db "MMX ",0
|
||||||
.mmx2 db "MMX2 ",0
|
@@mmx2 db "MMX2 ",0
|
||||||
.now3d db "3dNow! ",0
|
@@now3d db "3dNow! ",0
|
||||||
.now3d2 db "3dNow Extended! ",0
|
@@now3d2 db "3dNow Extended! ",0
|
||||||
.htt db "HyperThreading",0
|
@@htt db "HyperThreading",0
|
||||||
.sse db "SSE ",0
|
@@sse db "SSE ",0
|
||||||
.sse2 db "SSE2 ",0
|
@@sse2 db "SSE2 ",0
|
||||||
.sse3 db "SSE3 ",0
|
@@sse3 db "SSE3 ",0
|
||||||
.apic db "APIC ",0
|
@@apic db "APIC ",0
|
||||||
.fpu db "FPU ",0
|
@@fpu db "FPU ",0
|
||||||
|
|
||||||
endp
|
endp setinfo
|
||||||
|
|
||||||
;retourne en DS:%0 les capacités du processeur
|
;retourne en DS:%0 les capacités du processeur
|
||||||
proc cpuinfo uses eax ebx ecx edx si di ds es, pointer:word
|
PROC cpuinfo FAR
|
||||||
|
ARG @pointer:word
|
||||||
|
USES eax,ebx,ecx,edx,si,di,ds,es
|
||||||
push ds
|
push ds
|
||||||
pop es
|
pop es
|
||||||
mov di,[pointer]
|
mov di,[@pointer]
|
||||||
mov al,0
|
mov al,0
|
||||||
mov cx,cpu.sizeof
|
mov cx,size cpu
|
||||||
cld
|
cld
|
||||||
rep stosb
|
rep stosb
|
||||||
mov di,[pointer]
|
mov di,[@pointer]
|
||||||
call nocpuid ;Test si cpuid est dispo
|
call nocpuid ;Test si cpuid est dispo
|
||||||
je .nocpuidatall
|
je @@nocpuidatall
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
cpuid ;Fonction 0 de CPUID
|
cpuid ;Fonction 0 de CPUID
|
||||||
mov dword [cpu.vendor],ebx ;Vendeur sur 13 octets
|
mov [dword ptr (cpu di).vendor],ebx ;Vendeur sur 13 octets
|
||||||
mov dword [cpu.vendor+4],edx
|
mov [dword ptr (cpu di+4).vendor],edx
|
||||||
mov dword [cpu.vendor+8],ecx
|
mov [dword ptr (cpu di+8).vendor],ecx
|
||||||
mov byte [cpu.vendor+12],0
|
mov [byte ptr (cpu di+12).vendor],0
|
||||||
cmp eax,1
|
cmp eax,1
|
||||||
jb .nofonc1
|
jb @@nofonc1
|
||||||
mov eax,1
|
mov eax,1
|
||||||
cpuid ;Fonction 1 de CPUID
|
cpuid ;Fonction 1 de CPUID
|
||||||
mov ebx,eax ;infos de model
|
mov ebx,eax ;infos de model
|
||||||
and ebx,1111b
|
and ebx,1111b
|
||||||
mov [cpu.stepping],bl
|
mov [(cpu di).stepping],bl
|
||||||
shr eax,4
|
shr eax,4
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
and ebx,1111b
|
and ebx,1111b
|
||||||
mov [cpu.models],bl
|
mov [(cpu di).models],bl
|
||||||
shr eax,4
|
shr eax,4
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
and ebx,1111b
|
and ebx,1111b
|
||||||
mov [cpu.family],bl
|
mov [(cpu di).family],bl
|
||||||
shr eax,4
|
shr eax,4
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
and ebx,11b
|
and ebx,11b
|
||||||
mov [cpu.types],bl
|
mov [(cpu di).types],bl
|
||||||
shr eax,2
|
shr eax,2
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
and ebx,1111b
|
and ebx,1111b
|
||||||
mov [cpu.emodels],bl
|
mov [(cpu di).emodels],bl
|
||||||
shr eax,4
|
shr eax,4
|
||||||
mov [cpu.efamily],al
|
mov [(cpu di).efamily],al
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
and ebx,1 ;infos de jeu d'instruction
|
and ebx,1 ;infos de jeu d'instruction
|
||||||
setnz [cpu.fpu]
|
setnz [(cpu di).fpu]
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
and ebx,100000000000000000000000b
|
and ebx,100000000000000000000000b
|
||||||
setnz [cpu.mmx]
|
setnz [(cpu di).mmx]
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
and ebx,10000000000000000000000000b
|
and ebx,10000000000000000000000000b
|
||||||
setnz [cpu.sse]
|
setnz [(cpu di).sse]
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
and ebx,100000000000000000000000000b
|
and ebx,100000000000000000000000000b
|
||||||
setnz [cpu.sse2]
|
setnz [(cpu di).sse2]
|
||||||
mov ebx,ecx
|
mov ebx,ecx
|
||||||
and ebx,1b
|
and ebx,1b
|
||||||
setnz [cpu.sse3]
|
setnz [(cpu di).sse3]
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
and ebx,10000000000000000000000000000b
|
and ebx,10000000000000000000000000000b
|
||||||
setnz [cpu.htt]
|
setnz [(cpu di).htt]
|
||||||
.nofonc1:
|
@@nofonc1:
|
||||||
mov eax,80000000h ;Fonction 80000000 de CPUID
|
mov eax,80000000h ;Fonction 80000000 de CPUID
|
||||||
cpuid
|
cpuid
|
||||||
cmp eax,80000001h
|
cmp eax,80000001h
|
||||||
jb .nofonc8
|
jb @@nofonc8
|
||||||
mov eax,80000001h ;Fonction 80000000 de CPUID
|
mov eax,80000001h ;Fonction 80000000 de CPUID
|
||||||
cpuid
|
cpuid
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
and ebx,10000000000000000000000b
|
and ebx,10000000000000000000000b
|
||||||
setnz [cpu.mmx2]
|
setnz [(cpu di).mmx2]
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
and ebx,1000000000000000000000000000000b
|
and ebx,1000000000000000000000000000000b
|
||||||
setnz [cpu.now3d]
|
setnz [(cpu di).now3d]
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
and ebx,10000000000000000000000000000000b
|
and ebx,10000000000000000000000000000000b
|
||||||
setnz [cpu.now3d2]
|
setnz [(cpu di).now3d2]
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
and ebx,1000000000b
|
and ebx,1000000000b
|
||||||
setnz [cpu.apic]
|
setnz [(cpu di).apic]
|
||||||
.nofonc8:
|
@@nofonc8:
|
||||||
mov si,.marks
|
mov si,offset @@marks
|
||||||
push cs
|
push cs
|
||||||
pop ds
|
pop ds
|
||||||
.search:
|
@@search:
|
||||||
mov di,[pointer]
|
mov di,[@pointer]
|
||||||
mov cx,12
|
mov cx,12
|
||||||
cld
|
cld
|
||||||
rep cmpsb
|
rep cmpsb
|
||||||
jne .notthegood
|
jne @@notthegood
|
||||||
cmp cx,0
|
cmp cx,0
|
||||||
jne .notthegood
|
jne @@notthegood
|
||||||
mov cl,[si]
|
mov cl,[si]
|
||||||
inc si
|
inc si
|
||||||
mov di,[pointer]
|
mov di,[@pointer]
|
||||||
cld
|
cld
|
||||||
rep movsb
|
rep movsb
|
||||||
mov al,0
|
mov al,0
|
||||||
stosb
|
stosb
|
||||||
mov di,[pointer]
|
mov di,[@pointer]
|
||||||
cmp [es:cpu.family],15
|
cmp [es:(cpu di).family],15
|
||||||
jne .notextended
|
jne @@notextended
|
||||||
mov al,[es:cpu.efamily]
|
mov al,[es:(cpu di).efamily]
|
||||||
mov ah,[es:cpu.emodels]
|
mov ah,[es:(cpu di).emodels]
|
||||||
mov di,[si+2]
|
mov di,[si+2]
|
||||||
jmp .searchmodel
|
jmp @@searchmodel
|
||||||
.notextended:
|
@@notextended:
|
||||||
mov al,[es:cpu.family]
|
mov al,[es:(cpu di).family]
|
||||||
mov ah,[es:cpu.models]
|
mov ah,[es:(cpu di).models]
|
||||||
mov di,[si]
|
mov di,[si]
|
||||||
.searchmodel:
|
@@searchmodel:
|
||||||
cmp [di],ax
|
cmp [di],ax
|
||||||
jne .notgoodfamily
|
jne @@notgoodfamily
|
||||||
mov si,di
|
mov si,di
|
||||||
inc si
|
inc si
|
||||||
inc si
|
inc si
|
||||||
lea di,[es:cpu.names]
|
lea di,[es:cpu.names]
|
||||||
add di,[pointer]
|
add di,[@pointer]
|
||||||
.copystr:
|
@@copystr:
|
||||||
mov al,[si]
|
mov al,[si]
|
||||||
mov [es:di],al
|
mov [es:di],al
|
||||||
inc si
|
inc si
|
||||||
inc di
|
inc di
|
||||||
cmp al,0
|
cmp al,0
|
||||||
jne .copystr
|
jne @@copystr
|
||||||
jmp .endofsearch
|
jmp @@endofsearch
|
||||||
.notgoodfamily:
|
@@notgoodfamily:
|
||||||
inc di
|
inc di
|
||||||
.nextelement:
|
@@nextelement:
|
||||||
inc di
|
inc di
|
||||||
cmp byte [di-1],0
|
cmp [byte ptr di-1],0
|
||||||
jne .nextelement
|
jne @@nextelement
|
||||||
jmp .searchmodel
|
jmp @@searchmodel
|
||||||
.notthegood:
|
@@notthegood:
|
||||||
inc si
|
inc si
|
||||||
cmp word [si],0FFFFh
|
cmp [word ptr si],0FFFFh
|
||||||
jne .notthegood
|
jne @@notthegood
|
||||||
inc si
|
inc si
|
||||||
inc si
|
inc si
|
||||||
cmp word [si],0FFFFh
|
cmp [word ptr si],0FFFFh
|
||||||
je .endofsearch
|
je @@endofsearch
|
||||||
jmp .search
|
jmp @@search
|
||||||
.endofsearch:
|
@@endofsearch:
|
||||||
ret
|
ret
|
||||||
.nocpuidatall:
|
@@nocpuidatall:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;tableau avec vendeur taille + chainereelle + pointeur famille + pointeur famille etendue
|
;tableau avec vendeur taille + chainereelle + pointeur famille + pointeur famille etendue
|
||||||
|
|
||||||
.marks db "GenuineIntel",5,"Intel"
|
@@marks db "GenuineIntel",5,"Intel"
|
||||||
dw .intelfamily,.intelfamilye
|
dw @@intelfamily,@@intelfamilye
|
||||||
dw 0FFFFh
|
dw 0FFFFh
|
||||||
|
|
||||||
db "AuthenticAMD",3,"Amd"
|
db "AuthenticAMD",3,"Amd"
|
||||||
dw .amdfamily,.amdfamilye
|
dw @@amdfamily,@@amdfamilye
|
||||||
dw 0FFFFh
|
dw 0FFFFh
|
||||||
|
|
||||||
db "CyrixInstead",5,"Cyrix"
|
db "CyrixInstead",5,"Cyrix"
|
||||||
dw .cyrixfamily,.cyrixfamilye
|
dw @@cyrixfamily,@@cyrixfamilye
|
||||||
dw 0FFFFh
|
dw 0FFFFh
|
||||||
dw 0FFFFh
|
dw 0FFFFh
|
||||||
|
|
||||||
|
|
||||||
;tableau avec famille modele et chaine 0
|
;tableau avec famille modele et chaine 0
|
||||||
|
|
||||||
.intelfamily:
|
@@intelfamily:
|
||||||
db 4,0,"486 DX-25/33",0
|
db 4,0,"486 DX-25/33",0
|
||||||
db 4,1,"486 DX-50",0
|
db 4,1,"486 DX-50",0
|
||||||
db 4,2,"486 SX",0
|
db 4,2,"486 SX",0
|
||||||
@ -670,7 +700,7 @@ db 6,11,"Pentium III (0.13
|
|||||||
db 7,0,"Itanium (IA-64)",0
|
db 7,0,"Itanium (IA-64)",0
|
||||||
db 0FFh,0FFh,"Inconnu",0
|
db 0FFh,0FFh,"Inconnu",0
|
||||||
|
|
||||||
.intelfamilye:
|
@@intelfamilye:
|
||||||
db 0,0,"Pentium IV (0.18 µm)",0
|
db 0,0,"Pentium IV (0.18 µm)",0
|
||||||
db 0,1,"Pentium IV (0.18 µm)",0
|
db 0,1,"Pentium IV (0.18 µm)",0
|
||||||
db 0,2,"Pentium IV (0.13 µm)",0
|
db 0,2,"Pentium IV (0.13 µm)",0
|
||||||
@ -678,7 +708,7 @@ db 0,3,"Pentium IV (0.09
|
|||||||
db 1,0,"Itanium 2 (IA-64)",0
|
db 1,0,"Itanium 2 (IA-64)",0
|
||||||
db 0FFh,0FFh,"Inconnu",0
|
db 0FFh,0FFh,"Inconnu",0
|
||||||
|
|
||||||
.amdfamily:
|
@@amdfamily:
|
||||||
db 4,3,"486 DX/2",0
|
db 4,3,"486 DX/2",0
|
||||||
db 4,7,"486 DX/2-WB",0
|
db 4,7,"486 DX/2-WB",0
|
||||||
db 4,8,"486 DX/4",0
|
db 4,8,"486 DX/4",0
|
||||||
@ -705,12 +735,12 @@ db 6,8,"Athlon (Thoroughbred)",0
|
|||||||
db 6,10,"Athlon (Barton)",0
|
db 6,10,"Athlon (Barton)",0
|
||||||
db 0FFh,0FFh,"Inconnu",0
|
db 0FFh,0FFh,"Inconnu",0
|
||||||
|
|
||||||
.amdfamilye:
|
@@amdfamilye:
|
||||||
db 0,4,"Athlon 64",0
|
db 0,4,"Athlon 64",0
|
||||||
db 0,5,"Athlon 64 FX/Opteron",0
|
db 0,5,"Athlon 64 FX/Opteron",0
|
||||||
db 0FFh,0FFh,"Inconnu",0
|
db 0FFh,0FFh,"Inconnu",0
|
||||||
|
|
||||||
.cyrixfamily:
|
@@cyrixfamily:
|
||||||
db 4,4,"MediaGX",0
|
db 4,4,"MediaGX",0
|
||||||
db 5,2,"6x86/6x86L",0
|
db 5,2,"6x86/6x86L",0
|
||||||
db 5,4,"MediaGX MMX Enhanced",0
|
db 5,4,"MediaGX MMX Enhanced",0
|
||||||
@ -722,10 +752,10 @@ db 6,8,"WinChip C5N",0
|
|||||||
db 6,9,"WinChip C5XL/WinChip C5P",0
|
db 6,9,"WinChip C5XL/WinChip C5P",0
|
||||||
db 0FFh,0FFh,"Inconnu",0
|
db 0FFh,0FFh,"Inconnu",0
|
||||||
|
|
||||||
.cyrixfamilye:
|
@@cyrixfamilye:
|
||||||
db 0FFh,0FFh,"Inconnu",0
|
db 0FFh,0FFh,"Inconnu",0
|
||||||
|
|
||||||
endp
|
endp cpuinfo
|
||||||
|
|
||||||
;Test si CPUID est supporté oui=not Equal
|
;Test si CPUID est supporté oui=not Equal
|
||||||
nocpuid:
|
nocpuid:
|
||||||
|
229
lib/graphic.asm
229
lib/graphic.asm
@ -1,229 +0,0 @@
|
|||||||
use16
|
|
||||||
align 1
|
|
||||||
|
|
||||||
include "..\include\mem.h"
|
|
||||||
include "..\include\graphic.h"
|
|
||||||
|
|
||||||
org 0h
|
|
||||||
|
|
||||||
header exe 1,exports,imports,0,0
|
|
||||||
|
|
||||||
exporting
|
|
||||||
declare hline
|
|
||||||
declare line
|
|
||||||
declare polyfill
|
|
||||||
ende
|
|
||||||
|
|
||||||
importing
|
|
||||||
use VIDEO,showpixel
|
|
||||||
endi
|
|
||||||
|
|
||||||
proc hline uses cx dx, x1:word,x2:word,y:word,color:word
|
|
||||||
mov cx,[x1]
|
|
||||||
mov dx,[x2]
|
|
||||||
cmp cx,dx
|
|
||||||
jbe .boucle
|
|
||||||
xchg cx,dx
|
|
||||||
.boucle:
|
|
||||||
invoke showpixel,cx,[y],[color]
|
|
||||||
inc cx
|
|
||||||
cmp cx,dx
|
|
||||||
jbe .boucle
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
; affiche un pixel en %0 %1 couleur %2
|
|
||||||
proc line uses ax bx cx dx si di, x1:word,y1:word,x2:word,y2:word,color:word
|
|
||||||
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:
|
|
||||||
invoke 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:
|
|
||||||
invoke showpixel,si,di,[color]
|
|
||||||
inc cx
|
|
||||||
cmp cx,[deltay]
|
|
||||||
jl .boucle2
|
|
||||||
.endofline:
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;renvoie la valeur absolue de AX
|
|
||||||
proc absolute
|
|
||||||
cmp ax,0
|
|
||||||
jg .noabs
|
|
||||||
neg ax
|
|
||||||
.noabs:
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
ymax equ 200
|
|
||||||
|
|
||||||
; initialise un segment 2
|
|
||||||
proc polyfill uses eax ebx ecx edx si di es, pointer:word,nbfaces:word,color:word;
|
|
||||||
local startx[200]:WORD,endx[200]:WORD,pas:DWORD,miny:WORD,maxy:WORD
|
|
||||||
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]
|
|
||||||
virtual at 0
|
|
||||||
.vertex2d vertex2d
|
|
||||||
end virtual
|
|
||||||
add di,.vertex2d.sizeof
|
|
||||||
mov [miny],ymax
|
|
||||||
mov [maxy],0
|
|
||||||
mov cx,[nbfaces]
|
|
||||||
dec cx
|
|
||||||
.boucle:
|
|
||||||
push si di cx
|
|
||||||
virtual at si
|
|
||||||
.vertex2dsrc vertex2d
|
|
||||||
end virtual
|
|
||||||
virtual at di
|
|
||||||
.vertex2ddst vertex2d
|
|
||||||
end virtual
|
|
||||||
mov ax,[.vertex2ddst.py]
|
|
||||||
cmp ax,[.vertex2dsrc.py]
|
|
||||||
je .noexchange
|
|
||||||
jge .nothingtodo
|
|
||||||
xchg si,di
|
|
||||||
.nothingtodo:
|
|
||||||
xor eax,eax
|
|
||||||
mov ax,[.vertex2dsrc.px]
|
|
||||||
cwde
|
|
||||||
sal eax,8
|
|
||||||
mov ebx,eax
|
|
||||||
xor eax,eax
|
|
||||||
mov ax,[.vertex2ddst.px]
|
|
||||||
sub ax,[.vertex2dsrc.px]
|
|
||||||
cwde
|
|
||||||
sal eax,8
|
|
||||||
xor ecx,ecx
|
|
||||||
mov cx,[.vertex2ddst.py]
|
|
||||||
sub cx,[.vertex2dsrc.py]
|
|
||||||
cdq
|
|
||||||
idiv ecx
|
|
||||||
mov [pas],eax
|
|
||||||
add ebx,eax
|
|
||||||
mov dx,[.vertex2dsrc.py]
|
|
||||||
inc dx
|
|
||||||
cmp dx,[miny]
|
|
||||||
jge .notinf
|
|
||||||
mov [miny],dx
|
|
||||||
.notinf:
|
|
||||||
mov ax,[.vertex2ddst.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 [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,[.vertex2ddst.py]
|
|
||||||
jle .boucle2
|
|
||||||
.noexchange:
|
|
||||||
pop cx di si
|
|
||||||
add si,.vertex2d.sizeof
|
|
||||||
add di,.vertex2d.sizeof
|
|
||||||
dec cx
|
|
||||||
js .finished
|
|
||||||
jnz .boucle
|
|
||||||
mov di,[pointer]
|
|
||||||
mov cx,0FFFFh
|
|
||||||
jmp .boucle
|
|
||||||
.finished:
|
|
||||||
cmp word [miny],0
|
|
||||||
jae .noadj
|
|
||||||
mov [miny],0
|
|
||||||
.noadj:
|
|
||||||
cmp word [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:
|
|
||||||
stdcall hline,ax,bx,cx,[color]
|
|
||||||
inc cx
|
|
||||||
cmp cx,[maxy]
|
|
||||||
jna .drawboucle
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
18
lib/lib.asm
18
lib/lib.asm
@ -1,18 +0,0 @@
|
|||||||
use16
|
|
||||||
align 1
|
|
||||||
|
|
||||||
include "..\include\mem.h"
|
|
||||||
include "..\include\divers.h"
|
|
||||||
|
|
||||||
org 0h
|
|
||||||
|
|
||||||
header exe 1,exports,0,0,0
|
|
||||||
|
|
||||||
waitkey:
|
|
||||||
mov ax,0
|
|
||||||
int 16h
|
|
||||||
ret
|
|
||||||
|
|
||||||
exporting
|
|
||||||
declare waitkey
|
|
||||||
ende
|
|
14
lib/makefile
14
lib/makefile
@ -1,14 +0,0 @@
|
|||||||
ASM=fasm
|
|
||||||
CLEAN=rm -rf
|
|
||||||
OBJS= $(SRCS:.c=.o)
|
|
||||||
SRC= $(wildcard *.asm)
|
|
||||||
LIB= $(SRC:.asm=.lib)
|
|
||||||
|
|
||||||
all: $(LIB)
|
|
||||||
sync
|
|
||||||
|
|
||||||
%.lib: %.asm
|
|
||||||
$(ASM) $^ $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(CLEAN) *.lib
|
|
32
lib/math.asm
32
lib/math.asm
@ -1,32 +0,0 @@
|
|||||||
use16
|
|
||||||
align 1
|
|
||||||
|
|
||||||
include "..\include\mem.h"
|
|
||||||
|
|
||||||
org 0h
|
|
||||||
|
|
||||||
header exe 1,exports,0,0,0
|
|
||||||
|
|
||||||
exporting
|
|
||||||
declare random
|
|
||||||
declare randomize
|
|
||||||
ende
|
|
||||||
|
|
||||||
randseed dw 1234h
|
|
||||||
|
|
||||||
proc random uses dx
|
|
||||||
mov ax,[cs:randseed]
|
|
||||||
mov dx,8405h
|
|
||||||
mul dx
|
|
||||||
inc ax
|
|
||||||
mov [cs:randseed],ax
|
|
||||||
mov ax,dx
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
proc randomize uses ax cx dx
|
|
||||||
mov ah,0
|
|
||||||
int 1ah
|
|
||||||
mov [cs:randseed],dx
|
|
||||||
ret
|
|
||||||
endp
|
|
919
lib/str0.asm
919
lib/str0.asm
@ -1,919 +0,0 @@
|
|||||||
use16
|
|
||||||
align 1
|
|
||||||
|
|
||||||
include "..\include\mem.h"
|
|
||||||
include "..\include\divers.h"
|
|
||||||
|
|
||||||
org 0h
|
|
||||||
|
|
||||||
header exe 1,exports,0,0,0
|
|
||||||
|
|
||||||
|
|
||||||
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 uses ax bx cx dx si di ds es, src:word,dest:word,delim:word
|
|
||||||
local temp[256]:WORD
|
|
||||||
push ss
|
|
||||||
pop es
|
|
||||||
lea si,[temp]
|
|
||||||
mov di,[dest]
|
|
||||||
stdcall copy,[src],si
|
|
||||||
call xch
|
|
||||||
stdcall compressdelimiter,si,[delim]
|
|
||||||
stdcall getnbitems,si,[delim]
|
|
||||||
mov bx,ax
|
|
||||||
call xch
|
|
||||||
stdcall getnbitems,di,[delim]
|
|
||||||
cmp bx,ax
|
|
||||||
jne .notequalatall
|
|
||||||
xor cx,cx
|
|
||||||
.itemer:
|
|
||||||
call xch
|
|
||||||
stdcall whatisitem,si,cx,[delim]
|
|
||||||
mov dx,ax
|
|
||||||
stdcall xch
|
|
||||||
stdcall whatisitem,di,cx,[delim]
|
|
||||||
cmp ax,dx
|
|
||||||
jne .prob
|
|
||||||
cmp al,6
|
|
||||||
jb .equal
|
|
||||||
stdcall 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
|
|
||||||
xch:
|
|
||||||
push es
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
pop ds
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
;Compare les ‚l‚ments cx de deux chaine ds:si et es:di
|
|
||||||
proc cmpitems uses ax cx si di es, src:word,dest:word,item:word,delim:word
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
stdcall getpointeritem,[src],[item],[delim]
|
|
||||||
mov si,ax
|
|
||||||
stdcall getitemsize,[src],[item],[delim]
|
|
||||||
mov di,[dest]
|
|
||||||
mov cx,ax
|
|
||||||
cld
|
|
||||||
rep cmpsb
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
;Renvoie l'‚l‚ment cx de ds:si dans edx si nb et dans es:di si str ou name
|
|
||||||
proc gettypeditem uses bx cx si di, src:word,item:word,delim:word
|
|
||||||
mov si,[src]
|
|
||||||
mov cx,[item]
|
|
||||||
stdcall getpointeritem,si,cx,[delim]
|
|
||||||
mov di,ax
|
|
||||||
inc cx
|
|
||||||
stdcall getpointeritem,si,cx,[delim]
|
|
||||||
mov si,ax
|
|
||||||
dec si
|
|
||||||
mov cl,0
|
|
||||||
xchg cl,[ds:si]
|
|
||||||
stdcall gettyped,di
|
|
||||||
xchg cl,[ds:si]
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
;Renvoie eax si nb et dans ds:eax si str ou name
|
|
||||||
proc gettyped uses si, src:word
|
|
||||||
mov si,[src]
|
|
||||||
xor eax,eax
|
|
||||||
stdcall 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:
|
|
||||||
stdcall strtoint,si,2
|
|
||||||
jmp .endofgettypeditem
|
|
||||||
.oct:
|
|
||||||
stdcall strtoint,si,8
|
|
||||||
jmp .endofgettypeditem
|
|
||||||
.dec:
|
|
||||||
stdcall strtoint,si,10
|
|
||||||
jmp .endofgettypeditem
|
|
||||||
.hex:
|
|
||||||
stdcall strtoint,si,16
|
|
||||||
jmp .endofgettypeditem
|
|
||||||
.pointer:
|
|
||||||
stdcall strtoadress,si
|
|
||||||
.endofgettypeditem:
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Renvoie dans ax le type de la str0 point‚e par ds:%0 ‚l‚ment %1 delim %3
|
|
||||||
proc whatisitem uses bx cx si di, src:word,item:word,delim:word
|
|
||||||
mov si,[src]
|
|
||||||
mov cx,[item]
|
|
||||||
stdcall getpointeritem,si,cx,[delim]
|
|
||||||
mov di,ax
|
|
||||||
inc cx
|
|
||||||
stdcall getpointeritem,si,cx,[delim]
|
|
||||||
mov si,ax
|
|
||||||
dec si
|
|
||||||
mov cl,0
|
|
||||||
xchg cl,[ds:si]
|
|
||||||
stdcall whatis,di
|
|
||||||
xchg cl,[ds:si]
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Renvoie dans ax le type de la str0 point‚e 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 uses bx cx edx si, src:word
|
|
||||||
mov si,[src]
|
|
||||||
xor cx,cx
|
|
||||||
mov cl,2
|
|
||||||
stdcall strisbase,si,cx
|
|
||||||
jnc .finbase
|
|
||||||
mov cl,8
|
|
||||||
stdcall strisbase,si,cx
|
|
||||||
jnc .finbase
|
|
||||||
mov cl,10
|
|
||||||
stdcall strisbase,si,cx
|
|
||||||
jnc .finbase
|
|
||||||
mov cl,16
|
|
||||||
stdcall strisbase,si,cx
|
|
||||||
jc .testadress
|
|
||||||
.finbase:
|
|
||||||
mov bx,cx
|
|
||||||
xor ch,ch
|
|
||||||
mov al,[cs:bx+ basenn-2]
|
|
||||||
push eax
|
|
||||||
stdcall 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:
|
|
||||||
stdcall strisadress,si
|
|
||||||
jc .testname
|
|
||||||
mov ax,0005h
|
|
||||||
jmp .endofwhat
|
|
||||||
.testname:
|
|
||||||
stdcall strisname
|
|
||||||
jc .testnumber
|
|
||||||
xor ah,ah
|
|
||||||
cmp byte [si],'&'
|
|
||||||
je .okname
|
|
||||||
stdcall getlength,si
|
|
||||||
mov ah,al
|
|
||||||
.okname:
|
|
||||||
mov al,06h
|
|
||||||
jmp .endofwhat
|
|
||||||
.testnumber:
|
|
||||||
cmp byte [si],'#'
|
|
||||||
jne .testvarstr
|
|
||||||
xor ah,ah
|
|
||||||
mov al,08h
|
|
||||||
jmp .endofwhat
|
|
||||||
.testvarstr:
|
|
||||||
xor ah,ah
|
|
||||||
cmp byte [si],'?'
|
|
||||||
je .okvarstr
|
|
||||||
stdcall getlength,si
|
|
||||||
mov ah,al
|
|
||||||
.okvarstr:
|
|
||||||
mov al,07h
|
|
||||||
.endofwhat:
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;Renvoie non carry si la str ds:si point‚e peut ˆtre une adresse
|
|
||||||
proc strtoadress
|
|
||||||
;push
|
|
||||||
stc
|
|
||||||
;pop
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
;Renvoie en es:di le pointeur str0 ds:si
|
|
||||||
proc strisadress
|
|
||||||
;push
|
|
||||||
stc
|
|
||||||
;pop
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Renvoie non carry si la str ds:%0 point‚e peut ˆtre un nom de fichier
|
|
||||||
proc strisname uses ax si di, src:word
|
|
||||||
mov si,[src]
|
|
||||||
.isname:
|
|
||||||
mov al,[si]
|
|
||||||
inc si
|
|
||||||
cmp al,0
|
|
||||||
je .itsok
|
|
||||||
mov di, 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
|
|
||||||
|
|
||||||
non db '/<>|"?*:\',01,0FFh
|
|
||||||
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 non carry si le texte point‚ par %0 est de la base %1
|
|
||||||
proc strisbase uses ax cx si di es, src:word,base:word
|
|
||||||
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+ basen]
|
|
||||||
je .verifbase
|
|
||||||
xor ch,ch
|
|
||||||
inc cl
|
|
||||||
lea di,[base]
|
|
||||||
cld
|
|
||||||
repne scasb
|
|
||||||
cmp cx,0
|
|
||||||
je .nobase
|
|
||||||
inc si
|
|
||||||
jmp .isstrbase
|
|
||||||
.okbase:
|
|
||||||
clc
|
|
||||||
.endbase:
|
|
||||||
ret
|
|
||||||
.verifbase:
|
|
||||||
cmp byte [si+1],0
|
|
||||||
je .okbase
|
|
||||||
.nobase:
|
|
||||||
stc
|
|
||||||
jmp .endbase
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
;Converti un str %0 de base %1 en int dans eax
|
|
||||||
proc strtoint uses ebx ecx edx si edi es, src:word,base:word
|
|
||||||
push cs
|
|
||||||
pop es
|
|
||||||
mov si,[src]
|
|
||||||
.gotos:
|
|
||||||
cmp byte [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 [base]
|
|
||||||
inc cl
|
|
||||||
push di
|
|
||||||
lea di, [base]
|
|
||||||
cld
|
|
||||||
repne scasb
|
|
||||||
pop di
|
|
||||||
jne .noop
|
|
||||||
sub cl,byte [base]
|
|
||||||
neg cl
|
|
||||||
mov eax,edi
|
|
||||||
mul ecx
|
|
||||||
add ebx,eax
|
|
||||||
mov eax,edi
|
|
||||||
mov cl,byte [base]
|
|
||||||
mul ecx
|
|
||||||
mov edi,eax
|
|
||||||
.noop:
|
|
||||||
dec si
|
|
||||||
jmp .baseto
|
|
||||||
.endbaseto:
|
|
||||||
mov eax,ebx
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
;Renvoie en ds:%1 la partie de %2 caractŠres a partir de la gauche de ds:%0
|
|
||||||
proc left uses ax cx si di es, src:word,dest:word,nb:word
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
mov si,[src]
|
|
||||||
mov di,[dest]
|
|
||||||
mov cx,[nb]
|
|
||||||
cld
|
|
||||||
rep movsb
|
|
||||||
mov al,0
|
|
||||||
stosb
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Renvoie en ds:%1 la partie de %2 caractŠres a partir de la droite de ds:%0
|
|
||||||
proc right uses ax cx si di es, src:word,dest:word,nb:word
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
mov si,[src]
|
|
||||||
mov di,[dest]
|
|
||||||
stdcall getlength,si
|
|
||||||
add si,ax
|
|
||||||
sub si,[nb]
|
|
||||||
mov cx,[nb]
|
|
||||||
cld
|
|
||||||
rep movsb
|
|
||||||
mov al,0
|
|
||||||
stosb
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Renvoie en ds:%1 la partie de %3 caractŠres a partir de la position %2 de ds:%0
|
|
||||||
proc middle uses ax cx si di es, src:word,dest:word,item:word,nb:word
|
|
||||||
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
|
|
||||||
|
|
||||||
;Rempli de %3 caractŠres %2 a partir de la position %1 de ds:%0
|
|
||||||
proc fill uses ax cx si di es, src:word,item:word,char:word,nb:word
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
mov di,[src]
|
|
||||||
add di,[item]
|
|
||||||
mov ax,[char]
|
|
||||||
mov cx,[nb]
|
|
||||||
cld
|
|
||||||
rep stosb
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Remplace tout les caractŠres %1 de ds:%0 par des caractŠres %2
|
|
||||||
proc replaceallchar uses ax cx dx di es, src:word,char1:word,char2:word
|
|
||||||
mov di,[src]
|
|
||||||
stdcall 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
|
|
||||||
|
|
||||||
;Recherche un caractŠre dl dans la chaŒne ds:%0
|
|
||||||
proc searchchar uses cx di es, src:word,char:word
|
|
||||||
mov di,[src]
|
|
||||||
stdcall getlength,di
|
|
||||||
mov cx,ax
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
mov ax,[char]
|
|
||||||
repne scasb
|
|
||||||
mov ax,di
|
|
||||||
dec ax
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Inverse la chaine point‚e en ds:%0
|
|
||||||
proc invert uses ax cx si di, src:word
|
|
||||||
mov si,[src]
|
|
||||||
stdcall 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
|
|
||||||
|
|
||||||
;Compares 2 chaines de caractŠres DS:%0 et DS:%1 zerof si non equal
|
|
||||||
proc cmpstr uses cx dx si di, src:word,dest:word
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
mov si,[src]
|
|
||||||
mov di,[dest]
|
|
||||||
stdcall getlength,di
|
|
||||||
mov cx,ax
|
|
||||||
stdcall getlength,si
|
|
||||||
cmp cx,ax
|
|
||||||
jne .notequal
|
|
||||||
repe cmpsb
|
|
||||||
.notequal:
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;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 uses cx si di es, src:word,dest:word
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
mov si,[src]
|
|
||||||
mov di,[dest]
|
|
||||||
stdcall 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
|
|
||||||
|
|
||||||
;Insert une chaine ds:%0 en ds:%1 a partir du caractŠre %2
|
|
||||||
proc insert uses ax cx si di es, src:word,dest:word,item:word
|
|
||||||
push es
|
|
||||||
pop ds
|
|
||||||
mov si,[dest]
|
|
||||||
stdcall getlength,si
|
|
||||||
mov cx,ax
|
|
||||||
add si,ax
|
|
||||||
mov di,si
|
|
||||||
stdcall 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
|
|
||||||
|
|
||||||
|
|
||||||
;Detruit %2 caractŠres a partir du caractŠre %1 de DS:%0
|
|
||||||
proc delete uses ax cx dx si di es, src:word,item:word,size:word
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
mov si,[src]
|
|
||||||
stdcall 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
|
|
||||||
|
|
||||||
;Copie une chaine de ds:si en es:di
|
|
||||||
proc copy uses ax cx si di, src:word,dest:word
|
|
||||||
mov si,[src]
|
|
||||||
mov di,[dest]
|
|
||||||
stdcall getlength,si
|
|
||||||
mov cx,ax
|
|
||||||
cld
|
|
||||||
rep movsb
|
|
||||||
mov al,0
|
|
||||||
stosb
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
;ConcatŠne le chaine ds:si avec ds:di
|
|
||||||
proc concat uses ax cx si di es, src:word,dest:word
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
mov si,[src]
|
|
||||||
stdcall getlength,si
|
|
||||||
mov cx,ax
|
|
||||||
mov di,[dest]
|
|
||||||
stdcall getlength,di
|
|
||||||
add di,ax
|
|
||||||
cld
|
|
||||||
rep movsb
|
|
||||||
mov al,0
|
|
||||||
stosb
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
;D‚truit les d‚limiteur qui sont cons‚cutifs dans ds:%0 -> renvoie le nb d'item
|
|
||||||
proc compressdelimiter uses cx dx si di es, src:word,delim:word
|
|
||||||
mov di,[src]
|
|
||||||
stdcall 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
|
|
||||||
stdcall delete,di,0,1
|
|
||||||
jmp .againcomp
|
|
||||||
.nosup:
|
|
||||||
cmp cx,0
|
|
||||||
jne .compressitems
|
|
||||||
mov ax,dx
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Met le nombre d'‚l‚ments de ds:%0 à %1
|
|
||||||
proc setnbitems uses ax cx di es, src:word,size:word,delim:word
|
|
||||||
mov di,[src]
|
|
||||||
cmp [size],0
|
|
||||||
je .onlyzero
|
|
||||||
stdcall getnbitems,di,[delim]
|
|
||||||
cmp [size],ax
|
|
||||||
je .noadjust
|
|
||||||
jb .subsome
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
sub ax,[size]
|
|
||||||
neg ax
|
|
||||||
mov cx,ax
|
|
||||||
stdcall getlength,di
|
|
||||||
add di,ax
|
|
||||||
mov ax,[delim]
|
|
||||||
mov ah,'a'
|
|
||||||
rep stosw
|
|
||||||
xor al,al
|
|
||||||
stosb
|
|
||||||
jmp .noadjust
|
|
||||||
.subsome:
|
|
||||||
stdcall getpointeritem,[src],[size],[delim]
|
|
||||||
dec ax
|
|
||||||
mov di,ax
|
|
||||||
.onlyzero:
|
|
||||||
mov byte [di],0
|
|
||||||
.noadjust:
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Renvoie la taille ax de l'‚l‚ment %0
|
|
||||||
proc getitemsize uses cx dx, src:word,item:word,delim:word
|
|
||||||
mov cx,[item]
|
|
||||||
stdcall getpointeritem,[src],cx,[delim]
|
|
||||||
mov dx,ax
|
|
||||||
inc cx
|
|
||||||
stdcall getpointeritem,[src],cx,[delim]
|
|
||||||
sub ax,dx
|
|
||||||
dec ax
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Renvoie en ds:%1 l'‚l‚ment %2 de ds:%0
|
|
||||||
proc getitem uses ax cx si di es, src:word,dest:word,item:word,delim:word
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
stdcall getpointeritem,[src],[item],[delim]
|
|
||||||
mov si,ax
|
|
||||||
stdcall getitemsize,[src],[item],[delim]
|
|
||||||
mov di,[dest]
|
|
||||||
mov cx,ax
|
|
||||||
cld
|
|
||||||
rep movsb
|
|
||||||
mov al,0
|
|
||||||
stosb
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;renvoi un pointeur ax sur l'‚l‚ment %1 de ds:%0
|
|
||||||
proc getpointeritem uses cx dx di es, src:word,item:word,delim:word
|
|
||||||
mov di,[src]
|
|
||||||
cmp [item],0
|
|
||||||
je .finishpointer
|
|
||||||
push ds
|
|
||||||
pop es
|
|
||||||
stdcall 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
|
|
||||||
|
|
||||||
;Renvoie le nombre d'‚l‚ments ax de ds:%0
|
|
||||||
proc getnbitems uses cx dx di es, src:word,delim:word
|
|
||||||
mov di,[src]
|
|
||||||
stdcall 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
|
|
||||||
|
|
||||||
;renvoie la taille en octets AX de la chaine point‚e en ds:%0
|
|
||||||
proc getlength uses cx di es, src:word
|
|
||||||
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
|
|
||||||
|
|
||||||
;Met la taille en octets de la chaine point‚e ds:%0 a %1
|
|
||||||
proc setlength uses si, src:word,size:word
|
|
||||||
mov si,[src]
|
|
||||||
add si,[size]
|
|
||||||
mov byte [si],0
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;met en majuscule la chaine ds:%0
|
|
||||||
proc uppercase uses ax si, src:word
|
|
||||||
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 [si-1],'a'-'A'
|
|
||||||
jmp .uppercase
|
|
||||||
.enduppercase:
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;met en majuscule la premiŠre lettre chaine ds:%0
|
|
||||||
proc onecase uses ax si, src:word
|
|
||||||
mov si,[src]
|
|
||||||
mov al,[ds:si]
|
|
||||||
cmp al,'a'
|
|
||||||
jb .oneenduppercase
|
|
||||||
cmp al,'z'
|
|
||||||
ja .oneenduppercase
|
|
||||||
sub byte [si],'a'-'A'
|
|
||||||
.oneenduppercase:
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;met en minuscule la chaine ds:%0
|
|
||||||
proc lowercase uses ax si, src:word
|
|
||||||
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 [si-1],'a'-'A'
|
|
||||||
jmp .lowercase
|
|
||||||
.endlowercase:
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
;Inverse la casse la chaine ds:%0
|
|
||||||
proc invertcase uses ax si, src:word
|
|
||||||
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 [si-1],'a'-'A'
|
|
||||||
jmp .invertcase
|
|
||||||
.goinvertcase:
|
|
||||||
add byte [si-1],'a'-'A'
|
|
||||||
jmp .invertcase
|
|
||||||
.endinvertcase:
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
888
lib/video.asm
888
lib/video.asm
File diff suppressed because it is too large
Load Diff
66
makefile
66
makefile
@ -1,66 +0,0 @@
|
|||||||
all: boot/boot12.bin lib/3d.lib noyau/systeme.sys programs/commande.ce
|
|
||||||
sync
|
|
||||||
|
|
||||||
install:
|
|
||||||
(sudo apt-get install fasm qemu fusefat gdb)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
make -C final clean
|
|
||||||
make -C boot clean
|
|
||||||
make -C lib clean
|
|
||||||
make -C noyau clean
|
|
||||||
make -C programs clean
|
|
||||||
sync
|
|
||||||
|
|
||||||
backup: clean
|
|
||||||
(tar cf - . | gzip -f - > ../backup.tar.gz)
|
|
||||||
|
|
||||||
copy:
|
|
||||||
make -C final
|
|
||||||
|
|
||||||
tools:
|
|
||||||
fasm /usr/share/fasm/tools/libc/listing.asm
|
|
||||||
fasm /usr/share/fasm/tools/libc/prepsrc.asm
|
|
||||||
fasm /usr/share/fasm/tools/libc/symbols.asm
|
|
||||||
gcc -m32 -static /usr/share/fasm/tools/libc/listing.o -o /usr/bin/listing
|
|
||||||
gcc -m32 -static /usr/share/fasm/tools/libc/prepsrc.o -o /usr/bin/prepsrc
|
|
||||||
gcc -m32 -static /usr/share/fasm/tools/libc/symbols.o -o /usr/bin/symbols
|
|
||||||
|
|
||||||
test: all copy qemu
|
|
||||||
|
|
||||||
retest: clean test
|
|
||||||
|
|
||||||
view: final/cos2000.img
|
|
||||||
(hexdump -C ./final/cos2000.img|head -c10000)
|
|
||||||
|
|
||||||
view2: boot/boot12.bin
|
|
||||||
(objdump -D -b binary -mi386 -Maddr16,data16 ./boot/boot12.bin)
|
|
||||||
|
|
||||||
debug: debug-system
|
|
||||||
|
|
||||||
redebug: clean debug
|
|
||||||
|
|
||||||
debug-boot: all copy qemu-debug
|
|
||||||
(sleep 2;gdb -ix ./debug/gdb_init_real_mode.txt -x ./debug/boot.txt)
|
|
||||||
|
|
||||||
debug-system: all copy qemu-debug
|
|
||||||
(sleep 2;gdb -ix ./debug/gdb_init_real_mode.txt -x ./debug/system.txt)
|
|
||||||
|
|
||||||
qemu-debug:
|
|
||||||
(killall qemu-system-i386;qemu-system-i386 -m 1G -fda ./final/cos2000.img -s -S &)
|
|
||||||
|
|
||||||
qemu:
|
|
||||||
(killall qemu-system-i386;qemu-system-i386 -m 1G -fda ./final/cos2000.img -s)
|
|
||||||
|
|
||||||
noyau/systeme.sys:
|
|
||||||
make -C noyau
|
|
||||||
|
|
||||||
boot/boot12.bin:
|
|
||||||
make -C boot
|
|
||||||
|
|
||||||
lib/3d.lib:
|
|
||||||
make -C lib
|
|
||||||
|
|
||||||
programs/commande.ce:
|
|
||||||
make -C programs
|
|
||||||
|
|
358
noyau/8259a.asm
358
noyau/8259a.asm
@ -1,4 +1,4 @@
|
|||||||
;Adresses de port du controleur IRQ
|
;Adresses de port du contr“leur IRQ
|
||||||
MASTERPIC = 020h ;Adresse de base du PIC maŒtre
|
MASTERPIC = 020h ;Adresse de base du PIC maŒtre
|
||||||
SLAVEPIC = 0A0h ;Adresse de base du PIC esclave
|
SLAVEPIC = 0A0h ;Adresse de base du PIC esclave
|
||||||
IRQMASK = 001h ;Offset sur port de masquage
|
IRQMASK = 001h ;Offset sur port de masquage
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
;Position des vecteurs d'interruptions
|
;Position des vecteurs d'interruptions
|
||||||
MASTERFIRSTVECTOR = 008h ;Vecteurs logiciels des interruptions
|
MASTERFIRSTVECTOR = 008h ;Vecteurs logiciels des interruptions
|
||||||
SLAVEFIRSTVECTOR = 070h ;electroniques
|
SLAVEFIRSTVECTOR = 070h ;‚lectroniques
|
||||||
|
|
||||||
;OCW3 codes registres
|
;OCW3 codes registres
|
||||||
IRR = 002h ;Interrupt Request Register
|
IRR = 002h ;Interrupt Request Register
|
||||||
@ -24,18 +24,20 @@
|
|||||||
POLLING = 004h ;Polling bit
|
POLLING = 004h ;Polling bit
|
||||||
|
|
||||||
|
|
||||||
ISR = 0Bh ; Pas d'operation, pas de Poll, lire ISR OCW3
|
ISR = 0Bh ; Pas d'op‚ration, pas de Poll, lire ISR OCW3
|
||||||
IRR = 0Ah ; Pas d'operation, pas de Poll, lire IRR
|
IRR = 0Ah ; Pas d'op‚ration, pas de Poll, lire IRR
|
||||||
|
|
||||||
;Autorise une interruption electronique
|
;Autorise une interruption ‚lectronique
|
||||||
;Entree : %1 - Numero de l'interruption (0-15) à autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
;Entr‚e : %1 - Num‚ro de l'interruption (0-15) … autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
||||||
proc enableirq uses ax cx dx, irq:word
|
PROC enableirq FAR
|
||||||
mov ax,[irq]
|
ARG @irq:word
|
||||||
|
USES ax,cx,dx
|
||||||
|
mov ax,[@irq]
|
||||||
mov dx,MASTERPIC+IRQMASK
|
mov dx,MASTERPIC+IRQMASK
|
||||||
cmp al,7
|
cmp al,7
|
||||||
jbe .master
|
jbe @@master
|
||||||
mov dx,SLAVEPIC+IRQMASK
|
mov dx,SLAVEPIC+IRQMASK
|
||||||
.master:
|
@@master:
|
||||||
mov cl,al
|
mov cl,al
|
||||||
and cl,7
|
and cl,7
|
||||||
mov al,1
|
mov al,1
|
||||||
@ -46,17 +48,19 @@ proc enableirq uses ax cx dx, irq:word
|
|||||||
and al,ah
|
and al,ah
|
||||||
out dx,al
|
out dx,al
|
||||||
ret
|
ret
|
||||||
endp
|
endp enableirq
|
||||||
|
|
||||||
;Desactive une interruption ‚lectronique
|
;Desactive une interruption ‚lectronique
|
||||||
;Entr‚e : %0 - Num‚ro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
;Entr‚e : %0 - Num‚ro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
||||||
proc disableirq uses ax cx dx, irq:word
|
PROC disableirq FAR
|
||||||
mov ax,[irq]
|
ARG @irq:word
|
||||||
|
USES ax,cx,dx
|
||||||
|
mov ax,[@irq]
|
||||||
mov dx,MASTERPIC+IRQMASK
|
mov dx,MASTERPIC+IRQMASK
|
||||||
cmp al,7
|
cmp al,7
|
||||||
jbe .master
|
jbe @@master
|
||||||
mov dx,SLAVEPIC+IRQMASK
|
mov dx,SLAVEPIC+IRQMASK
|
||||||
.master:
|
@@master:
|
||||||
mov cl,al
|
mov cl,al
|
||||||
and cl,7
|
and cl,7
|
||||||
mov al,1
|
mov al,1
|
||||||
@ -67,338 +71,72 @@ proc disableirq uses ax cx dx, irq:word
|
|||||||
or al,ah
|
or al,ah
|
||||||
out dx,al
|
out dx,al
|
||||||
ret
|
ret
|
||||||
endp
|
endp disableirq
|
||||||
|
|
||||||
|
|
||||||
;Signale "End Of Interrupt" de l'interruption %0
|
;Signale "End Of Interrupt" de l'interruption %0
|
||||||
proc seteoi uses ax dx, irq:word
|
PROC seteoi FAR
|
||||||
mov ax,[irq]
|
ARG @irq:word
|
||||||
|
USES ax,dx
|
||||||
|
mov ax,[@irq]
|
||||||
cmp al,7
|
cmp al,7
|
||||||
jbe .master
|
jbe @@master
|
||||||
mov al,EOI
|
mov al,EOI
|
||||||
out SLAVEPIC,al
|
out SLAVEPIC,al
|
||||||
.master:
|
@@master:
|
||||||
mov al,EOI
|
mov al,EOI
|
||||||
out MASTERPIC,al
|
out MASTERPIC,al
|
||||||
ret
|
ret
|
||||||
endp
|
endp seteoi
|
||||||
|
|
||||||
|
|
||||||
;Lit les masques d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
|
;Lit les masques d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
|
||||||
proc readimr uses bx dx, controleur:word
|
PROC readmaskirq FAR
|
||||||
mov bx,[controleur]
|
ARG @controleur:word
|
||||||
|
USES bx,dx
|
||||||
|
mov bx,[@controleur]
|
||||||
mov dx,MASTERPIC+ IRQMASK
|
mov dx,MASTERPIC+ IRQMASK
|
||||||
cmp bl,0
|
cmp bl,0
|
||||||
jne .master
|
jne @@master
|
||||||
mov dx,SLAVEPIC+ IRQMASK
|
mov dx,SLAVEPIC+ IRQMASK
|
||||||
.master:
|
@@master:
|
||||||
xor ah,ah
|
xor ah,ah
|
||||||
in al,dx
|
in al,dx
|
||||||
pop dx
|
pop dx
|
||||||
ret
|
ret
|
||||||
endp
|
endp readmaskirq
|
||||||
|
|
||||||
;Lit le registre d'‚tat d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
|
;Lit le registre d'‚tat d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
|
||||||
proc readisr uses bx dx, controleur:word
|
PROC readisr FAR
|
||||||
mov bx,[controleur]
|
ARG @controleur:word
|
||||||
|
USES bx,dx
|
||||||
|
mov bx,[@controleur]
|
||||||
mov dx,MASTERPIC
|
mov dx,MASTERPIC
|
||||||
cmp bh,0
|
cmp bh,0
|
||||||
jne .master
|
jne @@master
|
||||||
mov dx,SLAVEPIC
|
mov dx,SLAVEPIC
|
||||||
.master:
|
@@master:
|
||||||
mov al,ISR
|
mov al,ISR
|
||||||
out dx,al
|
out dx,al
|
||||||
xor ah,ah
|
xor ah,ah
|
||||||
in al,dx
|
in al,dx
|
||||||
ret
|
ret
|
||||||
endp
|
endp readisr
|
||||||
|
|
||||||
|
|
||||||
;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh
|
;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh
|
||||||
proc readirr uses bx dx, controleur:word
|
PROC readirr FAR
|
||||||
mov bx,[controleur]
|
ARG @controleur:word
|
||||||
|
USES bx,dx
|
||||||
|
mov bx,[@controleur]
|
||||||
mov dx,MASTERPIC
|
mov dx,MASTERPIC
|
||||||
cmp bh,0
|
cmp bh,0
|
||||||
jne .master
|
jne @@master
|
||||||
mov dx,SLAVEPIC
|
mov dx,SLAVEPIC
|
||||||
.master:
|
@@master:
|
||||||
mov al,IRR
|
mov al,IRR
|
||||||
out dx,al
|
out dx,al
|
||||||
xor ah,ah
|
xor ah,ah
|
||||||
in al,dx
|
in al,dx
|
||||||
ret
|
ret
|
||||||
endp
|
endp readirr
|
||||||
|
|
||||||
;carry si enable et pas carry si pas enable
|
|
||||||
proc isenableirq uses ax cx dx, irq:word
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
;carry si enable et pas carry si pas enable
|
|
||||||
proc isinserviceirq uses ax cx dx, irq:word
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
;carry si enable et pas carry si pas enable
|
|
||||||
proc isrequestirq uses ax cx dx, irq:word
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
proc installirqhandler uses eax bx cx edx si di ds es
|
|
||||||
push fs
|
|
||||||
stdcall mbcreate,interruptionbloc,256*ints.sizeof
|
|
||||||
mov es,ax
|
|
||||||
mov ax,0x0000
|
|
||||||
mov ds,ax
|
|
||||||
xor si,si
|
|
||||||
.searchdummypointer:
|
|
||||||
virtual at si
|
|
||||||
.vector vector
|
|
||||||
end virtual
|
|
||||||
mov fs,[.vector.data.seg]
|
|
||||||
mov bx,[.vector.data.off]
|
|
||||||
cmp byte [fs:bx],0xCF ;iret
|
|
||||||
je .founded
|
|
||||||
add si,vector.sizeof
|
|
||||||
cmp si,256*4
|
|
||||||
jb .searchdummypointer
|
|
||||||
xor edx,edx
|
|
||||||
jmp .suite
|
|
||||||
.founded:
|
|
||||||
mov edx,[.vector.content]
|
|
||||||
.suite:
|
|
||||||
xor cx,cx
|
|
||||||
xor si,si
|
|
||||||
xor di,di
|
|
||||||
cli
|
|
||||||
.copy:
|
|
||||||
virtual at di
|
|
||||||
.ints ints
|
|
||||||
end virtual
|
|
||||||
mov [es:.ints.number],cl
|
|
||||||
mov [es:.ints.locked],0
|
|
||||||
mov [es:.ints.vector1.content],0
|
|
||||||
mov [es:.ints.vector3.content],0
|
|
||||||
mov [es:.ints.vector4.content],0
|
|
||||||
mov [es:.ints.vector5.content],0
|
|
||||||
mov [es:.ints.vector6.content],0
|
|
||||||
mov [es:.ints.vector7.content],0
|
|
||||||
mov [es:.ints.vector8.content],0
|
|
||||||
mov [es:.ints.launchedlow],0
|
|
||||||
mov [es:.ints.launchedhigh],0
|
|
||||||
mov [es:.ints.calledlow],0
|
|
||||||
mov [es:.ints.calledhigh],0
|
|
||||||
mov eax,[.vector.content]
|
|
||||||
cmp eax,edx
|
|
||||||
je .notarealvector
|
|
||||||
mov [es:.ints.vector1.content],eax
|
|
||||||
mov [es:.ints.activated],1
|
|
||||||
jmp .copynext
|
|
||||||
.notarealvector:
|
|
||||||
mov [es:.ints.vector1.content],0
|
|
||||||
mov [es:.ints.activated],0
|
|
||||||
.copynext:
|
|
||||||
mov bx,cx
|
|
||||||
shl bx,3
|
|
||||||
sub bx,cx
|
|
||||||
add bx,coupling
|
|
||||||
mov [.vector.data.seg],cs
|
|
||||||
mov [.vector.data.off],bx
|
|
||||||
add si,vector.sizeof
|
|
||||||
add di,ints.sizeof
|
|
||||||
inc cl
|
|
||||||
cmp cl,0
|
|
||||||
jne .copy
|
|
||||||
.end:
|
|
||||||
pop fs
|
|
||||||
sti
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
interruptionbloc db '/interrupts',0
|
|
||||||
|
|
||||||
|
|
||||||
proc savecontext uses eax si ds, pointer:word
|
|
||||||
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 [ss:bp]
|
|
||||||
push eax
|
|
||||||
push word [ss:bp+4]
|
|
||||||
xor eax,eax
|
|
||||||
mov ax,word [ss:bp+2]
|
|
||||||
push eax
|
|
||||||
mov ax,bp
|
|
||||||
add ax,4
|
|
||||||
push eax
|
|
||||||
virtual at si
|
|
||||||
.regs regs
|
|
||||||
end virtual
|
|
||||||
pop [.regs.sesp]
|
|
||||||
pop [.regs.seip]
|
|
||||||
pop [.regs.scs]
|
|
||||||
pop [.regs.sebp]
|
|
||||||
pop [.regs.sss]
|
|
||||||
pop [.regs.sgs]
|
|
||||||
pop [.regs.sfs]
|
|
||||||
pop [.regs.ses]
|
|
||||||
pop [.regs.sds]
|
|
||||||
pop [.regs.sedi]
|
|
||||||
pop [.regs.sesi]
|
|
||||||
pop [.regs.sedx]
|
|
||||||
pop [.regs.secx]
|
|
||||||
pop [.regs.sebx]
|
|
||||||
pop [.regs.seax]
|
|
||||||
pop [.regs.seflags]
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
proc restorecontextg, pointer:word
|
|
||||||
mov si,[pointer]
|
|
||||||
virtual at si
|
|
||||||
.regs regs
|
|
||||||
end virtual
|
|
||||||
pushd [cs:.regs.sesi]
|
|
||||||
pushd [cs:.regs.seflags]
|
|
||||||
mov eax,[cs:.regs.seax]
|
|
||||||
mov ebx,[cs:.regs.sebx]
|
|
||||||
mov ecx,[cs:.regs.secx]
|
|
||||||
mov edx,[cs:.regs.sedx]
|
|
||||||
mov edi,[cs:.regs.sedi]
|
|
||||||
mov ebp,[cs:.regs.sebp]
|
|
||||||
mov es,[cs:.regs.ses]
|
|
||||||
mov fs,[cs:.regs.sfs]
|
|
||||||
mov gs,[cs:.regs.sgs]
|
|
||||||
mov ds,[cs:.regs.sds]
|
|
||||||
popfd
|
|
||||||
pop esi
|
|
||||||
pop [cs:dummy]
|
|
||||||
db 0xCA,0x02,0x00 ;ret 2
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
coupling:
|
|
||||||
repeat 256
|
|
||||||
push %+256
|
|
||||||
push irqhandlers
|
|
||||||
ret
|
|
||||||
end repeat
|
|
||||||
|
|
||||||
interrupt dw 0
|
|
||||||
dummy dw 0
|
|
||||||
calling_reg regs
|
|
||||||
function_reg regs
|
|
||||||
|
|
||||||
irqhandlers:
|
|
||||||
cli
|
|
||||||
pop [cs:interrupt]
|
|
||||||
stdcall savecontext,calling_reg
|
|
||||||
stdcall irqhandler,[cs:interrupt]
|
|
||||||
stdcall restorecontextg,calling_reg
|
|
||||||
sti
|
|
||||||
iret
|
|
||||||
|
|
||||||
proc irqhandler, int:word
|
|
||||||
push cs
|
|
||||||
pop ds
|
|
||||||
stdcall mbfindsb,interruptionbloc,cs
|
|
||||||
jc .end
|
|
||||||
mov es,ax
|
|
||||||
mov ax,[int]
|
|
||||||
sub ax,256
|
|
||||||
mov cx,ints.sizeof
|
|
||||||
mul cx
|
|
||||||
mov si,ax
|
|
||||||
virtual at si
|
|
||||||
.ints ints
|
|
||||||
end virtual
|
|
||||||
add [es:.ints.calledlow],1
|
|
||||||
adc [es:.ints.calledhigh],0
|
|
||||||
cmp [es:.ints.activated],1
|
|
||||||
jne .end
|
|
||||||
add [es:.ints.launchedlow],1
|
|
||||||
adc [es:.ints.launchedhigh],0
|
|
||||||
lea si,[es:.ints.vector1]
|
|
||||||
mov cl,8
|
|
||||||
.launchall:
|
|
||||||
virtual at si
|
|
||||||
.vector vector
|
|
||||||
end virtual
|
|
||||||
cmp [es:.vector.content],0
|
|
||||||
je .end
|
|
||||||
push word [cs:calling_reg.seflags]
|
|
||||||
push cs
|
|
||||||
push .back
|
|
||||||
push [es:.vector.data.seg]
|
|
||||||
push [es:.vector.data.off]
|
|
||||||
stdcall savecontext,function_reg
|
|
||||||
stdcall restorecontextg,calling_reg
|
|
||||||
db 0xCB
|
|
||||||
.back:
|
|
||||||
cli
|
|
||||||
stdcall savecontext,calling_reg
|
|
||||||
stdcall restorecontextg,function_reg
|
|
||||||
.next:
|
|
||||||
add si,vector.sizeof
|
|
||||||
dec cl
|
|
||||||
jnz .launchall
|
|
||||||
.end:
|
|
||||||
ret
|
|
||||||
endp
|
|
||||||
|
|
||||||
|
|
||||||
|
|
36
noyau/MAKEFILE
Normal file
36
noyau/MAKEFILE
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
asm= lzasm
|
||||||
|
lnk= elink
|
||||||
|
|
||||||
|
all: systeme.sys boot.bin
|
||||||
|
|
||||||
|
systeme.sys: video.obj systeme.obj
|
||||||
|
$(lnk) systeme.obj systeme.sys
|
||||||
|
|
||||||
|
systeme.obj: ../lib/detect.lib ../lib/video.lib video.sys
|
||||||
|
$(asm) systeme.asm
|
||||||
|
|
||||||
|
|
||||||
|
video.sys:
|
||||||
|
$(lnk) video.obj video.sys
|
||||||
|
|
||||||
|
boot.bin: boot.obj
|
||||||
|
$(lnk) boot.obj boot.bin /bs
|
||||||
|
|
||||||
|
detect.obj:
|
||||||
|
$(asm) detect.asm
|
||||||
|
|
||||||
|
video.obj:
|
||||||
|
$(asm) video.asm
|
||||||
|
|
||||||
|
boot.obj:
|
||||||
|
$(asm) boot.asm
|
||||||
|
|
||||||
|
clean:
|
||||||
|
del *.obj
|
||||||
|
del *.exe
|
||||||
|
del *.bak
|
||||||
|
del *.lib
|
||||||
|
del *.com
|
||||||
|
del *.bin
|
||||||
|
del *.sys
|
||||||
|
del *.err
|
216
noyau/boot.asm
Normal file
216
noyau/boot.asm
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
model tiny,stdcall
|
||||||
|
p486
|
||||||
|
locals
|
||||||
|
jumps
|
||||||
|
codeseg
|
||||||
|
option procalign:byte
|
||||||
|
|
||||||
|
include "..\include\mem.h"
|
||||||
|
include "..\include\fat.h"
|
||||||
|
include "..\include\divers.h"
|
||||||
|
|
||||||
|
org 7C00h
|
||||||
|
|
||||||
|
jmp boot
|
||||||
|
|
||||||
|
bootsec bootinfo <"COS2000A",512,1,1,2,224,2880,0F0h,9,18,2,0,0,0,0,0,29h,01020304h,"COS2000 ","FAT12 ">
|
||||||
|
|
||||||
|
errorloading db " [Erreur]",0dh,0ah,0
|
||||||
|
okloading db "Recherche noyau ",0Dh,0ah," -"
|
||||||
|
sys db "SYSTEME SYS",0
|
||||||
|
syst db " [ Ok ]",0dh,0ah,"Chargement ",0
|
||||||
|
dot db ".",0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
errorboot:
|
||||||
|
mov si,offset errorloading
|
||||||
|
call showstr
|
||||||
|
mov ah,0
|
||||||
|
int 16h
|
||||||
|
int 19h
|
||||||
|
|
||||||
|
boot:
|
||||||
|
mov [bootsec.bootdrive],dl
|
||||||
|
cli
|
||||||
|
mov ax,09000h
|
||||||
|
mov ss,ax
|
||||||
|
mov sp,0FFFFh
|
||||||
|
sti
|
||||||
|
boot2:
|
||||||
|
push cs
|
||||||
|
push cs
|
||||||
|
pop es
|
||||||
|
pop ds
|
||||||
|
xor ax,ax
|
||||||
|
mov dl,[bootsec.bootdrive]
|
||||||
|
int 13h
|
||||||
|
jc errorboot
|
||||||
|
mov si,offset okloading
|
||||||
|
call showstr
|
||||||
|
mov cx,[bootsec.reservedsectors]
|
||||||
|
add cx,[bootsec.hiddensectorsh]
|
||||||
|
adc cx,[bootsec.hiddensectorsl]
|
||||||
|
push cx
|
||||||
|
mov bx,[bootsec.sectorsperfat]
|
||||||
|
mov di,offset bufferfat
|
||||||
|
readfat:
|
||||||
|
call readsector
|
||||||
|
jc errorboot
|
||||||
|
inc cx
|
||||||
|
add di,[bootsec.sectorsize]
|
||||||
|
dec bx
|
||||||
|
jnz readfat
|
||||||
|
pop cx
|
||||||
|
xor ax,ax
|
||||||
|
mov al,[bootsec.fatsperdrive]
|
||||||
|
mov bx,[bootsec.sectorsperfat]
|
||||||
|
mul bx
|
||||||
|
add cx,ax
|
||||||
|
mov ax,32
|
||||||
|
mul [bootsec.directorysize]
|
||||||
|
div [bootsec.sectorsize]
|
||||||
|
add ax,cx
|
||||||
|
sub ax,2
|
||||||
|
mov [word ptr bootsec.reservedfornt],ax
|
||||||
|
xor dx,dx
|
||||||
|
checkroot:
|
||||||
|
mov di,offset buffer
|
||||||
|
call readsector
|
||||||
|
jc errorboot
|
||||||
|
xor bx,bx
|
||||||
|
findnext:
|
||||||
|
cmp [byte ptr di],0
|
||||||
|
je errorboot
|
||||||
|
cmp [byte ptr di],0E5h
|
||||||
|
je no
|
||||||
|
cmp [byte ptr di],041h
|
||||||
|
je no
|
||||||
|
mov si,offset dot
|
||||||
|
call showstr
|
||||||
|
push di cx
|
||||||
|
mov si,offset sys
|
||||||
|
mov cx,11
|
||||||
|
rep cmpsb
|
||||||
|
pop cx di
|
||||||
|
je oksystem
|
||||||
|
no:
|
||||||
|
add di,32
|
||||||
|
add bx,32
|
||||||
|
inc dx
|
||||||
|
cmp dx,[bootsec.directorysize]
|
||||||
|
ja errorboot
|
||||||
|
cmp bx,[bootsec.sectorsize]
|
||||||
|
jb findnext
|
||||||
|
inc cx
|
||||||
|
jmp checkroot
|
||||||
|
oksystem:
|
||||||
|
mov si,offset syst
|
||||||
|
call showstr
|
||||||
|
mov cx,[di+26]
|
||||||
|
mov ax,0900h
|
||||||
|
mov es,ax
|
||||||
|
push es
|
||||||
|
mov di,0000h
|
||||||
|
push 0010h
|
||||||
|
mov si,offset dot
|
||||||
|
xor ax,ax
|
||||||
|
fatagain:
|
||||||
|
cmp cx,0FF0h
|
||||||
|
jae finishload
|
||||||
|
push cx
|
||||||
|
add cx,[word ptr bootsec.reservedfornt]
|
||||||
|
call readsector
|
||||||
|
pop cx
|
||||||
|
jc errorboot
|
||||||
|
inc ax
|
||||||
|
call showstr
|
||||||
|
add di,[bootsec.sectorsize]
|
||||||
|
call getfat
|
||||||
|
jnc fatagain
|
||||||
|
finishload:
|
||||||
|
retf
|
||||||
|
|
||||||
|
;=============READSECTOR (Fonction 01H)===============
|
||||||
|
;Lit le secteur CX et le met en es:di
|
||||||
|
;-> AH=1
|
||||||
|
;<- Flag Carry si erreur
|
||||||
|
;=====================================================
|
||||||
|
readsector:
|
||||||
|
push ax bx cx dx si
|
||||||
|
mov ax,cx
|
||||||
|
xor dx,dx
|
||||||
|
div [bootsec.sectorspertrack]
|
||||||
|
inc dl
|
||||||
|
mov bl,dl
|
||||||
|
xor dx,dx
|
||||||
|
div [bootsec.headsperdrive]
|
||||||
|
xchg dl,dh
|
||||||
|
mov cx,ax
|
||||||
|
xchg cl,ch
|
||||||
|
shl cl,6
|
||||||
|
or cl, bl
|
||||||
|
mov bx,di
|
||||||
|
mov si, 4
|
||||||
|
mov al, 1
|
||||||
|
tryagain:
|
||||||
|
mov ah, 2
|
||||||
|
mov dl,[bootsec.bootdrive]
|
||||||
|
int 13h
|
||||||
|
jnc done
|
||||||
|
dec si
|
||||||
|
jnz tryagain
|
||||||
|
done:
|
||||||
|
pop si dx cx bx ax
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
getfat:
|
||||||
|
push ax bx dx di
|
||||||
|
mov di,offset bufferfat
|
||||||
|
mov ax,cx
|
||||||
|
mov bx,ax
|
||||||
|
and bx,0000000000000001b
|
||||||
|
shr ax,1
|
||||||
|
mov cx,3
|
||||||
|
mul cx
|
||||||
|
add di,ax
|
||||||
|
cmp bx,0h
|
||||||
|
jnz evenfat
|
||||||
|
oddfat:
|
||||||
|
mov dx,[di]
|
||||||
|
and dx,0FFFh
|
||||||
|
mov cx,dx
|
||||||
|
jmp endfat
|
||||||
|
evenfat:
|
||||||
|
mov dx,[di+1]
|
||||||
|
and dx,0FFF0h
|
||||||
|
shr dx,4
|
||||||
|
mov cx,dx
|
||||||
|
endfat:
|
||||||
|
pop di dx bx ax
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
showstr:
|
||||||
|
push ax bx si
|
||||||
|
again:
|
||||||
|
lodsb
|
||||||
|
or al,al
|
||||||
|
jz fin
|
||||||
|
mov ah,0Eh
|
||||||
|
mov bx,07h
|
||||||
|
int 10h
|
||||||
|
jmp again
|
||||||
|
fin:
|
||||||
|
pop si bx ax
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
db 055h,0AAh
|
||||||
|
|
||||||
|
endof:
|
||||||
|
|
||||||
|
buffer equ offset endof+2048
|
||||||
|
bufferfat equ offset endof+4096
|
||||||
|
|
1656
noyau/disque.asm
1656
noyau/disque.asm
File diff suppressed because it is too large
Load Diff
BIN
noyau/font/2_hebrew.fnt
Normal file
BIN
noyau/font/2_hebrew.fnt
Normal file
Binary file not shown.
BIN
noyau/font/8x11snsf.fnt
Normal file
BIN
noyau/font/8x11snsf.fnt
Normal file
Binary file not shown.
BIN
noyau/font/ad&d.fnt
Normal file
BIN
noyau/font/ad&d.fnt
Normal file
Binary file not shown.
BIN
noyau/font/antique.fnt
Normal file
BIN
noyau/font/antique.fnt
Normal file
Binary file not shown.
BIN
noyau/font/applicat.fnt
Normal file
BIN
noyau/font/applicat.fnt
Normal file
Binary file not shown.
BIN
noyau/font/backward.fnt
Normal file
BIN
noyau/font/backward.fnt
Normal file
Binary file not shown.
BIN
noyau/font/bigserif.fnt
Normal file
BIN
noyau/font/bigserif.fnt
Normal file
Binary file not shown.
BIN
noyau/font/blcksnsf.fnt
Normal file
BIN
noyau/font/blcksnsf.fnt
Normal file
Binary file not shown.
BIN
noyau/font/block.fnt
Normal file
BIN
noyau/font/block.fnt
Normal file
Binary file not shown.
BIN
noyau/font/bold.fnt
Normal file
BIN
noyau/font/bold.fnt
Normal file
Binary file not shown.
BIN
noyau/font/breeze.fnt
Normal file
BIN
noyau/font/breeze.fnt
Normal file
Binary file not shown.
BIN
noyau/font/broadway.fnt
Normal file
BIN
noyau/font/broadway.fnt
Normal file
Binary file not shown.
BIN
noyau/font/comp.fnt
Normal file
BIN
noyau/font/comp.fnt
Normal file
Binary file not shown.
BIN
noyau/font/computer.fnt
Normal file
BIN
noyau/font/computer.fnt
Normal file
Binary file not shown.
BIN
noyau/font/courier.fnt
Normal file
BIN
noyau/font/courier.fnt
Normal file
Binary file not shown.
BIN
noyau/font/cyrillic.fnt
Normal file
BIN
noyau/font/cyrillic.fnt
Normal file
Binary file not shown.
BIN
noyau/font/dblmtx14.fnt
Normal file
BIN
noyau/font/dblmtx14.fnt
Normal file
Binary file not shown.
BIN
noyau/font/dblmtx16.fnt
Normal file
BIN
noyau/font/dblmtx16.fnt
Normal file
Binary file not shown.
BIN
noyau/font/finnish.fnt
Normal file
BIN
noyau/font/finnish.fnt
Normal file
Binary file not shown.
BIN
noyau/font/font1!!!.dat
Normal file
BIN
noyau/font/font1!!!.dat
Normal file
Binary file not shown.
BIN
noyau/font/font2!!!.dat
Normal file
BIN
noyau/font/font2!!!.dat
Normal file
Binary file not shown.
BIN
noyau/font/font3!!!.dat
Normal file
BIN
noyau/font/font3!!!.dat
Normal file
Binary file not shown.
BIN
noyau/font/font4!!!.dat
Normal file
BIN
noyau/font/font4!!!.dat
Normal file
Binary file not shown.
BIN
noyau/font/frankfrt.fnt
Normal file
BIN
noyau/font/frankfrt.fnt
Normal file
Binary file not shown.
BIN
noyau/font/fresno.fnt
Normal file
BIN
noyau/font/fresno.fnt
Normal file
Binary file not shown.
BIN
noyau/font/future.fnt
Normal file
BIN
noyau/font/future.fnt
Normal file
Binary file not shown.
BIN
noyau/font/greek.fnt
Normal file
BIN
noyau/font/greek.fnt
Normal file
Binary file not shown.
BIN
noyau/font/hebrew.fnt
Normal file
BIN
noyau/font/hebrew.fnt
Normal file
Binary file not shown.
BIN
noyau/font/hollow.fnt
Normal file
BIN
noyau/font/hollow.fnt
Normal file
Binary file not shown.
BIN
noyau/font/hylas.fnt
Normal file
BIN
noyau/font/hylas.fnt
Normal file
Binary file not shown.
BIN
noyau/font/inverted.fnt
Normal file
BIN
noyau/font/inverted.fnt
Normal file
Binary file not shown.
BIN
noyau/font/italic.fnt
Normal file
BIN
noyau/font/italic.fnt
Normal file
Binary file not shown.
BIN
noyau/font/italics.fnt
Normal file
BIN
noyau/font/italics.fnt
Normal file
Binary file not shown.
BIN
noyau/font/itt.fnt
Normal file
BIN
noyau/font/itt.fnt
Normal file
Binary file not shown.
BIN
noyau/font/lcd.fnt
Normal file
BIN
noyau/font/lcd.fnt
Normal file
Binary file not shown.
BIN
noyau/font/mechanix.fnt
Normal file
BIN
noyau/font/mechanix.fnt
Normal file
Binary file not shown.
BIN
noyau/font/medieval.fnt
Normal file
BIN
noyau/font/medieval.fnt
Normal file
Binary file not shown.
BIN
noyau/font/modern-1.fnt
Normal file
BIN
noyau/font/modern-1.fnt
Normal file
Binary file not shown.
BIN
noyau/font/norway.fnt
Normal file
BIN
noyau/font/norway.fnt
Normal file
Binary file not shown.
BIN
noyau/font/norway2.fnt
Normal file
BIN
noyau/font/norway2.fnt
Normal file
Binary file not shown.
BIN
noyau/font/old8x8.fnt
Normal file
BIN
noyau/font/old8x8.fnt
Normal file
Binary file not shown.
BIN
noyau/font/oldeng.fnt
Normal file
BIN
noyau/font/oldeng.fnt
Normal file
Binary file not shown.
BIN
noyau/font/roman.fnt
Normal file
BIN
noyau/font/roman.fnt
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user