Giter Site home page Giter Site logo

newcomb-luke / kos-kasm Goto Github PK

View Code? Open in Web Editor NEW
13.0 1.0 0.0 1.63 MB

Kerbal Assembler, for use with Kerbal OS mod for Kerbal Space Program. Using this tool one can program their KSP rockets in assembly code, or generate this assembly code from a compiler. Assembles directly to kRISC with no need for KerboScript.

Home Page: https://newcomb-luke.github.io/kOS-KASM/

License: GNU General Public License v3.0

Rust 100.00%
compiler assembler ksp kerbal-space-program kos kerbal-operating-system kasm krisc klinker

kos-kasm's Introduction

KASM

github github License

GitHub Workflow Status Libraries.io dependency status for GitHub repo Crates.io Downloads

The Kerbal Assembler, or KASM is a custom developed assembler designed to target the computers inside the Kerbal Operating System mod for Kerbal Space Program. KASM generates KerbalObject files which can then be linked using KLinker to create KerboScript Machine code (.ksm) files which can be run inside kOS.

Object files generated by KASM and KLinker can be viewed using the related project KDump

Any custom programming language for kOS can be implemented on top of KASM and that is what this project aims to help with.

Features

  • Extensive preprocessor directives
  • Easy to use functions and labels
  • Some small size optimizations over compiled KerboScript

Documentation

For documentation on how to use KASM, see the guide

Support

There is now a new Visual Studio Code Extension for KASM which enables syntax highlighting.

Besides reading the guide above, support on how to use and write KASM code can be found in the KASM Discord Server.

Installation

The Kerbal Assembler can either be installed via cargo through crates.io, or as a standalone binary.

Windows

If you have previously installed KLinker and KDump "standalone" through their own installers, when running the Windows installer, deselect KDump and KLinker from the "features" menu.

  • Download the .msi file from Releases on the right
  • Run the installer
  • kasm and associated tools should now be added to your PATH and available from any CMD or Powershell window

Arch Linux

  • Download the PKGBUILD from Releases on the right

  • Copy it to a temporary folder

  • Run makepkg -si to install kasm and all of its dependencies.

  • kasm should now be added to your PATH and available from any terminal

Standalone Executables

  • Download and extract the .zip file from Releases on the right
  • Place the executable in the desired location
  • Run the executable through the terminal, Powershell on Windows or the default terminal on Mac OS or Linux.

Cargo

cargo install kasm

kasm should then be added to your shell's PATH, and can be run from any terminal

You will need to install KLinker or KDump separately using

cargo install klinker
cargo install kdump

Usage

The Kerbal Assembler can be invoked after installation as kasm

Help can be accessed from the program itself by running:

kasm --help

The basic format for kasm arguments is:

kasm [FLAGS] [OPTIONS] <INPUT> --output <OUTPUT>

When running kasm, the assembler cannot infer the output file name, so one must always be specified. This is accomplished by passing the -o flag to kasm:

kasm main.kasm -o myprogram.ko

The -w flag can be used to suppress warnings generated by the assembler:

kasm -w

The -a flag can be used to disable preprocessing in kasm when assembling a file. This is usually done if one is not using preprocessor directives because it can speed up processing time:

kasm -a

In contrast, the -p flag can be used to tell kasm to only perform preprocessing if any must be done. The output file will then be kasm source code with all macros expanded, etc:

kasm -p

The -i option can be passed to kasm in order to specify the include path for .include directives in the code:

kasm main.kasm -o myprogram.ko -i include/

The -f option can be provided to kasm to specify the file name to be set in the generated KerbalObject file. This can be useful if using kasm as a second step down from a compiler.

kasm program.kasm -f program.ys

The -c option can be specified in order to set the generated file's comment field. The default comment is something along the lines of "Compiled by KASM ..." and the version number. This can be overridden if a compiler sits on top of this:

kasm program.kasm -c "Compiled by MyCompiler"

kos-kasm's People

Contributors

newcomb-luke avatar

Stargazers

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

Watchers

 avatar

kos-kasm's Issues

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.