This repository was archived by the owner on May 24, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.qas
More file actions
executable file
·114 lines (105 loc) · 4.02 KB
/
string.qas
File metadata and controls
executable file
·114 lines (105 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
;;; +- Programme -----------------------------------------------------------+
;;; | MBRLoader 2.0-i386 |
;;; | Gestionnnaire de démarrage "multi-boot" |
;;; | |
;;; | Voyez la documentation ci-jointe |
;;; | |
;;; +- Contacts ------------------------------------------------------------+
;;; | http://mbrloader.arnak.cjb.net |
;;; | mailto:mbrloader@arnak.cjb.net |
;;; | |
;;; +- Auteur --------------------------------------------------------------+
;;; | ArnaK, SARL / Rip-off, Inc. / Kompanio Fraudo / Schwindel, GmbH |
;;; | Fabien Pollet |
;;; | http://www.arnak.cjb.net |
;;; | mailto:arnak@arnak.cjb.net |
;;; | |
;;; +- Fichier -------------------------------------------------------------+
;;; | string.qas |
;;; | Fonctions gérant les chaines de caractères |
;;; +-------------------------------------------------------------------------+
;;; +-------------------------------------------------------------------------+
;;; | strlen |
;;; | entree : ds:si = chaine |
;;; | sortie cx = longueur |
;;; +-------------------------------------------------------------------------+
strlen:
push ax
push si
mov cx, 0
strlen1:
mov al, [si]
cmp al, 0
jz $strlen2
inc si
inc cx
jmp $strlen1
strlen2:
pop si
pop ax
ret
;;; +-------------------------------------------------------------------------+
;;; | strcpy |
;;; | entree : ds:si = chaine1 |
;;; | es:di = chaine2 |
;;; | sortie : es:di = chaine1 |
;;; +-------------------------------------------------------------------------+
strcpy:
push ax
push si
push di
strcpy1:
mov al, [ds:si]
mov [es:di], al
cmp al, 0
jz $strcpy2
inc si
inc di
jmp $strcpy1
strcpy2:
pop di
pop si
pop ax
ret
;;; +-------------------------------------------------------------------------+
;;; | strncpy |
;;; | entree : ds:si = chaine1 |
;;; | es:di = chaine2 |
;;; | cx = taille max |
;;; | sortie : es:di = cx caract max de chaine1 |
;;; +-------------------------------------------------------------------------+
strncpy:
push ax
push cx
push si
push di
strncpy1:
mov al, [ds:si]
cmp al, 0
jz $strncpy2
mov [es:di], al
inc si
inc di
loop $strncpy1
strncpy2:
mov byte [es:di], 0
pop di
pop si
pop cx
pop ax
ret
;;; +-------------------------------------------------------------------------+
;;; | make_str_blank |
;;; | entree : es:di : chaine, cx = taille |
;;; | sortie : es:di : cx caracteres espaces |
;;; +-------------------------------------------------------------------------+
make_str_blank:
push cx
push di
make_str_blank_loop:
mov [es:di], byte 0x20
inc di
loop $make_str_blank_loop
pop di
pop cx
ret