I recently decided to use HXA to assemble EhBASIC. I wasn't sure how much effort would be involved with converting the source code syntax, but it turned out to be pretty simple. Here's the awk script I used:
Code:
BEGIN {
print ".cpu \"6502\""
print ".hexfile"
print ".listfile"
print ".srecfile"
}
{
if (/^\t.byte\t"."/) { gsub(/"/,"'") }
if (/\+[$0-9]+;/) { gsub(/;/," ;") }
if (/\t#\[/) { gsub(/\[/,"("); gsub(/\]/,")") }
if (/\t.byte\t"/ || /\t.byte\t\$.*"/) { gsub(/\.byte/,".string") }
print
if (/^VEC_SV/) { print "IRQ_vec = VEC_SV+2" }
}
- The BEGIN block sets the processor and tells HXA to generate output and listing files.
- The first if statement converts .byte "A" (or any other character) to .byte 'A'.
- The second if statement adds a space before the ; of a comment.
- The third if statement converts square brackets in an immediate operand expression to parentheses: #[expr] to #(expr)
- The fourth if statement converts .byte "str" and .byte $num1,...,"str" to .string "str" and .string $num1,...,"str"
- The final if adds a definition of IRQ_vec (it's defined in min_mon.asm, which I don't use).
I haven't tested EhBASIC exhaustively, but everything I've tried appears to be working. If someone wants to generate a .hex or .s19 from the original source code and compare that to the HXA output, have at it.