2018-12-06 09:59:06 +01:00
|
|
|
:dword std_print(dword count, args)
|
2018-12-04 23:34:36 +01:00
|
|
|
{
|
2018-12-06 09:59:06 +01:00
|
|
|
consoleInit();
|
|
|
|
WHILE(count)
|
2018-12-04 23:34:36 +01:00
|
|
|
{
|
|
|
|
con_printf stdcall (DSDWORD[args]);
|
2018-12-06 09:59:06 +01:00
|
|
|
args+=4;
|
|
|
|
count--;
|
2018-12-04 23:34:36 +01:00
|
|
|
}
|
2018-12-06 09:59:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
:dword std_str(dword count, args)
|
|
|
|
{
|
|
|
|
dword tmp = 0;
|
|
|
|
tmp = malloc(15);
|
|
|
|
itoa_(tmp,DSDWORD[args]);
|
|
|
|
RETURN tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
:dword std_add(dword count, args)
|
|
|
|
{
|
|
|
|
dword ret = 0;
|
|
|
|
WHILE(count)
|
2018-12-04 23:34:36 +01:00
|
|
|
{
|
2018-12-06 09:59:06 +01:00
|
|
|
ret += DSDWORD[args];
|
|
|
|
args+=4;
|
|
|
|
count--;
|
2018-12-04 23:34:36 +01:00
|
|
|
}
|
2018-12-06 09:59:06 +01:00
|
|
|
RETURN ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
:dword std_sub(dword count, args)
|
|
|
|
{
|
|
|
|
dword ret = 0;
|
|
|
|
IF(count)
|
|
|
|
{
|
|
|
|
ret = DSDWORD[args];
|
|
|
|
count--;
|
|
|
|
args+=4;
|
2018-12-04 23:34:36 +01:00
|
|
|
}
|
2018-12-06 09:59:06 +01:00
|
|
|
WHILE(count)
|
2018-12-04 23:34:36 +01:00
|
|
|
{
|
2018-12-06 09:59:06 +01:00
|
|
|
ret -= DSDWORD[args];
|
|
|
|
args+=4;
|
|
|
|
count--;
|
2018-12-04 23:34:36 +01:00
|
|
|
}
|
2018-12-06 09:59:06 +01:00
|
|
|
RETURN ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
functions.init(100);
|
|
|
|
|
|
|
|
/* Console functions */
|
|
|
|
functions.set("print", #std_print);
|
|
|
|
|
|
|
|
/* String functions */
|
|
|
|
functions.set("str", #std_str);
|
|
|
|
|
|
|
|
/* System functions */
|
|
|
|
functions.set("exit", #ExitProcess);
|
|
|
|
|
|
|
|
/* Math functions */
|
|
|
|
functions.set("+", #std_add);
|
|
|
|
functions.set("-", #std_sub);
|
|
|
|
|
|
|
|
variables.init(100);
|
|
|
|
}
|
|
|
|
|
|
|
|
dword StdCall(dword count, name, args)
|
|
|
|
{
|
|
|
|
dword tmp = 0;
|
|
|
|
functions.get(name);
|
|
|
|
IF(EAX)RETURN EAX(count, args);
|
|
|
|
RETURN 0;
|
2018-12-04 23:34:36 +01:00
|
|
|
}
|