Giter Site home page Giter Site logo

coas's Introduction

COAS - The 0x10c assembler (python based)

COAS is a basic assembler for the 0x10c DCPU. Currently, it supports a the v1.7 DCPU standard and a good number of directives.

Current list of features

  • Binary output in big and little endian raw files, IntelHEX and notch assembly dat output
  • Macros
  • Expressions
  • Local scoping of labels
  • .org, .align and .bss operations for fine tuned control over your memory map
  • Includes of raw source as well as binaries
  • Relocation table generation
  • Linkage table generation
  • String and Character literals (.data, .big and .little blocks)

The syntax is similar to the dos assembler "TASM". I chose this mostly because it is what I am most familiar with. To keep the impedance level down for new developers, or porting existing assembling to a minimum.

Example Source

        .org 0x0000
        .include "system.inc"

.macro RET
        SET PC, POP
.endmacro

reset:  JSR setup
        ADD PC, -1


; === Setup screen and devices

        .proc
:setup  ; We support pre-and-post colon labels.
        RET
        .endproc

Directives

.org address` Redefine the origin address for the following instructions and labels (defaults to 0)

.align block-width Pad out the current data to N bytes to maintain even alignment.

.bss block-size Defines a space without create actual binary data (useful for creating uninitialized data sections)

.include "filename" Insert the contents of a file inside of the current assembly

.incbytes "filename" Insert the contents of a file inside of the current assembly, converting each byte to a word of data

.incbig "filename" Insert the contents of a file in big-endian format as a data block of words

.inclittle "filename" Insert the contents of a file in little-endian format as a data block of words

.data expression, expression, expression Insert a series of words into the assembly (each value truncated to 16bits)

.big expression, expression, expression For each two expression, treat them as a series of bytes and pack them into words (big-endian order).

.little expression, expression, expression For each two expression, treat them as a series of bytes and pack them into words (little-endian order)

.equ word expression Assign the value of a word to the value of an expression, doing a replacement across the entire project

.proc ... .endproc Creates local scoping, making any label beginning with '_' only be visible inside of the block

.macro word arg, arg, arg ... .endmacro

coas's People

Contributors

asterick avatar

Watchers

Lizzie Dixon avatar James Cloos 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.