Page 1 of 1
6502 Assembler
Posted: Wed May 04, 2011 10:30 am
by 67726e
I just wrote this for my final project for my IB Comp. Sci. class a few months back. I guess I just got around to releasing it. Its not much compared to most other assemblers out but it does support a few things I always wanted in NESASM.
Its called
hasm. Its probably really buggy right now but it *can* compile. I haven't had the time to write any test games or anything so it may well have some nice bugs.
Posted: Wed May 04, 2011 10:35 am
by qbradq
That's awesome! It's always fun to write a 6502 assembler. I wrote one in JavaScript about a year ago
Can you describe the special features you implemented? I read the text files in the repo but they do not seem to describe special functionality.
I noticed the C-style comment blocks in the test assembly file. That's one feature I wish all assemblers included.
Posted: Wed May 04, 2011 1:36 pm
by 67726e
Block commenting was one of them. I also hated how with NESASM you had to have a symbol to force zero-page addressing so I did away with that.
I was/am also working on an optimization tool that recommends possible areas to work on (assuming you enable the feature).
Posted: Wed May 04, 2011 11:22 pm
by koitsu
Can't tell from the .txt files in the main repo dir, but it doesn't look like decimal (e.g. LDA #123) or binary (e.g. LDA #%11011110) immediates are supported. Yes/no?
EDIT: Nevermind, Java... :(
Posted: Thu May 05, 2011 3:24 am
by 67726e
koitsu wrote:Can't tell from the .txt files in the main repo dir, but it doesn't look like decimal (e.g. LDA #123) or binary (e.g. LDA #%11011110) immediates are supported. Yes/no?(
Holy hell I don't know how I managed to miss that. I guess just give me a day or so to take care of that.
Posted: Thu May 05, 2011 3:45 am
by qbradq
This is really making me want to code a new assembler myself But since I'm already two projects deep I'll ask you to implement the things I want
Ever consider namespaces? I have always wanted an assembler that has true support for nested namespaces that work like C++ namespace or JavaScript container objects. Seems like it would work a lot better than CA65's named scope mess.
How about implementing curly brackets as anonymous labels? Here's what I'm talking about:
Code: Select all
lda my_label
beq }
{
// DO STUFF
jmp }}
}
{
// DO OTHER STUFF
{ // Some other block that does not interferer with the jmp }} above
}
}
I don't know, I haven't thought out the syntax on that very well yet. I just hate having to invent names for my if / else / for / while jump locations, and real anonymous labels have too many problems.
Posted: Thu May 05, 2011 8:15 am
by cartlemmy
qbradq wrote: Here's what I'm talking about:
Code: Select all
lda my_label
beq }
{
// DO STUFF
jmp }}
}
{
// DO OTHER STUFF
{ // Some other block that does not interferer with the jmp }} above
}
}
Cool, that's kinda like what my pre-parser does:
Code: Select all
//16 bit comparisons
CMP16 i, cameraX, BPL { ; Move camera to the left ...
CMP16 i, #$00, BMI { ; ... unless we are at the beginning of the map
LDA i
STA cameraX
LDA j
STA cameraX+1
}
}
//switches:
LDA objectType,x
TAX
switch (x) {
case 0:
JMP doneWithThisObject
case 1: ;Useless Splink
.include "objects/uselessSplink.asm"
JMP doneWithThisObject
}
//And other stuff too, but I'm lazy.
Posted: Thu May 05, 2011 11:38 am
by 67726e
So perhaps a feature list of things to implement?
So far I think:
1) Anonymous labels
2) Switch/Case
3) Decimal/Binary modes
Anyone want to add anything they think is a good idea?