,ll 6.6
,cs 10
,pl 66
,lm 0.2,0.5
,pn 35
,ju
,hd
,ce
OmegaSoft 6809 Cross Pascal Language Handbook (V1.0)
,,
,ft

,ce 1
4-##
,,
,ce
OmegaSoft 6809 Cross Pascal Language Handbook (V1.0)
,ce
VARIABLE DECLARATIONS

DATA ADDRESSING

If the type in the variable declaration is followed by the word "data" then the variable will be stored in the data section. For instance, in the declaration :

  abcd : integer data ;

the following code will be emitted :

 data
..n equ *
 rmb 2
 code

and an assignment such as "abcd := 5" will generate :

 ldd #5
 std ..n,pcr

This storage class may also be combined with entry and external where required. In the declaration :

  abcd : integer data entry ;

the following code will be emitted :

 data
abcd equ *
 rmb 2
 code
 xdef abcd

and an assignment such as "abcd := 5" will generate :

 ldd #5
 std abcd,pcr

In the declaration :

 abcd : integer data external ;

the following code will be emitted :

 xref abcd

and an assignment such as "abcd := 5" will generate :

 ldd #5
 std abcd,pcr

This addressing mode is normally used in the "data external" format for accessing tables in assembly language, or in the "data const" form for structured constants.

String constants used with the append procedure  are currently stored in data section, as are structured constants. ONLY CONSTANTS MAY BE USED IN DATA SECTION IF THE CODE IS TO BE PUT INTO ROM!!!!

The maximum size for data section is 64K bytes.
,ce
VARIABLE DECLARATIONS

"STATIC" variables should be put into varib section. This section is actually part of the same area of memory where your stack and heap are, so it is safe for ROM/RAM systems in addition to RAM only systems (under an operating system).

VARIB ADDRESSING

If the type in the variable declaration is followed by the word "varib" then the variable will be stored in the varib section. For instance, in the declaration :

  abcd : integer varib ;

the following code will be emitted :

 varib
..n equ *
 rmb 2
 code

and an assignment such as "abcd := 5" will generate :

 ldd #4
 ldx -6,y  {if not done from the main program}
 std ..n,y

This storage class may also be combined with entry and external where required. In the declaration :

  abcd : integer varib entry ;

the following code will be emitted :

 varib
abcd equ *
 rmb 2
 code
 xdef abcd

and an assignment such as "abcd := 5" will generate :

 ldd #5
 ldx -6,y   {if not done from the main program}
 std abcd,y

In the declaration :

 abcd : integer varib external ;

the following code will be emitted :

 xref abcd

and an assignment such as "abcd := 5" will generate :

 ldd #5
 ldx -6,y   {if not done from the main program}
 std abcd,y

The maximum size for varib section is 32K bytes.
,pg
,ce
VARIABLE DECLARATIONS

STRUCTURED CONSTANTS

A special form of data entry addressing is available for building constant tables at the pascal level. If the word "data" is followed by the word "const" then a structured constant is formed. Following the word "const" is a series of constant values to be placed into memory instead of just reserving storage as is normally done. An entry point is created at the assembly language level the same as data entry addressing.

The type of variable may be boolean, enumerated, character, integer, hex, longhex, longinteger, real, array, or record. For all but record and array, simply specify the constant after the word "const", such as :

default1 : boolean data const true ;
default2 : integer data const 400 ;
defaultname : string[16] data const '/dd/sys/password' ;

For each dimension of the array you specify within parenthesis the value for each element separated by commas. For each record you specify within parenthesis the value of each part of the record separated by commas. You may not use variant records in this syntax due to problems encountered trying to determine which variants you want to initialize.

In the case of arrays you may initialize a series of contiguous elements by specifying the repetition count, the word "of", and the value to be placed in those elements.

As an example, in the structure :

type
  abc = record
          def : integer ;
          ghi : string ;
          jkl : array [1..5,1..3] of integer ;
          mno : array ['A' .. 'Z'] of byte ;
          pqr : real
        end ;

var
  stu : abc data const (5,'test string',
                       ((1,2,3),(2,4,6),(3,6,9),
                        (4,8,12),(5,10,15)),(26 of #0),3.25) ;

Variable stu would be :

stu.def = 5
stu.ghi = test string
stu.jkl[i,j] = i * j
stu.mno = all elements are zero
stu.pqr = 3.25

Please note the use of parenthesis for the record and one level of parenthesis for each dimension of the array. Note that in multi-dimensional arrays the constants must be specified in row-major order which is the same way that they are stored.
,pg
,ce
VARIABLE DECLARATIONS

,ce
SCOPE OF IDENTIFIERS

Identifiers declared in a block are accessible from any inner blocks unless redefined in the inner block. Outer blocks may not use identifiers declared in inner blocks. The innermost definition is used in cases where the same identifier is used to define different objects in nested blocks. These scope rules apply to all identifiers used as names for constants, variables, types, procedures, and functions.
