AntonTreuenfels / HXA_Cross_Assembler

HXA is a macro assembler written in Thompson AWK.
GNU General Public License v2.0
5 stars 1 forks source link

Support agnostic case for directives #1

Open SongbirdPro opened 8 months ago

SongbirdPro commented 8 months ago

I'm using an old assembler from the 1990s, and it allows directives such as .EQ or .INCLUDE to be either upper or lower case. HXA fails with error when trying to use upper case directives.

image

AntonTreuenfels commented 8 months ago

Actually HXA does normalize all pseudo opcodes to lower case in a routine called "_normalize()" in "hxa_pseudo.py". Along with removing any prefixes such as "." and "#" (though I'm not completely happy with "#" as a prefix and may eventually remove it - it's handier as a comment symbol). I think what's happening is that "eq" is not a recognized pseudo opcode. HXA recognizes "equ" and "=" as synonyms, but those are the only ones it natively knows. Solutions I can think of off the top of my head (with varying degrees of difficulty): 1) alter the source code of the include file to change "eq" to "equ" or "="2) alter the source code of HXA by adding the entry { 'eq' : 'equ' } to the '_psAlias' dictionary in "hxa_pseudo.py"3) use the 'psalias' pseudo opcode to add 'eq' to the list of recognized pseudo opcodes at run time This last would be effective only for the assembly it is used in, but I put it there to deal with the very real likelihood of unrecognized pseudo opcodes and the painful process of changing source code to match. In your case I think a line like this: .psalias equ=eq somewhere before including "LYNX.INC" should work. Thanks for trying HXA! Regards, Anton Treuenfels PS. Oops, on actually paying attention to your image, I see HXA is telling you its version number is 0.201. That version was written in TAWK 5.0, which is a very nice language but not open source, nor one you can easily change. That means (2) is not an option for you. The latest version is 1.002, which I released just this year and is written in Python 3.11.4. On Monday, February 12, 2024 at 11:03:51 PM CST, Songbird Productions @.***> wrote:

I'm using an old assembler from the 1990s, and it allows directives such as .EQ or .INCLUDE to be either upper or lower case. HXA fails with error when trying to use upper case directives.

image.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

SongbirdPro commented 8 months ago

Thanks for the feedback! I did not realize there was a Python version. I'll have to check it out.

Right, I realized the different mnemonics for the directives could also be the problem. The very old 65c02 assembler I am using recognizes for example: .eq, .equ, .inc, .include. And those can be lower case or upper case. # is also recognized as a preprocessor directive, for example:

if 0 = 1

; Any code here will be ignored by the assembler

endif

Regards,

Carl

On Tue, Feb 13, 2024 at 10:01 AM Anton Treuenfels @.***> wrote:

Actually HXA does normalize all pseudo opcodes to lower case in a routine called "_normalize()" in "hxa_pseudo.py". Along with removing any prefixes such as "." and "#" (though I'm not completely happy with "#" as a prefix and may eventually remove it - it's handier as a comment symbol). I think what's happening is that "eq" is not a recognized pseudo opcode. HXA recognizes "equ" and "=" as synonyms, but those are the only ones it natively knows. Solutions I can think of off the top of my head (with varying degrees of difficulty): 1) alter the source code of the include file to change "eq" to "equ" or "="2) alter the source code of HXA by adding the entry { 'eq' : 'equ' } to the '_psAlias' dictionary in "hxa_pseudo.py"3) use the 'psalias' pseudo opcode to add 'eq' to the list of recognized pseudo opcodes at run time This last would be effective only for the assembly it is used in, but I put it there to deal with the very real likelihood of unrecognized pseudo opcodes and the painful process of changing source code to match. In your case I think a line like this: .psalias equ=eq somewhere before including "LYNX.INC" should work. Thanks for trying HXA! Regards, Anton Treuenfels PS. Oops, on actually paying attention to your image, I see HXA is telling you its version number is 0.201. That version was written in TAWK 5.0, which is a very nice language but not open source, nor one you can easily change. That means (2) is not an option for you. The latest version is 1.002, which I released just this year and is written in Python 3.11.4. On Monday, February 12, 2024 at 11:03:51 PM CST, Songbird Productions @.***> wrote:

I'm using an old assembler from the 1990s, and it allows directives such as .EQ or .INCLUDE to be either upper or lower case. HXA fails with error when trying to use upper case directives.

image.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/AntonTreuenfels/HXA_Cross_Assembler/issues/1#issuecomment-1941870194, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXA75TB3MBN6VNB3UZTKKTTYTOE7NAVCNFSM6AAAAABDF3QS46VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBRHA3TAMJZGQ . You are receiving this because you authored the thread.Message ID: @.***>