I was wondering maybe if someone could either point me in the right direction or perhaps show me a little code.. I'm currently involved in writing the backend for a compiler. As things stand now the code is in an intermediate assembler form which I have access to.

Before I actually try to write assembler code based on this pesudo-code, I thought I should take some time to make some generalized procedures, etc. I thought I'd start off with something really simple (a print string procedure) but for the life of me I can't get it to work.

Is there something about proc and parameters that I just don't get conceptually? Perhaps I have spent too much time in HLL but it seems to me something like this should work:


proc __sd_echo, arg
enter
mov edx, arg
mov ah, 9
int 21h
return

But it doesn't... What is happening internally when I use the proc macro? I don't really understand the macrolanguage well yet so looking at the source for it is a bit confusing to me. Also, I saw in the archives someone said to remove 'enter', but if I do that FASM won't assemble..


Hopefully someone can help me learn this stuff...

:stupid:

Coogle
Posted on 2003-02-21 18:25:22 by coogle
Try this:

proc __sd_echo, arg
enter
mov edx,
mov ah, 9
int 21h
return

That should work. You have to include the [ and the ] for the arguments.
Posted on 2003-02-21 18:44:21 by CyberGuy
:confused: still having problems... here's the related code:

segment __sterdick_script_dseg

foo db "asdf",24h


segment __sterdick_helpers

proc __sd_echo, arg
enter
mov edx,
mov ah, 9
int 21h
return

segment __sterdick_script_main

__start_script:
mov ax,__sterdick_script_dseg
mov ds, ax
mov edx, foo
stdcall __sd_echo, edx
retf


Coogle
Posted on 2003-02-21 19:26:36 by coogle
If you're having so many problems you could just simplify it to a macro:

macro __sd_echo arg
{
mov edx,
mov ah, 9
int 21h
}
Posted on 2003-02-27 17:53:58 by CyberGuy