a

Symbolic Constants

today's tutorial is going to be on

symbolic constants and symbolic constant

is kind of like a global variable and

other programming languages like C++ or

C so um this is how you define a

symbolic constant you just put the name

of it and then set it equal to something

like 57 or I'll make a second symbolic

constant here so you can place symbolic

constants and registers so I can do a

move operation okay so let me go ahead

and set a breakpoint here start

debugging

all right now let me go ahead expand

this window here all right so if you

hear there are these drunk values inside

the registers yeah

CVX register so if I go ahead and step

over e^x changes to 39 evx changes to 3a

but 57 we put 57 into the symbolic

constant why is this 39 well that's

because 57 is the decimal value and

registers they store hexadecimal values

so I could even show you here that 57

and this in decimal is 39 okay so let me

go ahead and stop that now if you wanted

to have 57 as a hexadecimal inside the

register you would just put an H next to

it like that so I'll show you the

difference I'll put a D as decimal it

should be the same all right so check

this up now it's 57 hexadecimal and said

that EAX register while EBX remains as 3

a hexadecimal or 58 decimal I usually do

find my symbolic constants in the data

section of the program but it is

possible to define them in that code

section of the program so you could also

redefined symbolic constants maybe he

turned 25 years old oh and then again

you don't have to put the D to specify

as decimal assembly knows by default

that these numbers are decimal values

okay

so yet you could you know add the sums H

to the EBX register for example you

could even create an array with symbolic

constants and I can make a video later

on discussing arrays if you'd like so if

I run this it should work okay good

it compiles it compiled without any

errors okay so let's talk about what you

cannot do it symbolic constants so you

can't read a final symbolic constants

with instructions in any type of way so

for example if I wanted to add four to

this one's age to make this 28 why I

cannot do that I will get errors

likewise you know you can't do a move

operation at any type of construction

operation to change a symbolic constant

will not work and doesn't matter if you

changes - you know this is age my

sister's age don't work either way so

yeah once again you cannot change a

symbolic constant using any type of

instructions but again you can redefine

them like this for example this will

work all right well thank you very much

if you would like more practice with

symbolic constants I have some source

code and my website x86 assembly that

plan

I can read link in the description on

how to use symbolic constants in MLA so

here I define seven symbolic constants

these numbers corresponds to the days of

the week and I store these symbolic

constants in three different types of

arrays this is a D rotary a word array

and a byte array so notice how I access

the elements of an array differently

depending if it's a D word array a word

array or battery so for a D right array

I use plus 4 plus 8 plus 12 to access

the second third and fourth in their

theory whereas forward rage plus 2 plus

4 plus 6 or fair byte array plus 1 plus

2 Plus 3 and here for the D word array

I'm stirring the first element into the

EAX register well throw it away after

this the first element in the ax

register which is which is just half the

EAX register an al register for the byte

array is a quarter of the EAX register I

can get into registers and arrays

more in-depth and in depth in another

video anyways for now thank you for

watching and until next time