Subversion Repositories Kolibri OS

Rev

Rev 988 | Rev 1295 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 988 Rev 1001
1
;;================================================================================================;;
1
;;================================================================================================;;
2
;;//// libini_p.asm //// (c) mike.dld, 2006-2008 /////////////////////////////////////////////////;;
2
;;//// libini_p.asm //// (c) mike.dld, 2006-2008 /////////////////////////////////////////////////;;
3
;;================================================================================================;;
3
;;================================================================================================;;
4
;;                                                                                                ;;
4
;;                                                                                                ;;
5
;; This file is part of Common development libraries (Libs-Dev).                                  ;;
5
;; This file is part of Common development libraries (Libs-Dev).                                  ;;
6
;;                                                                                                ;;
6
;;                                                                                                ;;
7
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
7
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
8
;; General Public License as published by the Free Software Foundation, either version 3 of the   ;;
8
;; Lesser General Public License as published by the Free Software Foundation, either version 2.1 ;;
9
;; License, or (at your option) any later version.                                                ;;
9
;; of the License, or (at your option) any later version.                                         ;;
10
;;                                                                                                ;;
10
;;                                                                                                ;;
11
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  ;;
11
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without  ;;
12
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  ;;
12
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU  ;;
13
;; General Public License for more details.                                                       ;;
13
;; Lesser General Public License for more details.                                                ;;
14
;;                                                                                                ;;
14
;;                                                                                                ;;
15
;; You should have received a copy of the GNU General Public License along with Libs-Dev. If not, ;;
15
;; You should have received a copy of the GNU Lesser General Public License along with Libs-Dev.  ;;
16
;; see .                                                            ;;
16
;; If not, see .                                                    ;;
17
;;                                                                                                ;;
17
;;                                                                                                ;;
18
;;================================================================================================;;
18
;;================================================================================================;;
19
 
19
 
20
mem.alloc   dd ?
20
mem.alloc   dd ?
21
mem.free    dd ?
21
mem.free    dd ?
22
mem.realloc dd ?
22
mem.realloc dd ?
23
dll.load    dd ?
23
dll.load    dd ?
24
 
24
 
25
;;================================================================================================;;
25
;;================================================================================================;;
26
proc libini._.init ;//////////////////////////////////////////////////////////////////////////////;;
26
proc libini._.init ;//////////////////////////////////////////////////////////////////////////////;;
27
;;------------------------------------------------------------------------------------------------;;
27
;;------------------------------------------------------------------------------------------------;;
28
;? Library entry point (called after library load)                                                ;;
28
;? Library entry point (called after library load)                                                ;;
29
;;------------------------------------------------------------------------------------------------;;
29
;;------------------------------------------------------------------------------------------------;;
30
;> eax = memory allocation routine                                                    ;;
30
;> eax = memory allocation routine                                                    ;;
31
;> ebx = memory freeing routine                                                        ;;
31
;> ebx = memory freeing routine                                                        ;;
32
;> ecx = memory reallocation routine                                                ;;
32
;> ecx = memory reallocation routine                                                ;;
33
;> edx = library loading routine                                                       ;;
33
;> edx = library loading routine                                                       ;;
34
;;------------------------------------------------------------------------------------------------;;
34
;;------------------------------------------------------------------------------------------------;;
35
;< eax = 1 (fail) / 0 (ok) (library initialization result)                                        ;;
35
;< eax = 1 (fail) / 0 (ok) (library initialization result)                                        ;;
36
;;================================================================================================;;
36
;;================================================================================================;;
37
	mov	[mem.alloc], eax
37
	mov	[mem.alloc], eax
38
	mov	[mem.free], ebx
38
	mov	[mem.free], ebx
39
	mov	[mem.realloc], ecx
39
	mov	[mem.realloc], ecx
40
	mov	[dll.load], edx
40
	mov	[dll.load], edx
41
 
41
 
42
	invoke	dll.load, @IMPORT
42
	invoke	dll.load, @IMPORT
43
	or	eax, eax
43
	or	eax, eax
44
	jz	.ok
44
	jz	.ok
45
 
45
 
46
	xor	eax, eax
46
	xor	eax, eax
47
	inc	eax
47
	inc	eax
48
	ret
48
	ret
49
 
49
 
50
  .ok:	xor	eax,eax
50
  .ok:	xor	eax,eax
51
	ret
51
	ret
52
endp
52
endp
53
 
53
 
54
;;================================================================================================;;
54
;;================================================================================================;;
55
proc libini._.unget_char _f ;/////////////////////////////////////////////////////////////////////;;
55
proc libini._.unget_char _f ;/////////////////////////////////////////////////////////////////////;;
56
;;------------------------------------------------------------------------------------------------;;
56
;;------------------------------------------------------------------------------------------------;;
57
;? --- TBD ---                                                                                    ;;
57
;? --- TBD ---                                                                                    ;;
58
;;------------------------------------------------------------------------------------------------;;
58
;;------------------------------------------------------------------------------------------------;;
59
;> --- TBD ---                                                                                    ;;
59
;> --- TBD ---                                                                                    ;;
60
;;------------------------------------------------------------------------------------------------;;
60
;;------------------------------------------------------------------------------------------------;;
61
;< --- TBD ---                                                                                    ;;
61
;< --- TBD ---                                                                                    ;;
62
;;================================================================================================;;
62
;;================================================================================================;;
63
	;push    ecx
63
	;push    ecx
64
	;mov     ecx,[f]
64
	;mov     ecx,[f]
65
	;inc     [ecx+INIFILE.cnt]
65
	;inc     [ecx+INIFILE.cnt]
66
	;dec     esi
66
	;dec     esi
67
	;pop     ecx
67
	;pop     ecx
68
	;ret
68
	;ret
69
	push	eax ecx
69
	push	eax ecx
70
	mov	ecx, [_f]
70
	mov	ecx, [_f]
71
	inc	[ecx + IniFile.cnt]
71
	inc	[ecx + IniFile.cnt]
72
	dec	esi
72
	dec	esi
73
	mov	eax, [ecx + IniFile.bsize]
73
	mov	eax, [ecx + IniFile.bsize]
74
	cmp	[ecx + IniFile.cnt], eax
74
	cmp	[ecx + IniFile.cnt], eax
75
	jle	@f
75
	jle	@f
76
	stdcall libini._.unload_block, [_f]
76
	stdcall libini._.unload_block, [_f]
77
    @@: ;mov     al,[esi-1]
77
    @@: ;mov     al,[esi-1]
78
	pop	ecx eax
78
	pop	ecx eax
79
	ret
79
	ret
80
endp
80
endp
81
 
81
 
82
;;================================================================================================;;
82
;;================================================================================================;;
83
proc libini._.get_char _f ;///////////////////////////////////////////////////////////////////////;;
83
proc libini._.get_char _f ;///////////////////////////////////////////////////////////////////////;;
84
;;------------------------------------------------------------------------------------------------;;
84
;;------------------------------------------------------------------------------------------------;;
85
;? --- TBD ---                                                                                    ;;
85
;? --- TBD ---                                                                                    ;;
86
;;------------------------------------------------------------------------------------------------;;
86
;;------------------------------------------------------------------------------------------------;;
87
;> --- TBD ---                                                                                    ;;
87
;> --- TBD ---                                                                                    ;;
88
;;------------------------------------------------------------------------------------------------;;
88
;;------------------------------------------------------------------------------------------------;;
89
;< --- TBD ---                                                                                    ;;
89
;< --- TBD ---                                                                                    ;;
90
;;================================================================================================;;
90
;;================================================================================================;;
91
	mov	ecx, [_f]
91
	mov	ecx, [_f]
92
	dec	[ecx + IniFile.cnt]
92
	dec	[ecx + IniFile.cnt]
93
	jns	@f
93
	jns	@f
94
	stdcall libini._.preload_block, [_f]
94
	stdcall libini._.preload_block, [_f]
95
	dec	[ecx + IniFile.cnt]
95
	dec	[ecx + IniFile.cnt]
96
    @@: lodsb
96
    @@: lodsb
97
	ret
97
	ret
98
endp
98
endp
99
 
99
 
100
;;================================================================================================;;
100
;;================================================================================================;;
101
proc libini._.skip_nonblanks _f ;/////////////////////////////////////////////////////////////////;;
101
proc libini._.skip_nonblanks _f ;/////////////////////////////////////////////////////////////////;;
102
;;------------------------------------------------------------------------------------------------;;
102
;;------------------------------------------------------------------------------------------------;;
103
;? --- TBD ---                                                                                    ;;
103
;? --- TBD ---                                                                                    ;;
104
;;------------------------------------------------------------------------------------------------;;
104
;;------------------------------------------------------------------------------------------------;;
105
;> --- TBD ---                                                                                    ;;
105
;> --- TBD ---                                                                                    ;;
106
;;------------------------------------------------------------------------------------------------;;
106
;;------------------------------------------------------------------------------------------------;;
107
;< --- TBD ---                                                                                    ;;
107
;< --- TBD ---                                                                                    ;;
108
;;================================================================================================;;
108
;;================================================================================================;;
109
	mov	ecx, [_f]
109
	mov	ecx, [_f]
110
    @@: stdcall libini._.get_char, [_f]
110
    @@: stdcall libini._.get_char, [_f]
111
	cmp	al, 32
111
	cmp	al, 32
112
	je	@b
112
	je	@b
113
	cmp	al, 13
113
	cmp	al, 13
114
	je	@b
114
	je	@b
115
	cmp	al, 10
115
	cmp	al, 10
116
	je	@b
116
	je	@b
117
	cmp	al, 9
117
	cmp	al, 9
118
	je	@b
118
	je	@b
119
    @@: stdcall libini._.unget_char, [_f]
119
    @@: stdcall libini._.unget_char, [_f]
120
	;inc     [ecx+INIFILE.cnt]
120
	;inc     [ecx+INIFILE.cnt]
121
	ret
121
	ret
122
endp
122
endp
123
 
123
 
124
;;================================================================================================;;
124
;;================================================================================================;;
125
proc libini._.skip_spaces _f ;////////////////////////////////////////////////////////////////////;;
125
proc libini._.skip_spaces _f ;////////////////////////////////////////////////////////////////////;;
126
;;------------------------------------------------------------------------------------------------;;
126
;;------------------------------------------------------------------------------------------------;;
127
;? --- TBD ---                                                                                    ;;
127
;? --- TBD ---                                                                                    ;;
128
;;------------------------------------------------------------------------------------------------;;
128
;;------------------------------------------------------------------------------------------------;;
129
;> --- TBD ---                                                                                    ;;
129
;> --- TBD ---                                                                                    ;;
130
;;------------------------------------------------------------------------------------------------;;
130
;;------------------------------------------------------------------------------------------------;;
131
;< --- TBD ---                                                                                    ;;
131
;< --- TBD ---                                                                                    ;;
132
;;================================================================================================;;
132
;;================================================================================================;;
133
	mov	ecx, [_f]
133
	mov	ecx, [_f]
134
    @@: stdcall libini._.get_char, [_f]
134
    @@: stdcall libini._.get_char, [_f]
135
	cmp	al, 32
135
	cmp	al, 32
136
	je	@b
136
	je	@b
137
	cmp	al, 9
137
	cmp	al, 9
138
	je	@b
138
	je	@b
139
    @@: stdcall libini._.unget_char, [_f]
139
    @@: stdcall libini._.unget_char, [_f]
140
	;inc     [ecx+INIFILE.cnt]
140
	;inc     [ecx+INIFILE.cnt]
141
	ret
141
	ret
142
endp
142
endp
143
 
143
 
144
;;================================================================================================;;
144
;;================================================================================================;;
145
proc libini._.skip_line _f ;//////////////////////////////////////////////////////////////////////;;
145
proc libini._.skip_line _f ;//////////////////////////////////////////////////////////////////////;;
146
;;------------------------------------------------------------------------------------------------;;
146
;;------------------------------------------------------------------------------------------------;;
147
;? --- TBD ---                                                                                    ;;
147
;? --- TBD ---                                                                                    ;;
148
;;------------------------------------------------------------------------------------------------;;
148
;;------------------------------------------------------------------------------------------------;;
149
;> --- TBD ---                                                                                    ;;
149
;> --- TBD ---                                                                                    ;;
150
;;------------------------------------------------------------------------------------------------;;
150
;;------------------------------------------------------------------------------------------------;;
151
;< --- TBD ---                                                                                    ;;
151
;< --- TBD ---                                                                                    ;;
152
;;================================================================================================;;
152
;;================================================================================================;;
153
	mov	ecx, [_f]
153
	mov	ecx, [_f]
154
    @@: stdcall libini._.get_char, [_f]
154
    @@: stdcall libini._.get_char, [_f]
155
	or	al, al
155
	or	al, al
156
	jz	@f
156
	jz	@f
157
	cmp	al, 13
157
	cmp	al, 13
158
	je	@f
158
	je	@f
159
	cmp	al, 10
159
	cmp	al, 10
160
	jne	@b
160
	jne	@b
161
    @@: stdcall libini._.unget_char, [_f]
161
    @@: stdcall libini._.unget_char, [_f]
162
	;inc     [ecx+INIFILE.cnt]
162
	;inc     [ecx+INIFILE.cnt]
163
	ret
163
	ret
164
endp
164
endp
165
 
165
 
166
;;================================================================================================;;
166
;;================================================================================================;;
167
proc libini._.unload_block _f ;///////////////////////////////////////////////////////////////////;;
167
proc libini._.unload_block _f ;///////////////////////////////////////////////////////////////////;;
168
;;------------------------------------------------------------------------------------------------;;
168
;;------------------------------------------------------------------------------------------------;;
169
;? --- TBD ---                                                                                    ;;
169
;? --- TBD ---                                                                                    ;;
170
;;------------------------------------------------------------------------------------------------;;
170
;;------------------------------------------------------------------------------------------------;;
171
;> --- TBD ---                                                                                    ;;
171
;> --- TBD ---                                                                                    ;;
172
;;------------------------------------------------------------------------------------------------;;
172
;;------------------------------------------------------------------------------------------------;;
173
;< --- TBD ---                                                                                    ;;
173
;< --- TBD ---                                                                                    ;;
174
;;================================================================================================;;
174
;;================================================================================================;;
175
	push	eax ebx ecx
175
	push	eax ebx ecx
176
	mov	ebx, [_f]
176
	mov	ebx, [_f]
177
	mov	eax, [ebx + IniFile.pos]
177
	mov	eax, [ebx + IniFile.pos]
178
	add	eax, -ini.BLOCK_SIZE
178
	add	eax, -ini.BLOCK_SIZE
179
	invoke	file.seek, [ebx + IniFile.fh], eax, SEEK_SET
179
	invoke	file.seek, [ebx + IniFile.fh], eax, SEEK_SET
180
	stdcall libini._.preload_block, ebx
180
	stdcall libini._.preload_block, ebx
181
	add	esi, eax ; ini.BLOCK_SIZE
181
	add	esi, eax ; ini.BLOCK_SIZE
182
	mov	[ebx + IniFile.cnt], 0
182
	mov	[ebx + IniFile.cnt], 0
183
	pop	ecx ebx eax
183
	pop	ecx ebx eax
184
	ret
184
	ret
185
endp
185
endp
186
 
186
 
187
;;================================================================================================;;
187
;;================================================================================================;;
188
proc libini._.preload_block _f ;//////////////////////////////////////////////////////////////////;;
188
proc libini._.preload_block _f ;//////////////////////////////////////////////////////////////////;;
189
;;------------------------------------------------------------------------------------------------;;
189
;;------------------------------------------------------------------------------------------------;;
190
;? --- TBD ---                                                                                    ;;
190
;? --- TBD ---                                                                                    ;;
191
;;------------------------------------------------------------------------------------------------;;
191
;;------------------------------------------------------------------------------------------------;;
192
;> --- TBD ---                                                                                    ;;
192
;> --- TBD ---                                                                                    ;;
193
;;------------------------------------------------------------------------------------------------;;
193
;;------------------------------------------------------------------------------------------------;;
194
;< --- TBD ---                                                                                    ;;
194
;< --- TBD ---                                                                                    ;;
195
;;================================================================================================;;
195
;;================================================================================================;;
196
	push	eax ebx ecx
196
	push	eax ebx ecx
197
	mov	ebx, [_f]
197
	mov	ebx, [_f]
198
    @@: mov	esi, [ebx + IniFile.buf]
198
    @@: mov	esi, [ebx + IniFile.buf]
199
	push	edi
199
	push	edi
200
	mov	edi, esi
200
	mov	edi, esi
201
	mov	ecx, ini.BLOCK_SIZE / 4
201
	mov	ecx, ini.BLOCK_SIZE / 4
202
	xor	eax, eax
202
	xor	eax, eax
203
	rep	stosd
203
	rep	stosd
204
	pop	edi
204
	pop	edi
205
	invoke	file.tell, [ebx + IniFile.fh]
205
	invoke	file.tell, [ebx + IniFile.fh]
206
	mov	[ebx + IniFile.pos], eax
206
	mov	[ebx + IniFile.pos], eax
207
	invoke	file.read, [ebx + IniFile.fh], esi, ini.BLOCK_SIZE
207
	invoke	file.read, [ebx + IniFile.fh], esi, ini.BLOCK_SIZE
208
	mov	esi,[ebx + IniFile.buf]
208
	mov	esi,[ebx + IniFile.buf]
209
	cmp	eax,ini.BLOCK_SIZE
209
	cmp	eax,ini.BLOCK_SIZE
210
	jl	@f
210
	jl	@f
211
	;dec     eax
211
	;dec     eax
212
    @@: mov	[ebx + IniFile.cnt], eax;ini.BLOCK_SIZE-1
212
    @@: mov	[ebx + IniFile.cnt], eax;ini.BLOCK_SIZE-1
213
	mov	[ebx + IniFile.bsize], eax
213
	mov	[ebx + IniFile.bsize], eax
214
	pop	ecx ebx eax
214
	pop	ecx ebx eax
215
	ret
215
	ret
216
endp
216
endp
217
 
217
 
218
;;================================================================================================;;
218
;;================================================================================================;;
219
proc libini._.reload_block _f ;///////////////////////////////////////////////////////////////////;;
219
proc libini._.reload_block _f ;///////////////////////////////////////////////////////////////////;;
220
;;------------------------------------------------------------------------------------------------;;
220
;;------------------------------------------------------------------------------------------------;;
221
;? --- TBD ---                                                                                    ;;
221
;? --- TBD ---                                                                                    ;;
222
;;------------------------------------------------------------------------------------------------;;
222
;;------------------------------------------------------------------------------------------------;;
223
;> --- TBD ---                                                                                    ;;
223
;> --- TBD ---                                                                                    ;;
224
;;------------------------------------------------------------------------------------------------;;
224
;;------------------------------------------------------------------------------------------------;;
225
;< --- TBD ---                                                                                    ;;
225
;< --- TBD ---                                                                                    ;;
226
;;================================================================================================;;
226
;;================================================================================================;;
227
	push	eax ebx ecx
227
	push	eax ebx ecx
228
	mov	ebx, [_f]
228
	mov	ebx, [_f]
229
	push	[ebx + IniFile.bsize]
229
	push	[ebx + IniFile.bsize]
230
	push	esi [ebx + IniFile.cnt]
230
	push	esi [ebx + IniFile.cnt]
231
	invoke	file.seek, [ebx + IniFile.fh], [ebx + IniFile.pos], SEEK_SET
231
	invoke	file.seek, [ebx + IniFile.fh], [ebx + IniFile.pos], SEEK_SET
232
	stdcall libini._.preload_block, ebx
232
	stdcall libini._.preload_block, ebx
233
	pop	[ebx + IniFile.cnt] esi
233
	pop	[ebx + IniFile.cnt] esi
234
	pop	eax
234
	pop	eax
235
	sub	eax,[ebx + IniFile.bsize]
235
	sub	eax,[ebx + IniFile.bsize]
236
	sub	[ebx + IniFile.cnt], eax
236
	sub	[ebx + IniFile.cnt], eax
237
	pop	ecx ebx eax
237
	pop	ecx ebx eax
238
	ret
238
	ret
239
endp
239
endp
240
 
240
 
241
; f_info - contains current file block number
241
; f_info - contains current file block number
242
; esi    - position in block from where to shift
242
; esi    - position in block from where to shift
243
; ecx    - number of bytes to shift by
243
; ecx    - number of bytes to shift by
244
 
244
 
245
;;================================================================================================;;
245
;;================================================================================================;;
246
proc libini._.shift_content _f, _delta ;//////////////////////////////////////////////////////////;;
246
proc libini._.shift_content _f, _delta ;//////////////////////////////////////////////////////////;;
247
;;------------------------------------------------------------------------------------------------;;
247
;;------------------------------------------------------------------------------------------------;;
248
;? Shift file content starting from cursor position (~ delete)                                    ;;
248
;? Shift file content starting from cursor position (~ delete)                                    ;;
249
;? Content is copied by 'delta' bytes up/down                                                     ;;
249
;? Content is copied by 'delta' bytes up/down                                                     ;;
250
;;------------------------------------------------------------------------------------------------;;
250
;;------------------------------------------------------------------------------------------------;;
251
;> --- TBD ---                                                                                    ;;
251
;> --- TBD ---                                                                                    ;;
252
;;------------------------------------------------------------------------------------------------;;
252
;;------------------------------------------------------------------------------------------------;;
253
;< eax = -1 (fail) / 0 (ok)                                                                       ;;
253
;< eax = -1 (fail) / 0 (ok)                                                                       ;;
254
;;================================================================================================;;
254
;;================================================================================================;;
255
locals
255
locals
256
  buf dd ?
256
  buf dd ?
257
endl
257
endl
258
 
258
 
259
	xor	eax, eax
259
	xor	eax, eax
260
	cmp	[_delta], 0
260
	cmp	[_delta], 0
261
	je	.skip
261
	je	.skip
262
 
262
 
263
	push	ebx ecx
263
	push	ebx ecx
264
	invoke	mem.alloc, ini.BLOCK_SIZE
264
	invoke	mem.alloc, ini.BLOCK_SIZE
265
	or	eax, eax
265
	or	eax, eax
266
	jz	.fail
266
	jz	.fail
267
	mov	[buf], eax
267
	mov	[buf], eax
268
 
268
 
269
	cmp	[_delta], 0
269
	cmp	[_delta], 0
270
	jl	.down
270
	jl	.down
271
 
271
 
272
	mov	ebx, [_f]
272
	mov	ebx, [_f]
273
	mov	ecx, [ebx + IniFile.cnt]
273
	mov	ecx, [ebx + IniFile.cnt]
274
	mov	ebx, [ebx + IniFile.fh]
274
	mov	ebx, [ebx + IniFile.fh]
275
	invoke	file.tell, ebx
275
	invoke	file.tell, ebx
276
;       push    eax
276
;       push    eax
277
	sub	eax, ecx
277
	sub	eax, ecx
278
;       dec     eax
278
;       dec     eax
279
	invoke	file.seek, ebx, eax, SEEK_SET
279
	invoke	file.seek, ebx, eax, SEEK_SET
280
    @@: invoke	file.seek, ebx, [_delta], SEEK_CUR
280
    @@: invoke	file.seek, ebx, [_delta], SEEK_CUR
281
	invoke	file.eof?, ebx
281
	invoke	file.eof?, ebx
282
	or	eax, eax
282
	or	eax, eax
283
	jnz	.done
283
	jnz	.done
284
	invoke	file.read, ebx, [buf], ini.BLOCK_SIZE
284
	invoke	file.read, ebx, [buf], ini.BLOCK_SIZE
285
	mov	ecx, eax
285
	mov	ecx, eax
286
	mov	eax, [_delta]
286
	mov	eax, [_delta]
287
	neg	eax
287
	neg	eax
288
	sub	eax, ecx;ini.BLOCK_SIZE
288
	sub	eax, ecx;ini.BLOCK_SIZE
289
	invoke	file.seek, ebx, eax, SEEK_CUR
289
	invoke	file.seek, ebx, eax, SEEK_CUR
290
	invoke	file.write, ebx, [buf], ecx;ini.BLOCK_SIZE
290
	invoke	file.write, ebx, [buf], ecx;ini.BLOCK_SIZE
291
	jmp	@b
291
	jmp	@b
292
  .done:
292
  .done:
293
	mov	eax, [_delta]
293
	mov	eax, [_delta]
294
	neg	eax
294
	neg	eax
295
	invoke	file.seek, ebx, eax, SEEK_CUR
295
	invoke	file.seek, ebx, eax, SEEK_CUR
296
	invoke	file.seteof, ebx
296
	invoke	file.seteof, ebx
297
;       pop     eax
297
;       pop     eax
298
;       invoke  file.seek, ebx, SEEK_SET;, eax
298
;       invoke  file.seek, ebx, SEEK_SET;, eax
299
	stdcall libini._.reload_block, [_f]
299
	stdcall libini._.reload_block, [_f]
300
	invoke	mem.free, [buf]
300
	invoke	mem.free, [buf]
301
	pop	ecx ebx
301
	pop	ecx ebx
302
  .skip:
302
  .skip:
303
	ret
303
	ret
304
  .fail:
304
  .fail:
305
	or	eax, -1
305
	or	eax, -1
306
	pop	ecx ebx
306
	pop	ecx ebx
307
	ret
307
	ret
308
 
308
 
309
  .down:
309
  .down:
310
	neg	[_delta]
310
	neg	[_delta]
311
 
311
 
312
	mov	ebx, [_f]
312
	mov	ebx, [_f]
313
	mov	ecx, [ebx + IniFile.cnt]
313
	mov	ecx, [ebx + IniFile.cnt]
314
	mov	ebx, [ebx + IniFile.fh]
314
	mov	ebx, [ebx + IniFile.fh]
315
	invoke	file.tell, ebx
315
	invoke	file.tell, ebx
316
;       push    eax
316
;       push    eax
317
	sub	eax, ecx
317
	sub	eax, ecx
318
	lea	edx, [eax - 1]
318
	lea	edx, [eax - 1]
319
	push	edx
319
	push	edx
320
    @@: invoke	file.seek, ebx, edx, SEEK_SET
320
    @@: invoke	file.seek, ebx, edx, SEEK_SET
321
	invoke	file.eof?, ebx
321
	invoke	file.eof?, ebx
322
	or	eax, eax
322
	or	eax, eax
323
	jnz	@f
323
	jnz	@f
324
	add	edx, ini.BLOCK_SIZE
324
	add	edx, ini.BLOCK_SIZE
325
	jmp	@b
325
	jmp	@b
326
    @@: cmp	edx, [esp]
326
    @@: cmp	edx, [esp]
327
	je	.skip.2
327
	je	.skip.2
328
	add	edx, -ini.BLOCK_SIZE
328
	add	edx, -ini.BLOCK_SIZE
329
	cmp	edx, [esp]
329
	cmp	edx, [esp]
330
	jl	@f
330
	jl	@f
331
	invoke	file.seek, ebx, edx, SEEK_SET
331
	invoke	file.seek, ebx, edx, SEEK_SET
332
	invoke	file.read, ebx, [buf], ini.BLOCK_SIZE
332
	invoke	file.read, ebx, [buf], ini.BLOCK_SIZE
333
	mov	ecx, eax
333
	mov	ecx, eax
334
	mov	eax, [_delta]
334
	mov	eax, [_delta]
335
	sub	eax, ecx
335
	sub	eax, ecx
336
	invoke	file.seek, ebx, eax, SEEK_CUR
336
	invoke	file.seek, ebx, eax, SEEK_CUR
337
	invoke	file.write, ebx, [buf], ecx
337
	invoke	file.write, ebx, [buf], ecx
338
	jmp	@b
338
	jmp	@b
339
    @@:
339
    @@:
340
  .skip.2:
340
  .skip.2:
341
	add	esp, 4
341
	add	esp, 4
342
;       mov     eax,[delta]
342
;       mov     eax,[delta]
343
;       neg     eax
343
;       neg     eax
344
;       invoke  file.seek,ebx,SEEK_CUR,eax
344
;       invoke  file.seek,ebx,SEEK_CUR,eax
345
;       pop     eax
345
;       pop     eax
346
;       invoke  file.seek,ebx,SEEK_SET;,eax
346
;       invoke  file.seek,ebx,SEEK_SET;,eax
347
	stdcall libini._.reload_block, [_f]
347
	stdcall libini._.reload_block, [_f]
348
	invoke	mem.free, [buf]
348
	invoke	mem.free, [buf]
349
	pop	ecx ebx
349
	pop	ecx ebx
350
	ret
350
	ret
351
endp
351
endp
352
 
352
 
353
;;================================================================================================;;
353
;;================================================================================================;;
354
proc libini._.get_value_length _f ;///////////////////////////////////////////////////////////////;;
354
proc libini._.get_value_length _f ;///////////////////////////////////////////////////////////////;;
355
;;------------------------------------------------------------------------------------------------;;
355
;;------------------------------------------------------------------------------------------------;;
356
;? --- TBD ---                                                                                    ;;
356
;? --- TBD ---                                                                                    ;;
357
;;------------------------------------------------------------------------------------------------;;
357
;;------------------------------------------------------------------------------------------------;;
358
;> --- TBD ---                                                                                    ;;
358
;> --- TBD ---                                                                                    ;;
359
;;------------------------------------------------------------------------------------------------;;
359
;;------------------------------------------------------------------------------------------------;;
360
;< --- TBD ---                                                                                    ;;
360
;< --- TBD ---                                                                                    ;;
361
;;================================================================================================;;
361
;;================================================================================================;;
362
	push	ebx ecx edx eax
362
	push	ebx ecx edx eax
363
	mov	ebx, [_f]
363
	mov	ebx, [_f]
364
	invoke	file.tell, [ebx + IniFile.fh]
364
	invoke	file.tell, [ebx + IniFile.fh]
365
	push	esi [ebx + IniFile.cnt] [ebx + IniFile.pos]
365
	push	esi [ebx + IniFile.cnt] [ebx + IniFile.pos]
366
	sub	eax, [ebx + IniFile.cnt]
366
	sub	eax, [ebx + IniFile.cnt]
367
	mov	edx, eax
367
	mov	edx, eax
368
 
368
 
369
	stdcall libini._.skip_line, [_f]
369
	stdcall libini._.skip_line, [_f]
370
	invoke	file.tell, [ebx + IniFile.fh]
370
	invoke	file.tell, [ebx + IniFile.fh]
371
	sub	eax, [ebx + IniFile.cnt]
371
	sub	eax, [ebx + IniFile.cnt]
372
	sub	eax, edx
372
	sub	eax, edx
373
	mov	[esp + 4 * 3], eax
373
	mov	[esp + 4 * 3], eax
374
 
374
 
375
	pop	eax
375
	pop	eax
376
	invoke	file.seek, [ebx + IniFile.fh], eax, SEEK_SET
376
	invoke	file.seek, [ebx + IniFile.fh], eax, SEEK_SET
377
	stdcall libini._.preload_block, [_f]
377
	stdcall libini._.preload_block, [_f]
378
	pop	[ebx + IniFile.cnt] esi
378
	pop	[ebx + IniFile.cnt] esi
379
	pop	eax edx ecx ebx
379
	pop	eax edx ecx ebx
380
	ret
380
	ret
381
endp
381
endp
382
 
382
 
383
;;================================================================================================;;
383
;;================================================================================================;;
384
proc libini._.string_copy ;///////////////////////////////////////////////////////////////////////;;
384
proc libini._.string_copy ;///////////////////////////////////////////////////////////////////////;;
385
;;------------------------------------------------------------------------------------------------;;
385
;;------------------------------------------------------------------------------------------------;;
386
;? --- TBD ---                                                                                    ;;
386
;? --- TBD ---                                                                                    ;;
387
;;------------------------------------------------------------------------------------------------;;
387
;;------------------------------------------------------------------------------------------------;;
388
;> --- TBD ---                                                                                    ;;
388
;> --- TBD ---                                                                                    ;;
389
;;------------------------------------------------------------------------------------------------;;
389
;;------------------------------------------------------------------------------------------------;;
390
;< --- TBD ---                                                                                    ;;
390
;< --- TBD ---                                                                                    ;;
391
;;================================================================================================;;
391
;;================================================================================================;;
392
    @@: lodsb
392
    @@: lodsb
393
	or	al, al
393
	or	al, al
394
	jz	@f
394
	jz	@f
395
	stosb
395
	stosb
396
	jmp	@b
396
	jmp	@b
397
    @@: ret
397
    @@: ret
398
endp
398
endp
399
 
399
 
400
;;================================================================================================;;
400
;;================================================================================================;;
401
proc libini._.find_next_section _f ;//////////////////////////////////////////////////////////////;;
401
proc libini._.find_next_section _f ;//////////////////////////////////////////////////////////////;;
402
;;------------------------------------------------------------------------------------------------;;
402
;;------------------------------------------------------------------------------------------------;;
403
;? --- TBD ---                                                                                    ;;
403
;? --- TBD ---                                                                                    ;;
404
;;------------------------------------------------------------------------------------------------;;
404
;;------------------------------------------------------------------------------------------------;;
405
;> --- TBD ---                                                                                    ;;
405
;> --- TBD ---                                                                                    ;;
406
;;------------------------------------------------------------------------------------------------;;
406
;;------------------------------------------------------------------------------------------------;;
407
;< --- TBD ---                                                                                    ;;
407
;< --- TBD ---                                                                                    ;;
408
;;================================================================================================;;
408
;;================================================================================================;;
409
	push	ebx edi
409
	push	ebx edi
410
 
410
 
411
    @@: stdcall libini._.skip_nonblanks, [_f]
411
    @@: stdcall libini._.skip_nonblanks, [_f]
412
	cmp	al, '['
412
	cmp	al, '['
413
	je	@f
413
	je	@f
414
	or	al, al
414
	or	al, al
415
	jz	.exit_error
415
	jz	.exit_error
416
	stdcall libini._.skip_line, [_f]
416
	stdcall libini._.skip_line, [_f]
417
	or	al, al
417
	or	al, al
418
	jz	.exit_error
418
	jz	.exit_error
419
	jmp	@b
419
	jmp	@b
420
    @@:
420
    @@:
421
	pop	edi ebx
421
	pop	edi ebx
422
	xor	eax, eax
422
	xor	eax, eax
423
	ret
423
	ret
424
 
424
 
425
  .exit_error:
425
  .exit_error:
426
	pop	edi ebx
426
	pop	edi ebx
427
	or	eax, -1
427
	or	eax, -1
428
	ret
428
	ret
429
endp
429
endp
430
 
430
 
431
;;================================================================================================;;
431
;;================================================================================================;;
432
proc libini._.find_section _f, _sec_name ;////////////////////////////////////////////////////////;;
432
proc libini._.find_section _f, _sec_name ;////////////////////////////////////////////////////////;;
433
;;------------------------------------------------------------------------------------------------;;
433
;;------------------------------------------------------------------------------------------------;;
434
;? Find section in file                                                                           ;;
434
;? Find section in file                                                                           ;;
435
;? Search is performed from the beginning of file                                                 ;;
435
;? Search is performed from the beginning of file                                                 ;;
436
;;------------------------------------------------------------------------------------------------;;
436
;;------------------------------------------------------------------------------------------------;;
437
;> --- TBD ---                                                                                    ;;
437
;> --- TBD ---                                                                                    ;;
438
;;------------------------------------------------------------------------------------------------;;
438
;;------------------------------------------------------------------------------------------------;;
439
;< eax = -1 (fail) / 0 (ok)                                                                       ;;
439
;< eax = -1 (fail) / 0 (ok)                                                                       ;;
440
;< [_f.pos] = new cursor position (right after ']' char if eax = 0, at the end of file otherwise) ;;
440
;< [_f.pos] = new cursor position (right after ']' char if eax = 0, at the end of file otherwise) ;;
441
;;================================================================================================;;
441
;;================================================================================================;;
442
	push	ebx edi
442
	push	ebx edi
443
 
443
 
444
	mov	ecx, [_f]
444
	mov	ecx, [_f]
445
	invoke	file.seek, [ecx + IniFile.fh], 0, SEEK_SET
445
	invoke	file.seek, [ecx + IniFile.fh], 0, SEEK_SET
446
	stdcall libini._.preload_block, [_f]
446
	stdcall libini._.preload_block, [_f]
447
 
447
 
448
  .next_section:
448
  .next_section:
449
	stdcall libini._.find_next_section, [_f]
449
	stdcall libini._.find_next_section, [_f]
450
	or	eax, eax
450
	or	eax, eax
451
	jnz	.exit_error
451
	jnz	.exit_error
452
 
452
 
453
	stdcall libini._.get_char, [_f]
453
	stdcall libini._.get_char, [_f]
454
;       inc     esi
454
;       inc     esi
455
;       dec     [ecx + IniFile.cnt]
455
;       dec     [ecx + IniFile.cnt]
456
	stdcall libini._.skip_spaces, [_f]
456
	stdcall libini._.skip_spaces, [_f]
457
	mov	edi, [_sec_name]
457
	mov	edi, [_sec_name]
458
    @@: stdcall libini._.get_char, [_f]
458
    @@: stdcall libini._.get_char, [_f]
459
	cmp	al, ']'
459
	cmp	al, ']'
460
	je	@f
460
	je	@f
461
	or	al, al
461
	or	al, al
462
	jz	.exit_error
462
	jz	.exit_error
463
	cmp	al, 13
463
	cmp	al, 13
464
	je	.next_section
464
	je	.next_section
465
	cmp	al, 10
465
	cmp	al, 10
466
	je	.next_section
466
	je	.next_section
467
	scasb
467
	scasb
468
	je	@b
468
	je	@b
469
	cmp	byte[edi - 1], 0
469
	cmp	byte[edi - 1], 0
470
	jne	.next_section
470
	jne	.next_section
471
	dec	edi
471
	dec	edi
472
	stdcall libini._.unget_char, [_f]
472
	stdcall libini._.unget_char, [_f]
473
	stdcall libini._.skip_spaces, [_f]
473
	stdcall libini._.skip_spaces, [_f]
474
	stdcall libini._.get_char, [_f]
474
	stdcall libini._.get_char, [_f]
475
	cmp	al, ']'
475
	cmp	al, ']'
476
	jne	.next_section
476
	jne	.next_section
477
    @@:
477
    @@:
478
	cmp	byte[edi], 0
478
	cmp	byte[edi], 0
479
	jne	.next_section
479
	jne	.next_section
480
	pop	edi ebx
480
	pop	edi ebx
481
	xor	eax, eax
481
	xor	eax, eax
482
	ret
482
	ret
483
 
483
 
484
  .exit_error:
484
  .exit_error:
485
	pop	edi ebx
485
	pop	edi ebx
486
	or	eax, -1
486
	or	eax, -1
487
	ret
487
	ret
488
endp
488
endp
489
 
489
 
490
;;================================================================================================;;
490
;;================================================================================================;;
491
proc libini._.find_key _f, _key_name ;////////////////////////////////////////////////////////////;;
491
proc libini._.find_key _f, _key_name ;////////////////////////////////////////////////////////////;;
492
;;------------------------------------------------------------------------------------------------;;
492
;;------------------------------------------------------------------------------------------------;;
493
;? Find key in section                                                                            ;;
493
;? Find key in section                                                                            ;;
494
;? Search is performed within current section starting from cursor position                       ;;
494
;? Search is performed within current section starting from cursor position                       ;;
495
;;------------------------------------------------------------------------------------------------;;
495
;;------------------------------------------------------------------------------------------------;;
496
;> --- TBD ---                                                                                    ;;
496
;> --- TBD ---                                                                                    ;;
497
;;------------------------------------------------------------------------------------------------;;
497
;;------------------------------------------------------------------------------------------------;;
498
;< eax = -1 (fail) / 0 (ok)                                                                       ;;
498
;< eax = -1 (fail) / 0 (ok)                                                                       ;;
499
;< [_f.pos] = new cursor position (right after '=' char if eax = 0, at the end of file or right   ;;
499
;< [_f.pos] = new cursor position (right after '=' char if eax = 0, at the end of file or right   ;;
500
;<            before '[' char otherwise)                                                          ;;
500
;<            before '[' char otherwise)                                                          ;;
501
;;================================================================================================;;
501
;;================================================================================================;;
502
	push	ebx edi
502
	push	ebx edi
503
 
503
 
504
  .next_value:
504
  .next_value:
505
	mov	edi, [_key_name]
505
	mov	edi, [_key_name]
506
	stdcall libini._.skip_line, [_f]
506
	stdcall libini._.skip_line, [_f]
507
	stdcall libini._.skip_nonblanks, [_f]
507
	stdcall libini._.skip_nonblanks, [_f]
508
	or	al, al
508
	or	al, al
509
	jz	.exit_error
509
	jz	.exit_error
510
	cmp	al, '['
510
	cmp	al, '['
511
	je	.exit_error
511
	je	.exit_error
512
    @@: stdcall libini._.get_char, [_f]
512
    @@: stdcall libini._.get_char, [_f]
513
	or	al, al
513
	or	al, al
514
	jz	.exit_error
514
	jz	.exit_error
515
	cmp	al, '='
515
	cmp	al, '='
516
	je	@f
516
	je	@f
517
	scasb
517
	scasb
518
	je	@b
518
	je	@b
519
	cmp	byte[edi - 1], 0
519
	cmp	byte[edi - 1], 0
520
	jne	.next_value
520
	jne	.next_value
521
	dec	edi
521
	dec	edi
522
	stdcall libini._.unget_char, [_f]
522
	stdcall libini._.unget_char, [_f]
523
	stdcall libini._.skip_spaces, [_f]
523
	stdcall libini._.skip_spaces, [_f]
524
	stdcall libini._.get_char, [_f]
524
	stdcall libini._.get_char, [_f]
525
	cmp	al, '='
525
	cmp	al, '='
526
	je	@f
526
	je	@f
527
	jmp	.next_value
527
	jmp	.next_value
528
    @@:
528
    @@:
529
	cmp	byte[edi], 0
529
	cmp	byte[edi], 0
530
	jne	.next_value
530
	jne	.next_value
531
 
531
 
532
	pop	edi ebx
532
	pop	edi ebx
533
	xor	eax, eax
533
	xor	eax, eax
534
	ret
534
	ret
535
 
535
 
536
  .exit_error:
536
  .exit_error:
537
	pop	edi ebx
537
	pop	edi ebx
538
	or	eax, -1
538
	or	eax, -1
539
	ret
539
	ret
540
endp
540
endp
541
 
541
 
542
;;================================================================================================;;
542
;;================================================================================================;;
543
proc libini._.low.read_value _f_addr, _buffer, _buf_len ;/////////////////////////////////////////;;
543
proc libini._.low.read_value _f_addr, _buffer, _buf_len ;/////////////////////////////////////////;;
544
;;------------------------------------------------------------------------------------------------;;
544
;;------------------------------------------------------------------------------------------------;;
545
;? --- TBD ---                                                                                    ;;
545
;? --- TBD ---                                                                                    ;;
546
;;------------------------------------------------------------------------------------------------;;
546
;;------------------------------------------------------------------------------------------------;;
547
;> --- TBD ---                                                                                    ;;
547
;> --- TBD ---                                                                                    ;;
548
;;------------------------------------------------------------------------------------------------;;
548
;;------------------------------------------------------------------------------------------------;;
549
;< --- TBD ---                                                                                    ;;
549
;< --- TBD ---                                                                                    ;;
550
;;================================================================================================;;
550
;;================================================================================================;;
551
	push	edi eax
551
	push	edi eax
552
	mov	edi, [_buffer]
552
	mov	edi, [_buffer]
553
	stdcall libini._.skip_spaces, [_f_addr]
553
	stdcall libini._.skip_spaces, [_f_addr]
554
    @@: dec	[_buf_len]
554
    @@: dec	[_buf_len]
555
	jz	@f
555
	jz	@f
556
	stdcall libini._.get_char, [_f_addr]
556
	stdcall libini._.get_char, [_f_addr]
557
	cmp	al, 13
557
	cmp	al, 13
558
	je	@f
558
	je	@f
559
	cmp	al, 10
559
	cmp	al, 10
560
	je	@f
560
	je	@f
561
	stosb
561
	stosb
562
	or	al, al
562
	or	al, al
563
	jnz	@b
563
	jnz	@b
564
    @@: stdcall libini._.unget_char, [_f_addr]
564
    @@: stdcall libini._.unget_char, [_f_addr]
565
	mov	byte[edi], 0
565
	mov	byte[edi], 0
566
	dec	edi
566
	dec	edi
567
    @@: cmp	byte[edi], 32
567
    @@: cmp	byte[edi], 32
568
	ja	@f
568
	ja	@f
569
	mov	byte[edi], 0
569
	mov	byte[edi], 0
570
	dec	edi
570
	dec	edi
571
	cmp	edi, [_buffer]
571
	cmp	edi, [_buffer]
572
	jae	@b
572
	jae	@b
573
    @@: pop	eax edi
573
    @@: pop	eax edi
574
	ret
574
	ret
575
endp
575
endp
576
 
576
 
577
;;================================================================================================;;
577
;;================================================================================================;;
578
proc libini._.str_to_int ;////////////////////////////////////////////////////////////////////////;;
578
proc libini._.str_to_int ;////////////////////////////////////////////////////////////////////////;;
579
;;------------------------------------------------------------------------------------------------;;
579
;;------------------------------------------------------------------------------------------------;;
580
;? --- TBD ---                                                                                    ;;
580
;? --- TBD ---                                                                                    ;;
581
;;------------------------------------------------------------------------------------------------;;
581
;;------------------------------------------------------------------------------------------------;;
582
;> esi = string buffer address                                                                    ;;
582
;> esi = string buffer address                                                                    ;;
583
;;------------------------------------------------------------------------------------------------;;
583
;;------------------------------------------------------------------------------------------------;;
584
;< eax = binary number representation (no overflow checks made)                                   ;;
584
;< eax = binary number representation (no overflow checks made)                                   ;;
585
;;================================================================================================;;
585
;;================================================================================================;;
586
	push	edx
586
	push	edx
587
 
587
 
588
	xor	eax, eax
588
	xor	eax, eax
589
	xor	edx, edx
589
	xor	edx, edx
590
 
590
 
591
    @@: lodsb
591
    @@: lodsb
592
	cmp	al, '0'
592
	cmp	al, '0'
593
	jb	@f
593
	jb	@f
594
	cmp	al, '9'
594
	cmp	al, '9'
595
	ja	@f
595
	ja	@f
596
	add	eax, -'0'
596
	add	eax, -'0'
597
	imul	edx, 10
597
	imul	edx, 10
598
	add	edx, eax
598
	add	edx, eax
599
	jmp	@b
599
	jmp	@b
600
 
600
 
601
    @@: dec	esi
601
    @@: dec	esi
602
	mov	eax, edx
602
	mov	eax, edx
603
	pop	edx
603
	pop	edx
604
	ret
604
	ret
605
endp
605
endp
606
 
606
 
607
;;================================================================================================;;
607
;;================================================================================================;;
608
proc libini._.int_to_str ;////////////////////////////////////////////////////////////////////////;;
608
proc libini._.int_to_str ;////////////////////////////////////////////////////////////////////////;;
609
;;------------------------------------------------------------------------------------------------;;
609
;;------------------------------------------------------------------------------------------------;;
610
;? --- TBD ---                                                                                    ;;
610
;? --- TBD ---                                                                                    ;;
611
;;------------------------------------------------------------------------------------------------;;
611
;;------------------------------------------------------------------------------------------------;;
612
;> eax = number to convert                                                                        ;;
612
;> eax = number to convert                                                                        ;;
613
;> ecx = base                                                                                     ;;
613
;> ecx = base                                                                                     ;;
614
;> edi = string buffer address                                                                    ;;
614
;> edi = string buffer address                                                                    ;;
615
;;------------------------------------------------------------------------------------------------;;
615
;;------------------------------------------------------------------------------------------------;;
616
;< --- TBD ---                                                                                    ;;
616
;< --- TBD ---                                                                                    ;;
617
;;================================================================================================;;
617
;;================================================================================================;;
618
	push	ecx edx
618
	push	ecx edx
619
 
619
 
620
	or	eax, eax
620
	or	eax, eax
621
	jns	@f
621
	jns	@f
622
	mov	byte[edi], '-'
622
	mov	byte[edi], '-'
623
	inc	edi
623
	inc	edi
624
    @@: call	.recurse
624
    @@: call	.recurse
625
	pop	edx ecx
625
	pop	edx ecx
626
	ret
626
	ret
627
 
627
 
628
  .recurse:
628
  .recurse:
629
	cmp	eax,ecx
629
	cmp	eax,ecx
630
	jb	@f
630
	jb	@f
631
	xor	edx,edx
631
	xor	edx,edx
632
	div	ecx
632
	div	ecx
633
	push	edx
633
	push	edx
634
	call	.recurse
634
	call	.recurse
635
	pop	eax
635
	pop	eax
636
    @@: cmp	al,10
636
    @@: cmp	al,10
637
	sbb	al,0x69
637
	sbb	al,0x69
638
	das
638
	das
639
	stosb
639
	stosb
640
	retn
640
	retn
641
endp
641
endp