lst2sym - tool for OSDK+Oricutron users
Posted: Fri Mar 11, 2016 12:00 pm
EDIT: This tool is useful only if you use newer version of XA, else the XA from OSDK works perfect 'as is'!
lst2sym is little tool for converting XA's output lst file to compatible Oricutron's input symbol file.
Here are sample source file, explanation of lst2sym usage and the result in Oricutron:
Usage:
compile source with XA: xa -M -W -bt 1536 -o test -l test.lst test.asm
This will generate LST file:
one, 0x0001, 0, 0x0000
two, 0x0002, 0, 0x0000
hex_80, 0x0080, 0, 0x0005
main, 0x0600, 0, 0x0000
convert LST to SYM: lst2sym test.lst test.sym
Now SYM file contains the symbols sorted by their address in Oricutron symbol-file format:
0001 one
0002 two
0080 hex_80
0600 main
... add TAP header: header test test.tap 1536
... and run Oricutron: oricutron -ma -r1536 -s test.sym test.tap
( -r1536 defines break-point at $600 and you can see in the disassembly window all symbols) Attached lst2sym-demo.zip contains:
- the source code of lst2sym in paranoiac pure ANSI-C
- all files mentioned in the above demo. Taking the risk to make this post boring long here is the history of lst2sym:
It was born as lua script:
... than simple bash command:
cat test.lst |awk '{ print $2 $1 }'| sed -e 's/^0x//g' -e 's/,/ /g' > test.sym
... and finished in C source - to be suitable for integration in the OSDK
I hope this will be useful for all Oric developers!
lst2sym is little tool for converting XA's output lst file to compatible Oricutron's input symbol file.
Here are sample source file, explanation of lst2sym usage and the result in Oricutron:
Code: Select all
; test.asm for lst2asm
.zero
one = 1
two = 2
* = $80
hex_80 .byt 0
.text
* = $600
main
lda one
ldy two
sta (hex_80),y
jmp main
compile source with XA: xa -M -W -bt 1536 -o test -l test.lst test.asm
This will generate LST file:
one, 0x0001, 0, 0x0000
two, 0x0002, 0, 0x0000
hex_80, 0x0080, 0, 0x0005
main, 0x0600, 0, 0x0000
convert LST to SYM: lst2sym test.lst test.sym
Now SYM file contains the symbols sorted by their address in Oricutron symbol-file format:
0001 one
0002 two
0080 hex_80
0600 main
... add TAP header: header test test.tap 1536
... and run Oricutron: oricutron -ma -r1536 -s test.sym test.tap
( -r1536 defines break-point at $600 and you can see in the disassembly window all symbols) Attached lst2sym-demo.zip contains:
- the source code of lst2sym in paranoiac pure ANSI-C
- all files mentioned in the above demo. Taking the risk to make this post boring long here is the history of lst2sym:
It was born as lua script:
Code: Select all
local function error(s) print(s); os.exit(-1) end
if 2 ~= #arg then error("Usage: "..arg[0].." <in file> <out file>") end
local fi = io.open(arg[1],"r") or error("Can't open '"..arg[1].."'")
local fo = io.open(arg[2],"w") or error("Can't open '"..arg[2].."'")
for l in fi:lines() do
l = l:gsub("\n",""):gsub("\r",""):gsub(" ","")
l:gsub("([^,]*),([^,]*),([^,]*),([^,]*)",
function(s,a) fo:write(a:gsub("0x","")," ",s,"\n") end)
end
fo:close()
fi:close()
cat test.lst |awk '{ print $2 $1 }'| sed -e 's/^0x//g' -e 's/,/ /g' > test.sym
... and finished in C source - to be suitable for integration in the OSDK
I hope this will be useful for all Oric developers!