flat assembler
Message board for the users of flat assembler.

Index > Main > using equ in FASM

Author
Thread Post new topic Reply to topic
rCX



Joined: 29 Jul 2007
Posts: 166
Location: Maryland, USA
rCX
Hello, I'm new to FASM, (from NASM). When I assemble the following code...

Code:
format binary
use16
org 100h

Label:
 mov bx,var
  var equ 1
    


...it give me this error...
Code:
flat assembler  version 1.67.21  (336840 kilobytes memory)
a.asm [16]:
mov bx,var
error: undefined symbol.
    


Is there a way to use "var equ 1" after "mov bx,var" in FASM?

Thanks
Post 29 Jul 2007, 17:30
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
> I'm new to FASM, (from NASM)

Make sure to avoid (just remove them) offending BYTE's:

Code:
CMP EAX, BYTE 3    


Idea

Code:
format binary
use16
org 100h

Label:
        mov bx,var
        var equ 1
    


> ...it give me this error...

It's correct Shocked

> Is there a way to use "var equ 1" after "mov bx,var" in FASM?

NO. EQU works at preprocess level Idea

Code:
format binary
use16
org 100h

Label:
        mov bx,var
        ...
        ret
var:   db 0,0
    


WOW: was faster than Loco Laughing

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug


Last edited by DOS386 on 29 Jul 2007, 18:03; edited 2 times in total
Post 29 Jul 2007, 18:00
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
No, but you can use "=" instead which is an assembly time variable and can be forward referenced (if you assing a value to it only once).

Read the manual before getting deeper because fasm isn't just a NASM written in assembly.
Post 29 Jul 2007, 18:01
View user's profile Send private message Reply with quote
rCX



Joined: 29 Jul 2007
Posts: 166
Location: Maryland, USA
rCX
Thanks it works! I'll make sure I read the whole manual Smile
Post 29 Jul 2007, 18:27
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.