NOTE: THIS PROJECT HAS BEEN FROZEN IN FAVOR OF THE MORE ROBUST JCOAS PROJECT
COAS is a basic assembler for the 0x10c DCPU. Currently, it supports a the v1.7 DCPU standard and a good number of directives.
- 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.
.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
.org address
Set the relative origin of labels. Does not alter the layout of the actual code generated
Example .org 0x0000 label1: ; This is 0x0000 .org 0x8000 label2: ; This is 0x8000
.align block-width
Pad out the current data to N bytes to maintain even alignment between blocks of code and data
.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
If you just want to run it:
pip install git+git://github.com/asterick/coas.git
For development:
git clone git://github.com/asterick/coas.git
# install it as editable
pip install -e coas