1830207 Members
1163 Online
109999 Solutions
New Discussion

assembler developer

 
SOLVED
Go to solution
Hoang Minh Tuan
Regular Advisor

assembler developer

Hi all
I'm a HP-UX system administrator, I know fuzziness about assembler language. For the work, a program developer want me to install assembler software for him. So, anyone can summarize what it's used for and guide me to this free/trial software.
Thanks in advance and highly appreciate
Bus wait at bus station, Work wait at my work station
12 REPLIES 12
Sanjiv Sharma_1
Honored Contributor

Re: assembler developer

Stefan Farrelly
Honored Contributor

Re: assembler developer

http://webster.cs.ucr.edu/AsmTools/index.html

Lots of free assemblers here, including the Gnu version.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Mark Grant
Honored Contributor

Re: assembler developer

Just a quick explanation of what it is.

All programs that run on a computer end up "machine code". They are conevrted to this either when they are compiled or at run time. An assembler is a program that allows you to write a program almost in machine code. It specifies mnemonics for the various instructions the CPU understands and these are basically what the programmer types in. The upside is it's blindingly quick and it allows fine grained control over all aspects of your machine. The downsides are it is architecture specific, it takes a lot longer write and it is a nightmare to debug someone elses code. Also, there aren't so many programmers these days that can write in assembler.
Never preceed any demonstration with anything more predictive than "watch this"
Hoang Minh Tuan
Regular Advisor

Re: assembler developer

Thank to Sanjiv , I followed your link mgtek.com...It has only 2 file when I extracted it , no other help, introduction or example information so it 's difficult to use it.
After that, I follow Stefan's link but it do not point exactly what I need (assembler for HP-UX). So could you please give me the links in more detail.
Thanks to all
Bus wait at bus station, Work wait at my work station
Laurent Menase
Honored Contributor

Re: assembler developer

There is no need of anyt special install
you can use
cc the c compiler frontend.
/usr/ccs/bin/as the assembler.
The difference will be that cc will use the c preprocessor before assembling.

to make an example:
xx.c:
int foo(){return 1;}
main(){printf("%d\n",foo());}

generate the assembly xx.s for xx.c
cc -S xx.c

then you can assemble xx.s with
cc xx.s -c
or
as xx.s

cc xx.o -o xx
or
ld /opt/langtools/lib/crt0.o xx.o -u main -lc -o xx
Hoang Minh Tuan
Regular Advisor

Re: assembler developer

Thanks Laurent Menase giving me an practical introduction in detail. I do follow you and it's OK. I give the same way to my program developer. In addition, he ask me to has any way to deassembly or tools(free/trial) to do this (it's very important).
Hope see your reply soon
Bus wait at bus station, Work wait at my work station
A. Clay Stephenson
Acclaimed Contributor

Re: assembler developer

Many old flavors of UNIX came with a 'dis' utility for disassembly. To a limited extent, you can disassemble with both adb and gdb but I don't know of a good PA-RISC disassembler that is readily available.

There are very few times now, even for writing device driver code, where an assembler is needed. You can always use the asm directive within C to generate assembly but I literally have not needed to use assembly in almost 10 years. Of course, an assembler is available with either the HP C compiler of the Gnu C compiler.

There are very few legitimate uses for a disassembler these days unless you are trying to reverse engineer someone's code -- which is almost always not a legitimate use.
If it ain't broke, I can fix that.
Laurent Menase
Honored Contributor
Solution

Re: assembler developer

gdb or adb ( or xdb on 10.20).

all are debuggers, but do not find the name of
a variable which is used for instance I modified my orinal program:
int titi;
toto()
{return titi++; }
with
gdb xx
gdb> disass toto
0x2828 : nop
0x282c : nop
0x2830 : nop
0x2834 : addil L'0,%dp,%r1
0x2838 : ldw 0x40(%r1),%ret0
0x283c : ldo 1(%ret0),%r31
0x2840 : addil L'0,%dp,%r1
0x2844 : stw %r31,0x40(%r1)
0x2848 : copy %ret0,%ret0
0x284c : ret
0x2850 : nop
with adb:

echo toto,10?ia| adb xx
or
adb xx
adb>toto,10?ia
toto:
toto: NOP
toto+4: NOP
toto+8: NOP
toto+0xC: ADDIL L%0x0,r27,r1
toto+10: LDW 64(r1),r28
toto+14: LDO 1(r28),r31
toto+18: ADDIL L%0x0,r27,r1
toto+1C: STW r31,64(r1)
toto+20: COPY r28,r28
toto+24: BVE (r2)
toto+28: NOP
main:
main: NOP
main+4: STW r2,-20(r30)
main+8: LDO 64(r30),r30
main+0xC: LDIL L%0x2800,r31
main+10: BE,L 0x28(sr4,r31),sr0,r31
main+14:

titi is at 64(r27)
toto+0xC: ADDIL L%0x0,r27,r1
toto+10: LDW 64(r1),r28
is addil LR'titi-$global$,%r27,%r1
LDW RR'titi-$global$(%r1),%r28
r27 always point to $global$
Hoang Minh Tuan
Regular Advisor

Re: assembler developer

It's very good with the Clay's guide, especial Laurent's.
As I read the man page, adb/gdb supports only execute(run) files (is it true?), not library files. He need disassembly a library file (???.a file that C using). So do you have another way to do this
Bus wait at bus station, Work wait at my work station
Laurent Menase
Honored Contributor

Re: assembler developer

You have gnu binutil
http://hpux.cs.utah.edu/hppd/hpux/Gnu/gcc-3.3.2/

objdump --reloc --disassemble-all xx.o
Hoang Minh Tuan
Regular Advisor

Re: assembler developer

Thank Laurent very much for helping me enthusiastically. I did follow you and it's seem to be OK but my programmer hasn't still completely satisfied because his aim is:
" I 's a program written by C , compiled in HP-PA1.0 HP-UX11.0 and it links with some library files in SOM (System Object Module) format. Do you have any way to compile this program in Itanium HP-UX 11.23."
Best regarded
Bus wait at bus station, Work wait at my work station
Laurent Menase
Honored Contributor

Re: assembler developer

Hi Hoang,

Do you want to link or compile and link.

Mainly install 11.0 gcc environnement. you will have gas, and gcc.

Else you can try to copy a 11.11 dev environment in a subdir of your 11.23.
then chroot to that subdir before compilation.