flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > How to assemble jumps and procedures

Author
Thread Post new topic Reply to topic
viraj2005



Joined: 16 Jan 2008
Posts: 2
Location: Sri Lanka
viraj2005 16 Jan 2008, 05:20
Hi All,

This is my first time in the FASM forum.

Recently I have started to build an OO compiler. I want to build my own assembler for it, I know the basics of assembler development. But I dont know how to assemble jumps and procedures.

Can any one advise me how to implement jumps and procedures.

thanks

Viraj

_________________
Viraj Siriwardana
Post 16 Jan 2008, 05:20
View user's profile Send private message Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7103
Location: Slovakia
vid 16 Jan 2008, 05:25
my advice would be to use FASM as backend compiler, if you don't know how to do this.
Post 16 Jan 2008, 05:25
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
viraj2005



Joined: 16 Jan 2008
Posts: 2
Location: Sri Lanka
viraj2005 16 Jan 2008, 05:31
Hi Vid,

thanks for the reply.
I really wants to build my own assembler cos it is my final year project.

Rgds,

Viraj
Post 16 Jan 2008, 05:31
View user's profile Send private message Yahoo Messenger MSN Messenger Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1904
DOS386 16 Jan 2008, 10:52
.

> Recently I have started to build an OO compiler. I want to build my own assembler

> really wants to build my own assembler cos it is my final year project.

Isn't the OO compiler itself hard enough ? Confused

> But I dont know how to assemble jumps and procedures.

1. CPU has no procedures. "proc" in MASM is just a sub, with some odd extra stuff processed/added by the assembler (stack frame, "local" stuff, parameter counting/checking ?).

2. Jumps: you need at least 2 passes.
- 1st pass place all labels into a table, compile back jumps but leave forward jumps open (assume "near")
- 2nd pass fill the forward jumps from table
This works but is suboptimal ... FASM does more than 2 passes and is better.

And YES, you should focus on your "OO" and just use FASM.

_________________
Bug Nr.: 12345

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

Status: Closed: NOT a Bug
Post 16 Jan 2008, 10:52
View user's profile Send private message Reply with quote
System86



Joined: 15 Aug 2007
Posts: 77
System86 16 Jan 2008, 23:38
Quote:

But I dont know how to assemble jumps and procedures.


When compiling to asm for the fasm backend, use jmp for jumps and call for procedures (as for these, you can create a stack frame using the enter/leave instructions or by modifying esp, the CPU won't do if for you).
Post 16 Jan 2008, 23:38
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.