flat assembler
Message board for the users of flat assembler.

Index > Main > Solved: Putting label addresses in a table?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20462
Location: In your JS exploiting you and your system
revolution 20 Feb 2008, 16:20
bitRAKE wrote:
revolution wrote:
Hehe, bitRAKE: the align 8 will probably cost more than you save by using db.
It worked for me.
db saves one byte over dw, guaranteed. align 8, on average, will cost 4 bytes for randomly aligned code. So, overall you lose 3 bytes per function. Normally this won't matter a toss but since the idea was to save bytes then it kinda defeats the purpose, yeah.
Post 20 Feb 2008, 16:20
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4082
Location: vpcmpistri
bitRAKE 20 Feb 2008, 16:44
I've never coded in a random manner - how does that work for you?

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 20 Feb 2008, 16:44
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20462
Location: In your JS exploiting you and your system
revolution 20 Feb 2008, 16:51
bitRAKE wrote:
I've never coded in a random manner - how does that work for you?
My code is extremely random. Haven't you noticed?
Post 20 Feb 2008, 16:51
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4082
Location: vpcmpistri
bitRAKE 20 Feb 2008, 17:31
revolution wrote:
My code is extremely random. Haven't you noticed?
Nah, I haven't seen it, but if you say random then I'll take your word for.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 20 Feb 2008, 17:31
View user's profile Send private message Visit poster's website Reply with quote
daniel.lewis



Joined: 28 Jan 2008
Posts: 92
daniel.lewis 21 Feb 2008, 07:34
As odd as it sounds, I'm putting alot of thought into this particular part of my code - because the lexer will do it for every last byte of the source file during runtime.

I like this, it answers my original question. : )
Quote:

Table1:
rept 4 count:0 ;start count from 0, 4 labels
{ dw Label#count-Label0 } ;dw Label0-Label0, Label2-Label1,Label3-Label1 etc..


I'm now thinking to use lodsb + xlatb to pull the offset. I know there are register stalls in there, but I'm more worried about cache misses and fitting it tight. Once I have it working at all, the next stage will be to write the reverse-lexer to scan it from both ends on multiprocessors for double the speed.

strings, arrays, expressions, multi-line comments, whitespace and parens can share code between the forward and reverse lexers.

Am I crazy?
Post 21 Feb 2008, 07:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20462
Location: In your JS exploiting you and your system
revolution 21 Feb 2008, 07:49
Post 21 Feb 2008, 07:49
View user's profile Send private message Visit poster's website Reply with quote
daniel.lewis



Joined: 28 Jan 2008
Posts: 92
daniel.lewis 21 Feb 2008, 23:58
Confused Yeah, I don't take advice so much. I'm too high on my royal horse. But I will read the article, so thanks. Smile

In my not-so-humble opinion there are major code structure differences between the different ways of doing it so that the written code of one doesn't resemble the other mooting the point of writing anything but the correct solution.

Quote:

Update:
I read the article. There are already 12 ECMAScript interpreters, including mine. They say that after you pee, tugging 3 times is just to clean the pipes but after that it's masturbation.

If I'm going to write another ECMAScript engine, it had better be because I'm going to do it vastly better than previous attempts.


I've already implemented working lexer/parsers, so while I'm still pretty rookie with optimizing assembler this is about reinventing the wheel round. There's no point in doing it if the wheel's a hexagon or square like the last one.

So far I have a 72-byte algorithm and a 256-byte jump table that consumes any amount of lines and whitespace
correctly - which to me means I just need to add and test handler cases for each of the remaining tokens before I want to profile and bench the lexical analysis to see what's up.

To get the second processor running the source backwards, I simply do this:

- std for only that processor.
- give it a different table where most of the offsets are the same, but some are different. Make sure each table is only loaded on it's processor's cache.
- provide handler cases for tokens that aren't penundromes (sp?) like line comments, flow control structures, and a reverser for identifiers before using the normal means for that.[/quote]

_________________
dd 0x90909090 ; problem solved.
Post 21 Feb 2008, 23:58
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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.