-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTRING.inc
More file actions
75 lines (61 loc) · 1.34 KB
/
Copy pathSTRING.inc
File metadata and controls
75 lines (61 loc) · 1.34 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
.proc CompareString
@t: .data 0
@s1: .data 0
@s2: .data 0
@ch1: .data 0
@ch2: .data 0
CompareString:
POP @t ; Pop off the return address and parameters
POP @s2
POP @s1
PUSH @t ; Push the return address back onto the stack
CLR compResult
@loop:
INDEXEDRD @s1 @ch1
INDEXEDRD @s2 @ch2
CMPNE @ch1 @ch2 @fail
JMPN0 @ch1 @next
JMPN0 @ch2 @next
INC compResult
RET
@next:
INC @s1
INC @s2
JMP @loop
@fail:
RET
.endp
.proc CompareStringIgnoreCase
@t: .data 0
@s1: .data 0
@s2: .data 0
@ch1: .data 0
@ch2: .data 0
CompareStringIgnoreCase:
POP @t ; Pop off the return address and parameters
POP @s2
POP @s1
PUSH @t ; Push the return address back onto the stack
CLR compResult
@loop:
INDEXEDRD @s1 @ch1
INDEXEDRD @s2 @ch2
JBETWEEN @ch1 ASCII_a ASCII_z @uc1 ; If the character is a lower case letter, convert it to upper case
JMP @uc2
@uc1: CONST_32 @ch1
@uc2: JBETWEEN @ch2 ASCII_a ASCII_z @uc3
JMP @uc4
@uc3: CONST_32 @ch2
@uc4:
CMPNE @ch1 @ch2 @fail
JMPN0 @ch1 @next
JMPN0 @ch2 @next
INC compResult
RET
@next:
INC @s1
INC @s2
JMP @loop
@fail:
RET
.endp