flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > invalid symbol - macro

Author
Thread Post new topic Reply to topic
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 27 May 2007, 17:46
i'm getting the following error:

push arg2
error: undefined symbol.


for the following macro:

[
;********************************************************************
; strCat
; desc: concatenate strings = arg1 + arg2
; args: arg1 - string to be concatenated to
; arg2 - string to concatenate
; ret: arg1 = concatenated string
; error: n/a
;********************************************************************
macro strCat arg1,arg2
{
push TEMP_SIZE
push arg1
push TEXT_SIZE
push arg2
call str.cat
jc fasmError
mov [arg1],eax
}
]

i've done lots of testing but can't put my finger on the problem.

can someone help?
thanks,
bob k.
Post 27 May 2007, 17:46
View user's profile Send private message Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo 29 May 2007, 01:22
I think the macro itself has to be defined before arg2 is. (Just an educated guess.)
Post 29 May 2007, 01:22
View user's profile Send private message Visit poster's website Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 29 May 2007, 11:47
the macro is defined first. it's part of an include file.
Post 29 May 2007, 11:47
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 29 May 2007, 12:20
macro looks allright. show us code that uses that macro.

i bet you are doing this:
Code:
strCat myString, "abcde"    


so arg="abcde", and it results to
Code:
push "abcde"    
which is not valid instruction
Post 29 May 2007, 12:20
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 29 May 2007, 12:44
format PE console

include 'include/win32ax.inc'

SYSTEM equ win32

include 'include/fasmlib/include/fasm/fasmlib-src.inc'
include 'k2mMacros.inc'
include 'k2mProcedures.inc'
include 'k2wMacros.inc'

PROMPT equ 'k2-m> '
TEMP_SIZE = 512
TEXT_SIZE = 1024

.data

k2ExitCode db '0',0 ;used when exiting - '0' no error, 1 - error
_char db 'char: ',0
_error db 'fasm error: ',0
_prompt db 'k2-m> ',0
x1 db '',0

x dd 'i',0 ;temporary storage that can be reused
x2 dd '/',0

IncludeIData
IncludeUData

text rb TEXT_SIZE


.code

start:

; initialize modules
initialize

beginLoop:

; display prompt
emit _prompt

; get single character
getChar x
push [x]
call isAlpha
jc endLoop

; concatenate string
strCat x,_cat

; display string
emit [x]



endLoop:

; unititialize modules
unInitialize

; exit without error
exitProcess k2ExitCode


exp:

expected [x]

.end start


fasmError:
; eax holds fasmError code
; ebx = text of fasmError code in eax
push eax
call err.text
mov ebx,eax

; display 'Error: '
push _error
push stream.stderr
call text.write

; display fasmError message
push ebx
push stream.stderr
call text.write

; unitialize modules
unInitialize

; exit with code '1'
mov [k2ExitCode],1
exitProcess k2ExitCode
][/code]
Post 29 May 2007, 12:44
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 29 May 2007, 13:31
well... where is the problem? The symbol "_cat" is not defined. Exactly what error message says.
Post 29 May 2007, 13:31
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rkamarowski



Joined: 21 May 2007
Posts: 15
Location: Gainesville, Florida
rkamarowski 29 May 2007, 13:35
talk about obvious! that was it. my apologies for not being more thorough. sometimes i can't see the forest for the trees...

bob k.
Post 29 May 2007, 13:35
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.