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

,ce 1
5-##
,,
,ce
OmegaSoft 6809 Cross Pascal Language Handbook (V1.0)
,ce
TRANSFER STATEMENTS

GOTO

The goto is rarely required and should be avoided when possible. The OmegaSoft Pascal compiler will not allow you to jump in or out of a block and you cannot jump into certain statements including withs, for loops, and case statements using a string selector. The destination of a goto must be a labeled statement (covered later in this chapter) and there is a limit of 20 forward defined goto's in a block. A forward defined goto is a goto to a label that follows the goto.

goto = goto unsigned-integer

,ce
WITH STATEMENT

The with statement is used to abbreviate the notation required for accessing fields in a record. In the with statement a record variable name is specified and when the statement is being compiled any identifiers will be checked to see if they are a field of the specified record before checking the rest of the symbol table. In the record :

   applicant : record
                 name : string [40] ;
                 age : integer ;
                 address : array [1..2] of string [40]
                 score : integer
               end ;

The fields could be setup as :

   applicant.name := 'Joe Smith' ;
   applicant.age := 26 ;
   applicant.address[1] := '4500 Nonroad st.' ;
   applicant.address[2] := 'Reseda, NJ 90009' ;
   applicant.score := 93

Or as :

   with applicant do
     begin
       name := 'Joe Smith' ;
       age := 26 ;
       address[1] := '4500 Nonroad st.' ;
       address[2] := 'Reseda, NJ 90009' ;
       score := 93
     end

Note that using a with statement affects the code generated to access each field. In the first example each field was accessed individually from the stack mark. In the second example at the start of the with statement the record was accessed from the stack mark and that address is pushed on the stack. The fields are accessed as offsets from this value saved on the stack. In this example it might generate more code to use the with statement than without it. Where a with statement can save code is when the record access involves array indexing or file access.
,pg
,ce
WITH STATEMENT

If the data structure allows you to have an array of records :

  symbol = array [1.1000] of record
                               name : string[6] ;
                               address : hex ;
                                 .
                             end ;

Then it would be advantages to use a with :

   with symbol [j] do
     begin
       name := curr_name ;
       address := location ;
         .
         .
     end ;

Since the array access would be done only once for many field accesses.

More than one record name can appear in a with statement and in this case :
  
  with name1, name2, name3 do .....

is equivalent to :

  with name1 do
    with name2 do
      with name3 do ...

and the innermost name (name3) would be searched first when looking for possible fields. With statements can be nested 16 levels maximum.

with-statement = with variable {, variable} do statement


                   record
     with          variable          do         statement
 
                      ,


,ce
PROCEDURE CALL

A procedure call is used to pass actual parameters to a procedure and execute it. See chapter 6 for a description of procedures and parameters. The parameters are pushed onto the stack in forward order before calling the procedure.

procedure-call = procedure-identifier [( expression
                                      {, expression} )]

      procedure
      identifier       (          expression          )

                                     ,



,ce
LABELED STATEMENTS

Labeled statements are used as destinations for goto statements. The unsigned-integer must have already been declared as a label in this block and any gotos to the label must also be in this block.

labeled-statement = unsigned-integer : statement

,ce
INLINE STATEMENT

The inline statement allows assembly language source code to be passed through the compiler unchanged.

The inline statement is specified by following a exclamation mark "!" by the code to be passed through. Everything up until the end of the line is passed through. A group of these lines represent one statement. If the last character on the line (before the carriage return) is a semicolon then the semicolon is not passed through but is instead considered a statement separator. As an example :

   begin
     ! lda #4
     !loop tst.b $a00c
     ! bmi loop
     ! sta $a00d ;
     a := true
   end ;

NOTE! : the above example will only work if using the compiler "O" option (generating assembly language). If using the "R", "D", or "I" command line options on the compiler then you are restricted when using inline assembly language code. This is because the assembler in the compiler and the debugger cannot handle labels (they are single pass). You also cannot use any directives (except FCB, FDB, and FCC), and the only error checking is for invalid opcode.

The example above could be represented by :

    begin
      ! lda #4
      ! tst.b $a00c
      ! bmi *-3
      ! sta $a00d ;
      a := true
    end ;
