## 1) How To Use Symbolic Constants In An Array

Name 7 symbolic constants the 7 days of the week.  Then place them into a DWORD array.

```.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD

.data
mon = 1				;symbolic constants
tue = 2
wed = 3
thurs = 4
fri = 5
sat = 6
sun = 7
;puting symbolic constants in an array of DWORDS
week DWORD mon,tue,wed,thurs,fri,sat,sun		;DWORD = 4 Bytes
week2 WORD mon,tue,wed,thurs,fri,sat,sun		;WORD = 2 Bytes
week3 BYTE mon,tue,wed,thurs,fri,sat,sun		;BYTE = 1 Byte

.code
main PROC

;week 1
;in order to reach the next element of the array
;we must inciment by 4 because it is a DWORD array
;32 bit registers should be used
mov eax, week							 	  ;eax = 1
mov ebx, week+4								;eax = 2
mov ecx, week+8								;eax = 3
mov edx, week+12							;eax = 4

;week2
;in order to reach the next element of the array
;we must inciment by 2 because it is a WORD array
;16 bit registers should be used
mov ax, week2						 		  ;ax = 1
mov bx, week2+2								;bx = 2
mov cx, week2+4								;cx = 3
mov dx, week2+6								;dx = 4

;week3
;in order to reach the next element of the array
;we must inciment by 1 because it is a BYTE array'
;8 bit registers should be used
mov al, week3						 		  ;al = 1
mov bl, week3+1								;bl = 2
mov cl, week3+2								;cl = 3
mov dl, week3+3								;dl = 4

INVOKE ExitProcess,0
main ENDP

END main
```

## 2) How To Use The EQU Directive

Use the EQU directive.

```.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD

.data
;EQU directive defines a symbol by either an integer or text
;EQU directive makes the symbolic constant so it can't be redefined.
str1 EQU <"apple",0>
str2 EQU <"orange",0>
str3 EQU <"grape",0>
str4 EQU <"melon",0>

var1 BYTE str1
var2 BYTE str2
var3 BYTE str3
var4 BYTE str4

result DWORD 1234567h
.code
main PROC
mov eax,0                       ;clarity purposes
mov ebx,0
mov edx,0
mov ecx,0

mov al, var1                    ; al = 61h which is 'a' in ascii
mov bl, var2+1                  ; bl = 71h which is 'r' in ascii
mov cl, var3+2                  ; cl = 61h which is 'a' in ascii
mov dl, var4+3                  ; dl = 6Fh which is 'o' in ascii

INVOKE ExitProcess,0
main ENDP
END main```

## 3) How To Use Add, Sub, Mul, Div Instructions

Do simple calculations using the add, sub, mul, and div instructions.

```.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword

.data
sum DWORD 0
remainder DWORD 0

num1 WORD 5
num2 word 12
num3 word 10
symbolicCon = 8
.code
main proc
; sum = (13 + 6) - 5
mov eax,13
sub eax,5
mov sum,eax               ;Sum = 16 eax= Eh

; sum = (13h + 6h) - 5h
mov eax,13h               ;19
sub eax,5h                ;5
mov sum,eax               ;Sum = 20 eax = 14h

; sum = (44 / (2 * 11)) + 7
mov eax, 2
mov ebx, 11
mul ebx                   ;eax = 22
mov ebx, 44
xchg eax, ebx             ;eax = 44 ebx = 22
div ebx                   ;eax = 2
mov sum, eax              ;Sum = 9

; sum = (7 * 5) / 4
mov eax, 7
mov ebx, 5
mul ebx
mov ebx, 4
div ebx
mov sum, eax              ;Sum = 8
mov remainder, edx        ;Remainder = 3

; sum = ((num1 * num2) / num3) - symbolicCon
mov ax, num1
mul num2
div num3
sub ax, symbolicCon
mov sum, eax              ;Sum = -2 Eax = FFFE
invoke ExitProcess,0
main endp
end main

```

## 4) Two Ways To Loop Through an Array (Indirect & Index Addressing)

Show two different ways to loop through an array.  One using index addressing and the other using indirect addressing.

## 5) How To Reverse An Array

Write a program with a loop using indirect addressing that copies data from the source array to the target array, reversing the order in the process.

## 6) How To Copy Elements From A 16bit Array To A 32bit Array

Copies elements from a 16bit array to a 32bit array using loops.

## 7) How To Make A String Different Colors

Write a program that displays the same string in 15 different colors, using a loop.  Call the SetTextColor procedure from the book’s link library.

## 8) How To Change The Background Color

Set the background and text color to a color other than black or white.

## 9) How To Read A Txt File From Assembly Part1 (Strings)

Read a .txt file containing strings and display it on screen.