1

To answer my own question here, I wrote a small sample program, example.asm:

var_1 equ H'0001'

    constant var_2=H'0002'

#define var_3 H'0003'

cblock H'0004'
    var_4
endc

    END

and compiled it with gpasm using the instructions here, Makefile

all: example.asm    
    gpasm -p p10f200 example.asm 

clean:
    rm -f *.hex *.lst *.cod *.asm~ 

Now inspecting the example.hex file with hexdump -C example.hex, I get:

00000000  3a 30 32 30 30 30 30 30  34 30 30 30 30 46 41 0a  |:020000040000FA.|
00000010  3a 30 30 30 30 30 30 30  31 46 46 0a              |:00000001FF.|
0000001c

which I have no clue how to interpret, and the objdump -d example.hex, throws this error:

example.hex:     file format ihex

objdump: can't disassemble for architecture UNKNOWN!

eventually I want to know what are the differences between the above four different methods of defining a constant and compare their performance and memory efficiency.

6
  • Isn't .hex already a text file? Looks like you're hex-dumping an ASCII hex dump, not a .bin Commented Feb 7, 2022 at 22:22
  • Dear @PeterCordes , My apologies. I am absolutely ignorant about the topic. My final goal is to compare the compiled version of the above four syntax and see the differences. Where did I go wrong, and how should I do that instead?
    – Foad
    Commented Feb 7, 2022 at 22:38
  • 1
    They're text files, so diff -u foo1.hex foo2.hex. And/or just look at them with a text editor you know how to use, or a GUI diff tool like meld. Of course, you don't use any of the constants, so like we explained in comments on your SO question, no part of the assemblers output corresponds to them at all; your output is the same as for an empty file. And if you did use them, they'd all be equivalent (or would be if you'd used the same numbers) Commented Feb 7, 2022 at 22:58
  • you are defining not using there will be no assembly generated for defines and no efficiency calculations can be done you need to burn cycles for calculating efficiency performance , etc
    – blabb
    Commented Feb 8, 2022 at 10:22
  • 1
    there seems to be a gpdasm available as per the doc link you posted which is capable of taking the hex file and disassemble it why not try using it instead of hexdump or objdump ?
    – blabb
    Commented Feb 8, 2022 at 10:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.