Author Topic: Convert ASM mnemonics to HEX (ASCII) ?  (Read 17584 times)

0 Members and 4 Guests are viewing this topic.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #15 on: December 04, 2013, 04:41:05 pm »
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).
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #16 on: December 04, 2013, 07:45:50 pm »
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?)


Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #17 on: December 05, 2013, 01:57:32 am »
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 ?
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #18 on: December 05, 2013, 09:40:44 am »
Quote from: Hayleia
... "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. :)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #19 on: December 05, 2013, 10:26:06 am »
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 :/

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #20 on: December 05, 2013, 11:33:27 am »
Quote from: Hayleia
... "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 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).
« Last Edit: December 05, 2013, 11:38:54 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Dapianokid

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 539
  • Rating: +46/-27
  • That one dude
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #21 on: December 05, 2013, 05:58:11 pm »
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
Keep trying.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #22 on: December 05, 2013, 06:17:57 pm »
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.
« Last Edit: December 05, 2013, 06:19:00 pm by Deep Thought »




Offline AssemblyBandit

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 374
  • Rating: +60/-1
  • ~AssemblyBandit~
    • View Profile
    • briandm82.com
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #23 on: December 05, 2013, 06:25:20 pm »
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.
« Last Edit: December 05, 2013, 06:27:10 pm by AssemblyBandit »

Offline Dapianokid

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 539
  • Rating: +46/-27
  • That one dude
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #24 on: December 05, 2013, 06:46:23 pm »
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.
Keep trying.

Offline AssemblyBandit

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 374
  • Rating: +60/-1
  • ~AssemblyBandit~
    • View Profile
    • briandm82.com
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #25 on: December 05, 2013, 07:17:18 pm »
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

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #26 on: December 06, 2013, 12:34:10 am »
OK, thanks all for the solutions, I'll try them all and see which one I like best ^^
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s