Quote:
For RMB, SMB, BBR, and BBS, I think I would prefer that the assembler take the bit number from the operand list (which you could do with a macro). Then if you decide you have to swap a couple of bits in the hardware before going to production for example, only the constants used in the operand list change, and only where they are defined. You would not have to go through and search for and change the mnemonics.
A reasonable position, but I've just been wrestling with this in connection with developing an alternate set of "instruction" macros for the 65Org16b (EE's effort is formidable - 750K worth of macros so far! I'm aiming for something a little more compact
)
The issue for me came up with that barrel shifter. Is it better to have an instruction like:
Code:
ASL B,#4
or one like:
Code:
ASL4 B
A problem with the first form is that because the value "#4" really isn't a separate byte in the assembled code but part of the opcode itself, its value has to be known before the opcode can be stored. But users would expect "#4" to act like all other immediate mode instructions, eg., allow forward reference (it might not be common, but it should be possible).
There's also the issue of what to do if "#x" turns out to be outside the range 0-15. Silently truncate? Declare an error?
The second form eliminates both those problems. The mnemonic itself declares what the opcode bits should be, and it becomes impossible to use an out-of-range value (at least not without causing an easily-diagnosed complaint from the assembler).
I decided to go with the second form after thinking about it for a few days. It occurs to me now that it would be possible (at least with some assemblers *ahem*) to write yet another macro that looked like the first form and expanded to the second, for those that wanted to do so.