1
0
mirror of https://github.com/pfusik/xasm.git synced 2024-12-30 05:30:22 +00:00
6502 cross-assembler with original syntax extensions
Go to file
maraflush 2e43507088 fix compilation issue
fix :
xasm.d(2655): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"ea" instead.
xasm.d(2656): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"18a2006105" instead.
xasm.d(2657): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"a9cd8d3412a9ab8d3512" instead.
xasm.d(2658): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"05a6efef8945" instead.
xasm.d(2660): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"400100000000 401200000000 410123000000 441234567890 461234567890 3f5000000000 3f0300000000 3f1664534589 701000000000" instead.
2019-08-24 09:17:57 +02:00
debian xasm 3.1.0 release. 2014-07-20 19:10:41 +02:00
.gitignore Add .gitignore 2016-01-03 11:23:16 +01:00
Makefile Rename the documentation so that GitHub formats it. 2019-03-26 23:48:10 +01:00
README.md Update some links. 2019-03-26 23:34:56 +01:00
xasm.1.asciidoc Rename the documentation so that GitHub formats it. 2019-03-26 23:48:10 +01:00
xasm.d fix compilation issue 2019-08-24 09:17:57 +02:00
xasm.properties SciTE: Fix the open filter. Add to the Language menu. 2016-12-15 20:43:40 +01:00
xasm.spec xasm 3.1.0 release. 2014-07-20 19:10:41 +02:00

xasm

xasm is a 6502 cross-assembler with original syntax extensions. By default it generates binaries for Atari 8-bit computers.

Syntax

6502 assembly code is full of LDA, STA, LDA, STA sequences. With xasm you can use MVA as a shortcut for an LDA/STA pair or even MWA for 16-bit transfers. Short branches can be replaced with conditional skip and repeat pseudo-instructions. You can use a pair of instructions with a shared argument. These are just some of the features that help you program in a more concise way. Let's look at typical 6502 code (which is also valid in xasm):

    lda #<dest
    sta ptr
    lda #>dest
    sta ptr+1
    ldx #192
do_line
    ldy #39
do_byte
    lda pattern,y
    sta (ptr),y
    dey
    bpl do_byte
    lda #40
    clc
    adc ptr
    sta ptr
    bcc skip
    inc ptr+1
skip
    dex
    bne do_line

Using xasm's features this code can be rewritten to:

    mwa     #dest ptr
    ldx     #192
do_line
    ldy     #39
    mva:rpl pattern,y (ptr),y-
    lda     #40
    add:sta ptr
    scc:inc ptr+1
    dex:bne do_line

xasm syntax is an extension of Quick Assembler's (created in 1991 for Atari 8-bit). Accumulator shifts should be written as in asl @. Whitespace is important: it is required before the instruction and disallowed in the operands, because it separates a comment from the operand, e.g.

    lda #0   this is a comment, no need for a semicolon

This may look weird at first, but it enables nice features such as instruction pairs and two-argument pseudo-instructions.

Usage

xasm is a command-line tool. Therefore you additionally need a programmer's text editor.

I use SciTE. To install xasm syntax highlighting and single-keystroke compilation, copy xasm.properties to the SciTE directory.

For single source file programs, press Ctrl+F7 to compile. You can double-click error messages to go to the incorrect line. Press F5 to run the program in the emulator.

For larger projects, I use GNU Make. Press F7 to build (and possibly run) a project as described in the Makefile. You can find my Makefiles in my repositories on GitHub.

If you prefer VIM, see a link below.

Poetic License

This work 'as-is' we provide.
No warranty express or implied.
We've done our best,
to debug and test.
Liability for damages denied.

Permission is granted hereby,
to copy, share, and modify.
Use as is fit,
free or for profit.
These rights, on this notice, rely.

Download

xasm 3.1.0 for Windows, OS X, Ubuntu and Fedora.

  • Atari800 - portable emulator of Atari 8-bit computers
  • Atari XL/XE Source Archive - source code of Atari demos, utilities and games
  • cc65 - C cross-compiler targeting 6502-based systems
  • MADS - another 6502/65816 cross-assembler, partially supporting xasm's syntax
  • vim-xasm - VIM syntax highlighting for xasm
  • WUDSN IDE - Eclipse plugin, front-end to several 6502 cross-assemblers, including xasm