-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrremove.asm
More file actions
60 lines (43 loc) · 798 Bytes
/
strremove.asm
File metadata and controls
60 lines (43 loc) · 798 Bytes
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
.386
Include \masm32\include\Irvine32.inc
Includelib \masm32\lib\Irvine32.lib
includelib \masm32\lib\Kernel32.lib
includelib \masm32\lib\User32.lib
;in IDE mod:
;TITLE MASM(test.asm)
;include Irvine32.inc
Str_remove PROTO,
pStart: PTR BYTE,
nChars: DWORD
.data
target BYTE "abcxxxxdefghijklmop",0
.code
main PROC
INVOKE Str_remove, ADDR [target+3],4
mov edx, OFFSET target
call WriteString
call crlf
INVOKE Str_remove, ADDR [target+2],19
mov edx, OFFSET target
call WriteString
call crlf
exit
main ENDP
Str_remove PROC
pStart: PTR BYTE,
nChars: PTR DWORD
INVOKE Str_length,pStart
mov ecx,eax
.IF nChars <= ecx
sub ecx,nChars
.ENDIF
mov esi,pStart
add esi,nChars
mov edi,pStart
cld
rep movsb
mov BYTE PTR [edi],0
Exit_proc:
ret
Str_remove ENDP
END main