flat assembler
Message board for the users of flat assembler.

Index > Windows > Procedures vs. Macros

Author
Thread Post new topic Reply to topic
log(21



Joined: 09 Jun 2006
Posts: 6
log(21 09 Jun 2006, 22:46
I am working on writing an operating system in fasm. However, the kernal has grown quite large and I have a way to shrink it down. I have used macroinstructions for most of the system, and because of this, it has become quite bulky. I want to be able to convert them to procedures to save space, but it doesn't seem to be working the same way as other assemblers such as MASM. Could someone post some example code on how to write a procedure in FASM with arguments passed to it?
Post 09 Jun 2006, 22:46
View user's profile Send private message Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost 11 Jun 2006, 00:41
with macros

Code:
include 'PROC32.INC'

proc name param1, param2
        mov eax, <return value>
        ret
endp
    


i believe fasm supports MASM style procdures now such as

Code:
name:BYTE/:DWORD etc
    


or you can do it manually

Code:
param1 equ ebp+8 ;delcare variable one way
name:
    label param1 DWORD at ebp+8 ;delcare variable another way
    push ebp
    mov ebp, esp

    mov [param1], <value>

    mov esp, ebp
    pop ebp

    mov eax, <return value>
    ret
    

_________________
redghost.ca
Post 11 Jun 2006, 00:41
View user's profile Send private message AIM Address MSN Messenger 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.