Crate rustasm6502 [−] [src]
A MOS6502 assembler implemented as a macro.
Note: Due to limitations in Rust macros, syntax for absolute addressing modes requires the
use of abs after the mnemonic (eg. lda abs 0xffff).
Example
#[macro_use] #[no_link] extern crate rustasm6502; fn main() { let machine_code = assemble6502! { lda #0x00 ldx #0x00 ldy #0x00 txs main: adc 0xff // Zero-Page adc abs 0x1234 // Absolute address 0x1234 beq main end: jmp end }; assert_eq!(machine_code, [ 0xA9, 0x00, 0xA2, 0x00, 0xA0, 0x00, 0x9A, 0x65, 0xff, 0x6D, 0x34, 0x12, // Little-endian 0xF0, (-7i8) as u8, 0x4C, 14, 0, ]); }
Macros
| asm_! |
hidden |
| assemble6502! |
Entry point for the macro-based MOS6502 assembler. |
| codelen! |
Given an array of machine code (Bytes), returns its length. FIXME Don't go through an array hidden |
| ident_map! |
A compile-time map from identifiers to arbitrary (heterogeneous) expressions hidden |
| lockstep_replace! |
Replace elements of "arrays" of expressions with sorted replacements by seeking along a "positional array" containing n expressions, then replacing elements in the source array. |
| reloc! |
Performs relocation of machine code based on given labels and relocations.
Looks up label names in an |