+ 22
Assembly Language?
How many here have programmed in one or more machine's actual hardware instructions?
8 ответов
+ 8
Aye, and I'll probably still do it. I recently watched a Python video where knowing how the architecture worked yielded several thousand times better runtime (in cython) by just rearranging a few operations. I've also beaten optimizers by inlining assembly.
There are also a number of instructions that you can't get to without using assembly, and aren't selected by optimizers.
+ 28
Dear John,
A knowledgeable and veteran programmer like you is a treasure for this community. Hopefully, learners link me can learn some REAL and hardly-achieved lessons and techniques from you.
+ 13
I've programmed over 20 different hardware instruction sets starting with CDC Mainframe at college followed by IBM 360 mainframe and DEC System 10. Then various mini computers like DEC PDP. Finally, tons of microprocessors.
+ 7
@Tor, if one instruction programmed executes as one instruction the hardware processed, yes. I don't know either of those. Instructions look like:
LOD A,#1200
LOD B,#1202
ADD A,B
STO A,#1204
This loads the data at 1200 and 1202 into registers, adds them updating A, and puts the result into 1204. C++ or Java would code:
int a,b,result;
...
result=a+b;
+ 6
Back in the 90s I messed around with it, but it was only useful to me as a learning experience and nothing more. I haven't messed with it since then.
+ 6
It helps to be able to read assembly even if you'll write in a higher language.
There are some real gems there, e.g., this assembly I pulled forward (from AMD's 64-bit processors guide):
https://code.sololearn.com/cZX2I8giW2zV/?ref=app
"Populaton count" counts bits set in a bit string, in parallel.
I also included a "BSR" inline, which returns the most significant bit set in a single instruction.
Though trivial, it's something you won't usually see from a compiler's optimizer.
+ 6
In college, I convinced my professor to spend two classes of the intro to programming class to look at an assembly output of their working basic program (IBM 360 code). After they got graded on the program, I took the best written and generated the code to run it. I taught the class in two parts, architecture & simple examples of usage on day one and going through the code of the program the second. It was a major hit and the professor continued teaching that course in that way.
+ 3
Does TIS-100 video game count? Or SHENZHEN I/O?