-
Notifications
You must be signed in to change notification settings - Fork 0
/
Arrays in ASM exercises.asm
119 lines (98 loc) · 1.37 KB
/
Arrays in ASM exercises.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
107
108
109
110
111
112
113
114
115
116
117
118
119
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
org 100h
; Several cases with the arrays in ASM
; Declare two arrays, and move only first elements of both arrays in AL and BL respectively.
;mov al, A1
;mov bl, A2
;
;ret
;
;A1 DB 1, 2, 3
;A2 DB 4, 5, 6
; now move 2nd element of A1 to AL and 3rd element of A2 to BL.
;mov al, A1+1
;mov bl, A2+2
;
;ret
;
;A1 DB 1, 2, 3
;A2 DB 4, 5, 6
; Display 123 using arrays
;mov ah, 02h
;mov dl, A1
;int 21h
;
;mov ah, 02h
;mov dl, A1+1
;int 21h
;
;mov ah, 02h
;mov dl, A1+2
;int 21h
;
;ret
;
;A1 DB 31h, 32h, 33h
;
; Display 1 2 3 using arrays
;mov ah, 02h
;mov dl, A1
;int 21h
;
;mov ah, 02h
;mov dl, 20h
;int 21h
;
;mov ah, 02h
;mov dl, A1+1
;int 21h
;
;mov ah, 02h
;mov dl, 20h
;int 21h
;
;mov ah, 02h
;mov dl, A1+2
;int 21h
;
;ret
;
;A1 DB 31h, 32h, 33h
;another way
;mov ah, 02h
;mov dl, A1
;int 21h
;
;mov ah, 02h
;mov dl, A1+1
;int 21h
;
;mov ah, 02h
;mov dl, A1+2
;int 21h
;
;mov ah, 02h
;mov dl, A1+3
;int 21h
;
;mov ah, 02h
;mov dl, A1+4
;int 21h
;
;ret
;
;A1 DB 31h, 20h, 32h, 20h, 33h
; Duplicate in ASM arrays
;mov ah, 02h
;mov dl, A1
;int 21h
;
;ret
;
;A1 DB 5 DUP(39h)
;constants
;what EQU 3
;mov ax, what
;same as
;mov ax, 3