{"id":13608240,"url":"https://github.com/xyproto/battlestar","last_synced_at":"2025-04-14T21:51:28.802Z","repository":{"id":14318593,"uuid":"17027713","full_name":"xyproto/battlestar","owner":"xyproto","description":":dizzy: A different take on Assembly, with the goal of creating tiny executables.","archived":false,"fork":false,"pushed_at":"2024-03-06T10:28:09.000Z","size":693,"stargazers_count":81,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T09:51:34.202Z","etag":null,"topics":["assembly","dosbox","gcc","inline","linux","programming-language","tiny"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xyproto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-20T16:49:03.000Z","updated_at":"2025-02-24T22:32:48.000Z","dependencies_parsed_at":"2024-06-20T19:14:27.100Z","dependency_job_id":null,"html_url":"https://github.com/xyproto/battlestar","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fbattlestar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fbattlestar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fbattlestar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xyproto%2Fbattlestar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xyproto","download_url":"https://codeload.github.com/xyproto/battlestar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968741,"owners_count":21191158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembly","dosbox","gcc","inline","linux","programming-language","tiny"],"created_at":"2024-08-01T19:01:25.466Z","updated_at":"2025-04-14T21:51:28.779Z","avatar_url":"https://github.com/xyproto.png","language":"Go","readme":"Battlestar\n==========\n\n[![License](http://img.shields.io/badge/license-BSD-green.svg?style=flat)](https://raw.githubusercontent.com/xyproto/battlestar/main/LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/github.com/xyproto/battlestar)](https://goreportcard.com/report/github.com/xyproto/battlestar)\n\n\nWhat is Battlestar?\n-------------------\n\n* A programming language specifically for 64-bit x86 Linux, 32-bit x86 Linux and 16-bit x86 DOS.\n* Subset of assembly with an alternative syntax and with support for inline C.\n* A work in progress.\n* Created for fun and for the educational process.\n* The indended purpose is for writing small operating systems, 1k and 4k demoscene demos.\n\n\nQuick start\n-----------\n\nBuild and install Battlestar, build the samples and run the \"life\" sample:\n\n* `make; sudo make devinstall; make samples; cd life; ./life.sh; cd ..`\n\nThis requires DosBox, Go, Yasm and GCC.\n\nBuild and boot a kernel (requires GCC, Yasm, Battlestar and the `qemu-system-i386` executable):\n\n* `cd kernel/simple; make boot; cd ../..`\n\n\nFeatures and limitations\n------------------------\n\n* The resulting executables are tiny!\n* \"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)\n* It's possible to write an operating system / kernel with only one source file.\n* Full support for inline C (by utilizing gcc).\n* C and Battlestar code can exist in the same source file and calls can be made both ways.\n* Battlestar programs compiles almost instantly.\n* Programs can be run like scripts by including this line at the top: ```#!/usr/bin/bts```\n* Interrupts can be called with the same syntax for both 32-bit and 64-bit x86 on Linux.\n* Supports 16-bit x86 that can run within DosBox.\n* The intermediate assembly is fully commented.\n* No register allocator, just an alternative assembly syntax.\n* `gccgo` is not supported yet.\n\n\nSample program\n--------------\n\nThis is a 16-bit x86 program, for DOS:\n\n```c\n// \"Life\"\n// The original was written by \"melezov\" (http://256bytes.untergrund.net/demo/334)\n\nfun main\n    al = 0x13               // set graphics mode (mode 13h)\n                            // 320x200, 256 colors, one byte per pixel\n    int 10\n\n    stack -\u003e sp             // pop  sp\n    stack -\u003e b              // pop  bx\n    stack -\u003e ds             // pop  ds\n\n    ds -\u003e es                // push ds, pop es\n\n    al = 62\n    ch = 0xFA\n    loopwrite               // rep stosb\n\n    loop\n\n        di \u003c\u003c\u003c 3           // rotate left 3\n\n        di -= 7            // subtraction\n        di ^= 2            // xor\n\n        al = readbyte di   // read byte from memory\n        al += [di+321]     // add value at [di+321] (pixel on the line below)\n        al /= 2\n\n        di -\u003e stack\n        write               // stosb\n        write\n\n        di += 0x13E\n        write\n        write\n\n        stack -\u003e di\n\n    end // loops forever\n\nend\n```\n\nIn progress\n-----------\n\n* macOS support\n* Reimplementing 16-bit demoscene demos without using any inline assembly\n* See TODO\n\n\nInstallation\n------------------\n\nMake sure Go, Yasm and GCC are installed.\n\nInstallation:\n\n`sudo make PREFIX=/usr install`\n\nFor development, install soft links instead:\n\n`sudo make install-dev`\n\nBuild all the samples:\n\n`make samples`\n\n\nBuild dependencies\n------------------\n\n* go \u003e= 1.3\n\n\nRuntime dependencies\n--------------------\n\n* yasm\n\n\nOptional runtime dependencies\n-----------------------------\n* gcc (for inline C support)\n* elftools/sstrip (for even smaller binaries)\n* binutils (for disassembling with objdump)\n* dosbox (for running 16-bit executables) (only GCC 4.9 and up supports compiling to 16-bit with -m16)\n* SDL 2 (must be compiled and installed manually if on Red Hat 6)\n* tcc (for even smaller binaries, in many cases)\n\nExternal links\n--------------\n\n* Battlestar programs on [Rosetta Code](https://rosettacode.org/wiki/Category:Battlestar#mw-pages)\n\nGeneral info\n------------\n\n* Version: 0.7.0\n* License: BSD-3\n* Author: Alexander F. Rødseth \u0026lt;xyproto@archlinux.org\u0026gt;\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxyproto%2Fbattlestar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxyproto%2Fbattlestar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxyproto%2Fbattlestar/lists"}