Space Pirate
Join Date: May 2004
Location: Atlanta
|
I ran across this article on the pros and cons of learning assembly language. I am posting this for nostalgia, as I played with learning it on my old Atari 800xl and always considered people who could code in assembly language to be wizards.
https://www.allaboutcircuits.com/tec...e-development/ ... |
quote |
Lord of the Rant.
Formerly turtle2472 Join Date: Mar 2005
Location: Upstate South Carolina
|
You know, at one point I almost started learning assembly back in the 90's I think? I opted against it for C++. Of course, that was long ago and I don't know either now.
![]() Louis L'Amour, “To make democracy work, we must be a notion of participants, not simply observers. One who does not vote has no right to complain.” Visit our archived Minecraft world! | Maybe someday I'll proof read, until then deal with it. |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Wow, this is weirdly timely. Two weeks ago, I participated in a security capture-the-flag (CTF) event, and some of the challenges required me to take compiled binaries and look at their assembly or run them through a decompiler (and also run with gdb breakpoints) to help understand what they were doing so I could find the flag.
I was very quickly reminded of my appreciation for higher-level languages. ![]() The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
As I understand it, 30 years ago you couldn't count on compilers to yield clean code, and hardware was far less capable. I still think you're an ultimate wizard if you can understand how to write spare code at the atomic level.
So Brad=Wizard. Turtle is a Mage. ... |
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
Nailed it
![]() ... |
quote |
Lord of the Rant.
Formerly turtle2472 Join Date: Mar 2005
Location: Upstate South Carolina
|
![]() |
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
Today is the first day that I read this historic tale.
Code:
Real Programmers write in FORTRAN.
Maybe they do now,
in this decadent era of
Lite beer, hand calculators, and "user-friendly" software
but back in the Good Old Days,
when the term "software" sounded funny
and Real Computers were made out of drums and vacuum tubes,
Real Programmers wrote in machine code.
Not FORTRAN. Not RATFOR. Not, even, assembly language.
Machine Code.
Raw, unadorned, inscrutable hexadecimal numbers.
Directly.
Lest a whole new generation of programmers
grow up in ignorance of this glorious past,
I feel duty-bound to describe,
as best I can through the generation gap,
how a Real Programmer wrote code.
I'll call him Mel,
because that was his name.
I first met Mel when I went to work for Royal McBee Computer Corp.,
a now-defunct subsidiary of the typewriter company.
The firm manufactured the LGP-30,
a small, cheap (by the standards of the day)
drum-memory computer,
and had just started to manufacture
the RPC-4000, a much-improved,
bigger, better, faster --- drum-memory computer.
Cores cost too much,
and weren't here to stay, anyway.
(That's why you haven't heard of the company,
or the computer.)
I had been hired to write a FORTRAN compiler
for this new marvel and Mel was my guide to its wonders.
Mel didn't approve of compilers.
"If a program can't rewrite its own code",
he asked, "what good is it?"
Mel had written,
in hexadecimal,
the most popular computer program the company owned.
It ran on the LGP-30
and played blackjack with potential customers
at computer shows.
Its effect was always dramatic.
The LGP-30 booth was packed at every show,
and the IBM salesmen stood around
talking to each other.
Whether or not this actually sold computers
was a question we never discussed.
Mel's job was to re-write
the blackjack program for the RPC-4000.
(Port? What does that mean?)
The new computer had a one-plus-one
addressing scheme,
in which each machine instruction,
in addition to the operation code
and the address of the needed operand,
had a second address that indicated where, on the revolving drum,
the next instruction was located.
In modern parlance,
every single instruction was followed by a GO TO!
Put *that* in Pascal's pipe and smoke it.
Mel loved the RPC-4000
because he could optimize his code:
that is, locate instructions on the drum
so that just as one finished its job,
the next would be just arriving at the "read head"
and available for immediate execution.
There was a program to do that job,
an "optimizing assembler",
but Mel refused to use it.
"You never know where it's going to put things",
he explained, "so you'd have to use separate constants".
It was a long time before I understood that remark.
Since Mel knew the numerical value
of every operation code,
and assigned his own drum addresses,
every instruction he wrote could also be considered
a numerical constant.
He could pick up an earlier "add" instruction, say,
and multiply by it,
if it had the right numeric value.
His code was not easy for someone else to modify.
I compared Mel's hand-optimized programs
with the same code massaged by the optimizing assembler program,
and Mel's always ran faster.
That was because the "top-down" method of program design
hadn't been invented yet,
and Mel wouldn't have used it anyway.
He wrote the innermost parts of his program loops first,
so they would get first choice
of the optimum address locations on the drum.
The optimizing assembler wasn't smart enough to do it that way.
Mel never wrote time-delay loops, either,
even when the balky Flexowriter
required a delay between output characters to work right.
He just located instructions on the drum
so each successive one was just *past* the read head
when it was needed;
the drum had to execute another complete revolution
to find the next instruction.
He coined an unforgettable term for this procedure.
Although "optimum" is an absolute term,
like "unique", it became common verbal practice
to make it relative:
"not quite optimum" or "less optimum"
or "not very optimum".
Mel called the maximum time-delay locations
the "most pessimum".
After he finished the blackjack program
and got it to run
("Even the initializer is optimized",
he said proudly),
he got a Change Request from the sales department.
The program used an elegant (optimized)
random number generator
to shuffle the "cards" and deal from the "deck",
and some of the salesmen felt it was too fair,
since sometimes the customers lost.
They wanted Mel to modify the program
so, at the setting of a sense switch on the console,
they could change the odds and let the customer win.
Mel balked.
He felt this was patently dishonest,
which it was,
and that it impinged on his personal integrity as a programmer,
which it did,
so he refused to do it.
The Head Salesman talked to Mel,
as did the Big Boss and, at the boss's urging,
a few Fellow Programmers.
Mel finally gave in and wrote the code,
but he got the test backwards,
and, when the sense switch was turned on,
the program would cheat, winning every time.
Mel was delighted with this,
claiming his subconscious was uncontrollably ethical,
and adamantly refused to fix it.
After Mel had left the company for greener pa$ture$,
the Big Boss asked me to look at the code
and see if I could find the test and reverse it.
Somewhat reluctantly, I agreed to look.
Tracking Mel's code was a real adventure.
I have often felt that programming is an art form,
whose real value can only be appreciated
by another versed in the same arcane art;
there are lovely gems and brilliant coups
hidden from human view and admiration, sometimes forever,
by the very nature of the process.
You can learn a lot about an individual
just by reading through his code,
even in hexadecimal.
Mel was, I think, an unsung genius.
Perhaps my greatest shock came
when I found an innocent loop that had no test in it.
No test. *None*.
Common sense said it had to be a closed loop,
where the program would circle, forever, endlessly.
Program control passed right through it, however,
and safely out the other side.
It took me two weeks to figure it out.
The RPC-4000 computer had a really modern facility
called an index register.
It allowed the programmer to write a program loop
that used an indexed instruction inside;
each time through,
the number in the index register
was added to the address of that instruction,
so it would refer
to the next datum in a series.
He had only to increment the index register
each time through.
Mel never used it.
Instead, he would pull the instruction into a machine register,
add one to its address,
and store it back.
He would then execute the modified instruction
right from the register.
The loop was written so this additional execution time
was taken into account ---
just as this instruction finished,
the next one was right under the drum's read head,
ready to go.
But the loop had no test in it.
The vital clue came when I noticed
the index register bit,
the bit that lay between the address
and the operation code in the instruction word,
was turned on ---
yet Mel never used the index register,
leaving it zero all the time.
When the light went on it nearly blinded me.
He had located the data he was working on
near the top of memory ---
the largest locations the instructions could address ---
so, after the last datum was handled,
incrementing the instruction address
would make it overflow.
The carry would add one to the
operation code, changing it to the next one in the instruction set:
a jump instruction.
Sure enough, the next program instruction was
in address location zero,
and the program went happily on its way.
I haven't kept in touch with Mel,
so I don't know if he ever gave in to the flood of
change that has washed over programming techniques
since those long-gone days.
I like to think he didn't.
In any event,
I was impressed enough that I quit looking for the
offending test,
telling the Big Boss I couldn't find it.
He didn't seem surprised.
When I left the company,
the blackjack program would still cheat
if you turned on the right sense switch,
and I think that's how it should be.
I didn't feel comfortable
hacking up the code of a Real Programmer. ... |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
That's a neat story and highlights how "programming" as a skill used to be much more about knowing the peculiar ins and outs of the physical hardware you were operating with.
![]() It also reminds me how every generation of programmers has its gatekeepers… Rust? Real programmers don't need memory protection. Swift? Real programmers don't use Macs or iPhones. JavaScript? Real programmers don't just work in a web browser. Python? Ruby? Real programmers don't use interpreted languages. Java? Real programmers don't need virtual machines. Objective C? Real programmers don't use Macs. C++? Real programmers don't need classes and exceptions. C? Real programmers don't need structs and memory management. Pascal? Real programmers don't need procedures. Assembly? Real programmers don't need human-readable "words". Machine code? Real programmers don't need, uhh, programs. These are just a few "complaints" off the top of my head, and I've actually run into most of these in my years. ![]() Of course, only after I wrote all this out did I remember there's a classic XKCD for this. ![]() Brainfuck and Whitespace, though? Now those are a real programmer's programming languages. ![]() … * I was shocked to find the little badge by name name telling me that my code helped NASA's Ingenuity Mars Helicopter mission a couple years ago. I'd argue my inclusion was more of a technicality, and there's a slim-to-none chance that anyone on the project actually read or used what I wrote, but I did contribute once to Python's "cpython" project, and Python was a key language in that mission. The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting. |
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
Bespoke Programming is so 1900s 🤣
And I deeply appreciate ALL memes that reference gatekeeping and belittling new technology, because it's just so human. btw: THAT IS SUCH A COOL THING TO DROP INTO THE MICETYPE!! ... |
quote |
Member
Join Date: May 2004
|
Speed and footprint. Not things that programmers are particularly concerned about with today's hardware.
There used to be a text editor for the Mac written in assembly for that reason, but I don't remember what it was. I was never advanced with my hardware design, but assembly was my favorite when programming microcontrollers because writing to a registers controls your port outputs. Of course, there are higher level languages to do that, but for the complexity I was dealing with, it felt satisfying to be in control. Then again, this is me in high school: "Calculator? Why do I need a calculator. That's what paper, pencil, and a slide rule are for (while looking fondly at my book of log tables). |
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
It's numbers all the way down, man.
![]() ... |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
|
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
Thank God I'm still useful for SOMETHING
![]() ... |
quote |
Likes his boobies blue.
Join Date: May 2004
Location: Hell
|
God I love this thread. XD
For the physics degree at the Univ of Washington back in the stone age, we had a lab class that was, literally, build a Motorola 6800 based logic board, then interface it with some other piece of apparatus in the lab and do something interesting. Two partners built the logic board. Input was a hexadecimal keypad, output was an 8 character LCD screen... so yes, it was all assembler, hand translated to hex and punched in one character at a time, in sequence, into memory. Which was volatile. Partner hooked it up to an ultrasonic pinger to measure distance. I asked if I could piggyback on his data, and instead of interfacing with an input device, interface with the oscilloscope instead. Prof was confused, but said 'have fun'. X-Y leads on the scope turned it into a CRT. I wrote a differentiation function that took the distance data, turned it into velocity data, then into acceleration data, and with pressing '1', '2' or '3' would display the d, v, and a on the scope as a graph. '4' would display all three at once. In a total of 4096 bytes of RAM. Rare to dust off those skills, but sometimes it's still useful. @kickaha@social.seattle.wa.us #IRC isn't old school... Old school is being able to say 'finger me' with a straight face. |
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
I hope that anecdotal stories like this (awesome one) are being centrally preserved somewhere, as they're terribly insightful into the mindset of coders from the those days.
|
quote |
Lord of the Rant.
Formerly turtle2472 Join Date: Mar 2005
Location: Upstate South Carolina
|
I found my punch tape I used to program a YUK-7 with my teletype and RD-358 while I was in C School in the Navy.
Sadly I don't have access to the tape reader anymore so I can't even load it now. But I still have it! Louis L'Amour, “To make democracy work, we must be a notion of participants, not simply observers. One who does not vote has no right to complain.” Visit our archived Minecraft world! | Maybe someday I'll proof read, until then deal with it. |
quote |
Space Pirate
Join Date: May 2004
Location: Atlanta
|
I have LOTS of Dictaphone recording machines my dad saved from his work with them in the 60s-80s. They will not work, but they're glorious devices. I may have the world's largest Dictaphone collection, from machines to printed material to recording media to cabinets. It's going to be a restoration process but I can't begin until after I finish cleaning out the crap from the basement.
... |
quote |
Posting Rules | Navigation |
|
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
x86 Assembly in OS X | evan | Programmer's Nook | 3 | 2010-04-15 01:56 |
Assembly | evan | Programmer's Nook | 5 | 2010-03-25 23:37 |
Code | Banana | AppleOutsider | 1 | 2006-04-25 21:15 |
Code | Banana | AppleOutsider | 1 | 2006-04-25 21:15 |
Insult my code (pt. 1) | chucker | Programmer's Nook | 43 | 2006-04-20 14:39 |