6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 12:56 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Sep 21, 2011 1:06 am 
Offline

Joined: Wed Sep 21, 2011 12:29 am
Posts: 1
Location: Sydney, Australia
Greetings 6502ers,

I've written a small, simple, 6502 assembler in Perl for my own amusement, and to learn a little about the process of assembling machine code. I targeted the 6502 as a simple real world cpu, but it's merely a jumping off point to explore SPARC or possibly VAX at a later date.

I've reached a point where it can spit out a raw binary image of the assembled code. It reads the source code from stdin, producing a listing and symbol table on stdout, and dumping the assembled binary to a file named a.out. I know there are still some bugs, but I also know I'm no expert on the 6502, so I'm putting this out there for anyone who wants to test it and give some feedback so I can get it to a fully functional state.

All standard 6502 instructions and addressing modes are recognised. I neglected to add language support for BCD data - this will come later on. I've tried to adhere to the Commodore 64 style syntax for addressing modes where possible:

    Immediate values are prefaced with a #, they can be either decimal or hex (hex should be prefaced with $)
    labels are defined using the format /[a-zA-Z_][a-zA-Z_0-9]?/.
    labels declaring a value are marked with an =. labels declaring a jump or subroutine beginning are followed by a :
    raw byte and word declarations can be made using the .byte and .word directives, followed with a comma separated list of hex values


The addressing mode selection code is based on the syntax and value of the operands specified for each instruction. all memory addresses that are below $100 are automatically treated as zero-page addresses, even if explicitly stated by a full word value in source. This is not by intentional design (At least, I didn't realise it at the time), and will probably change at a later date.

Source is hosted on github (https://github.com/duranain/6502asm/tree/volatile). the volatile branch is active development. I apologise in advance for the present state of the code. It has fallen into some neglect as I have been hacking away, and is in need of some cleanup.

Feedback is greatly appreciated.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: