•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-File
If you need one structure ABSOLUTE can be used:

' create source mfdb structure (buffer)
INLINE s_mfdb%,20

' place our variables at a specific address
ABSOLUTE fd_addr%,s_mfdb%+0
ABSOLUTE fd_width&,s_mfdb%+4
ABSOLUTE fd_height&,s_mfdb%+6
ABSOLUTE fd_wdwidth&,s_mfdb%+8
ABSOLUTE fd_stand&,s_mfdb%+10
ABSOLUTE fd_planes&,s_mfdb%+12
ABSOLUTE fd_reserved1&,s_mfdb%+14
ABSOLUTE fd_reserved2&,s_mfdb%+16
ABSOLUTE fd_reserved3&,s_mfdb%+18

' fill the mfdb structure
fd_addr%=XBIOS(2)  !screen adr in  s_mfdb.fd_addr=xbios(2)
fd_width&=640      !screen width   s_mfdb.fd_width=workout(0)+1
fd_height&=480     !screen height  s_mfdb.fd_width=workout(1)+1
fd_wdwidth&=640\16 !screen width in words
fd_stand&=0        !device specific
fd_planes&=8       !planes
fd_reserved1&=0    !reserved...
fd_reserved2&=0    !...
fd_reserved3&=0    !...

See ABSOLUTE.

------------------------------------------------------------------------------

If you need multiple structures use this method:

' constants for vro_cpyfm mfdb structure (never change)
' offsets into the structure
fd_addr&=0
fd_width&=4
fd_height&=6
fd_wdwidth&=8
fd_stand&=10
fd_planes&=12
fd_reserved1&=14
fd_reserved2&=16
fd_reserved3&=18
'
' create source mfdb structure (buffer)
INLINE s_mfdb%,20
'
' fill the mfdb structure
LONG{s_mfdb%+fd_addr&}=XBIOS(2)  !screen adr in  s_mfdb.fd_addr=xbios(2)
WORD{s_mfdb%+fd_width&}=640      !screen width   s_mfdb.fd_width=workout(0)+1
WORD{s_mfdb%+fd_height&}=480     !screen height  s_mfdb.fd_width=workout(1)+1
WORD{s_mfdb%+fd_wdwidth&}=640\16 !screen width in words
WORD{s_mfdb%+fd_stand&}=0        !device specific
WORD{s_mfdb%+fd_planes&}=8       !planes
WORD{s_mfdb%+fd_reserved1&}=0    !reserved...
WORD{s_mfdb%+fd_reserved2&}=0    !...
WORD{s_mfdb%+fd_reserved3&}=0    !...

See BYTE{}, WORD{}, LONG{}, and CHAR{}.

------------------------------------------------------------------------------

If you need maximum speed, variable references add more over head:
WORD{s_mfdb%+fd_width&}=640  !slower but more readable
WORD{s_mfdb%+4}=640          !faster but less readable

If you want to get the best of both worlds, faster plus readable, use meta
command #DC+ in GBE. This option turns specified varaibles into constants at
compile time and converts them to absolute values.

' assuming #DC+ is used in the startup phase:
WORD{s_mfdb%+fd_width&}=640  !as seen in GBE's editor
WORD{s_mfdb%+4}=640          !what's sent to the compiler