LALU-Assembler
所属分类:硬件设计
开发工具:Java
文件大小:2222KB
下载次数:0
上传日期:2015-12-21 22:49:03
上 传 者:
sh-1993
说明: 我在数字电子课程中构建的处理器的汇编程序
(An assembler for a processor I am building in my Digital Electronics class)
文件列表:
.idea (0, 2015-12-22)
.idea\.name (15, 2015-12-22)
.idea\compiler.xml (686, 2015-12-22)
.idea\copyright (0, 2015-12-22)
.idea\copyright\profiles_settings.xml (74, 2015-12-22)
.idea\encodings.xml (159, 2015-12-22)
.idea\gradle.xml (890, 2015-12-22)
.idea\libraries (0, 2015-12-22)
.idea\libraries\Gradle__junit_junit_4_11.xml (481, 2015-12-22)
.idea\libraries\Gradle__org_hamcrest_hamcrest_core_1_3.xml (537, 2015-12-22)
.idea\misc.xml (1291, 2015-12-22)
.idea\modules.xml (425, 2015-12-22)
.idea\uiDesigner.xml (8792, 2015-12-22)
.idea\workspace.xml (57630, 2015-12-22)
LALU_Assembler_v3.2.jar (2386046, 2015-12-22)
LICENSE (35146, 2015-12-22)
build.gradle (728, 2015-12-22)
gradle (0, 2015-12-22)
gradle\wrapper (0, 2015-12-22)
gradle\wrapper\gradle-wrapper.jar (52271, 2015-12-22)
gradle\wrapper\gradle-wrapper.properties (230, 2015-12-22)
gradlew (5080, 2015-12-22)
gradlew.bat (2404, 2015-12-22)
settings.gradle (37, 2015-12-22)
src (0, 2015-12-22)
src\main (0, 2015-12-22)
src\main\antlr (0, 2015-12-22)
src\main\antlr\com (0, 2015-12-22)
src\main\antlr\com\github (0, 2015-12-22)
src\main\antlr\com\github\charmoniumq (0, 2015-12-22)
src\main\antlr\com\github\charmoniumq\assembler (0, 2015-12-22)
src\main\antlr\com\github\charmoniumq\assembler\grammar (0, 2015-12-22)
src\main\antlr\com\github\charmoniumq\assembler\grammar\Main.g4 (2887, 2015-12-22)
src\main\java (0, 2015-12-22)
src\main\java\com (0, 2015-12-22)
src\main\java\com\github (0, 2015-12-22)
src\main\java\com\github\charmoniumq (0, 2015-12-22)
... ...
LALU Assembler
==============
"A simple assembler for a simple processor."
##### Labels:
Writing the @ symbol lets you 'name' the next address in program memory. A label can be used in place of any 5-bit address.
@abc // stores the address of the next command
add
sub
jmp @abc // goes back to the 'add' statement
##### Pointers:
Writing the * symbol lets you 'name' an address in data memory. A pointer can be used in place of any 4-bit address.
*idx = 0101
st *idx // stores A to 0101
##### Bases:
You can enter any number as a binary, decimal, or hexidecimal. All of the following lines do the same thing (set the pointer `*idx` to `0100`). The assembler deduces the number of bits that the number should take up.
*idx = 0b100 // 0b in front means binary
*idx = 0b0100 // any number of leading zeros
*idx = 100 // (no modifier means binary)
*idx = 0d4 // 0d for decimal
*idx = 0x4 // 0x for hexidecimal
##### Literal command:
If your implementation has extra non-standard commands, good for you! You can still use the assembler if you encode your special commands as literals. When the assmbler comes to a literal number , it translates that number into binary literally. For example:
This
add
sub
0b11110001
0xAD
51
add
sub
Compiles to
00 01 F1 AD 00 01
since 11110001 base 2 is F1 base 16.
##### Comments:
Java-style comments are ignored (both line-comments and block-comments).
add // This is a comment
sub /*
this is a comment
so is this
*/
ld 100 // /*
(notably) this is a comment
*/
##### Commands:
- add (0000)
- sub (0001)
- ld (0010) takes one 4-bit address
- xchg (0011)
- st (0100) takes one 4-bit address
- jmp (101) takes one 5-bit address
- djmp ("delayed jump") is an alias for jmp
- jmpn (110) takes one 5-bit address
- djmpn ("delayed jump if negative") is an alias for jmpn
- loada (0111)
- sta (1000)
- incr (1001)
- nop (1000)
##### Whitespace ignorant:
This
add sub
ld
1000
st1000
is equivalent to this
add
sub
ld 1000
st 1000
##### Errors:
Error messages look really nice with line number and the error line with the offending token underlined. Hopefully you won't have to see them. :)
##### CMD mode:
Execute the program normally (with no arguments) to enter GUI mode as usual.
To use CMD mode, add the argument `cmd` to the program. It reads source from stdin, outputs the assembled binary to stdout, and outputs errors to stderr. Run this from the prompt to compile test.asm to tset.out: `java -jar LALU_Assembler_v*.jar cmd < test.asm > test.out`.
近期下载者:
相关文件:
收藏者: