2007-03-23 18:37:28 +01:00
|
|
|
|
include "..\include\mem.h"
|
|
|
|
|
include "..\include\divers.h"
|
|
|
|
|
|
|
|
|
|
org 0h
|
|
|
|
|
|
2019-07-09 18:30:00 +02:00
|
|
|
|
header exe 1
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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<63> par rapport a es:di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc checksyntax uses ax bx cx dx si di ds es, src:word,dest:word,delim:word
|
|
|
|
|
local temp[256]:WORD
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ss
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
lea si,[temp]
|
|
|
|
|
mov di,[dest]
|
|
|
|
|
stdcall copy,[src],si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
call xch
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall compressdelimiter,si,[delim]
|
|
|
|
|
stdcall getnbitems,si,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov bx,ax
|
|
|
|
|
call xch
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getnbitems,di,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp bx,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .notequalatall
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor cx,cx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.itemer:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
call xch
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall whatisitem,si,cx,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov dx,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall xch
|
|
|
|
|
stdcall whatisitem,di,cx,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp ax,dx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .prob
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,6
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jb .equal
|
|
|
|
|
stdcall cmpitems
|
|
|
|
|
je .equal
|
|
|
|
|
.prob:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp dl,4
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .nonumber
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp dl,8
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .equal
|
2007-03-23 18:37:28 +01:00
|
|
|
|
;cmp al,4
|
2019-07-09 18:30:00 +02:00
|
|
|
|
;jne .notequalatall
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp dh,ah
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .notequalatall
|
|
|
|
|
jmp .equal
|
|
|
|
|
.nonumber:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,7
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .nostr
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp ah,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .notequalatall
|
|
|
|
|
jmp .equal
|
|
|
|
|
.nostr:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,6
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .noname
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp dl,6
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .noname
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp ah,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .notequalatall
|
|
|
|
|
jmp .equal
|
|
|
|
|
.noname:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,8
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .equal
|
|
|
|
|
jmp .notequalatall
|
|
|
|
|
.equal:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
inc cx
|
|
|
|
|
cmp cx,bx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .itemer
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cld
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.ackno:
|
|
|
|
|
retf
|
|
|
|
|
.notequalatall:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
stc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .ackno
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xch:
|
|
|
|
|
push es
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
pop ds
|
|
|
|
|
ret
|
2019-07-09 18:30:00 +02:00
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Compare les <20>l<EFBFBD>ments cx de deux chaine ds:si et es:di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc cmpitems uses ax cx si di es, src:word,dest:word,item:word,delim:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getpointeritem,[src],[item],[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov si,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getitemsize,[src],[item],[delim]
|
|
|
|
|
mov di,[dest]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
cld
|
|
|
|
|
rep cmpsb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Renvoie l'<27>l<EFBFBD>ment cx de ds:si dans edx si nb et dans es:di si str ou name
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc gettypeditem uses bx cx si di, src:word,item:word,delim:word
|
|
|
|
|
mov si,[src]
|
|
|
|
|
mov cx,[item]
|
|
|
|
|
stdcall getpointeritem,si,cx,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov di,ax
|
|
|
|
|
inc cx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getpointeritem,si,cx,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov si,ax
|
|
|
|
|
dec si
|
|
|
|
|
mov cl,0
|
|
|
|
|
xchg cl,[ds:si]
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall gettyped,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xchg cl,[ds:si]
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Renvoie eax si nb et dans ds:eax si str ou name
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc gettyped uses si, src:word
|
|
|
|
|
mov si,[src]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor eax,eax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall whatis,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,1
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .bin
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,2
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .oct
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,3
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .dec
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,4
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .hex
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,5
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .pointer
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ax,si
|
2019-07-09 18:30:00 +02:00
|
|
|
|
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
|
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie dans ax le type de la str0 point<6E>e par ds:%0 <20>l<EFBFBD>ment %1 delim %3
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc whatisitem uses bx cx si di, src:word,item:word,delim:word
|
|
|
|
|
mov si,[src]
|
|
|
|
|
mov cx,[item]
|
|
|
|
|
stdcall getpointeritem,si,cx,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov di,ax
|
|
|
|
|
inc cx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getpointeritem,si,cx,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov si,ax
|
|
|
|
|
dec si
|
|
|
|
|
mov cl,0
|
|
|
|
|
xchg cl,[ds:si]
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall whatis,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xchg cl,[ds:si]
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie dans ax le type de la str0 point<6E>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
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc whatis uses bx cx edx si, src:word
|
|
|
|
|
mov si,[src]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor cx,cx
|
|
|
|
|
mov cl,2
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall strisbase,si,cx
|
|
|
|
|
jnc .finbase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cl,8
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall strisbase,si,cx
|
|
|
|
|
jnc .finbase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cl,10
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall strisbase,si,cx
|
|
|
|
|
jnc .finbase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cl,16
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall strisbase,si,cx
|
|
|
|
|
jc .testadress
|
|
|
|
|
.finbase:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov bx,cx
|
|
|
|
|
xor ch,ch
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov al,[cs:bx+ basenn-2]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push eax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall strtoint,si,cx
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov edx,eax
|
|
|
|
|
pop eax
|
|
|
|
|
cmp edx,0000FFFFh
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .bits32
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp dx,00FFh
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .bits16
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ah,1
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .endofwhat
|
|
|
|
|
.bits16:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ah,2
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .endofwhat
|
|
|
|
|
.bits32:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ah,4
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .endofwhat
|
|
|
|
|
.testadress:
|
|
|
|
|
stdcall strisadress,si
|
|
|
|
|
jc .testname
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ax,0005h
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .endofwhat
|
|
|
|
|
.testname:
|
|
|
|
|
stdcall strisname
|
|
|
|
|
jc .testnumber
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor ah,ah
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp byte [si],'&'
|
|
|
|
|
je .okname
|
|
|
|
|
stdcall getlength,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ah,al
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.okname:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,06h
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .endofwhat
|
|
|
|
|
.testnumber:
|
|
|
|
|
cmp byte [si],'#'
|
|
|
|
|
jne .testvarstr
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor ah,ah
|
|
|
|
|
mov al,08h
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .endofwhat
|
|
|
|
|
.testvarstr:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor ah,ah
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp byte [si],'?'
|
|
|
|
|
je .okvarstr
|
|
|
|
|
stdcall getlength,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ah,al
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.okvarstr:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,07h
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.endofwhat:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Renvoie non carry si la str ds:si point<6E>e peut <20>tre une adresse
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc strtoadress
|
2007-03-23 18:37:28 +01:00
|
|
|
|
;push
|
|
|
|
|
stc
|
|
|
|
|
;pop
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Renvoie en es:di le pointeur str0 ds:si
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc strisadress
|
2007-03-23 18:37:28 +01:00
|
|
|
|
;push
|
|
|
|
|
stc
|
|
|
|
|
;pop
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie non carry si la str ds:%0 point<6E>e peut <20>tre un nom de fichier
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc strisname uses ax si di, src:word
|
|
|
|
|
mov si,[src]
|
|
|
|
|
.isname:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,[si]
|
|
|
|
|
inc si
|
|
|
|
|
cmp al,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .itsok
|
|
|
|
|
mov di, non
|
|
|
|
|
.verify:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ah,[cs:di]
|
|
|
|
|
inc di
|
|
|
|
|
cmp ah,0FFh
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .isname
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp ah,al
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .verify
|
2007-03-23 18:37:28 +01:00
|
|
|
|
stc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .itsdead
|
|
|
|
|
.itsok:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.itsdead:
|
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
non db '/<>|"?*:\',01,0FFh
|
2019-07-09 18:30:00 +02:00
|
|
|
|
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
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie non carry si le texte point<6E> par %0 est de la base %1
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc strisbase uses ax cx si di es, src:word,base:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push cs
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
.isstrbase:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,[si]
|
|
|
|
|
cmp al,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .okbase
|
|
|
|
|
mov cx,[base]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor ch,ch
|
|
|
|
|
mov di,cx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
cmp al,[es:di-2+ basen]
|
|
|
|
|
je .verifbase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor ch,ch
|
|
|
|
|
inc cl
|
2019-07-09 18:30:00 +02:00
|
|
|
|
lea di,[base]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
|
|
|
|
cmp cx,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .nobase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
inc si
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .isstrbase
|
|
|
|
|
.okbase:
|
|
|
|
|
clc
|
|
|
|
|
.endbase:
|
|
|
|
|
retf
|
|
|
|
|
.verifbase:
|
|
|
|
|
cmp byte [si+1],0
|
|
|
|
|
je .okbase
|
|
|
|
|
.nobase:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
stc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .endbase
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Converti un str %0 de base %1 en int dans eax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc strtoint uses ebx ecx edx si edi es, src:word,base:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push cs
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
.gotos:
|
|
|
|
|
cmp byte [si+1], 0
|
|
|
|
|
je .oklo
|
2007-03-23 18:37:28 +01:00
|
|
|
|
inc si
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .gotos
|
|
|
|
|
.oklo:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov edi,1
|
|
|
|
|
xor ebx,ebx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.baseto:
|
|
|
|
|
cmp [src],si
|
|
|
|
|
ja .endbaseto
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,[si]
|
|
|
|
|
xor ecx,ecx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov cl,byte [base]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
inc cl
|
|
|
|
|
push di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
lea di, [base]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
|
|
|
|
pop di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .noop
|
|
|
|
|
sub cl,byte [base]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
neg cl
|
|
|
|
|
mov eax,edi
|
|
|
|
|
mul ecx
|
|
|
|
|
add ebx,eax
|
|
|
|
|
mov eax,edi
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov cl,byte [base]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mul ecx
|
|
|
|
|
mov edi,eax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.noop:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
dec si
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .baseto
|
|
|
|
|
.endbaseto:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov eax,ebx
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Renvoie en ds:%1 la partie de %2 caract<63>res a partir de la gauche de ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc left uses ax cx si di es, src:word,dest:word,nb:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
mov di,[dest]
|
|
|
|
|
mov cx,[nb]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov al,0
|
|
|
|
|
stosb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie en ds:%1 la partie de %2 caract<63>res a partir de la droite de ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc right uses ax cx si di es, src:word,dest:word,nb:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
mov di,[dest]
|
|
|
|
|
stdcall getlength,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
add si,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
sub si,[nb]
|
|
|
|
|
mov cx,[nb]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov al,0
|
|
|
|
|
stosb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie en ds:%1 la partie de %3 caract<63>res a partir de la position %2 de ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc middle uses ax cx si di es, src:word,dest:word,item:word,nb:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
mov di,[dest]
|
|
|
|
|
mov cx,[nb]
|
|
|
|
|
add si,[item]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov al,0
|
|
|
|
|
stosb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Rempli de %3 caract<63>res %2 a partir de la position %1 de ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc fill uses ax cx si di es, src:word,item:word,char:word,nb:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov di,[src]
|
|
|
|
|
add di,[item]
|
|
|
|
|
mov ax,[char]
|
|
|
|
|
mov cx,[nb]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cld
|
|
|
|
|
rep stosb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Remplace tout les caract<63>res %1 de ds:%0 par des caract<63>res %2
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc replaceallchar uses ax cx dx di es, src:word,char1:word,char2:word
|
|
|
|
|
mov di,[src]
|
|
|
|
|
stdcall getlength,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov ax,[char1]
|
|
|
|
|
mov dx,[char2]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.findandchange:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
repne scasb
|
|
|
|
|
cmp cx,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .endofchange
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov [es:di-1],dl
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .findandchange
|
|
|
|
|
.endofchange:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Recherche un caract<63>re dl dans la cha<68>ne ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc searchchar uses cx di es, src:word,char:word
|
|
|
|
|
mov di,[src]
|
|
|
|
|
stdcall getlength,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov ax,[char]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
repne scasb
|
|
|
|
|
mov ax,di
|
|
|
|
|
dec ax
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Inverse la chaine point<6E>e en ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc invert uses ax cx si di, src:word
|
|
|
|
|
mov si,[src]
|
|
|
|
|
stdcall getlength,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov di,si
|
|
|
|
|
add di,ax
|
|
|
|
|
dec di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.revert:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,[si]
|
|
|
|
|
xchg al,[di]
|
|
|
|
|
mov [si],al
|
|
|
|
|
inc si
|
|
|
|
|
dec di
|
|
|
|
|
cmp si,di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .finishinvert
|
2007-03-23 18:37:28 +01:00
|
|
|
|
dec di
|
|
|
|
|
cmp si,di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .finishinvert
|
2007-03-23 18:37:28 +01:00
|
|
|
|
inc di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .revert
|
|
|
|
|
.finishinvert:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Compares 2 chaines de caract<63>res DS:%0 et DS:%1 zerof si non equal
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc cmpstr uses cx dx si di, src:word,dest:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
mov di,[dest]
|
|
|
|
|
stdcall getlength,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getlength,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp cx,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .notequal
|
2007-03-23 18:37:28 +01:00
|
|
|
|
repe cmpsb
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.notequal:
|
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Compares 2 chaines de caract<63>res DS:%0 et DS:%1 zerof si non equal et renvoie le nb de caract<63>re egaux dans ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc evalue uses cx si di es, src:word,dest:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
mov di,[dest]
|
|
|
|
|
stdcall getlength ,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
repe cmpsb
|
|
|
|
|
pushf
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .noident
|
2007-03-23 18:37:28 +01:00
|
|
|
|
sub ax,cx
|
|
|
|
|
popf
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
.noident:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
sub ax,cx
|
|
|
|
|
dec ax
|
|
|
|
|
popf
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Insert une chaine ds:%0 en ds:%1 a partir du caract<63>re %2
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc insert uses ax cx si di es, src:word,dest:word,item:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push es
|
|
|
|
|
pop ds
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[dest]
|
|
|
|
|
stdcall getlength,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
add si,ax
|
|
|
|
|
mov di,si
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getlength,[src]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
add di,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
sub cx,[item]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
inc cx
|
|
|
|
|
std
|
|
|
|
|
rep movsb
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
mov di,[dest]
|
|
|
|
|
add di,[item]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Detruit %2 caract<63>res a partir du caract<63>re %1 de DS:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc delete uses ax cx dx si di es, src:word,item:word,size:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
stdcall getlength,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
sub cx,[size]
|
|
|
|
|
sub cx,[item]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
inc cx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add si,[item]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov di,si
|
2019-07-09 18:30:00 +02:00
|
|
|
|
add si,[size]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Copie une chaine de ds:si en es:di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc copy uses ax cx si di, src:word,dest:word
|
|
|
|
|
mov si,[src]
|
|
|
|
|
mov di,[dest]
|
|
|
|
|
stdcall getlength,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov al,0
|
|
|
|
|
stosb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Concat<61>ne le chaine ds:si avec ds:di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc concat uses ax cx si di es, src:word,dest:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov si,[src]
|
|
|
|
|
stdcall getlength,si
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov di,[dest]
|
|
|
|
|
stdcall getlength,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
add di,ax
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov al,0
|
|
|
|
|
stosb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;D<>truit les d<>limiteur qui sont cons<6E>cutifs dans ds:%0 -> renvoie le nb d'item
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc compressdelimiter uses cx dx si di es, src:word,delim:word
|
|
|
|
|
mov di,[src]
|
|
|
|
|
stdcall getlength,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov ax,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor dx,dx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.compressitems:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
repne scasb
|
|
|
|
|
inc dx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.againcomp:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp [di],al
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .nosup
|
|
|
|
|
stdcall delete,di,0,1
|
|
|
|
|
jmp .againcomp
|
|
|
|
|
.nosup:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp cx,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .compressitems
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ax,dx
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Met le nombre d'<27>l<EFBFBD>ments de ds:%0 <20> %1
|
2019-07-09 18:30:00 +02:00
|
|
|
|
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
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
sub ax,[size]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
neg ax
|
|
|
|
|
mov cx,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getlength,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
add di,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov ax,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ah,'a'
|
|
|
|
|
rep stosw
|
|
|
|
|
xor al,al
|
|
|
|
|
stosb
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jmp .noadjust
|
|
|
|
|
.subsome:
|
|
|
|
|
stdcall getpointeritem,[src],[size],[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
dec ax
|
|
|
|
|
mov di,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.onlyzero:
|
|
|
|
|
mov byte [di],0
|
|
|
|
|
.noadjust:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie la taille ax de l'<27>l<EFBFBD>ment %0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc getitemsize uses cx dx, src:word,item:word,delim:word
|
|
|
|
|
mov cx,[item]
|
|
|
|
|
stdcall getpointeritem,[src],cx,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov dx,ax
|
|
|
|
|
inc cx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getpointeritem,[src],cx,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
sub ax,dx
|
|
|
|
|
dec ax
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie en ds:%1 l'<27>l<EFBFBD>ment %2 de ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc getitem uses ax cx si di es, src:word,dest:word,item:word,delim:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getpointeritem,[src],[item],[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov si,ax
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getitemsize,[src],[item],[delim]
|
|
|
|
|
mov di,[dest]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov al,0
|
|
|
|
|
stosb
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;renvoi un pointeur ax sur l'<27>l<EFBFBD>ment %1 de ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc getpointeritem uses cx dx di es, src:word,item:word,delim:word
|
|
|
|
|
mov di,[src]
|
|
|
|
|
cmp [item],0
|
|
|
|
|
je .finishpointer
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
stdcall getlength,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov ax,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor dx,dx
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.countnbitems:
|
|
|
|
|
cmp [item],dx
|
|
|
|
|
je .finishpointer
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
|
|
|
|
inc dx
|
|
|
|
|
cmp cx,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .countnbitems
|
2007-03-23 18:37:28 +01:00
|
|
|
|
inc di
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.finishpointer:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ax,di
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Renvoie le nombre d'<27>l<EFBFBD>ments ax de ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc getnbitems uses cx dx di es, src:word,delim:word
|
|
|
|
|
mov di,[src]
|
|
|
|
|
stdcall getlength,di
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov cx,ax
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov ax,[delim]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
xor dx,dx
|
|
|
|
|
cld
|
2019-07-09 18:30:00 +02:00
|
|
|
|
.countitems:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
repne scasb
|
|
|
|
|
inc dx
|
|
|
|
|
cmp cx,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jne .countitems
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov ax,dx
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;renvoie la taille en octets AX de la chaine point<6E>e en ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc getlength uses cx di es, src:word
|
2007-03-23 18:37:28 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 18:30:00 +02:00
|
|
|
|
mov di,[src]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,0
|
|
|
|
|
mov cx,0FFFFh
|
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
|
|
|
|
neg cx
|
|
|
|
|
dec cx
|
|
|
|
|
dec cx
|
|
|
|
|
mov ax,cx
|
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Met la taille en octets de la chaine point<6E>e ds:%0 a %1
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc setlength uses si, src:word,size:word
|
|
|
|
|
mov si,[src]
|
|
|
|
|
add si,[size]
|
|
|
|
|
mov byte [si],0
|
2007-03-23 18:37:28 +01:00
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;met en majuscule la chaine ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc uppercase uses ax si, src:word
|
|
|
|
|
mov si,[src]
|
|
|
|
|
.uppercase:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,[ds:si]
|
|
|
|
|
inc si
|
|
|
|
|
cmp al,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .enduppercase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,'a'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jb .uppercase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,'z'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .uppercase
|
|
|
|
|
sub byte [si-1],'a'-'A'
|
|
|
|
|
jmp .uppercase
|
|
|
|
|
.enduppercase:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;met en majuscule la premi<6D>re lettre chaine ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc onecase uses ax si, src:word
|
|
|
|
|
mov si,[src]
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,[ds:si]
|
|
|
|
|
cmp al,'a'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jb .oneenduppercase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,'z'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .oneenduppercase
|
|
|
|
|
sub byte [si],'a'-'A'
|
|
|
|
|
.oneenduppercase:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;met en minuscule la chaine ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc lowercase uses ax si, src:word
|
|
|
|
|
mov si,[src]
|
|
|
|
|
.lowercase:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,[ds:si]
|
|
|
|
|
inc si
|
|
|
|
|
cmp al,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .endlowercase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,'A'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jb .lowercase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,'Z'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .lowercase
|
|
|
|
|
add byte [si-1],'a'-'A'
|
|
|
|
|
jmp .lowercase
|
|
|
|
|
.endlowercase:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
clc
|
2019-07-09 18:30:00 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|
|
|
|
|
;Inverse la casse la chaine ds:%0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
proc invertcase uses ax si, src:word
|
|
|
|
|
mov si,[src]
|
|
|
|
|
.invertcase:
|
2007-03-23 18:37:28 +01:00
|
|
|
|
mov al,[ds:si]
|
|
|
|
|
inc si
|
|
|
|
|
cmp al,0
|
2019-07-09 18:30:00 +02:00
|
|
|
|
je .endinvertcase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,'A'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jb .invertcase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,'Z'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jbe .goinvertcase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,'a'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
jb .invertcase
|
2007-03-23 18:37:28 +01:00
|
|
|
|
cmp al,'z'
|
2019-07-09 18:30:00 +02:00
|
|
|
|
ja .invertcase
|
|
|
|
|
sub byte [si-1],'a'-'A'
|
|
|
|
|
jmp .invertcase
|
|
|
|
|
.goinvertcase:
|
|
|
|
|
add byte [si-1],'a'-'A'
|
|
|
|
|
jmp .invertcase
|
|
|
|
|
.endinvertcase:
|
|
|
|
|
clc
|
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-23 18:37:28 +01:00
|
|
|
|
|