PitfallJ wrote:
INC16 and CMP16 don't seem to work - is it because they contain an existing keyword.
Yes, exactly. They are equivalent to INC &10 and CMP &10 respectively (because BeebAsm, like BBC BASIC, doesn't require spaces after its keywords). Maybe I'll make a change so that invoking macros takes priority over assembler opcodes, so that the likes of INC16 work ok (this would also be more consistent, given that it's possible to
define macros with names like these). My best suggestion for now would be to prefix all macro names with an underscore character, both so that they stand out, and so there's no clashes with reserved words.
Quote:
Sorry to be picky but it would be even cooler if it could tell the difference between:
ADD16 label,#23 and ADD16 label,address.
When I was implementing macros, I wondered about this, but in the end I figured it didn't make sense. In your example, you'd want it to generate different code depending on whether it was an immediate constant or another address (due to the way the MSB would be handled - in the first, it'd be HI(val) and in the second it'd be addr+1), so there'd be no advantage in 'unifying' the two macros in this way. It could be done by implementing 'overloading' of macro definitions, i.e. the same name but with different parameter types, but this would just be getting far more complicated than would be worthwhile!
Quote:
Also the
.label thing drives me crazy - I'm just too used to the 'standard'
label:
At lease it accepts
.label:
When I wrote BeebAsm, my original intention was to create something which would let me write 6502 assembler in exactly the same way as I used to in BBC BASIC, in particular putting multiple instructions on one line, separated by colons. I couldn't find any other 6502 assembler that allowed this, and so I wrote my own! So that's why all the conventions are as per BBC BASIC, right down to the .label syntax, and even the names of the functions. It even uses P% (as well as the more conventional '*') to return the address currently being assembled at.
Of course, since those early days, it's grown quite a bit, and it's true that some of the original features, such as not requiring whitespace, aren't really all that useful.