2007-05-13

In Another Assembler...

Here’s the same thing designed to compile with DASM:

        PROCESSOR 6502
        .ORG $0200      ;Locate asm at $0200

CODE    LDA #<LIST      ;Load low byte of LIST into acc
        STA $30         ;Store low byte at address $30
        LDA #>LIST      ;Load high byte of LIST into acc
        STA $31         ;Store high byte at address $31
        JSR LOAD        ;Jump to LOAD subroutine
        BRK             ;Stop running

LOAD    LDY #$1         ;Load 1 into Y register
        LDA ($30),Y     ;Load data pointed to by address $30+1 into accumulator
        RTS             ;Return from subroutine

LIST    DC.B #$20,#$04  ;Define a list of bytes

Great, so I can now compile 6502 programs from an OSX terminal instead of loading up Parallels. The only problem is I can’t run them in OSX. Gahh.