GithubHelp home page GithubHelp logo

paperfanz / laser Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 8.0 243 KB

An LC3 assembler created over winter break to practice C.

License: GNU General Public License v3.0

C 99.18% Makefile 0.82%
assembler practice lc3-assembler lc3

laser's Introduction

LASER - [L]c3 [AS]sembl[ER]

Description

Laser is a cross-platform, command-line-based assembler for the LC3 assembly language implemented in pure C. Version 2 extends the functionality of LC3Tools and LC3Edit through new pseudoops, along with a project assembly mode.

Installing

Under the releases tab, there are pre-compiled binaries for Windows, Mac, and Linux. In addition, it is highly recommended that you use this program with an extensible editor like VSCode or Notepad++, and to add Laser as a shortcut in your editor. If all this installation stuff is not up your alley or you'd like to learn more about how Laser was created, take a look at BUILDING.md for instructions on how to build Laser from source.

Linux/Mac OS X

Once you've downloaded the precompiled binary (building from source is actually recommended on Linux due to all the different distrubutions and their differences, but Laser has practically 0 dependencies so it should be fine), copy the file to either /usr/bin or /usr/local/bin and make it executable. Alternatively, put it wherever and add it to your PATH environment variable.

Windows

Download the laser-x-x-x.exe from the releases tab and place it somewhere permanent (I.E. not your Downloads folder), and add it to your Windows PATH.

To add the program to your PATH, open the file explorer, right click on This PC, and select 'properties'. Then, click on 'advanced system settings' and click on the 'environment variables' button. In the window that pops up, highlight the 'Path' variable and select 'edit'. From there, click 'new' and input the file path of where you placed the downloaded laser executable. Afterwards, click 'ok' and then 'apply'. You should then be able to invoke laser from the command line.

Usage

See USAGE.md

Building from Source

see BUILDING.md

Copyright

Laser- a command line utility to assemble LC3 assembly code

Copyright Notice:

Copyright 2018, 2019 Zhiyuan Fan

License Notice:

Laser is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Laser is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Laser.  If not, see <https://www.gnu.org/licenses/>.

laser's People

Contributors

paperfanz avatar parkerbjur avatar vyduckien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laser's Issues

Clean up files on Windows does not always work

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

Seg fault on syntax error

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.

Problem assembling PUTs with release 2.0.1 on Windows

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 !

.lst file does not word w/ Simulate 3.0.1.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

Assembled with Edit:
Edit

Assembled with Laser:
Laser

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.