-
Notifications
You must be signed in to change notification settings - Fork 1
Variable management
Guillaume DERAMCHI edited this page Feb 20, 2024
·
4 revisions
Variable management in the Virtual Processor's assembly language involves declaring, initializing, and manipulating variables for data storage and retrieval.
-
Syntax:
var name, value - Function: Declares a variable with a given name and initializes it with a value.
-
Binary code:
- For numeric values:
1001 1000 0101 1001(var id),1100 1000 0000 0001,1101 0000 0000 1001(Op code:1 0011) - For string values: Binary code sequence includes the variable ID, size, and data.
- For numeric values:
-
Error check:
- Avoid redeclaration of existing variables.
- Adhere to size constraints (not exceeding 256 bytes).
-
Declaring a numeric variable:
var myVar, 10 ; Declares variable 'myVar' with an initial value of 10
-
Declaring a string variable:
var myString, "Hello" ; Declares a string variable 'myString'