Coder Social home page Coder Social logo

portalgun-io / battlestar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xyproto/battlestar

0.0 1.0 0.0 620 KB

:dizzy: A different take on assembly, with the goal of creating tiny executables

License: MIT License

Makefile 4.14% C 24.01% Assembly 0.30% Shell 8.16% Python 3.22% Go 60.18%

battlestar's Introduction

Battlestar

Build Status License Report Card

What is Battlestar?

  • A work in progress.
  • Created for fun and for the educational process.
  • A programming language specifically for 64-bit and 32-bit x86 and Linux.
  • Subset of assembly with an alternative syntax and with support for inline C.
  • The indended purpose is for writing 4k and 64k demoscene demos.

Quick start

Build and install Battlestar, build the samples and run the "life" sample:

  • make; sudo make devinstall; make samples; cd life; ./life.sh

This requires DosBox, Go, Yasm and GCC.

gcc-go is not supported yet.

Features and limitations

  • The resulting executables are tiny!
  • "hello world" is only 174 bytes for 32-bit Linux (when using sstrip from elfkickers). (238 bytes for 64-bit Linux, 31 bytes for 16-bit DOS)
  • It's possible to write an operating system / kernel with only one source file.
  • Full support for inline C (by utilizing gcc).
  • C and Battlestar code can exist in the same source file and calls can be made both ways.
  • Battlestar programs compiles almost instantly.
  • Programs can be run like scripts by including this line at the top: #!/usr/bin/bts
  • Interrupts can be called with the same syntax for both 32-bit and 64-bit x86 on Linux.
  • Also supports 16-bit x86 with DosBox.
  • The intermediate assembly is fully commented.
  • No register allocator, just an alternative assembly syntax.

In progress

  • macOS support
  • Reimplementing 16-bit demoscene demos without using any inline assembly
  • See TODO

Installation

Make sure Go, Yasm and GCC are installed.

Installation:

sudo make PREFIX=/usr install

For development, install soft links instead:

sudo make install-dev

Build all the samples:

make samples

Build dependencies

  • go >= 1.3

Runtime dependencies

  • yasm

Optional runtime dependencies

  • gcc (for inline C support)
  • elftools/sstrip (for even smaller binaries)
  • binutils (for disassembling with objdump)
  • dosbox (for running 16-bit executables) (only GCC 4.9 and up supports compiling to 16-bit with -m16)
  • SDL 2 (must be compiled and installed manually if on Red Hat 6)
  • tcc (for even smaller binaries, in many cases)

General info

  • Version: 0.6.1
  • License: MIT
  • Author: Alexander F. Rødseth

battlestar's People

Contributors

xyproto avatar

Watchers

 avatar

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.