![]() |
Variable declarationsVariables are objects that have values that change during the execution of a program. Variables are created by a variable declaration. The format of the variable declaration is: VAR {identifier {,identifier}: TypeSpecification;} Each of the identifiers to the left of the colon is declared as a variable of the type that is specified to the right of the colon. TypeSpecification can be either a type name or a new type. The following are examples of variable declarations: VAR Absolute variablesYou can give the absolute address of a variable as follows: VAR identifier [MAKEADR(constant)] : TypeSpecifiation; MAKEADR is imported from the ISO module SYSTEM. The two different forms of MAKEADR are due to the segmented nature of the 80x86 processor. If MAKEADR is passed a single constant the value represents the offset of the address relative to the data segment. When two constants are passed they are the segment and the offset, respectively, of the absolute address. When you give an absolute address, the compiler does not allocate space for the variable, but refers to the address you specify. Example: VAR screen [MAKEADR(0B800H,0)] : ScreenType; The variable screen refers to the screen memory of the color display adaptor in an IBM PC. Source:
|