flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > only xor, only add and only sub

Author
Thread Post new topic Reply to topic
uri



Joined: 09 Apr 2004
Posts: 43
Location: L'viv, Ukraine
uri 19 Aug 2005, 09:45
Look at this 3 different but identical programs:
Code:
org     100h
ptr     fix     ; for fasm
xor     word ptr [0106h],6530h
xor     byte ptr [bp-33h],10h
xor     word ptr [0110h],13F0h
xor     al,04
xor     word ptr [0118h],0AF89h
xor     sp,[bp+03]
xor     word ptr [0127h],1F13h
xor     word ptr [011Bh],3C6Ah
xor     cl,0EEh
xor     word ptr [0136h],54A7h
xor     word ptr [012Ah],3C6Ah
xor     al,0BAh
xor     word ptr [0144h],44C3h
xor     word ptr [0138h],3C6Ah
xor     word ptr [bx+di],0FFD4h
xor     word ptr [0153h],0BB90h
xor     word ptr [0147h],3C6Ah
xor     word ptr [bp+di-56h],0EFE2h
xor     word ptr [0164h],7E73h
xor     word ptr [0158h],3C6Ah
xor     bp,[01B4h]
xor     word ptr [0174h],644Ch
xor     word ptr [0168h],3C6Ah
xor     word ptr [bp+si+58h],0CE74h
xor     word ptr [0185h],5EF9h
xor     word ptr [0179h],3C6Ah
xor     al,7Eh
    

Code:
org     100h
ptr     fix     ; for fasm
add     word ptr [0106h],05AEh
add     cl,[10CDh]
add     word ptr [0110h],7BC0h
add     al,9Ch
add     word ptr [0118h],4EB8h
add     bh,[bp+di+3]
add     word ptr [0127h],0EB8Eh
add     word ptr [011Bh],046Ah
add     ax,0EE03h
add     word ptr [0136h],0DA8Fh
add     word ptr [012Ah],046Ah
add     al,14h
add     word ptr [0144h],0B4BDh
add     word ptr [0138h],046Ah
add     ax,0FFD4h
add     word ptr [0153h],0C191h
add     word ptr [0147h],046Ah
add     byte ptr [0E2AAh],0EFh
add     word ptr [0164h],1A3Dh
add     word ptr [0158h],046Ah
add     si,[01B4h]
add     word ptr [0174h],8F4Ah
add     word ptr [0168h],046Ah
add     word ptr [bx+7458h],0FFCEh
add     word ptr [0185h],24C9h
add     word ptr [0179h],046Ah
add     al,0FCh
    

Code:
org     100h
ptr     fix     ; for fasm
sub     word ptr [0106h],2A79h
sub     [10CDh],di
sub     word ptr [0110h],0A268h
sub     al,0BAh
sub     word ptr [0118h],8873h
sub     ax,0352h
sub     word ptr [0127h],149Ah
sub     word ptr [011Bh],2396h
sub     ax,0EE03h
sub     word ptr [0136h],0B599h
sub     word ptr [012Ah],2396h
sub     al,0A4h
sub     word ptr [0144h],0CEEBh
sub     word ptr [0138h],2396h
sub     ax,[si-2Ch]
sub     word ptr [0153h],6672h
sub     word ptr [0147h],2396h
sub     word ptr [0E2AAh],0FFEFh
sub     word ptr [0164h],3DE9h
sub     word ptr [0158h],2396h
sub     [bp+01B4h],cx
sub     word ptr [0174h],97B3h
sub     word ptr [0168h],2396h
sub     byte ptr [bp+7458h],0CEh
sub     word ptr [0185h],155Fh
sub     word ptr [0179h],2396h
sub     al,36h
    


Do you ou like it?
Files for creating code, which contains only xor, only add or only sub commands(random.inc, xor.inc) and examples (add.asm, sub.asm, xor.asm, effect.asm), are in an attach.

    comments:
  • convert from normal code to encoded does macro @,
  • macro set_stub_cmd sets the needed command (currently only xor, add, sub),
  • variable do_reenterant must be set in 1, if you want to execute next code more than 1, else it must be set to 0 (for avoid unnecessary code)
  • macro @ requires arguments with total size from 2 to 6 bytes,
  • if you use command to change flags and command to analyze this flags - they must be in one @ macro, because between different @ macroses flags are destroyed,


be careful, this macro is beta and must have bugs.
if you have questions - post it here. i'll try to write article about it, but don't sure that it can be done.
thanks.


Description: add.asm, sub.asm xor.asm - programs.
effect.asm - common part of this programs.
random.inc - randomizer.
xor.inc - main macroses.

Download
Filename: xor.rar
Filesize: 2.29 KB
Downloaded: 502 Time(s)

Post 19 Aug 2005, 09:45
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 602
Location: Germany
MCD 19 Aug 2005, 12:50
Hi uri

maybe this old post of mine may inspire you: http://board.flatassembler.net/topic.php?t=2749
have fun
Post 19 Aug 2005, 12:50
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 19 Aug 2005, 20:52
uri: Amazing idea! I checked it, but it unfortunately didn't work, probably because I used it with PE and you created these macroses for dos. But if you ever make win version please post it, I'd love to have such macroses. Great job!
Post 19 Aug 2005, 20:52
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 22 Aug 2005, 21:07
funny idea Smile FASMs macrosystem is really good source for humor. by the way there's no reason for specific "add" and "sub" it's same, you just invert one bit and constant.
Post 22 Aug 2005, 21:07
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
uri



Joined: 09 Apr 2004
Posts: 43
Location: L'viv, Ukraine
uri 23 Aug 2005, 09:02
vid wrote:
funny idea Smile no reason for specific "add" and "sub" it's same, you just invert one bit and constant.

Yes, but then you will have 2 different programs (xor and add), and i'm have 3 different (+sub) Smile

In realy macros is universal for xor and add and sub, and i'm not sure to add more logic to invert sign bit.
If i will have a time - i'll add more commands.
Post 23 Aug 2005, 09:02
View user's profile Send private message Visit poster's website ICQ Number 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.