how do you add var in ASM. I currently not understanding what the kip irvine book is saying . Is it similar to basic c++ where i set
int for the value
int for the total
cout statements to display on the console ?
I use a label and the db keyword to define "variables"
1 2 3 4 5 6 7 8 9 10
jmp main;
VarNameHere:
db "String to print", 0; Null terminatinion with null
main:
mov ax, VarNameHere; A register will be dedicated to storing the first byte in the string
mov bx, somecommandbyte; A second register will be used by the OS to say what you want to do, in our case print whatever is in AX to stdout until null termination
int 80h; Call kernel/OS to print string
The above code may be different if you are using GAS syntax, I haven't touched assembly in a while!
A lable is just an address of memory/the program. So when you lable the object as shown above, any future use of that object can be reffered to by the label "VarNameHere"