[sdiy] Hiss, Crackle, and Pop
Phillip Harbison
alvitar at xavax.com
Wed Apr 5 01:57:54 CEST 2017
MTG wrote:
> Them's fightin words. ;-)
Spoken like a true K&R fan! I've been using C since 1982 and
assembler since 1978 for various processors including 6502,
6801, 6809 68K, 88K, 8080, x86, Z80, VAX-11, PowerPC, and the
Univac 1100. Writing assembler for any of those which have an
orthogonal instruction set is not too bad; however, I would
still prefer to write in C. I usually use assembler only for
things like the power-on reset code and interrupt handlers,
and even those are short snippets that call C code ASAP.
> If it's in the memory map you can get at it. Use the address
> as a pointer, done. [...]
In addition to that, learn the structure padding rules or your
compiler and create structs that map the hardware registers.
It is still worthwhile to know assembler and understand how C
code is compiled. I don't normally encourage premature code
optimization (there's a pill for that) but this is one case
where you might consider it. For example, the 68K had extdnd
byte to word and extend word to long, but not extend byte to
long. Spend time looking at the code you'll learn to avoid
using signed characters in C.
This song sums it up nicely (with apologies to The Beatles).
http://www.poppyfields.net/filks/00259.html
Write in C
(to the tune of "Let It Be")
When I find my code in tons of trouble,
Friends and colleagues come to me,
Speaking words of wisdom:
"Write in C."
As the deadline fast approaches,
And bugs are all that I can see,
Somewhere, someone whispers:
"Write in C."
Write in C, Write in C,
Write in C, oh, Write in C.
LOGO's dead and buried,
Write in C.
I used to write a lot of FORTRAN,
For science it worked flawlessly.
Try using it for graphics!
Write in C.
If you've just spent nearly 30 hours
Debugging some assembly,
Soon you will be glad to
Write in C.
Write in C, Write in C,
Write in C, yeah, Write in C.
Only wimps use BASIC.
Write in C.
Write in C, Write in C
Write in C, oh, Write in C.
Pascal won't quite cut it.
Write in C.
Write in C, Write in C,
Write in C, yeah, Write in C.
Don't even mention COBOL.
Write in C.
And all worthy hackers said "Amen".
--
Phil Harbison
More information about the Synth-diy
mailing list