paperfanz / laser Goto Github PK
View Code? Open in Web Editor NEWAn LC3 assembler created over winter break to practice C.
License: GNU General Public License v3.0
An LC3 assembler created over winter break to practice C.
License: GNU General Public License v3.0
I am using the LC-3 Edit and LC-3 Simulate (runtime) from McGraw-Hill. I can assemble using laser, then run in Simulate. The .obj file excutes as expected, but Simlate appears to not understand the .lst file format
The effect is that the Simulate tool does not display the labels
I've just tried assembling a very simple program against v2.0.1. on Windows, but i'm not getting the object code written for the PUTs instruction - see source code below:
.ORIG x3000 ; this is the address in memory where the program will be loaded
LEA R0, HELLO_STR ; load the address of the HELLO_STR string into R0
PUTs ; output the string pointed to by R0 to the console
HALT ; halt the program
HELLO_STR .STRINGZ "Hello World!" ; store this string here in the program
.END ; mark the end of the file
No errors/warnings were reported by the assembly process.
The output produces the following hex:
3000
E001
F025
0048
0065
006C
006C
006F
0020
0057
006F
0072
006C
0064
0021
0000
You can see the HALT (Trap code F025) immediately after the LEA (E001) instruction. Looks like we've skipped an instruction somehow ? Any chance you could take a look ?
Fantastic work btw - I've installed both the assembler and VS Code extensions - really nice !
When trying to assemble a file with a syntax error, laser segfaults, sometimes on the first pass, sometimes on the second pass.
Note: I compiled with gcc, not clang.
When a file fails to assemble on Windows, this is the output:
C:\Users\paperfanz\home\programming\laser>laser -a .\test\prog-1\program1.asm
Assembling ".\test\prog-1\program1.asm"...
Warning (program1.asm line 24): 'BRnxp' expects 0 operands
Error (program1.asm line 25): Multiple labels pointing to same address: 'BRnxp' and 'nfin'
1 error(s) and 1 warning(s) in pass one
Unresolved errors encountered in pass one.
Cleaning up...
Deleting ".\test\prog-1\program1.sym"...
Unable to delete '.\test\prog-1\program1.sym'!
Deleting ".\test\prog-1\program1.bin"...
Unable to delete '.\test\prog-1\program1.bin'!
Deleting ".\test\prog-1\program1.hex"...
Unable to delete '.\test\prog-1\program1.hex'!
Deleting ".\test\prog-1\program1.lst"...
Unable to delete '.\test\prog-1\program1.lst'!
Deleting ".\test\prog-1\program1.obj"...
Unable to delete '.\test\prog-1\program1.obj'!
Done!
1 job processed in 00:00:054
0 successful, 1 failed
However, using laser to clean up the files afterwards still works:
C:\Users\paperfanz\home\programming\laser>laser -c .\test\prog-1\program1.asm
Cleaning up...
Deleting ".\test\prog-1\program1.sym"...
Deleting ".\test\prog-1\program1.bin"...
Deleting ".\test\prog-1\program1.hex"...
Deleting ".\test\prog-1\program1.lst"...
Deleting ".\test\prog-1\program1.obj"...
1 job processed in 00:00:008
1 successful, 0 failed
Whenever a 0x0A
is written into an object file on windows, a 0x0D
is inserted before it, throwing off the entire program.
Hexdumps of the Linux and Windows assemblers:
linux.txt
windows.txt
Diff:
diff.txt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.