feat: ajout de la commande kill Utilisation de la bibliotheque video.lib plutot que l'int 47h Ajout de l'aide aux commandes Colorisation des commandes internes

This commit is contained in:
Nicolas Hordé 2004-11-30 19:30:30 +00:00
parent 8025aca688
commit 1fbe390e3e
1 changed files with 319 additions and 289 deletions

View File

@ -1,16 +1,16 @@
.model tiny .model tiny
.486 .486
smart smart
.code .code
org 0h org 0h
include ..\include\fat.h include ..\include\fat.h
include ..\include\mem.h include ..\include\mem.h
include ..\include\divers.h include ..\include\divers.h
start: start:
header exe <,1,0,,,offset imports,,> header exe <,1,0,,,offset imports,,>
realstart: realstart:
push offset msginit push offset msginit
@ -24,9 +24,9 @@ replay:
noret: noret:
mov ah,6 mov ah,6
int 47h int 47h
mov ah,16 mov ah,16
mov di,offset dir mov di,offset dir
int 48h int 48h
push offset prompt push offset prompt
call [print] call [print]
mov di,offset buffer mov di,offset buffer
@ -38,20 +38,20 @@ waitchar:
jne norr jne norr
cmp bp,0 cmp bp,0
je waitchar je waitchar
push word ptr cs:[bp-8] push word ptr cs: [bp-8]
call [print] call [print]
push cs push cs
pop es pop es
call copy0 call copy0
call getlength0 call getlength0
add di,cx add di,cx
jmp waitchar jmp waitchar
norr: norr:
cmp al,0Dh ;entrée cmp al,0dh ;entrée
je entere je entere
cmp al,08h ;backspace cmp al,08h ;backspace
je backspace je backspace
cmp al,27 ;echap cmp al,27 ;echap
je escape je escape
cmp al,' ' cmp al,' '
jb waitchar jb waitchar
@ -115,13 +115,13 @@ tre:
cmp di,0 cmp di,0
je error je error
push cs push cs
pop es pop es
call evalue0 call evalue0
cmp dx,bp cmp dx,bp
jb noadd jb noadd
mov bp,dx mov bp,dx
mov ax,bx mov ax,bx
noadd: noadd:
call cmpstr0 call cmpstr0
jne tre jne tre
mov si,offset buffer mov si,offset buffer
@ -146,7 +146,7 @@ nopod:
error: error:
mov bp,ax mov bp,ax
push cs push cs
pop es pop es
mov dl,'.' mov dl,'.'
call searchchar0 call searchchar0
je noaddext je noaddext
@ -161,53 +161,58 @@ noaddext:
xor bp,bp xor bp,bp
jmp replay jmp replay
reallyerror: reallyerror:
push offset Error_Syntax push offset error_syntax
call [print] call [print]
push word ptr cs:[bp-8] push word ptr cs: [bp-8]
call [print] call [print]
jmp replay jmp replay
errorprec: errorprec:
push offset derror push offset derror
call [print] call [print]
jmp replay jmp replay
Code_Exit: code_exit:
pop ax pop ax
retf retf
Code_Version: code_version:
push offset Version_Text push offset version_text
call [print] call [print]
ret ret
Version_Text db 'Cos 2000 version 1.2Fr par Nico',0 version_text db 'Cos 2000 version 1.4Fr par \c04MrNop',0
Code_Cls: code_cls:
mov ah,2 mov ah,2
int 47h int 47h
ret ret
Code_Reboot: code_reboot:
push 0FFFFh push 0ffffh
push 00000h push 00000h
db 0CBH retf
Code_Command: code_command:
push offset def
call [print]
mov bx,offset commands mov bx,offset commands
showalls: showalls:
mov si,[bx]
add bx,8 add bx,8
cmp si,0 cmp word ptr [bx],0
je endoff je endoff
push si push word ptr [bx+4]
push word ptr [bx+6]
push word ptr [bx]
push offset commandes
call [print] call [print]
mov ah,6
int 47h
jmp showalls jmp showalls
endoff: endoff:
ret ret
Code_Mode: def db 'Liste des commandes internes\l\l',0
commandes db '%0 \h10:\h12%0 \h70%0\l',0
code_mode:
mov cx,0 mov cx,0
call gettypeditem0 call gettypeditem0
mov ah,0 mov ah,0
@ -218,295 +223,320 @@ Code_Mode:
int 47h int 47h
ret ret
present db 'Le volume insere est nomme %0, Numero de serie : %hD\l\l',0 code_dir:
nomdisque db 13 dup (0) mov ah,12
Code_Dir: int 48h
mov ah,12 push edx
int 48h mov ah,11
push edx mov di,offset nomdisque
mov ah,11 int 48h
mov di,offset nomdisque push di
int 48h push offset present
push di call [print]
push offset present xor bp,bp
call [print] mov di,offset bufferentry
xor bp,bp mov ah,7
mov di,offset bufferentry int 48h
mov ah,7 jc nofiles
int 48h
jc nofiles
go: go:
push word ptr [di+Entries.FileAttr] push word ptr [di+entries.fileattr]
push dword ptr [di+Entries.FileSize] push dword ptr [di+entries.filesize]
push word ptr [di+Entries.FileTime] push word ptr [di+entries.filetime]
push word ptr [di+Entries.FileDate] push word ptr [di+entries.filedate]
push word ptr [di+Entries.FileTimeCrea] push word ptr [di+entries.filetimecrea]
push word ptr [di+Entries.FileDateCrea] push word ptr [di+entries.filedatecrea]
push di push di
push offset line push offset line
call [print] call [print]
inc bp inc bp
mov ah,8 mov ah,8
int 48h int 48h
jnc go jnc go
nofiles: nofiles:
push ebp push ebp
push offset filess push offset filess
call [print] call [print]
ret ret
bufferentry db 32 dup (0)
line db '\c07%n %d %t %d %t %z %a\l',0 nomdisque db 13 dup (0)
filess db '\l\l%u Fichier(s) au total\l',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
changing db 'Changement de repertoire vers ',0
code_cd: code_cd:
mov cx,0 mov cx,0
call gettypeditem0 call gettypeditem0
push offset changing push di
call [print] push offset changing
mov si,di call [print]
mov ah,13 mov si,di
int 48h mov ah,13
jnc okchange int 48h
push offset errorchanging jnc okchange
call [print] push offset errorchanging
call [print]
okchange: okchange:
ret ret
changing db 'Changement de repertoire vers %0\l',0
errorchanging db '\c04Impossible d''atteindre ce dossier',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: code_refresh:
mov ah,3 mov ah,3
int 48h int 48h
jnc okrefresh jnc okrefresh
push offset errorrefreshing push offset errorrefreshing
call [print] call [print]
ret ret
okrefresh: okrefresh:
mov ah,12 mov ah,12
int 48h int 48h
push edx push edx
mov ah,11 mov ah,11
mov di,offset nomdisque mov di,offset nomdisque
int 48h int 48h
push di push di
push offset present push offset present
call [print] call [print]
ret ret
errorrefreshing db '\c04Impossible de lire le support',0 errorrefreshing db '\c04Impossible de lire le support',0
extcom db '.CE',0
extcom db '.CE',0 code_mem:
push offset msg
Code_Mem: call [print]
push offset msg xor ebx,ebx
call [print] xor cx,cx
xor cx,cx
listmcb: listmcb:
mov ah,4 mov ah,4
int 49h int 49h
jc fino jc fino
inc cx inc cx
;placement mémoire ;placement mémoire
mov dx,gs mov dx,gs
inc dx inc dx
inc dx inc dx
push edx push edx
;parent ;parent
cmp gs:[MB.Reference],0 cmp gs: [mb.reference],0
je next jne next
mov dx,gs:[MB.Reference] push cs
dec dx push offset none
dec dx add bx,gs:[mb.sizes]
push dx jmp suitemn
push offset MB.Names
jmp suitemn
next: next:
push cs mov dx,gs: [mb.reference]
push offset none dec dx
dec dx
push dx
push offset mb.names
suitemn: suitemn:
;Resident ;Resident
cmp gs:[MB.IsResident],true cmp gs: [mb.isresident],true
jne notresident jne notresident
push offset resident push offset resident
jmp suitelistmcb jmp suitelistmcb
notresident: notresident:
push offset nonresident push offset nonresident
suitelistmcb: suitelistmcb:
;taille memoire ;taille memoire
xor edx,edx xor edx,edx
mov dx,gs:[MB.Sizes] mov dx,gs: [mb.sizes]
shl edx,4 shl edx,4
push 6 push 6
push edx push edx
;nom ;nom
push gs push gs
push offset MB.Names push offset mb.names
push offset line2 push offset line2
call [print] call [print]
jmp listmcb jmp listmcb
fino: fino:
ret shl ebx,4
resident db "oui",0 push ebx
nonresident db "non",0 push offset fin
line2 db "%0P\h15%w\h24%0\h30%0P\h46%hW\l",0 call [print]
msg db "Plan de la memoire\l\lNom Taille Res Parent Mem\l",0 ret
none db ".",0 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 ;converti le jeux scancode/ascii en fr ax->ax
convertfr: convertfr:
push dx si push dx si
mov si,offset fr mov si,offset fr
searchtouch: searchtouch:
mov dx,cs:[si] mov dx,cs: [si]
cmp dx,0 cmp dx,0
je endofconv je endofconv
add si,4 add si,4
cmp dx,ax cmp dx,ax
jne searchtouch jne searchtouch
mov ax,cs:[si-2] mov ax,cs: [si-2]
endofconv: endofconv:
pop dx si pop dx si
ret ret
fr: db '1', 02, '&', 02 fr: db '1', 02, '&', 02
db '!', 02, '1', 02 db '!', 02, '1', 02
db '2', 03, '', 03 db '2', 03, '', 03
db '@', 03, '2', 03 db '@', 03, '2', 03
db '3', 04, '"', 04 db '3', 04, '"', 04
db '#', 04, '3', 04 db '#', 04, '3', 04
db '4', 05, 39, 05 db '4', 05, 39, 05
db '$', 05, '4', 05 db '$', 05, '4', 05
db '5', 06, '(', 06 db '5', 06, '(', 06
db '%', 06, '5', 06 db '%', 06, '5', 06
db '6', 07, '-', 07 db '6', 07, '-', 07
db '^', 07, '6', 07 db '^', 07, '6', 07
db '7', 08, 'Š', 08 db '7', 08, 'Š', 08
db '&', 08, '7', 08 db '&', 08, '7', 08
db '8', 09, '_', 09 db '8', 09, '_', 09
db '*', 09, '8', 09 db '*', 09, '8', 09
db '9', 10, '‡', 10 db '9', 10, '‡', 10
db '(', 10, '9', 10 db '(', 10, '9', 10
db '0', 11, '…', 11 db '0', 11, '…', 11
db ')', 11, '0', 11 db ')', 11, '0', 11
db '-', 12, ')', 12 db '-', 12, ')', 12
db '_', 12, 'ø', 12 db '_', 12, 'ø', 12
db 'Q', 16, 'A', 16 db 'Q', 16, 'A', 16
db 'q', 16, 'a', 16 db 'q', 16, 'a', 16
db 'W', 17, 'Z', 17 db 'W', 17, 'Z', 17
db 'w', 17, 'z', 17 db 'w', 17, 'z', 17
db '{', 26, '‰', 26 db '{', 26, '‰', 26
db '[', 26, 'ˆ', 26 db '[', 26, 'ˆ', 26
db ']', 27, '$', 27 db ']', 27, '$', 27
db '}', 27, 'œ', 27 db '}', 27, 'œ', 27
db 'A', 30, 'Q', 30 db 'A', 30, 'Q', 30
db 'a', 30, 'q', 30 db 'a', 30, 'q', 30
db ':', 39, 'M', 39 db ':', 39, 'M', 39
db ';', 39, 'm', 39 db ';', 39, 'm', 39
db 39, 40, '—', 40 db 39, 40, '—', 40
db '"', 40, '%', 40 db '"', 40, '%', 40
db 00, 40, '%', 40 db 00, 40, '%', 40
db '\', 43, '*', 43 db '\', 43, '*', 43
db '|', 43, 'æ', 43 db '|', 43, 'æ', 43
db 'Z', 44, 'W', 44 db 'Z', 44, 'W', 44
db 'z', 44, 'w', 44 db 'z', 44, 'w', 44
db 'm', 50, ',', 50 db 'm', 50, ',', 50
db 'M', 50, '?', 50 db 'M', 50, '?', 50
db ',', 51, ';', 51 db ',', 51, ';', 51
db '<', 51, '.', 51 db '<', 51, '.', 51
db '.', 52, ':', 52 db '.', 52, ':', 52
db '>', 52, '/', 52 db '>', 52, '/', 52
db '?', 53, 'õ', 53 db '?', 53, 'õ', 53
db '/', 53, '!', 53 db '/', 53, '!', 53
db '\', 86, '<', 86 db '\', 86, '<', 86
db '|', 86, '>', 86 db '|', 86, '>', 86
db 00, 79h, '~', 03 db 00, 79h, '~', 03
db 00, 7Ah, '#', 04 db 00, 7ah, '#', 04
db 00, 7Bh, '{', 05 db 00, 7bh, '{', 05
db 00, 7Ch, '[', 06 db 00, 7ch, '[', 06
db 00, 7Dh, '|', 07 db 00, 7dh, '|', 07
db 00, 7Eh, '`', 08 db 00, 7eh, '`', 08
db 00, 7Fh, '\', 09 db 00, 7fh, '\', 09
db 00, 80h, '^', 10 db 00, 80h, '^', 10
db 00, 81h, '@', 11 db 00, 81h, '@', 11
db 00, 82h, ']', 12 db 00, 82h, ']', 12
db 00, 83h, '}', 13 db 00, 83h, '}', 13
db 00, 00, 00, 00 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)
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 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
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
Help_Exit db 0
Help_Version db 0
Help_Cls db 0
Help_Reboot db 0
Help_Command db 0
Help_Mode db 0
Help_Dir db 0
Help_refresh db 0
Help_cd db 0
Help_Mem db 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',0
include str0.asm
dir db 32 dup (0)
buffer db 256 dup (0)
buffer2 db 256 dup (0)
imports: imports:
db "VIDEO.LIB::print",0 db "VIDEO.LIB::print",0
print dd 0 print dd 0
db "VIDEO.LIB::showhex",0 db "VIDEO.LIB::showhex",0
showhex dd 0 showhex dd 0
db "VIDEO.LIB::showchar",0 db "VIDEO.LIB::showchar",0
showchar dd 0 showchar dd 0
dw 0 dw 0
end start end start