-
Notifications
You must be signed in to change notification settings - Fork 0
/
LabFinal.asm
106 lines (89 loc) · 1.53 KB
/
LabFinal.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
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
org 100h
.DATA
a DW ?,?,?,?
b DW ?,?,?,?
.CODE
mov AX,@Data
mov DS,AX
xor AX,AX
mov CX,4
mov SI,OFFSET a
input1:
MOV AH,01
INT 21h
SUB AL,30H
MOV [SI],AL
INC SI
loop input1
mov CX,4
mov SI,OFFSET b
input2:
MOV AH,01
INT 21h
SUB AL,30H
MOV [SI],AL
INC SI
loop input2
mov CX,4
XOR AX,AX
XOR BX,BX
mov SI, OFFSET a
first:
MOV AX,[SI]
AND AX,1
JZ skipped
ADD BX,[SI]
skipped:
INC SI
loop first
XOR AX,AX
XOR DX,DX
MOV CX,4
mov SI, OFFSET b
second:
MOV AX,[SI]
AND AX,1
JZ skipped2
ADD DX,[SI]
skipped2:
INC SI
loop second
CMP DX,BX
JL lesser
MOV AH,02H
MOV SI,OFFSET b
MOV DL,[SI]
ADD DL,30H
INT 21h
INC SI
MOV DL,[SI]
ADD DL,30H
INT 21h
INC SI
MOV DL,[SI]
ADD DL,30H
INT 21h
INC SI
MOV DL,[SI]
ADD DL,30H
INT 21h
JMP end
lesser:
MOV AH,2
MOV SI,OFFSET a
MOV DL,[SI]
ADD DL,30H
INT 21h
INC SI
MOV DL,[SI]
ADD DL,30H
INT 21h
INC SI
MOV DL,[SI]
ADD DL,30H
INT 21h
INC SI
MOV DL,[SI]
ADD DL,30H
INT 21h
end: