SFC Development Wiki
🌝
Browse Tags
New Document
Editing xkas
Title
Slug
Original Slug (Reference Only)
Redirects
Image
Excerpt
Content
Write
xkas (acronym for: cross-knight assembler) is a cross-assembler for the WDC G65816 processor, specifically tailored for use with SFC/SNES programming and translations but also supports GBA Thumb CPU (ARM7TDMI Thumb). The documentation below is for the most recent version of xkas. ## Features * Supports All 256 Opcodes * Supports Labels / Sublabels / +/- Labels * Supports Math * Supports ASCII-Tables * Supports Defines * Supports Macros ## Versions * xkas v0.06 * xkas v0.06 Unoffical * xkas v0.08 Unoffical * xkas v0.12 * xkas v0.14 ## Command Line xkas -o output.bin input.asm [second-input.asm ...] If the output file exists, xkas will assemble the source file on top of this file. If it does not exist, xkas will create the file. Usage examples: xkas -o output.bin input.asm xkas -o output.bin input1.asm input2.asm xkas input1.asm input2.asm -o output.bin ## Commands ### arch type Select processor architecture. Supported values: none - None; uses base commands only gba.thumb - GBA THUMB CPU (ARM7TDMI THUMB) snes.cpu - SNES CPU (WDC 65816) ### endian type Manually specify processor endian. This will affect dw, dl and dd commands. Note that selecting a processor architecture will automatically select endian. This is intended to be used for "arch none" only. Supported values: lsb - Little endian msb - Big endian ### incsrc filename.asm Include additional source file. Note that this command is infinitely recursive. Eg `file1.asm` can `incsrc file2.asm`, which can `incsrc file3.asm`. Recursion is only limited to available memory. The state will remain unchanged, eg all defines and labels will remain in-tact. ### incbin filename.bin Insert binary file directly into output. ### org offset Seek to specified offset. Offset address relativity to output file is based upon the current architecture. Eg if `arch = snes.cpu`, `org` should be an SNES-memory-mapped offset. For `arch = none`, this is a literal offset into the output file. ### base offset Override internal `org` address when computing eg labels. This is useful for relocatable code and custom address mapping. Usage example: org $c02000; base $7f0000 lda #$00 loop: jml loop //will assemble as jml $7f0002; while writing to pc($c02002) ### align modulus Write `0x00`s until offset is evenly divisible by modulus. Eg if offset is `$8011`, "`align 4`" will write three `0x00`s, aligning offset to a 4-byte boundary; in this case, `$8014`. ### db / dw / dl / dd value [, value, "string", ...] Simple binary data insertion; these are used to write binary data to the file. These commands additionally support quote-delimited 7-bit ANSI encoded strings. db - Data byte (8-bits) dw - Data word (16-bits) dl - Data long (24-bits) dd - Data double word (32-bits) ### fill length [, value] Writes "length" number of bytes to output file. If value is not specified, write value is 0x00. ### fillto offset [, value] Writes until "offset" is reached. If value is not specified, write value is `0x00`. ### define name "value" Creates a new define, or overrides a previous define by the same name. Quotes are only needed if space is needed inside the define. Usage example: define add "clc; adc" define health_bonus 32 {add}.w #{health_bonus} //will assemble as clc; adc.w #32 ### define 'char' value Redefine string table entry. "char" must be exactly one ANSI character in length, and "value" must resolve to an integer. Usage example: define 'C' $1234 // value can be up to 64-bits in length lda.b #'C' // will assemble as lda.b #$34 lda.w #'C' // will assemble as lda.w #$1234 dw "C" // will write #$1234 to output ### label: Creates a new label. A label is used to represent a position in code, and allows one to code without having to constantly update branches and jumps/calls. A label should be able to be used in any opcode, but was specifically added to be used with branches, jumps, and calls. Can start with `_[A-Za-z]`, can contain `_[A-Za-z0-9]`. ### .sublabel: Creates a new sublabel. A sublabel is used to declare labels within labels that will share its address space only, and can contain the same characters as a label. Must start with ., can contain _[A-Za-z0-9]. Sublabel is automatically prefixed with the most recently specified label. Example: label: .sublabel: // will assemble as label.sublabel ### + / - label: Creates a nameless label. Will ignore active namespace. + is used to point to a label after the current code position, - is used to point before the current position. Can be redefined at any point in the code. Example: -; dex; beq +; ...; bra - +; rts ### namespace name Sets the active namespace. When a `label`, `sublabel` or `define` is specified without a namespace prefix, it is automatically prefixed by the active namespace. This defaults to "global". Note that unlike C++ namespaces, this function is not recursive. There is only one namespace level. Example: namespace global label: .sublabel: define def "0" dw label, .sublabel, custom::label, custom::label.sublabel, {def}, {custom::def} namespace custom label: .sublabel: define def "1" dw label, .sublabel, global::label, global::label.sublabel, {def}, {global::def} ### print arg [, arg, "string", ...] Prints specified message to the terminal. Example: org $8000 label1: print "label1 offset = ", org //prints "label1 offset = 0x8000" _Written by byuu August 1st, 2004 - October 19th, 2010_
Preview
Tags
Delete
Drop files here or click to upload.