Omnimaga
Calculator Community => TI Calculators => General Calculator Help => Topic started by: Hayleia on December 04, 2013, 02:40:13 pm
-
Helloes
I am looking for some software that would (as the title says) convert a file with ASM mnemonics into HEX code.
For example, say that I have a file named "test.z80" with this inside:
xor a
ret
Then the software would return a file with AFC9 inside.
I don't really care if the program needs a header or not, or if it returns AF and C9 on separate lines, I'd just like a tool that converts, basically and I'll make adjustment myself if needed.
So does that exist ?
Note: I know RunerBot does that, but I'd like an offline solution (because I don't have any connexion when on the train).
Note2: Whatever OS you want it to be run with is ok, I have both Windows and Linux on my laptop.
-
I don't know if such a program exists, but you can always do it manually using a z80 instruction set. (http://clrhome.org/table/)
-
True, thanks for the table.
However, this can be painful for long programs :P
I also forgot to say which OS I wanted it to run on, because I don't care I have both Windows and Linux. I'll edit the first post.
-
have you considered using an on-calc editor, like mimas? (http://www.ticalc.org/archives/files/fileinfo/431/43140.html)
-
I am looking for some software that would (as the title says) convert a file with ASM mnemonics into HEX code.
Of course, that exists! It's called a z80 assembler!
Am i missing something?
-
I think (s)he whants a program to convert the assembly code to readable hexadecimal code, instead of into a binary program file.
-
With SPASM, you can use the -T command-line option to generate a code listing (as well as -O to not specify an output file). This won't give the hex by itself, though, it's a bit more verbose. Alternatively you can just output to a .bin file and use another tool to convert that to hex.
-
A z80 assembler (almost any will do!) produces "both" a binary AND a list output with the hex codes beside the asm mnemonics!
-
I think (s)he whants a program to convert the assembly code to readable hexadecimal code, instead of into a binary program file.
Yeah, that's it.
With SPASM, you can use the -T command-line option to generate a code listing (as well as -O to not specify an output file). This won't give the hex by itself, though, it's a bit more verbose.
Thanks, I've used SPASM to compile for a little while without even knowing it had options lol. But yeah, there are a bit too much things.
A z80 assembler (almost any will do!) produces "both" a binary AND a list output with the hex codes beside the asm mnemonics!
Well TASM doesn't because it doesn't even run in Win8 (and don't tell me "install Win7", I tried and it missed so many drivers that even the mouse was not recognized), and SPASM does but I don't want the "beside the asm mnemonics" part :P
I want only hex, plus things at the beginning or the end if you like, but not things that are hard to remove for lazy people :P
-
I know you said you wanted an offline solution, but maybe talk to Deep Thought about ORG (http://clrhome.org/asm/). It gives an option to output the hex.
-
I want only hex, plus things at the beginning or the end if you like, but not things that are hard to remove for lazy people :P
Well, with all that laziness, may i ask what do you need the hex codes for? x.x
-
I know you said you wanted an offline solution, but maybe talk to Deep Thought about ORG (http://clrhome.org/asm/). It gives an option to output the hex.
Good idea, he might have something that can do it.
I want only hex, plus things at the beginning or the end if you like, but not things that are hard to remove for lazy people :P
Well, with all that laziness, may i ask what do you need the hex codes for? x.x
It's not "all that laziness", I'd like to see you remove half the line on every line of a file everytime you compiled it :P
And it's to include ASM code into Axe code (because it is a lot better to design GUIs with Axe but the core of the program I am writing needs to be in ASM).
-
It's not "all that laziness", I'd like to see you remove half the line on every line of a file everytime you compiled it :P
A very simple program can do it for you, you don't need to edit the file yourself... :P
-
It's not "all that laziness", I'd like to see you remove half the line on every line of a file everytime you compiled it :P
A very simple program can do it for you, you don't need to edit the file yourself... :P
You just reminded me that NotePad++ supports column edition/selection, thanks :D
So yeah, using -T in SPASM then using NotePad++ to remove useless columns is a solution, but if anyone has better, I'll take it :)
-
Why not just use a hex dumper to dump the .bin file? You could write a script or batch file to do it automatically.
-
Why not just use a hex dumper to dump the .bin file? You could write a script or batch file to do it automatically.
I have a problem on each OS :P
- I could write a shell script on Ubuntu but I don't manage to setup SPASM (says some lib is missing and a "sudo apt-get install <that lib>" installs something that doesn't seem to be what was missing since it still says that lib is missing).
- SPASM works on Windows but I don't know anything to batch. But yeah, I am sure it is not complicated (like just two lines of code, one that launches SPASM and one that launches the dumper) so I guess I could try to read some tutorials (after finding a good hex dumper).
-
Here's a very simple vbs script ('cut.vbs') that may help you to achieve what you need.
Please find inside the attached archive (vbs-cut.zip):
1. Files:
ReadMe.txt - this file!
fire.lst - a sample output list file created with an assembler (NASM in this case)
hexa_codes.txt - the hexacodes stripped off from 'fire.lst'
2. How to use 'cut.vbs':
Execute it in a dos command prompt, like this:
"cscript cut.vbs > hexa_codes.txt
3. Test it with the provided sample first.
4. Adjust the parameters (which depend on your 'lst' output) inside the script (open it with Notepad)
Hope it helps to get you started. ;)
Caveat: Because this was generated with 'Windows Script Host' you still need to delete the first 2 lines of 'hexa_codes.txt' (not a big deal?)
-
Wow, thanks :D
I just have a little problem with your program: when I put fire.lst in C:\ it works, but when I put it in an other place like "E:\<full path>\fire.lst", then I change the line in your program where it's written "C:\fire.lst" to have the path I have instead, but it says (in French) "E:\<full path\cut.vbs(7, 1) Erreur d'exécution Microsoft UBScript: Chemin d'accès introuvable". Could this be because I have spaces in the path ?
-
... "Chemin d'accès introuvable". Could this be because I have spaces in the path ?
Well, that could well be the case, to be honnest, i dunno. But the 'Windows Script Host' is rather funky indeed. Take it as a 'proof of concept' only and learn to live with its shortcomings.
Of course, a much better utility can be written but that also requires some spare time, which atm i don't have. :)
-
It is likely due to spaces in the filepath name. Also, it seems that ClrHome is down, so I am thinking Deep Thought is too busy :/
-
... "Chemin d'accès introuvable". Could this be because I have spaces in the path ?
Well, that could well be the case, to be honnest, i dunno. But the 'Windows Script Host' is rather funky indeed. Take it as a 'proof of concept' only and learn to live with its shortcomings.
Of course, a much better utility can be written but that also requires some spare time, which atm i don't have. :)
Wow, something weird happened here, I remember editing my previous post twice but I don't see those edits anywhere O.O
I was saying that the problem doesn't come from spaces, I tried in another folder with spaces and it worked like a charm.
Anyway, it works in certain conditions, I'll just find a place where it works and where it doesn't bother me. Thanks for the utility :)
edit In fact I just messed things up and wrote my edits in the wrong post (http://ourl.ca/20259/369899) lol :P
Also, it seems that ClrHome is down, so I am thinking Deep Thought is too busy :/
Yeah, this is another reason why I wanted an offline solution. They always work (except when Microsoft makes stupid updates).
-
I wish I were here earlier to tell you to do what I used to do:
Output to .bin and use Notepad++ to view the hex of it and copy and paste that as your own file. :P BOOM. HeXsTrInGs
-
As I said in a PM you might be able to use this: http://www.ticalc.org/archives/files/fileinfo/168/16869.html
I've never used it myself but it looks relevant enough. (It's an unsquisher so it'll extract and display the ASCII hex.)
EDIT: Yeah, ClrHome is down because my PayPal derped and I need to renew my domain :/ I'm trying to get it up now, sorry about that.
-
The hex listing function in asm studio 8x exports a text file of the program in hex. Your program would have to be called test.asm I think.
-
The hex listing function in asm studio 8x exports a text file of the program in hex. Your program would have to be called test.asm I think.
I believe you can change the function to support different names. It might not accept arguments, but at least you can write something that will and use the function. Idk. I haven't used it in ages.
-
Yeah, it works with .z80, when opening the file just select 'All files' from the drop down box. Then click on 'Assembly' and select 'Hex Listing'. It creates test.txt with the following text:
test.txt - Hex Listing
2 bytes total
AF C9
-
OK, thanks all for the solutions, I'll try them all and see which one I like best ^^