indoctrinated reality in nesdev(?)

You can talk about almost anything that you want to on this board.
tepples
Posts: 23006
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)

Re: indoctrinated reality(?)

Post by tepples »

In four years of computer science coursework at university, I saw assembly language in only one class. This was a computer architecture course using the textbook Computer Organization and Design by David A. Patterson and John L. Hennessy. The book used the MIPS architecture as an example to teach how a computer works down to the digital logic level. Exercises were in MIPS assembly.

I don't know about computer science programs in Latin America, but this book seems to be fairly popular in English-language computer architecture courses. It probably won't apply directly to anything but PlayStation or Nintendo 64, but it will help you understand assembly in general.
User avatar
TakuikaNinja
Posts: 441
Joined: Mon Jan 09, 2023 6:42 pm
Location: New Zealand

Re: indoctrinated reality(?)

Post by TakuikaNinja »

The malware analysis course I took at university covered basic x86 assembly in the context of disassembling compiled C/C++ code. Hand-written shellcode was brought up as part of some anti-disassembly techniques, but was not required for any of the assignments. Modern assembly isn't really meant to be written by humans, anyway. (Except for some RISC architectures, perhaps)
User avatar
segaloco
Posts: 939
Joined: Fri Aug 25, 2023 11:56 am

Re: indoctrinated reality(?)

Post by segaloco »

tepples wrote: Sat Nov 02, 2024 5:04 pm This was a computer architecture course using the textbook Computer Organization and Design by David A. Patterson and John L. Hennessy. The book used the MIPS architecture as an example to teach how a computer works down to the digital logic level. Exercises were in MIPS assembly.
Their latest editions are RISC-V focused. One of the goals of the RISC-V project AFAIK was to establish a practical ISA that could also be used for pedagogical purposes in the areas of CPU design and compiler sciences. I could see modern courses coalescing around the ISA, but in terms of practical knowledge it really comes down to what sort of microcontrollers are used in the line of work you hope to enter. Aside from RISC-V, ARM and AVR are popular in deeply embedded applications these days. You run into both of those often in the "maker" community, not sure how much overlap there is with the sort of thing you can get from university.

Frankly I wouldn't feel inclined to pursue this sort of thing in a university setting anyway. Computer sciences in general consist of a wealth of freely available information and resources. Any course is likely going to have a micro-focus on some very specific application or use case, so you can only gain so much if their direction is far afield from what you're actually interested in.
Pokun
Posts: 3476
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: indoctrinated reality(?)

Post by Pokun »

Some Swedish friends that have studied computer engineering told me that they had a course in RISC architecture assembly in which case MIPS was used (it wasn't an actual MIPS CPU they used though but an FPGA) and that was the only assembly they did AFAIK. I guess it's basically the same course as Tepples did. I guess RISC-V may soon replace MIPS in such courses in the future.

I myself took a University course in microcontrollers and digital logic using PIC MCUs. It did have some exercises in the beginning which we did in assembly just for understanding the fundamentals, but after that everything was in C (using a particular non-ANSI-C-compiler), and they would only accept the examination work if it was done in C.

I also remember speaking with a computer engineer (who had used a lot of x86 assembly in the past) and he told me that assembly is no longer needed for anything and by anyone because compilers has become so good that no manual optimization can outperform it. I guess he was talking specifically about x86-64 architectures as used in modern PCs, as assembly for about any 8-bit CPU has definitely not played out its role and may be used in microcontrollers and the like (like the aforementioned PIC architecture, possibly AVR and of course 65xx) when you don't need as advanced hardware but still need the benefits of assembly.

I still think it's strange though, if no human ever needs to learn assembly anymore, how is it that the hardware is constructed if no one understands it?

It sounds a bit like in Isaac Asimov's "I, Robot" where they basically create a "positronic" super brain which is then used to create an even more advanced brain, which again in turn is used to create an even more advanced brain and this continues for many iterations until they have an incredible super duper brain. Considering only few engineers even understands positronic brains in the first place, this super duper brain's complexity is far beyond what humans can ever hope to understand, but it has near-demigodly wisdom and insight.


For hobbyists though I see a lot of value in typical 8-bit CISC CPUs like 6502 and Z80 as they are generally a bit less complicated than any RISC architecture, and I don't think it's a hobby that will disappear.
Oziphantom
Posts: 2000
Joined: Tue Feb 07, 2017 2:03 am

Re: indoctrinated reality(?)

Post by Oziphantom »

For my Uni we also had the Programming in MIPS course, only back then MIPS was the hot new kid on the block and CSIC was a dinosaur that was going to have it day soon as we all know RISC is going to be so much better, such a cleaner system {sic}. We also did some X86 and "looked at SPARC" mainly because my teachers were all SUN fanboys. But I handed in some of my assignments in other classes in 65816.

Humans can't outdo compilers, yeah nah, Carmack went on a rant about that a while ago on Twitter and showed that in some cases he could still easily decimate a compiler. The `can't outdo Compilers` is a myth from the P4 era where yeah the really stuffed up the arch and everything you knew would just fail on the P4 because of the cache injection line algorithms and the 40 stage pipeline etc To which it was a case of "good luck, just let the intel engineers fix their mess". Maybe Vtune really does still "match" because it really really understands the CPU when you tune it to a specific chip.
User avatar
Memblers
Posts: 4153
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis

Re: indoctrinated reality(?)

Post by Memblers »

Pokun wrote: Sun Nov 03, 2024 4:57 pm I also remember speaking with a computer engineer (who had used a lot of x86 assembly in the past) and he told me that assembly is no longer needed for anything and by anyone because compilers has become so good that no manual optimization can outperform it.
I wonder if stuff like out-of-order, branch delay slots, etc. made people want to give up on assembly. I think going directly in assembly can still be the fastest, but after using llvm-mos, even though it's still a young project, it's definitely feels closer to what people say about modern compilers, but for 6502. It's not 100% optimal all the time, but it's been improving. It pretty much automatically does things an asm coder would do, as far as moving the hottest variables to zeropage, reuse of temporary variables to save on RAM, it's fully call graphed. It seems like small change in the code can potentially free up a byte of RAM by effectively rewriting variable using throughout your the entire program, it will happily do it every time you build. At some point I guess the asm coder will win, John Henry-style.
Oziphantom
Posts: 2000
Joined: Tue Feb 07, 2017 2:03 am

Re: indoctrinated reality(?)

Post by Oziphantom »

the other issue is more. Most programmers are crap. We have a far greater need for programming than people who can actually do it, hence the push towards JS and a 'pad-left' library. So can a good programmer who knows what they are doing defeat a compiler, yes. Can the average year10 dropout who scammed his way into IT and then picked up a bit of programming who now works at the company that makes the code for plane flight systems beat a compiler, not a chance.

Back in the 68K era they use to claim that a compiler was about 90% as good, to which the speed of which the C code could be written and maintained vs the ASM code for the pay off in the 10% of performance ; wasn't worth it. And that was the 25mhz era, by the time you get to the Ghz era even less they tried to argue that Java was worth the speed cost.

The topic is discussed in Microsoft Press' Code Complete, if you are working in the programming field and have not read that book, I highly recommend you do, for this crowd, go with the first version as in the new 2nd version they removed all the gory 68K, i386, i286 details and examples.
User avatar
creaothceann
Posts: 874
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany

Re: indoctrinated reality(?)

Post by creaothceann »

Pokun wrote: Sun Nov 03, 2024 4:57 pm I also remember speaking with a computer engineer (who had used a lot of x86 assembly in the past) and he told me that assembly is no longer needed for anything and by anyone because compilers has become so good that no manual optimization can outperform it. I guess he was talking specifically about x86-64 architectures as used in modern PCs
Assembly may help, especially PDEP/PEXT or when you work with lots of floating-point numbers. But imo knowledge about the hardware is more useful than knowledge about the instruction set.

Compilers can optimize the program code (which may account for only 10% of the running time), and perhaps re-arrange some variables to pack them tighter. With profile-guided optimization they may even move some rarely-used code out of the "hot path".

A programmer can optimize the data layout to fill cache lines to more efficiently use cache (which is many times faster than RAM). They can use look-up tables, tuned for size and "good enough" accuracy. They can re-calculate simple values instead of reloading them from RAM. And if a value is set via a hard-to-predict if-else block they may rewrite it to a bit-manipulation that doesn't involve an if.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
User avatar
donato-zits-
Posts: 92
Joined: Fri Jun 03, 2022 11:14 am
Location: -&&.&&&&&, -88.88888

Re: indoctrinated reality(?)

Post by donato-zits- »

Fisher wrote: Thu Oct 31, 2024 9:14 pm Well, looks like you're at something very similar to what I was around 20 years ago. @donato-zits-!
I studied at a Federal Institute campus in my city called Instituto Federal Farroupilha.
At first, I thought that I would learn exactly what I wanted, but not!
Many teachers didn't know much about those things and I was utterly disappointed.
I remember I even got a zero for a work that I did in x86 assembly, even with lots of comments, because the teacher didn't understand what I was doing.
And I wasn't doing anything "funny" just creating a palette with some red tones, throwing it at the screen, and moving it! It was a nice fire effect using int13 if I remember correctly.

The fact is, they're going to try to prepare you to work on the mainstream market, and assembly is rarely used in these.
Another thing that I discovered is that some teachers, although nice and cool, don't know much about a vast base of knowledge but have vast knowledge on a very limited scope of things. Some of them have not even worked on a regular job before; they have just studied all their lives!
Also, modern gaming platforms, as stated in this topic before, are way more complex than they were a while ago.
There are a lot of inner communication and resource sharing and other things that are "abstracted".
So programming them in low-level languages would be very difficult. if not impossible.

So what I did was to "play the game" and try to learn what was being taught, because it makes you better at thinking logically, and I think this is the key to any learning and development.
The best source to learn assembly and any other low-level stuff is forums like this.
I bet most people here just learn the basics and the logic in formal education, then start talking to each other and testing stuff until they discover what works and not and then document it.

So, be patient. If you like to make games and stuff, these courses will be a good place to start.
The idea is to prepare you for "the market", and unfortunately in our country the game development market is small, but this can change!
I could also recommend you to try something like computer science (or like I say as a joke "occult computing sciences"), mechatronic, or telecom engineering which tends to teach lots of low-level stuff and algorithms. So you probably will learn a little more of what you want, but probably not everything.

Sorry for the wall of text, but I kind of saw my past me here.
eu definitivamente não vou leer isso, nem tentar digamos, você pode postar isso aqui por gentileza?
I definitly dont will read this, let's say that I even do not will try, do you can post this here do me a favor?
viewtopic.php?t=24252 <<<<my game
viewtopic.php?t=25285 <<<my second game
User avatar
segaloco
Posts: 939
Joined: Fri Aug 25, 2023 11:56 am

Re: indoctrinated reality(?)

Post by segaloco »

Question: what does everyone else in this thread translating their posts into some other language achieve that you can't achieve by doing the same thing? Is it the work of each English speaking poster outside the international subforum to translate their content into your language of choice? Or is it your responsibility to interact in English in the sections of the forum conventionally in English. Needing translations is fine, expecting everyone else to translate for you when there is a forum section dedicated to conversing in other languages is tedious, especially when multiple well-thought out responses are replied to with "translate this for me". You have access to the tools you keep linking us to, use them.
User avatar
Fisher
Posts: 1299
Joined: Sat Jul 04, 2015 9:58 am
Location: -29.794229 -55.795374

Re: indoctrinated reality(?)

Post by Fisher »

donato-zits- wrote: Mon Nov 04, 2024 11:34 am eu definitivamente não vou leer isso, nem tentar digamos, você pode postar isso aqui por gentileza?
I definitly dont will read this, let's say that I even do not will try, do you can post this here do me a favor?
Confesso que estava bem "inspirado" quando escrevi este post, mas resumi bastante no outro.

Machine translated because I'm lazy:
I confess that I was quite "inspired" when I wrote this post, but I summarized it quite a bit in the other one.
User avatar
Fisher
Posts: 1299
Joined: Sat Jul 04, 2015 9:58 am
Location: -29.794229 -55.795374

Re: indoctrinated reality(?)

Post by Fisher »

segaloco wrote: Mon Nov 04, 2024 11:59 am Question: what does everyone else in this thread translating their posts into some other language achieve that you can't achieve by doing the same thing? Is it the work of each English speaking poster outside the international subforum to translate their content into your language of choice? Or is it your responsibility to interact in English in the sections of the forum conventionally in English. Needing translations is fine, expecting everyone else to translate for you when there is a forum section dedicated to conversing in other languages is tedious, especially when multiple well-thought out responses are replied to with "translate this for me". You have access to the tools you keep linking us to, use them.
Sorry, I'll start posting these things in the NesDev International section.
It's just a little more convenient to post here and I'm machine-translating, because I'm a little lazy to rethink it, so everybody can understand what's going on.
Pokun
Posts: 3476
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: indoctrinated reality(?)

Post by Pokun »

But what about the future? If we are coming to a point when assembly is no longer needed and no person on earth that still knows this art is still alive, how do you create a compiler in the first place? How is the hardware made if no one knows how the stuff works? It's kinda like trying to forge an anvil without having an anvil needed to forge it.

I don't buy what that engineer said, of course there will always be a need to know how the fundamentals works.
User avatar
segaloco
Posts: 939
Joined: Fri Aug 25, 2023 11:56 am

Re: indoctrinated reality(?)

Post by segaloco »

Fisher you're fine, you're not the one demanding a translation every reply. It's not annoying to mention, once, that it may help, just to act like it's some sort of slight by not automatically replying with a translation in hand. I would expect the same of myself posting in a non-English thread in international, it's not their job in an active conversation in another language to translate everything to English for my sake.

Anywho regarding maintaining how to do these things that are becoming uncommon in computing education, I think there is a big enough niche for tech history these days that educational tracks specifically focused on these sorts of things are viable, the commercial market just thinks in quarters rather than decades or centuries, so they're not concerned with how folks will be flailing about in a few decades as critical historical knowledge scurries off into the dark corners of the collective consciousness. This is what interests me in old AT&T stuff for instance. Our entire telecom world is built on the back of decades of R&D that happened solely at AT&T. There are telephone networks the world over that still reply on hardware and software designs from a company that for all intents and purposes doesn't truly exist anymore (today's AT&T is a different corporate entity entirely). AT&Ts designs and approach were predicated on just about the opposite of planned obsolescence: They were a monopoly with a captive customer base, serve them products built to last and be extremely backwards compatible and you aren't incurring any of the overhead of needing to constantly sell people new shiny things to keep the money flowing. You want little to no costs spent on producing new, you want to keep milking every cent from what you've already made.
tepples
Posts: 23006
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)

Re: indoctrinated reality(?)

Post by tepples »

FFmpeg engineers ran benchmarks and found that rewriting certain steps of video decoding in AVX-512 assembly speeds up their execution by a factor of 94 compared to current compilers. That's not 94% faster but 9400% faster. (Source: @ffmpeg on X)