-
Notifications
You must be signed in to change notification settings - Fork 1
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
9eed3d0
commit 74d1fb8
Showing
6 changed files
with
144 additions
and
40 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef ASM_CMD | ||
#error "macro ASM_CMD was not defined" | ||
#endif | ||
|
||
#define _ , | ||
|
||
ASM_CMD(NOP, 0x00, {.arg_count = 0 _ .arg_list = {}}) | ||
|
||
ASM_CMD(ADD, 0x01, {.arg_count = 0 _ .arg_list = {}}) | ||
|
||
ASM_CMD(INC, 0x02, {.arg_count = 0 _ .arg_list = {}}) | ||
|
||
ASM_CMD(SUB, 0x03, {.arg_count = 0 _ .arg_list = {}}) | ||
|
||
ASM_CMD(DEC, 0x04, {.arg_count = 0 _ .arg_list = {}}) | ||
|
||
ASM_CMD(MUL, 0x05, {.arg_count = 0 _ .arg_list = {}}) | ||
|
||
ASM_CMD(DIV, 0x06, {.arg_count = 0 _ .arg_list = {}}) | ||
|
||
ASM_CMD(PUSH,0x07, {.arg_count = 1 _ .arg_list = {{.perms = ARG_RD}}}) | ||
|
||
ASM_CMD(POP, 0x08, {.arg_count = 0 _ .arg_list = {}}) | ||
|
||
ASM_CMD(HALT,0x09, {.arg_count = 0 _ .arg_list = {}}) | ||
|
||
#undef _ |
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
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,9 +1,9 @@ | ||
1: push 50 7 50 | ||
2: push 30 7 30 | ||
3: sub 3 | ||
4: push 5 7 5 | ||
5: push 3 7 3 | ||
6: sub 3 | ||
7: div 6 | ||
8: pop 8 | ||
9: halt 9 | ||
[000000] 0x0007 0x0032 | push 50 | ||
[0x0002] 0x0007 0x001e | push 30 | ||
[0x0004] 0x0003 | sub | ||
[0x0005] 0x0007 0x0005 | push 5 | ||
[0x0007] 0x0007 0x0003 | push 3 | ||
[0x0009] 0x0003 | sub | ||
[0x000a] 0x0006 | div | ||
[0x000b] 0x0008 | pop | ||
[0x000c] 0x0009 | halt |
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
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