6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 8:14 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Apr 08, 2019 2:21 am 
Offline
User avatar

Joined: Thu Mar 11, 2004 7:42 am
Posts: 362
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.


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 12, 2020 10:52 pm 
Offline

Joined: Sun Nov 08, 2009 1:56 am
Posts: 411
Location: Minnesota
Cool! :D


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 57 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron