Need help with kasm?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

141 Stars 14 Forks Other 32 Commits 0 Opened issues


Simple 6502 assembler

Services available


Need anything else?

Contributors list

# 458,448
31 commits


This is a simple two-pass 6502 assembler that I wrote for fun. No warranty expressed or implied.

It supports standard opcodes and opcode syntax. Binary output is in Kim-1 format.

Command line synopsis:

python inputfile[.asm]

The files 'inputfile.lst' (an assembler listing) and 'inputfile.dat' (the Kim-1 format binary) are produced unconditionally.

General syntax:

Labels are case sensitive, and are followed with a colon. Assembler mnemonics and psuedo-ops are not case sensitive. The special symbol '*' is the location counter of the start of the current line of input.

; ----------------
; comments start with semicolons

    include     "filename.asm"
    org         expression                  ; set location counter
    db          byte, byte, byte...
    dw          word, word, word...
    ds          expression                  ; reserve bytes

Labels have colons:

label:      op      operand(s)

Equate values with =

symbol      =       expression

Labels starting with '.' are local between labels that don't start with '.'

func:       lda     #1
.loop       adc     #1
            bcc     .loop
mumble:     ldx     #1
.loop       inx                             ; distinct from first '.loop'
            bne     .loop

Expressions use C operators, and C operator precedence. Operators are (in order of decreasing precedence):

( expression )

  •               (unary minus)
    ! (logical not, yields 0 or 1)
  • /     % 
  • - 

<< >>

< <= > >= == !=

& ^ |

Development status:

This assembles some moderately size files without fuss, and apparently correctly (I tried it on Microchess, for instance). There are probably bugs in it.

It would be nice if the listing file wasn't unconditionally created, but it's fine for me at the moment.

It would be nice to have macros and conditional assembly.

It would be nice to have (say) Atari output format, but I don't really need it.

More pseudo-ops might be interesting (e.g., EQU in addition to '=').

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.