CONST in ASM 
Author Message
 CONST in ASM

When I defince a constant in TP like
CONST
        BlokSize=256
how do I use this constant in an external .asm file compiled with TASM2.0




Wed, 18 Jun 1902 08:00:00 GMT  
 CONST in ASM


Quote:

> When I defince a constant in TP like
> CONST
>         BlokSize=256
> how do I use this constant in an external .asm file compiled with TASM2.0



See your manual! AFAK you declare it as "external" but you have to
define the model as "Pascal" (I think).

CU,
Bernd



Wed, 18 Jun 1902 08:00:00 GMT  
 CONST in ASM


Quote:

> When I defince a constant in TP like
> CONST
>         BlokSize=256
> how do I use this constant in an external .asm file compiled with TASM2.0

You cannot use such constants in .asm files because they exist only
while compiling. You could use something like:

CONST
   BlockSize:Word=256;

and then declare a external variable in your .asm file like:

EXTRN BlockSize:Word

(I'm not sure if this is MASM compatible. I use the IDEAL mode of TASM
to reduce language quirks. If you use MASM mode then take the MASM mode
equivalents).

Another Method I use is to put all common constants in an external file
called p.ex. constant.inc with following structure:

  BlockSize=256; {Comment after semicolon!}
  AnotherConst=7737;
  :
  :

In your Pascal source you declare it:

CONST
  {$I constant.inc}

and in your .asm source:

include 'constant.inc'

This is the only way I know to use the same constants in both pascal and
assembler sources without wasting memory for typed constants.



Wed, 18 Jun 1902 08:00:00 GMT  
 CONST in ASM


writes:

Quote:

>When I defince a constant in TP like
>CONST
>    BlokSize=256
>how do I use this constant in an external .asm file compiled with TASM2.0

 BlokSize equ 256

-- Jay

 --------------------------------------------------------------------------
| Jason Burgon - author of Graphic Vision, TV-Like GUI for 256 Colour SVGA |

| ***NEW VERSION OF GV AVAILABLE FROM*** -> http://www.jayman.demon.co.uk  |
 --------------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Read from Const in ASM?

2. Read from Const ( VARIABLE !!!) in ASM?

3. const instead of var for a local parameter

4. Const assignment

5. Leaving out fields in CONST initialisation

6. const instead of var for a local parameter

7. Const assignment

8. Const and arrays of records

9. "Exceeded line length" in Const

10. Big Const

11. Const parameter in procedures?

12. Global Const R00les Bigtimes

 

 
Powered by phpBB® Forum Software