6502sbc wrote:
Is there any other (simpler) options to compile 6502 software?
What is your goal? If it is to gain the structure of a higher-level language and get rid of the spaghetti which is typical of assembly language, you can use program-structure macros in assembly and get more clarity, better control, fewer bugs, with (in most cases) no penalties in memory taken or in performance. I have an article on them, with source code for the C32 assembler, at
http://wilsonminesco.com/StructureMacros/index.html. Others here have written assemblers with the structure capabilities built in. The
As65 assembler (written by BitWise on this forum) has structure capabilities without the user adding macros. His even automatically chooses branch versus jump instructions to get the code compact in most cases but still able to make the jump when the distances exceed 127 bytes. Anton Treuenfels added structures to his
HXA 6502 assembler. The source code I provide on my website has the following:
Code:
IF_EQ (using Z flag) BEGIN
IF_ZERO (using Z flag)
IF_NEQ (using Z flag) WHILE_EQ (using Z flag)
IF_NOT_ZERO (using Z flag) WHILE_NEQ (using Z flag)
IF_PLUS (using N flag) WHILE_ZERO (using Z flag)
IF_MINUS (using N flag) WHILE_NOT_ZERO (using Z flag)
IF_NEG (using N flag) WHILE_PLUS (using N flag)
IF_C_SET (using C flag) WHILE_MINUS (using N flag)
IF_C_CLR (using C flag) WHILE_NEG (using N flag)
IF_GE (using C flag) WHILE_C_CLR (using C flag)
IF_LT (using C flag) WHILE_C_SET (using C flag)
IF_V_SET (using V flag) WHILE_GE (using C flag)
IF_V_CLR (using V flag) WHILE_LT (using C flag)
IF_FLAG_VAR (added May 2013) WHILE_V_CLR (using V flag)
IF_BIT (added May 2013) WHILE_V_SET (using V flag)
IF_MEM_BYTE_NEG (added May 2013) WHILE_BIT (added May 2013)
IF_MEM_BYTE_POS (added May 2013)
REPEAT
ELSE_ AGAIN
END_IF
UNTIL_EQ (using Z flag)
CASE (using A, X, or Y) UNTIL_ZERO (using Z flag)
CASE_OF (using A, X, or Y) UNTIL_NEQ (using Z flag)
END_OF UNTIL_NOT_ZERO (using Z flag)
END_CASE UNTIL_PLUS (using N flag)
UNTIL_MINUS (using N flag)
UNTIL_NEG (using N flag)
FOR (16-bit. Overwrites A) UNTIL_C_CLR (using C flag)
NEXT (16-bit. Overwrites A) UNTIL_C_SET (using C flag)
UNTIL_GE (using C flag)
FOR_X (added May 2013) UNTIL_LT (using C flag)
NEXT_X (added May 2013) UNTIL_V_CLR (using V flag)
FOR_Y (added May 2013) UNTIL_V_SET (using V flag)
NEXT_Y (added May 2013) UNTIL_BIT (added May 2013)
plus a group of accessory macros I find useful:
RTS_IF_EQ RTS if Z flag is set
RTS_IF_NEQ RTS if Z flag is clear
RTS_IF_PLUS RTS if N flag is clear
RTS_IF_MINUS RTS if N flag is set
RTS_IF_FLAG_VAR RTS on a flag variable's condition. The variable name and target condition are given in the parameter list.
RTS_IF_BIT RTS if the specified bit of the specified byte in memory meets the target condition. These are given in the parameter list.
RTS_IF_MEM_LOC RTS if the value in the specified memory location is positive | negative | zero | non-zero, again per the parameter list.
I have not done a major 6502 project yet using the structure macros, but I have completed one commercial project using them on PIC16 and am well on my way to completing another one (the latter using two separate PIC16's), and the structures have made things vastly easier and more clear, without the memory and performance penalties of higher-level languages. It's still assembly and you still have full control, but does the same thing you would do by hand but keeps you from having to look at the ungly internal details over and over.