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

0 Members and 3 Guests are viewing this topic.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Convert ASM mnemonics to HEX (ASCII) ?
« 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.
« Last Edit: December 04, 2013, 02:50:28 pm 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 ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #1 on: December 04, 2013, 02:44:43 pm »
I don't know if such a program exists, but you can always do it manually using a z80 instruction set.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

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 #2 on: December 04, 2013, 02:49:39 pm »
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.
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 ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #3 on: December 04, 2013, 02:52:38 pm »
have you considered using an on-calc editor, like mimas?
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline SpiroH

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


Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #5 on: December 04, 2013, 02:55:10 pm »
I think (s)he whants a program to convert the assembly code to readable hexadecimal code, instead of into a binary program file.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #6 on: December 04, 2013, 02:56:43 pm »
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.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #7 on: December 04, 2013, 02:56:56 pm »
A z80 assembler (almost any will do!) produces "both" a binary AND a list output with the hex codes beside the asm mnemonics!

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 #8 on: December 04, 2013, 03:26:23 pm »
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 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 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 #9 on: December 04, 2013, 03:30:03 pm »
I know you said you wanted an offline solution, but maybe talk to Deep Thought about ORG. It gives an option to output the hex.

Offline SpiroH

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

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 #11 on: December 04, 2013, 03:35:49 pm »
I know you said you wanted an offline solution, but maybe talk to Deep Thought about ORG. 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).
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 #12 on: December 04, 2013, 03:40:10 pm »
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



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 #13 on: December 04, 2013, 03:57:24 pm »
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 :)
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 chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Convert ASM mnemonics to HEX (ASCII) ?
« Reply #14 on: December 04, 2013, 04:16:03 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.