-
Notifications
You must be signed in to change notification settings - Fork 0
/
1labtask.asm
82 lines (54 loc) · 1.18 KB
/
1labtask.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
include irvine32.inc
;--------------DATA SEGMENT-----------------------------------
.data
a sbyte +128
b sbyte -127
var sbyte -1 ; i use "var" instead of C
temp byte 0
msg1 byte "the addition result is : ",0
msg2 byte "the multiplication result is : " ,0
addResult byte 0
mulResult byte 0
MYARRAY byte 20 dup(0)
;------------------;CODE SEGMENT--------------------------------
.code
main proc
;how to make a swap function
xor eax,eax
xor ebx,ebx
;-------------------------addition result--------------------------
mov al,b
add bl,var
mov addResult,bl
call crlf
MOV EDX,OFFSET msg1
CALL WRITESTRING
call writedec
;-------------------------multiplication result-------------------
xor eax,eax
xor ebx,ebx
mov al,a
mul var ; this is the syntax of multiplcation
mov mulResult,bl
call crlf
MOV EDX,OFFSET msg2
CALL WRITESTRING
call writedec
;------------------------Swap Function------------------------------
xor eax,eax
xor ebx,ebx
mov al,a
mov temp,al
mov bl,b
mov al,bl
mov al,temp
mov temp,0
call crlf
call writedec
call crlf
mov al,a
call writedec
call crlf
exit
main ENDP
end main