Re: fledgling assembler programmer

Thomas Koenig <tkoenig@netcologne.de>
Wed, 22 Mar 2023 06:49:31 -0000 (UTC)

          From comp.compilers

Related articles
fledgling assembler programmer Alan.Beck@darkrealms.ca (2023-03-21)
Re: fledgling assembler programmer gah4@u.washington.edu (gah4) (2023-03-21)
Re: fledgling assembler programmer tkoenig@netcologne.de (Thomas Koenig) (2023-03-22)
Re: fledgling assembler programmer anton@mips.complang.tuwien.ac.at (2023-03-22)
Re: fledgling assembler programmer david.brown@hesbynett.no (David Brown) (2023-03-22)
Re: fledgling assembler programmer gneuner2@comcast.net (George Neuner) (2023-03-22)
Re: fledgling assembler programmer gah4@u.washington.edu (gah4) (2023-03-22)
Re: fledgling assembler programmer tkoenig@netcologne.de (Thomas Koenig) (2023-03-23)
Re: fledgling assembler programmer arnold@skeeve.com (2023-03-23)
[15 later articles]
| List of all articles for this month |
From: Thomas Koenig <tkoenig@netcologne.de>
Newsgroups: comp.compilers
Date: Wed, 22 Mar 2023 06:49:31 -0000 (UTC)
Organization: news.netcologne.de
References: 23-03-001 23-03-002
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="27736"; mail-complaints-to="abuse@iecc.com"
Keywords: assembler
Posted-Date: 22 Mar 2023 15:06:01 EDT

gah4 <gah4@u.washington.edu> schrieb:
> On Tuesday, March 21, 2023 at 2:40:22 PM UTC-7, Alan Beck wrote:
>
>> I have started to learn Assembler out of an old book.


At the risk of stating the blindingly obvious: There is more
than one assembler language, each computer architecture has its
own (with extensions over time, too). There are also sometimes
different syntax variant, for example AT&T vs. Intel.


[...]


> Compilers today don't write out the generated code in the same way,


Quite the opposite.


The standard on UNIXy systems is to write out assemblly language to
a file, which is then further processed with the actual assembler.
Use "-S" to just generate the foo.s file from foo.c.


Plus, you can disassemble object files and programs with "objdump -d".


> and there aren't so many libraries around to read.


Not ones written in assembler. But it is possible to download
the source code to many libraries, for example glibc, and then
examine what it is compiled to.


Another possibility would be to use http://godbolt.org, which shows
you assembler generated for different systems with differnt options.
To really make sense of it for different architectures you are
not familiar with may be difficult, though). Or build clang/LLVM
yourself and set different options for the architecture.


>And, personally,
> 8086 is my least favorite to write assembly code in.


I like 6502 even less :-)


> Learning C, and thinking about pointers and addresses, is a good start
> toward assembly programming.


That, I agree with. And it helps a lot to also look at the
generated code.


[...]


> C programming works so well, that there are only a few
> things you can't do in C, and so need assembly programs.


Bringing it back a bit towards compilers: Reading assembler code is
a good way to see where they generate inefficient or (more rarely)
incorrect code. In some special cases, writing in assembler can
bring benefits of a factor of 2 or even 4 over compiler-generated
code, usually when SIMD is involved.


Assembler is a bit like Latin: For most people, there is no need
to speak or write, but one should be able to read it.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.