Git Product home page Git Product logo

6502asm.js's Introduction

6502asm.js Build Status

A 6502 assembler written in Javascript

NOTE: This is still in pre-alpha stage. That means unstable, slow and ugly code lies ahead.

You're welcome to submit patches or features!

Example

let Assembler = require('6502asm').Assembler;
let asm = new Assembler();

asm.assemble(`
  lda #$01
  cmp #$02
  bne notequal
  sta $22
notequal:
  jmp *
`)

// > { objectCode: [ 169, 1, 201, 2, 208, 2, 133, 34, 76, 8, 0 ],
//     symbolTable: { notequal: 8 } }

Dependencies

Uses Ecmascript 6 extensively so you need either Node 6+, or Babel to transpile to ES5 (especially if you need to run it on browsers).

Install

You can install with npm:

npm install munshkr/6502asm.js

If you clone the repo, install all dependency packages with npm install.

Then execute npm test to run unit tests and verify everything works.

Usage

To use it as a library, use Assembler class, as shown in the example above.

There is also a command line program:

  Usage: 6502asm [options] <file>

  Options:

    -h, --help            output usage information
    -o, --output [file]   output object file (default: ./a.out)
    -s, --symbols [file]  output symbols table (in JSON)
    -d, --debug           print debugging info

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/munshkr/6502asm.js

License

Source code is released under Apache 2 license.

6502asm.js's People

Contributors

munshkr avatar

Stargazers

 avatar Earture avatar Alexandre Lehmann Holzhey avatar Cristian Douce avatar Steven Hugg avatar  avatar

Watchers

 avatar

6502asm.js's Issues

Make sure an indirect jump never uses an address beginning on the last byte of a page

There is a bug in the 6502 where an indirect JMP will never cross page boundaries. E.g: If address $3000 contains $40, $30FF contains $80, and $3100 contains $50, the result of JMP ($30FF) will be a transfer of control to $4080 rather than $5080.

Assembler should do both of these:

  • If JMP uses a label that references an address on the last byte of a page (i.e. low byte of address is $ff), shift up or down code referenced by label 1 byte.
  • If JMP uses a hardcoded address that is on the last byte of a page, throw a warning.

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.