ASM
grumpygamer.com
grumpygamer.com
I learned how to program in Basic on a Casio25 calculator, and later on a TI82 (the Casio couldn't do key polling, and my parents wouldn't buy me a new calculator just for programming. So I broke it on purpose to get a new one. Sorry mom! I later got a TI-83, while all my friends had overpowered TI89-92; the underpowered nature of the TI-83 felt more romantic and elegant to me.)
2 friends and I got really into programming, making tons of games in BASIC. I made a grid based SimCity clone, a turn by turn clone of [1], a very slow dungeon crawler inspired by Diablo (my parents were fairly antivideogames, so my way of experiencing the games I wanted to play was to program clones of them), a flexible "engine" for text adventures (I was really into pen and paper RPGs but none of my friends were into it), etc.
Then one day we discovered assembly, and our mind was blown. We would sneakily use the library computers to print z80 reference sheets; it was awesome.
Middle & high school were awful times all around for me, but this definitely made it better.
[1]: http://en.wikipedia.org/wiki/Star_Wars:_Galactic_Battlegroun...
That's exactly why I couldn't be happy if I only knew some high level languages like Java / Python / C#.
After learning an assembly language and C I feel much more comfortable using any other language. You know the real thing.
It's all good. Some people are happy in a single niche, some never are.
It goes on forever.
Sadly, we live in a world where the lie that compilers can optimize better than humans is widely spread. The reality is, compilers can optmize better than your everyday-javaguy (the kind of person who believes you can just throw more processing power at a problem while the programmer just needs to abstract ad nauseam).
I like using frameworks, libraries, high-level languages as much as anyone in here, but I know ASM will always be faster, just not always suitable for the issue.
In what way? (Not meant to be accusing, just curious)
Compiling is just translating source code in one language into code in another.
You touched on the reason: compiling is translating one language to another. Assembly code is not changing language, just replacing symbols from human-convenient to machine-convenient, more like encryption.
You wouldn't consider Pig Latin a different language from English, it's just a straightforward mangling thereof.
Its not quite a one-to-one mapping though.
For example, there are assembly instructions which map to more than one opcode, depending on how it is used and opcodes can have various flags that change its encoding (prefixes and such), like the MOV x86 instruction. Beyond that, it is also rare to find assembly code which does not make use of macros or assembler-implemented pseudo instructions.
http://stackoverflow.com/questions/2546715/how-to-analysis-h...
Obviously the distinction being made is that "assemblers", even in the days of 8 bit CPUs (and earlier!) have always been able to translate at or near the speed of the I/O required to read the data. So there's an intuition that says they're "instantly fast" and thus deserve their own name.
When I rewrote it in assembly and the screen was instantly filled with white pixels, I couldn't believe it was true. You just can't set pixels that fast! I went back to "debug" my assembly code by setting the pixels to different colors to convince myself that the assembler didn't somehow "cheat" by just setting the background color to white. And sure enough, assembly just turned out to be orders of magnitude faster.
y=199
x=319
c=15
def seg = &ha000 + (&h14 * y)
poke x, c
Of course, functions like CIRCLE were already much faster since the entire function was already in ASM, instead of having to go in and out of the interpreter for each pixel. You'd wrap the above code in a SUB routine and replace all your PSETs with it. I even coded my own sprite maker that used the mouse in a similar manner and made a pretty impressive looking Mario clone with the appropriate functions I learned in math class. Pythagorean theorem was very useful when working with grids. I didn't understand why everyone wasn't doing the same thing and why everyone hated math.Imagine the teachers surprise when on the first day everyone is learning FOR loops and I'm making a RND bump map with directional lighting. This was 1997 so we were still using Yahoo to look up the ASM offset codes, which worked just fine, you'd just have to be good at making your queries or you'd have to dig through a couple of pages of results.
Ouch!
btw, I think "fill the screen with @'s" must be the "Hello, world!" of Commodore machine-language programming. (Back when you could call it "ML" and not get it confused with a functional programming language, too.)
More 'advanced' versions transform BASIC into bytecode that's interpreted, stripping all the comments
But yeah, for the early systems...
I started with the MSX. Alas, the literature was scarce, but I could play some tricks.
I couldn't go too far with assembly though. 1 - see point above. 2 - There were several ways of doing a "system call" but I think one way only worked into "raw programming" (that is, running from basic) another one if you had DOS.
Unfortunatelly I coudn't make that work.
Another thing is that the VPU was not memory-mapped (maybe on MSX2 it was), you could do 'text mapping' sure
One nice thing I remember was reading bitmaps for the font in the memory and then printing it as a sequence of (8x8) characters
I think part of the excitement was also the limited access, there weren't that many computers and you had to wait for the next issue of Byte (or c't, in my case). I spent many hours at the magazine racks reading computer magazines I didn't have the money to buy.
Having said that, things are great now too. The low-level stuff you can do on a $20 HW platform are fantastic.
It might simply be that a common first-time benchmark exercise for programmers moving from BASIC to assembler is to fill the screen with characters or pixels. I have a sneaking suspicion I did the same too.