flat assembler
Message board for the users of flat assembler.

Index > Main > Add "sar" and "size-reporting" operators

Author
Thread Post new topic Reply to topic
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
These improvements are a bit more complex than all others I've yet proposed/done.

You could add a "sar" operator which works like the ASM instruction. I've no idea how to do this although this should not be to difficult if somewhen Privalov would finish his "Guide to Fasm internals".

But more the "size reporting"-operand is the feature I currently miss the most.
I have some macros which should work differently depending on the size of an operand. Although you can compare registers like "AL" and "AX" directly to define the size and you can compare numbers by their value to get the right size,

there is no way (I think so) to define the size of a memory operand passed to a macro. "eqtype" does not go.

Any idea?

Should I open a poll?

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||
Post 22 Sep 2004, 18:37
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7796
Location: Kraków, Poland
Tomasz Grysztar
There is a trick that allows to do it in macro, a bit complicated though, here a sample for 32-bit mode:
Code:
if arg eqtype [0]
 virtual at 0
  inc arg
  load opcode byte from 0
 end virtual
 if opcode = 0FEh
  display 'byte variable'
 else if opcode = 0FFh
  display 'dword variable'
 else if opcode = 66h
  display 'word variable'
 end if
end if    

Also with similar trick you can whether the 32-bit or 16-bit mode is used and adjust the tests.
Post 22 Sep 2004, 22:14
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
Yes, this works, but looks a bit provisory. Perhaps I should write something for myself when the "Guide to Fasm internals" gets finished.

Do you remeber, once, we fasm-people also used macros for alignments lol:
Post 14 Oct 2004, 17:51
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
Privalov, what about rol and ror?
Post 14 Oct 2004, 19:10
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
Rol and ror would be nice to, and not to difficult to implement. (GFI)

It is only a matter of concept: you could add lots and lots and lots of operators, but this will be a waste of time/code size, since you won't probably use all. So here are some usefull operators you probably won't use any time soon:

trn: reverses bit pattern
chksum: calculates bitwize checksum
ibs/xbs: insert/extract bit string
rcl/rcr: rotate with 2^n + 1 bits (9,17,33...)

... many many others.

I think, not every operator should be implemented directly, since this causes the code to become messy.
Post 14 Oct 2004, 21:26
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
i.e. you would mess up rcl/rcr with rotations through carry Sad
r2l/r2r gives you a hint maybe that its using 2^n (maybe rnl/rnr)
Post 15 Oct 2004, 09:49
View user's profile Send private message Visit poster's website Yahoo Messenger 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.