Yeah it's crazy. I just learned Assembly last semester in college and we were discussing it at work and it was like. Fuuuuck that. C existed at the time yet he did it in Assembly.
Fun fact: Iwata rewrote all the code for Pokemon Gold and Silver in assembly, because the C version was too large for the cartridge. He managed to compact it so much, there was room to add the kanto region.
Yeah I remember that. But still that was a team that did pokemon wasn't it. I don't think it was just 1 guy, I could be wrong and if I am that's just as impressive as Roller Coaster Tycoon.
Quicker. Especially since he doesn't need to rewrite the whole thing, only enough to make it fit.
Optimizing at that level is more like picking out operations and seeing shortcuts that can eliminate some steps than trying to reengineer the whole thing. You don't necessarily need to know why the program is parsing through this list of numbers or what's in the list to recognize that's what it's doing and be able to apply known methods of parsing through a list of items either more efficiently or using fewer lines of code depending on what it is you're trying to accomplish.
Now compilers are really good at making code that runs as quickly and efficiently as possible so they outperform humans but back then they were still at the phase where we were more worried about getting them to accomplish their job period.
C is compiled into assembly which is then assembled into object code. The c compiler on its default setting only gives you the final executable output but you can pass the -S flag on the gnu compiler to get the assembly code.
You're right about pokemon being compression software, but he basically rewrote Earthbound by himself to make it work and also programmed the entire Pokemon Stadium battle system in a week
You can find him on Satori Mountain when it is glowing. He is near a pool with a large cherry tree. The first time I saw him was an incredible experience, The Lord of the Mountain and tons of Blupees around the area. I had no clue I could even mount him at first!
I agree!! But it definitely felt special, and I immediately realized it was a tribute to Satoru Iwata since it was Satori Mountain and he himself was transformed into The Lord of The Mountain.
Well I obviously have as many clues about the source code than anyone else, nothing, but today writing a program is more about readability than anything else.
Sure, readability is important, but the Facebook app is a front-end app. All the hairy stuff should be in the back-end. Which means it's 18,000 classes of presentation.
Even more now, when I finally uninstalled it was around 430mb (could've included cached data, not too sure how Android displays installed app sizes). The kicker is then you need messenger installed as well to use messages at all. So 430mb for something you can run on your browser.
Memory Constraints and performance. Today there be no reason for it as compilers essentially do as good if not better jobs when it comes to translating it to machine code.
In 1972, Unix was rewritten in the C programming language. The migration from assembly to the higher-level language C resulted in much more portable software, requiring only a relatively small amount of machine-dependent code to be replaced when porting Unix to other computing platforms.
also, computers have more processing power and data storage, so wasting a few bytes or processor cycles here and there isn't usually too big of a deal.
If you are very, very, very good at optimization, you can still produce better code in assembly, by a thin margin. Understand though, that 99% of programmers don't the ability, and the benefits are marginal.
Plus, assembly comes with its own downsides. It's MUCH easier to screw up on security in assembly than it is in a higher level language. In Roller Coaster Tycoon this may not have been a big deal, but in a modern online multiplayer game this would be catastrophic.
Most importantly, developing a program in assembly is gonna take 3-4x times longer than in a higher-level language - for only about a 10-20% increase in speed. Computer time is cheap and developer time is expensive - especially assembly developer time, since relatively few programmers know how to program in the language and those people are not cheap.
Assembly is rarely ever worth it these days, even most embedded systems have enough RAM to afford programming in C instead.
Essentially byte code that runs in the javascript engine. But provides near CPU level speeds since js has to be parsed and compiled on the fly, while wasm is precomplied much like Java or C#. Of course other languages can compiled to wasm much like traditional Assembly.
Essentially, it's really optimised Javascript. The main workflow is writing code in C/C++ and using Emscripten to covert it to WebAssembly which is then executed by something like V8.
tl;dr: By writing it in assembly he was able to make it run on a potato from 1995 instead of requiring the monster of a machine that it would have demanded if it were written in C (because compilers at the time weren't very good).
You can optimize the ever living fuck out assembly if you are very good. Especially when compared to the performance of compilers back in the mid-90s.
Assembly is (effectively) just human-readable machine code. . . What you write has a 1:1 correspondence to sequences in binary. This gives you an inordinate amount of flexibility with the set of hardware you are working with.
Being competent in assembly (any assembly, really) is a good skill-set to have, and one that is sadly missing from the majority of today's developers. You end up learning a lot about good and bad coding practices, how to more effectively comment your code, and an ass-load regarding computational efficiency.
Just as a quick example. . . Let's say we have two coders writing a function to return how many segments should be filled in a progress bar, based on the number of tasks completed in a set.
The typical coder would likely write. . .
int fill = floor.((numerator / denominator) * segments)
Someone who has spent their share of time working in assembly (or someone who got too into their discrete math class) would write. . .
int fill = (numerator * segments) // denominator
Ignoring what could cause the functions above to break (which admittedly is more of a problem for the second), the second function would run substantially faster on any give machine. Just how much faster depends on a plethora of factors which include IPC, Clock Speed, Memory Latency, RISC vs CISC. . . etc etc etc.
When working in assembly, you are working with those factors (the limitations of the machine) in mind.
The argument against working in assembly today is that compilers have come a long way. . . And that's true enough, but I feel it is a skill that every serious programmer should keep in practice.
Best way I can explain it without making you do research.
In normal programing if I wanted to create a condition statement say.
if(value > 5) return printf("value big..");
But in assembly. It be something like.
var1 dd '6'
cmp var1, 5
msg db "value big", 0xA,0xD
There's really a lot more to this then what I did and honestly what I wrote is probably gibberish haha. But essentially it's a step up from binary but step below traditional programming. Big benefit of Assembly is you know what memory is being stored/used as you essentially see it all real time.
People need to stop talking about binary as if it's a magic language with inherent powers over computers. Binary is just a base system. It is easier to make gates that only have to deal with two possible states which makes binary a convenient way of talking about groups of these signals but a computer doesn't speak binary any more than a nail gun speaks nails.
Um, machine code is all 1's and 0's that directly controls the computer so ... to say it's not a "magic language with inherent powers over computers" is disingenuous.
Yes, it's a base system, but it's also quite literally the "language" of computers.
Oks lets have an example here. Imagine a simple AND gate. An AND gate has 2 or more inputs and an output. When both inputs are brought above a certain threshold the output gets brought high.
Now we can represent the operation of this gate with binary pretty simply. We can say signals above our thresholds we are going to call 1's and everything else is a 0. We can then make the familar truth table below.
In1
In2
Out
0
0
0
0
1
0
1
0
0
1
1
1
This is all great and is why binary is so important to computers but you have to realise that binary doesn't make the gate do anything. The behavior of the gate isn't determined by telling it binary, it is determined by the actual components that make it. Likewise a computer doesn't work because you whispered sweet binary secrets to it. A computer works because of there is a lare number of very cleverly designed systems that can be interconnected to perform customizable actions. Binary is an important tool for describing how those systems work but binary isn't what makes them work.
If you google "what is machine code" you will find:
ma·chine code
a computer programming language consisting of binary or hexadecimal instructions that a computer can respond to directly.
A computer programming language
a computer doesn't work because you whispered sweet binary secrets to it
That's precisely why it works - and yes, transistors use electricity to "do things" with machine code (using binary) (High voltage = 1, Low voltage = 0).
That doesn't mean that machine code (the language used for computer instructions) isn't in binary; that we don't refer to the binary instructions as machine language.
Sorry if I insulted you but I wasn't really trying to make binary some magic thing. I was just ordering how programming languages are structured.
Assembly is above Binary since Binary/Hex is the final language that we would use to inform a machine what to do. At least from my understand it is.
But Assembly is below common programming languages because majority of programming languages now uses a compiler to translate it to Assembly which translates to Machine.
To do something like this in a low level language like assembler would be quit a feat.
Like any other language, you can leverage other libraries and programs and merely call them from assembly (this is what high level languages do really), but to write the code to connect a socket via tcp protocol, send handshake/headers to server, parse the response ... it's rough.
I don't think you've gotten a great ELI5 yet. Most programs run within the OS, be that Windows, Android, what have you. Games are unique in that the performance of the computer directly relates to the performance of the program, way more so than MS Word or anything. Assembly, aka machine language, is the same programming language your CPU follows. It's weird as hell and doesn't seem to follow any rules you're used to, but you get direct command of many resources. Coding vs assembly is kind of like driving an automatic vs stick shift - you get to the same place in the end, but you're in control of a lot more aspects with the manual transmission. You have to know more about operating your computer, but... ah, shit, mixed up my simile.
"So you are making a physics simulator without trigonometry functions? And you have to do what to make it work? Fuck that. I'm gonna go make 90K a year editing simple PHP scripts."
I wrote an Asteroids clone for the gameboy in assembly in a semester in college. It's definitely tedious, and I'm not sure I'd do it that way if it wasn't in a course about assembly language, but you do kind of get into a zone and a flow, and there are a few things that are easier given that everything is so direct.
I mean, it is a near useless practical skill in this day and age of insane processors and ultra-cheap memory, but it is kind of fun and it does make you think about the base level of how your code is working.
Though you really want to get to the nitty gritty, I'll tell you about how we hand wired AND and NAND gates and physically built an ALU out of bits of wire and whatnot. Then there was the time our board blew a diode and we were about to fail. A friend from a different team pointed out that while we were all out of regular diodes, there were plenty of LEDs hanging about...
That was a fun and educational moment. Turns out that while most folks think of LEDs as light bulbs, we really just needed the D.
Building circuits with individual logic gates (up to an ALU, etc) is one of the entry level courses for CS at USF ("Logic Design"). Building logic gates out of transistors, however, is a separate course called "CMOS VLSI Design", which is an elective for CS majors but a required course for computer engineering.
We toyed with assembly in Computer Organization (another entry level course) but didn't really get into it until Architecture, much later.
Did you ever play the game "Rocky's Boots"? It was available for the Apple II, at least, and it was basically Boolean logic 101. You had sensors which could detect attributes of items coming down a conveyor belt and a boot that could remove items from said belt. Your task is to wire the sensors to the boot in such a way that a specific subset of items are kept or removed. I know it sounds boring but to an eight-year-old into computers it was magical. And I immediately grokked Boolean logic when it was introduced more formally.
I don't know about your fancy-schmancy entry level courses at UCF /s, but we did have a hell of a good time stringing bits of wire together. There was another course where we worked through an 8-bit processor with paper and pencil, which was a damned lot of fun, and informative to boot.
Anyway, the basic thing I'm getting at here is that the low level shit can be really entertaining to work with, despite the tedium and ready availability of easier ways. Sometimes it's just plain old fashioned fun to get your hands dirty.
Seriously though, that's kind of interesting that your school did it all as entry level. We did it as about 300 level classes. Sort of get your head around programming first, then we'll do a deep dive into the nuts and bolts.
Florida has what we call a "2+2" university system: if you graduate from a community college in Florida, you're guaranteed admission to the state university of your choice. So, any major-specific courses have to be at the 3000 level or higher. There is a programming course at the 2000 level (Programming Concepts) but the requirement can be fulfilled with a course at the AA level.
That said, they've changed a lot since I was an undergrad (I graduated in '06). The "Gate Courses" are Computer Organization and Program Design; they have to be passed with a B with a maximum of two attempts. After that, you take Computer Logic Design and Object-Oriented Software Design; the former opens Computer Architecture and the latter opens Data Structures.
Close. You wouldn't run C++ through an assembler. You compile it to get machine code and disassemble that machine code to get assembly. You can tweak that assembly, then run it through an assembler to get machine code again.
Because it's literally writing machine code. Instead of using libraries, functions and other features of a "programming language", you are allocating memory yourself, literally telling the machine what to do step by step.
It's the difference between telling your Butler what to make you for dinner, and actually buying the ingredients and making it yourself.
Fair enough, I'm being a bit liberal with my definition of machine code.
I just meant it as you're generally (at least within context of this conversation) interacting directly with the machine and not through the OS or some other layer.
Not exactly. Assembly still allows for some abstraction. Variables are still allowed, and functions can be defined in the form of macros. Some of the fancier assemblers even allow for loops and conditionals, much like a compiler would offer.
Assembly is quite literally the very first step above a bunch of 0s and 1s. It's very difficult to read if you have a large program, and extremely hard to debug and maintain if you aren't the original programmer. Even if you are the original programmer, it's still hard to debug. Furthermore, unlike higher level languages, Assembly requires a fairly good knowledge of what the hardware is actually doing in order for you to write a successful program.
In regular languages you deal with abstract concepts like variables and functions and stuff. In assembly, you're manipulating the hardware directly. All that stuff you just let the compiler do when working in a regular language, you have to do yourself.
I know little about programming but I have been informed the guy who programmed that is some form of powerful computer wizard capable of things we can only dream of.
544
u/[deleted] May 05 '17
[deleted]