Welcome, Guest. Please login or register.

Author Topic: funcdef macro in phxass?  (Read 7607 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: funcdef macro in phxass?
« on: November 26, 2003, 10:29:56 PM »
Dont waste your chuff dude :-) I think the asm you are using is using macro stuff not to PhxAss liking.

However, I dunno if this may help, but I have written asm (for use in C and C++ both) with PhxAss

A function definition in C compatible format is a label with a underscore prefix like so:

_

Now, in PhxAss, to make this externally visible (ie resolvable by the linker), you XREF it thus

    XREF _MyFunction

_MyFunction
    ; do stuff here
    ;...
    rts

Hope this helps...
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: funcdef macro in phxass?
« Reply #1 on: November 26, 2003, 10:37:24 PM »
At a rough guess the macro is maybe to do something like this:

    MACRO FUNCDEF
    XDEF _\1
    ENDM

What that would do is to simply generate

    XDEF _FunctionName

which is basically importing a name from outside the source, just as XDEF makes a name in the source externally visible.

But I am just guessing. All my asm stuff is optimising my own inner functions that virtually never use OS calls anyway...

-edit-

Heh, I should have read your first post more closely, the FUNCDEF macro is there.

I was close... :lol:

Anyway, the problem is no doubt with the SET directive. PhxAss uses the following instead

EQU

You could, as an experiment, before your include lines add the following

    MACRO SET
1\  EQU  \2
    ENDM

might work...
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: funcdef macro in phxass?
« Reply #2 on: November 26, 2003, 11:02:35 PM »
What we need is Frank Willie to step in, give us a big fat slap and then say "You do it like this.."

Incidentally, I don't wish to be the harbringer of doom but are you quite sure that even if you do assemble these sources ok that the object format exported by PhxAss will be linkable with gcc?

I've never actually tried...
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: funcdef macro in phxass?
« Reply #3 on: November 27, 2003, 01:46:04 AM »
That is pretty odd.

Which macro do you mean? The SET one? Using EQU to equate a name with a value is pretty normal and I can verify it works in PhxAss here - I use it all the time.

As it goes, the FUNCDEF one I was guessing the nature of was wrong anyway (your first post has its actual definition) - I was close but forgot about the LVO naming thing used by amiga shared libs.

The XDEF _FuncName thing is pretty standard for normal C accessible function name definitions tho.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: funcdef macro in phxass?
« Reply #4 on: November 27, 2003, 01:58:43 AM »
things to note

Directives like MACRO / ENDM / EQU / XDEF etc need to be indented by at least 1 tab space to be recognised as directives by the assembler.

ie

MACRO SET
\1EQU \2
ENDM

If the directive is not tabbed, the assembler assumes its a label name instead. All kinds of arcane crapness can occur then...
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: funcdef macro in phxass?
« Reply #5 on: November 27, 2003, 02:18:08 AM »
Most likely SET is already an alternative for EQU then.

-edit-

Do you have the PhxAss docs by the way? The guide explains all the syntax and directive stuff in there somewhere.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: funcdef macro in phxass?
« Reply #6 on: November 28, 2003, 06:21:34 AM »
Blimey dude, this thing really is doing it's level best to get on yer tits by the sound of it :-(
int p; // A