-
Notifications
You must be signed in to change notification settings - Fork 1
/
Trim.asm
executable file
·63 lines (49 loc) · 1.08 KB
/
Trim.asm
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
TITLE Trim - J. Gavin Ray (6/20/12)
INCLUDE Irvine32.inc
Str_trim PROTO,
pString:PTR BYTE,
char:BYTE
Str_length PROTO,
pString:PTR BYTE
ShowString PROTO,
pString:PTR BYTE
.data
; Test data:
string_1 BYTE "Printing lots of strings#",0
string_2 BYTE "#",0
string_3 BYTE "Hello World###",0
string_4 BYTE "Hello World",0
string_5 BYTE "H#",0
string_6 BYTE "#H",0
.code
main PROC
call Clrscr
INVOKE Str_trim,ADDR string_1,'#'
INVOKE ShowString,ADDR string_1
INVOKE Str_trim,ADDR string_2,'#'
INVOKE ShowString,ADDR string_2
INVOKE Str_trim,ADDR string_3,'#'
INVOKE ShowString,ADDR string_3
INVOKE Str_trim,ADDR string_4,'#'
INVOKE ShowString,ADDR string_4
INVOKE Str_trim,ADDR string_5,'#'
INVOKE ShowString,ADDR string_5
INVOKE Str_trim,ADDR string_6,'#'
INVOKE ShowString,ADDR string_6
exit
main ENDP
ShowString PROC USES edx, pString:PTR BYTE
.data
lbracket BYTE "(",0
rbracket BYTE ")",0
.code
mov edx,OFFSET lbracket
call WriteString
mov edx,pString
call WriteString
mov edx,OFFSET rbracket
call WriteString
call Crlf
ret
ShowString ENDP
END main