next up previous contents
Next: 14.1.2 Declaring an Initialization Up: 14.1 The Binary Source Previous: 14.1 The Binary Source

14.1.1 Declaring Variables in Binary Files

The label variable_foo is an example of a special form to declare the name and location of a variable accessable from C. The special label prefix `` variable_'' is followed the name of the variable, in this case, `` foo.''

This label must be immediately followed by the statement FDB <number>. This is an assembler directive that creates a two-byte value (which is the initial value of the variable).

Variables used by binary programs must be declared in the binary file. These variables then become C globals when the binary file is loaded into C.

The next binary program in the file is named `` set_foo.'' It performs the action of setting the value of the variable foo, which is defined later in the file. It does this by storing the D register into the memory contents reserved for foo, and then returning.

The next binary program is named `` get_foo.'' It loads the D register from the memory reserved for foo and then returns.

Fred G. Martin
Fri Mar 29 17:44:15 EST 1996