Referencing Fortran variables

In this section:

Variables are referenced using the following scheme.

  • Local dynamic variables are addressed using EBP%.

  • Non-local dynamic variables are addressed using EBX%.

  • An argument can only be referenced by its address. For example, in order to load the argument L into AX% use:

SUBROUTINE FRED(L)
INTEGER*2 L
CODE
  MOV EAX%,=L ;Get address of L
  MOVH AX%,[EAX%] ;Load halfword
  .
  .

  • References to common or external variables are constructed using a full 32-bit address.

These rules mean that local variable references may be indexed by one extra register, and common variables may have two indexing registers if necessary. For example:

INTEGER*4 L(200)
CODE
  MOV EAX%,=8
  MOV L[EAX%],=0 ;This sets L(3) to 0

Variable references may be offset. For example:

CHARACTER*10 FOO
CODE
  MOVB FOO+3,=32 ;Sets FOO(4:4)=' '

Indices can also contain multipliers of 1 (default), 2, 4, or 8. For example:

ADD [EAX%+ECX%*4], =6

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited