### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: Lazarus doesn't understand TYPE operator in assembler code  (Read 279 times)

#### andy-cat

• New member
• Posts: 7
##### Lazarus doesn't understand TYPE operator in assembler code
« on: December 02, 2022, 07:47:12 am »
Hello, Lazarus doesn't understand TYPE operator in assembler code:

cmp     EAX, dword ptr [EDI + ECX * TYPE Int64 + \$04]

xxxxxxx.pas(1704,41) Error: Invalid reference syntax

Does anyone know how to solve this problem?

This is the working code from delphi.

Documentation:
4.3.4 TYPE Operator
The TYPE operator returns the size, in bytes, of a single element of a variable. For example, the
TYPE of a byte equals 1, the TYPE of a word equals 2, the TYPE of a doubleword is 4, and the
TYPE of a quadword is 8.

#### Red_prig

• Jr. Member
• Posts: 75
##### Re: Lazarus doesn't understand TYPE operator in assembler code
« Reply #1 on: December 02, 2022, 08:54:30 am »
SizeOf(Int64) worked?

#### andy-cat

• New member
• Posts: 7
##### Re: Lazarus doesn't understand TYPE operator in assembler code
« Reply #2 on: December 02, 2022, 09:26:13 am »
No, it does not work. Same error message.

#### jamie

• Hero Member
• Posts: 5076
##### Re: Lazarus doesn't understand TYPE operator in assembler code
« Reply #3 on: December 02, 2022, 12:33:57 pm »
make a constant outside somewhere?

Const TYPE_INT64 = 8;

?
The only true wisdom is knowing you know nothing

#### ASerge

• Hero Member
• Posts: 2049
##### Re: Lazarus doesn't understand TYPE operator in assembler code
« Reply #4 on: December 02, 2022, 09:59:39 pm »
From docs Intel syntax:
Quote
The Scaling value must be a value, and not an identifier to a symbol. Examples:
const myscale = 1;
...
mov al,byte ptr [esi+ebx*myscale] -- not allowed.
use:
mov al, byte ptr [esi+ebx*1]