Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Do auto-assembler scripts support define-like macros?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
AJarOfLube
Newbie cheater
Reputation: 0

Joined: 30 Dec 2015
Posts: 12

PostPosted: Sun Jan 03, 2016 6:41 pm    Post subject: Do auto-assembler scripts support define-like macros? Reply with quote

I'm looking for something similar to
Code:
#define something(param1, param2)
in C

For example, to push an integer value onto the FPU stack, you need code that looks something like this:

Code:
push 1500
fild [esp]
add esp, 4


I've been copying+pasting that a lot. It would be nice to be able to just write something like

Code:
PUSH_FPU(1500)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 150

Joined: 06 Jul 2014
Posts: 4654

PostPosted: Sun Jan 03, 2016 8:20 pm    Post subject: Reply with quote

You can use define(name,whatever) to replace "name" with "whatever". You can't pass parameters to it AFAIK, so you'll still have to push it onto the stack.
Also, in CE, you can specify you're declaring an imm32 as a float by writing (float) before the number, so you can easily use fld instead of fild.

Example:
Code:
define(MOVE_FPU,db D9 04 24 83 C4 04) // fld dword ptr [esp] ; add esp,4

newmem:
  ...
  push (float)1500
  MOVE_FPU
  ...

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
AJarOfLube
Newbie cheater
Reputation: 0

Joined: 30 Dec 2015
Posts: 12

PostPosted: Sun Jan 03, 2016 11:04 pm    Post subject: Reply with quote

Well that's... disappointing. Most other assemblers support macros - why doesn't CE use one of them to compile its scripts?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Jan 04, 2016 12:29 am    Post subject: Reply with quote

Not exactly clean... but it works!
Code:
{$lua}
local macro=[[
  push 1500
  fild [esp]
  add esp,4
]]
{$asm}

[ENABLE]
alloc(newmem,$1000)
newmem:
{$lua}
return macro
{$asm}
registersymbol(newmem)

[DISABLE]
dealloc(newmem)
unregistersymbol(newmem)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites