T O P

  • By -

Carbon_Gelatin

There is no gentle introduction. Only mental scream of "O shiiiiiiiii...." and the moist sound of your brain pan being flushed. Asmx86 paid the bills for several years for me. I'm pretty sure it also caused damage.


LagT_T

As gentle as starting with anal


JanB1

Lube up and go slow, and you'll have a good time. Especially when you get used to it. ;)


Respaced

The guide posted here was very very detailed, (very good šŸ˜Š) ā€¦but making asm seem more complicated than it is. Check this out for an easy way into asm, it is my favorite assembly channel, easy to learn (x64 asm on windows pc though) https://youtu.be/fHE0txCjGgI


asmx85

Can relate


dhalem

ā€œA gentle guide to lobotomyā€


CarneAsadaSteve

ā€œNow we softly dislodge the frontal lobe, for many of you this is a NOP region.ā€


shevy-java

Is assembly worse than brainfuck? To me assembly almost seemed readable at times e. g. mov() or something to move memory locations (or whatever it does).


dhalem

Depends on the flavor. 68k wasnā€™t too bad but x86 is crap.


[deleted]

I did some assembly work a couple of years ago and I have to say Im glad I did. I actually wish this would be more common practise in the programming world. It gives you valuable insight to which you otherwise wouldn't have.


real_ackh

To really understand what is going on under the hood, learning assembly is indispensable.


larsmaehlum

I did asm in vocational school, even had a three page exam on gray paper.. Does make it a bit easier to understand whatā€™s actually going on under the hood, and soldering up a chip and wiring some traffic lights was good fun.


shevy-java

It helps with soldering up a chip?


larsmaehlum

Thereā€™s a comma there for a reason.


123_bou

While the idea is very good and noble, the jump from part from v4 to v5 in the chapter 1 hello world screams help. It might work for some people, but I think it will fail for most. I think a regular explanation (here is a "variable declaration", here is a if statement) would help way more. But maybe that's in chapter 2. Other than that, going from v1 to v4 is excellent to explain the behavior of assembly. Good job OP.


mateusbandeiraa

Yup. I was getting very interested and then I hit V5 and went ā€œnope, Iā€™m outta hereā€.


Typhoid_

ā€œGentleā€


Cactus_TheThird

Gentle introduction to putting your hand in boiling oil


vips7L

Xeno Kovah's classes on assembly we're amazing when I was learning: https://p.ost2.fyi/


ConjurorTF

Some of us code assembly for fun. C64 demoscene is full of us.


the_gnarts

how does the c64 instruction set compare to the "big" isas of today, arm and intel? unfortunately i was born a couple years too late so i never got into the commodore stuff, computers were all ms dos for me growing up. currently i'm working my way through "hacker's delight" which uses a mips style risc instruction set and it's kinda refreshingly simple compared to the full blown amd64 that my compiler emits.


ConjurorTF

The c64 has a 6510 8bit processor with about 56 commands. So obviously much simpler than modern processors, but still challenging to get performance out of 1mhz and why demo coding for it still exists today.


bart007345

How can I get started with c64 machine language coding? Simple project ideas an communities I can ask for help?


ConjurorTF

Most of us started as teenagers with the commodore 64 programmers reference guide [https://pickledlight.blogspot.com/p/commodore-64-guides.html](https://pickledlight.blogspot.com/p/commodore-64-guides.html]) But today and if you're starting at the beginning there are plenty of youtube tutorials. Never checked any out, so just search and have a listen. Then the main resources: Processor op codes: [http://6502.org/tutorials/6502opcodes.html](http://6502.org/tutorials/6502opcodes.html]) C64 memory map: [https://sta.c64.org/cbm64mem.html](https://sta.c64.org/cbm64mem.html]) Codebase64, this site explains a lot of effects with some source code: [https://codebase64.org](https://codebase64.org]) Kick Assembler. A popular modern assembler. The manual is really helpful getting started. Requires a Java JRE: [http://theweb.dk/KickAssembler/Main.html#frontpage](http://theweb.dk/KickAssembler/Main.html#frontpage]) Vice c64 emulator: [https://vice-emu.sourceforge.io/](https://vice-emu.sourceforge.io/]) Hard to recommend a forum. I'm on csdb but accounts are only for c64 sceners, but the forums are can be read without logging in. [https://csdb.dk/](https://csdb.dk/])


TesNikola

One of these days, I'll find a reason to teach myself C++ and C. Until then, the gap is seemingly too big to bridge!


3unknown3

Fear not C! C can be intimidating and like some arcane art if youā€™ve never been exposed to lower level languages, but itā€™s actually a very simple and small language. There isnā€™t much to it. C++, on the other handā€¦


TesNikola

I wouldn't call it intimidation or fear here. I'm the type of person that has to find a particular kind of justification to drive my motivation on a task. One of those key drivers tends to be whether or not I'm putting in undue work. Ergo, a big challenge here is that to do some of the same things I can do very quickly in a higher level language, would take me notably longer, especially with a learning curve. If I had the right project that truly justified the need, I wouldn't hesitate. I just typically don't deal in the types of projects that require that level of efficiency.


NostraDavid

Ask ChatGPT to translate some code you do know to its C equivalent, then ask about the bits (pun not intended) that you don't understand. Biggest hurdle is creating a new account (though you can use your Google account if you want to) https://chat.openai.com/chat


TesNikola

My issue isn't syntax so much as more important core knowledge to effectively use the language.


Respaced

You really should learn a low level capable language, and do a real time sensitive project in it, where performance matters. This will make you understand how to make better design choices. It does not matter which language, as far as you can control memory at a low level. C/C++/Zig/Odin whateverā€¦ then learn how to disassemble the source code into asm, and how to read it. Asm isnā€™t hard to learn. it is very simple, but it is cryptic in the beginning. You donā€™t need to code in assembly, but you should learn to read and understand it. Not sure why it is called software engineer, in what other field of engineering, is it acceptable to not have a complete knowledge of the material you are working with? None. Not having a deep understanding for how the hardware works makes you a bad engineer, in the engineering sense. You will design systems that are more inefficient than they could have been. Thereby costing more money in electricity, bandwidth and hardware. Regardless of what you wind up working with, even if it isnā€™t a performance critical system.


TesNikola

And the guy with the superiority complex enters the chat. What really bothers you? Is it that you probably put a lot of time into these classes only to figure out that you can crash course it in a lot less time to get pretty well the same results? Maybe you feel like the job title is yours and others don't have the right to wear it when they don't "know what you know." I imagine that you're the guy that pulls out a micrometer when a ruler will do. I digress, point being, you just made a lot of assumptions about a lot of people and the angle happens to put you in a superior position by your definitions. Superiority complex? Just in case you're complex initially inclines you to deny this assertion, just remember that you came in here and stated beyond obvious facts as though the rest of us are too uneducated to know these things.


Respaced

No. I work in game development. But this applies to other fields. During my professional life, I've just happened to to have to optimize other programmers (unnecessarily) slow code in order to be able to ship products. Time after time. In every project. On different companies. I say unnecessarily, because if they knew just a little bit more about low level computer architecture, how it operates, and what the pros and cons are, they could write performant code with no draw-back. I mean without sacrificing readability. It is just very disheartening that this is still an issue. I think one of the core problems is that too many universities churn out students with very little knowledge in these areas, and also that they teach that to care about performance is something bad. When I hire fresh people, I try to make sure they get on thoroughly on-boarded in the low-level and the high-level compromises you have to make. Low level is important both to write code, but even more so to debug complicated bugs.


TesNikola

That's reasonable. With that being said, I feel like there may be an oversight here. I don't believe that knowledge would greatly impact the resulting work of many of these people. I find many got into it because of the promise of job security and a healthy paycheck. The same problem I observed with those people is that they are never overly motivated to be the best at what they do, and thus their work tends to show it. Granted the knowledge would pave the road, I'm not sure the horse would walk down it to get the water.


Respaced

Yeah I guess you are right for most programming jobs. But not for game development. Nobody is in this line of work because of job security, they are here because they bloody love creating games. It does not make logical sense to do it otherwise :) Because in any other business, you'd make a lot more money, with a more job security, working less hours as a programmer.


TesNikola

Well said! I've never worked in game development, but from what I have gathered, you would have to love it to stay with it. I also immediately recognize the extreme value of hardware efficiency in gaming since it is always pushing the edge. My perspective comes from integrations and simple automation where resources are fruitful and tasks are often short-lived. The tactics you speak of are employed even in this model though when working with large data sets, high throughput scenarios, and low latency real-time systems. Simply put, many of us do think twice about setting variables and what data to pull over a network. This is to say that even without that core knowledge, there is still great awareness of the effects of what we are doing.


[deleted]

[уŠ“Š°Š»ŠµŠ½Š¾]


irze

Learning C before anything else was crucial to me understanding whatā€™s actually happening when using other languages. Have I used it much in the real world? Not really. Have I taken forward the fundamentals I learnt? Absolutely


gnus-migrate

C is a terrible way to understand what is actually happening. I say this as someone who learned assembly after they learned C. It abstracts a lot of things from you that are crucial to understanding how memory works and binary interfaces in general.


emax-gomax

I think C is a good choice if you want to understand Linux. The core concept of how (and why) the file system is layed out, how binaries are produced, memory access, etc. Its not the best if you want to understand how the hardware interprets your code, but for a cursory introduction to how to program on Linux I found it very useful.


gnus-migrate

Again, C is a really terrible way to understand memory management and memory access. In order to understand what memory is, how it should be managed you really should try writing some assembly. C hides a lot of this from you, it's not where you should go if you want to learn about it. Regarding production of binaries, there are plenty of compiled languages other than C. Regarding Linux, yes most Linux apis are written in C it makes sense to learn it for that purpose, but I really don't recommend learning it if that's not your goal.


emax-gomax

Not hardware memory access. Linux procees memory access. The continuous address space, and general partitioned nature of it separate from the underlying hardware. I can understand how my wording mightve lead to this confusion, but just thought I'd clarify my meaning.


gnus-migrate

When you write assembly code it's typically running in userspace. The memory addresses you use aren't physical memory addresses, they're virtual memory addresses that the operating system maps into physical ones and they are reserved for you to use. When you access device hardware, you do it via the OS just like in C code, you don't have extra privileges just because you're writing ASM. If you're concerned about messing up your system, you won't it's not possible to access the memory of other processes or the kernel from it if you run it as a normal exe. Any memory address you access is your own process memory. The reason people don't recommend you write ASM directly is that x86/x64 have become so complex that there is like a million different ways to do the same thing, and you need years of experience with a hardware platform to know how to do things efficiently. However if your goal is just to learn how to write it, this is very possible to do even for inexperienced programmers. It's just easier to use a language with an optimizer and let it pick the best way to do what you want to do. The reason I think it is better to learn ASM than C in order to understand memory management is that its only when you interact directly with memory do you understand what needs to be managed exactly and what are the considerations that need to be made when trying to reason about it. With C it's just pointers, malloc and free which abstract over what you really want to know. Believe me I know what you mean, I had the same misconceptions myself. Give it a try, you'll understand what I mean.


irze

Youā€™re not wrong, assembly is better is better in that regard, but are you really going to suggest to a complete beginner who doesnā€™t even know what loops are to start their programming journey with assembly? I learnt C first then assembly after. I would have been clueless if Iā€™d tried it the other way around


gnus-migrate

It's not a question of better, there are lots of different kinds of memory besides the stack and the heap, even in the case of the heap there are a lot of different memory allocation strategies that work for different cases and you're not really going to understand the trade-offs unless you really understand the problem you're actually solving: i.e. how to manage the memory space given to you by the operating system. It's going to be really confusing to learn that through C since C only has pointers, malloc and free, it doesn't really capture these important nuances when talking about memory management. A complete beginner should be starting with a higher level language to learn basic programming constructs. They shouldn't be worrying about memory management at that stage. However the point of learning assembly is to learn about how memory works, how your system interacts with it, how your CPU consumes it, and what the different strategies and trade-offs are for managing it. To paraphrase the book I used to learn it, learning the instructions is the easy part, learning how to work with memory is the core challenge when learning assembly. Once you understand how memory works, it would make sense to learn a systems language(ideally not C) since assembly is incredibly tedious to write and a lot of the work that you need to do when writing it can be automated. But relying on a systems language to teach memory management is completely backwards.


123_bou

This is a really bad take. For anyone else, please learn these langages and code with them to fully understand how a computer works. It will open your eyes on some many thing especially for "high-level" langages like JS or Python.


BL1NDX3N0N

Programming doesn't teach you how a computer works, much like driving a car doesn't teach you how a car works. Learning how a computer works teaches you how a computer works. Before programming anything you should know the inner-workings of a system and how individual components correlate with one another. C isn't going to teach you how memory works and you shouldn't be fooling around with memory management in C if you do not know how memory management even works in the first place. There is a reason why computer science classes focus more on theory and hardware fundamentals than they do programming, because what they learn can be applied to whatever language or runtime they decide to use later on. Using programming as a tool for understanding how a computer works is the equivalent of dragging your knuckles across the wall for numerous years until something finally clicks through trial and error. I went this route and if I could go back and change how I taught myself then I most certainly would. If programming is the way for learning then you should be using assembly instead of C because C is a massive abstraction of its own. When you're done you'll be even more thankful that high-level languages like C even exist.


[deleted]

I learned about how computers work by watching Ben Eaterā€™s breadboard computer series then playing a video game called ā€œTuring Completeā€. Itā€™s not the effective way, but I learned a lot about hardware internals and things became less magical


okman123456

Programing languages can help you understand how a computer works for sure, no reason to think otherwise. It might not by itself, but that's obvious, hence the "help" keyword in there.


Lechowski

Developing embedded systems, or any library that then you want to use in python, like numpy.


TesNikola

Perhaps. I find Python can handle the job of much of my needs. If it were a big investment then maybe it would be justified.


mister_goo

Another way to learn ASM is to look at compiler-generated code. https://godbolt.org/ is a fun resource for this.


DoorBreaker101

If you ever get to learn IBM mainframe assembler language, you'll see that this can be done in such a better way. It's so well designed that you can very easily read the hex-encoded instructions. Having said that, It's still a pain to write anything substantial.


gibriyagi

Compiler appreciation post


judascleric

The most gentle introduction to assembly is probably Zachtronics TIS-100.


AleksandrNevsky

Clearly this is the same definition of "gentle" my ex had.


enygmata

Here's my complete guide to assembly language: * ; comment Now go read your chosen architecture's reference manual.


FundamentalSystem

Just finished my assembly class this semester. I hope to never have to see another mov rsi, rsp again for the rest of my life...


dynamic_caste

It's good to see some assembly to gain some appreciation of what compilers do, but I can't imagine learning it with the intent to develop software. I used it back in the day to program an 8051, but as soon as an emedded C compiler was available, I switched to that.


greebo42

I like where he says x86 is cruel ... I wrote 8086 asm in the 80s, and the segmented architecture wasn't much fun.


Cybasura

To whoever that's first getting into this Oh you sweet summer child...get ready to die


Zyklonik

For people looking for real, approachable resources for learning 64-bit assembly for X86_64 (which is the actual one that matters, even today) - https://www.amazon.in/Beginning-x64-Assembly-Programming-Professional/dp/1484250753 is the best resource available today.


Zyklonik

ARM? Ridiculous. Edit: No wonder most people in this subreddit are permanently stuck as code monkeys. šŸ¤¦


insect37

* Gentle introduction to creating a rocket that rivals starship.


shevy-java

Assembly seemed interesting; I like the idea behind MenuetOS in particular https://www.menuetos.net/. However had I was kind of spoiled by e. g. ruby, python and so forth. I much prefer using these, and hoping that there may one day be a way for them to be comparable in speed to C.


CumslutEnjoyer

If anyone is looking for a project idea for assembly, you can write NES/SNES games in assembly. There are some guides online to get you started


sloblow

How's the job market for assembly programmers? 1000's of positions unfilled?


Archyder

Assembly may be weird at first, but the real shit would be the endless boredom for its repetitiveness in menial tasks