-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7b31bc
commit e18b5f7
Showing
1 changed file
with
31 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,47 @@ | ||
int test(int a, int b, int c, int d, int e); | ||
#define SYS(__sysn) ((((__sysn) + 0x20) << 10) | (2 << 4)) | ||
|
||
typedef (*funcCall)(); | ||
unsigned short sys1_value[] = {0x01a1, SYS(2), 0x61c1}; | ||
#define dputs(__str) ((void (*)(const char*))sys1_value)(__str) | ||
|
||
struct program { | ||
int state; | ||
int foo; | ||
} program; | ||
|
||
int test(struct program *p); | ||
void printResult(int a); | ||
|
||
short array = {0x61c1}; | ||
|
||
int main() | ||
{ | ||
((funcCall)array)(); | ||
program.state = 3; | ||
program.foo = 4; | ||
|
||
int ret = test(&program); | ||
|
||
printResult(ret); | ||
|
||
int some_var = 3; | ||
ret = foo(6); | ||
|
||
int ret = test(1, 2, 3, 4, 5); | ||
printResult(ret); | ||
|
||
return some_var + ret; | ||
return foo(ret); | ||
} | ||
|
||
int foo(int a) | ||
{ | ||
return 9 + a; | ||
return a - 4; | ||
} | ||
|
||
int test(int a, int b, int c, int d, int e) | ||
int test(struct program *p) | ||
{ | ||
a = foo(a); | ||
return ((a + b + c) * d / a) + (d * e); | ||
return p->state + p->foo; | ||
} | ||
|
||
void printResult(int a) | ||
{ | ||
static char string[] = "result is 0\n\0"; | ||
|
||
string[10] = '0' + a; | ||
dputs(string); | ||
} |