-
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.
Merge pull request #16 from yaacov/add-nop-and-arg-length-table
Add NOP command and a list for command lengths
- Loading branch information
Showing
7 changed files
with
94 additions
and
57 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
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
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
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,26 +1,53 @@ | ||
const opcodes = { | ||
LOADA: 0x00, | ||
LOADB: 0x01, | ||
STOREA: 0x02, | ||
STOREB: 0x03, | ||
ORA: 0x04, | ||
ORB: 0x05, | ||
ANDA: 0x06, | ||
ANDB: 0x07, | ||
XORA: 0x08, | ||
XORB: 0x09, | ||
NOTA: 0x0A, | ||
NOTB: 0x0B, | ||
SHLA: 0x0C, | ||
SHLB: 0x0D, | ||
SHRA: 0x0E, | ||
SHRB: 0x0F, | ||
JUMP: 0x10, | ||
JZA: 0x11, | ||
JZB: 0x12, | ||
ADDA: 0x13, | ||
ADDB: 0x14, | ||
export const opcodes = { | ||
NOP: 0x00, | ||
LOADA: 0x01, | ||
LOADB: 0x02, | ||
STOREA: 0x03, | ||
STOREB: 0x04, | ||
ORA: 0x05, | ||
ORB: 0x06, | ||
ANDA: 0x07, | ||
ANDB: 0x08, | ||
XORA: 0x09, | ||
XORB: 0x0A, | ||
NOTA: 0x0B, | ||
NOTB: 0x0C, | ||
SHLA: 0x0D, | ||
SHLB: 0x0E, | ||
SHRA: 0x0F, | ||
SHRB: 0x10, | ||
JUMP: 0x11, | ||
JZA: 0x12, | ||
JZB: 0x13, | ||
ADDA: 0x14, | ||
ADDB: 0x15, | ||
END: 0xFF, | ||
}; | ||
|
||
export const opcodesParams = { | ||
[opcodes.NOP]: 0, | ||
[opcodes.LOADA]: 1, | ||
[opcodes.LOADB]: 1, | ||
[opcodes.STOREA]: 1, | ||
[opcodes.STOREB]: 1, | ||
[opcodes.ORA]: 1, | ||
[opcodes.ORB]: 1, | ||
[opcodes.ANDA]: 1, | ||
[opcodes.ANDB]: 1, | ||
[opcodes.XORA]: 1, | ||
[opcodes.XORB]: 1, | ||
[opcodes.NOTA]: 0, | ||
[opcodes.NOTB]: 0, | ||
[opcodes.SHLA]: 1, | ||
[opcodes.SHLB]: 2, | ||
[opcodes.SHRA]: 1, | ||
[opcodes.SHRB]: 1, | ||
[opcodes.JUMP]: 1, | ||
[opcodes.JZA]: 1, | ||
[opcodes.JZB]: 1, | ||
[opcodes.ADDA]: 1, | ||
[opcodes.ADDB]: 1, | ||
[opcodes.END]: 0, | ||
}; | ||
|
||
export default opcodes; |
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