master
Miloslav Ciz 1 year ago
parent 325284d58c
commit 6644dd16d3

@ -1,14 +1,18 @@
# Assembly
*GUYS I AM NOT SO GREAT AT ASSEMBLY, correct my errors*
Assembly (also ASM) is, for any given hardware computing platform ([ISA](isa.md), basically a [CPU](cpu.md) architecture), the lowest level [programming language](programming_language.md) that expresses a linear (typically unstructured) sequence of instructions -- it maps (mostly) 1:1 to [machine code](machine_code.md) (the actual [binary](binary.md) CPU instructions) and basically only differs from the actual machine code by utilizing a more human readable form (it mostly just gives human friendly nicknames to combinations of 1s and 0s). Assembly is converted by [assembler](assembler.md) into the the machine code. Assembly is similar to [bytecode](bytecode.md), but bytecode is meant to be [interpreted](interpreter.md) or used as an intermediate representation in [compilers](compiler.md) while assembly represents actual native code run by hardware. In ancient times when there were no higher level languages (like [C](c.md) or [Fortran](fortran.md)) assembly was used to write computer programs -- nowadays most programmers no longer write in assembly (majority of zoomer "[coders](coding.md)" probably never even touch anything close to it) because it's hard (takes a long time) and not [portable](portability.md), however programs written in assembly are known to be extremely fast as the programmer has absolute control over every single instruction.
Assembly is, for any given hardware platform ([ISA](isa.md)), the unstructured, lowest levels [programming language](programming_language.md) -- it maps (mostly) 1:1 to [machine code](machine_code.md) (the actual binary CPU instructions) and basically only differs from the actual machine code by utilizing a more human readable form. Assembly is compiled by [assembler](assembler.md) into the the machine code. Assembly is **not** a single language, it differs for every architecture, and is therefore not [portable](portability.md)!
**Assembly is NOT a single language**, it differs for every architecture, i.e. every model of CPU has potentially different architecture, understands a different machine code and hence has a different assembly; therefore **assembly is not [portable](portability.md)** (i.e. the program won't generally work on a different type of CPU or under a different [OS](os.md))! For this reason (and also for the fact that "assembly is hard") you shouldn't write your programs directly in assembly but rather in a bit higher level language such as [C](c.md) (which can be compiled to any CPU's assembly). However you should know at least the very basics of programming in assembly as a good programmer will come in contact with it sometimes, for example during hardcore [optimization](optimization.md) (many languages offer an option to embed inline assembly in specific places), debugging, reverse engineering, when writing a C compiler for a completely new platform or even when designing one's own new platform.
The most common assembly languages you'll encounter nowadays are **[x86](x86.md)** (used by most desktop [CPUs](cpu.md)) and **[ARM](arm.md)** (used by most mobile CPUs) -- both are used by [proprietary](proprietary.md) hardware and though an assembly language itself cannot (as of yet) be [copyrighted](copyright.md), the associated architectures may be "protected" (restricted) e.g. by [patents](patent.md). **[RISC-V](risc_v.md)** on the other hand is an "[open](open.md)" alternative, though not yet so wide spread. Other assembly languages include e.g. [AVR](avr.md) (8bit CPUs used e.g. by some [Arduinos](arduino.md)) and [PowerPC](ppc.md).
To be precise, a typical assembly language is actually more than a set of nicknames for machine code instructions, it may offer helpers such as [macros](macro.md) (something aking the C preprocessor), pseudoinstructions (commands that look like instructions but actually translate to e.g. multiple instructions), [comments](comment.md), directives, named labels for jumps (as writing literal jump addresses would be extremely tedious) etc.
## Typical Assembly Language
The language is unstructured, i.e. there are no control structures such as `if` or `for` statements: these have to be manually implemented using labels and jump instructions. The typical look of an assembly program is therefore a single column of instructions with arguments, one per line.
Assembly languages are usually unstructured, i.e. there are no control structures such as `if` or `while` statements: these have to be manually implemented using labels and jump ([goto](goto.md)) instructions. There may exist macros that mimic control structures. The typical look of an assembly program is however still a single column of instructions with arguments, one per line.
The working of the language reflects the actual hardware architecture -- usually there is a small number of registers (e.g. 16) which may be called something like R0 to R15. These registers are the fastest available memory (faster than the main RAM memory) and are used to perform calculations. Some registers are general purpose and some are special: typically there will be e.g. the FLAGS register which holds various 1bit results of performed operations (e.g. overflow, zero result etc.). Values can be moved between registers and the main memory.
The working of the language reflects the actual [hardware](hardware.md) architecture -- usually there is a small number (something like 16) of [registers](register.md) which may be called something like R0 to R15, or A, B, C etc. Sometimes registers may even be subdivided (e.g. in x86 there is an *eax* 32bit register and half of it can be used as the *ax* 16bit register). These registers are the fastest available memory (faster than the main RAM memory) and are used to perform calculations. Some registers are general purpose and some are special: typically there will be e.g. the FLAGS register which holds various 1bit results of performed operations (e.g. [overflow](overflow.md), zero result etc.). Some instructions may only work with some registers (e.g. there may be kind of a "[pointer](pointer.md)" register used to hold addresses along with instructions that work with this register, which is meant to implement [arrays](array.md)). Values can be moved between registers and the main memory.
Instructions are typically written as three-letter abbreviations and follow some unwritten naming conventions so that different assembly languages at least look similar. Common instructions found in most assembly languages are for example:

11
c.md

@ -55,16 +55,17 @@ The standard library (libc) is a subject of live debate because while its interf
## Bad Things About C
C isn't perfect, it was one of the first relatively higher level languages and even though it has showed to have been designed extremely well, some things didn't age great, or were simply bad from the start. We still prefer this language as usually the best choice, but it's good to be aware of its downsides or smaller issues, if only for the sake of one day designing a better version of C. So, let's go:
Nothing is [perfect](perfect.md), not even C; it was one of the first relatively higher level languages and even though it has showed to have been designed extremely well, some things didn't age great, or were simply bad from the start. We still prefer this language as usually the best choice, but it's good to be aware of its downsides or smaller issues, if only for the sake of one day designing a better language. Keep in mind all here are just suggestions, they made of course be a subject to counter arguments and further discussion. So, let's go:
- **C specification (the ISO standard) is [proprietary](proprietary.md)** :( The language itself probably can't be copyrighted, nevertheless this may change in the future, and a proprietary specs lowers C's accessibility and moddability (you can't make derivative versions of the spec).
- **The specification is also long as fuck**. A good, free language should have a simple definition. It could be simplified a lot by simplifying the language itself as well as dropping some truly legacy considerations (like [BCD](bcd.md) systems?) and removing a lot of undefined behavior.
- **Some behavior is weird and has exceptions**, for example a function can return anything, including a `struct`, except for an array. This makes it awkward to e.g. implement vectors which would best be made as arrays but you want functions to return them, so you may do hacks like wrapping them instide a struct just for this.
- **Some things could be made simpler**, e.g. using [reverse polish](reverse_polish.md) notation for expressions, rather than expressions with brackets and operator precedence, would make implementations much simpler, increasing sucklessness.
- Some things like [enums](enum.md) or [bitfields](bitfield.md) could be dropped entirely, they can be done imitated in other ways without much hassle.
- **Some things could be made simpler**, e.g. using [reverse polish](reverse_polish.md) notation for expressions, rather than expressions with brackets and operator precedence, would make implementations much simpler, increasing sucklessness (of course readability is an argument).
- **Some things could be dropped entirely** ([enums](enum.md), [bitfields](bitfield.md), possibly also unions etc.), they can be done and imitated in other ways without much hassle.
- **The preprocessor isn't exactly elegant**, it has completely different syntax and rules from the main language, not very suckless -- ideally preprocessor uses the same language as the base language.
- **The syntax isn't perfect**, e.g. it's pretty weird that the condition after `if` has to be in brackets, it could be designed better. Keywords also might be better being single chars, like `?` instead of `if` or the weird long ass names with spaces like `unsigned long long` could be made nicer. A shorter, natural-language-neutral source code would be probably better. Both line and block comments could be implemented with a single character, e.g. `#` which would end either with a newline or another `#`.
- **Some basic things that are part of libraries or extensions**, like fixed with types and binary literals, could be part of the language itself.
- **The syntax isn't perfect**, e.g. it's pretty weird that the condition after `if` has to be in brackets, it could be designed better. Keywords also might be better being single chars, like `?` instead of `if` or the weird long ass names with spaces like `unsigned long long` could be made nicer. A shorter, natural-language-neutral source code would be probably better. Both line and block comments could be implemented with a single character (e.g. `#` for line comment, ending with a newline or another `#`, `##` for block comment ending with another `##`?).
- **Some basic things that are part of libraries or extensions**, like fixed with types and binary literals and possibly very basic I/O (putchar/readchar) could be part of the language itself.
- **Some undefined behavior might be better defined** -- undefined behavior isn't bad in general, it is what allows C to be so fast and efficient in the first place, but some of it has shown to be rather cumbersome; for example the unspecified representation of numbers or byte size leads to a lot of trouble (unknown upper bounds, sizes, undefined behavior of many operators etc.) while practically all computers have settled on using 8 bit bytes and [two's complement](twos_complement.md) -- this could easily be made a mandatory assumption which would simplify great many things without doing basically any harm. New versions of C actually already settle on two's complement. This doesn't mean C should be shaped to reflect the degenerate "[modern](modern.md)" trends in programming though!
- TODO: moar
## Basics

@ -1,3 +1,15 @@
# Censorship
*THIS PAGE HAS BEEN BLOCKED IN YOUR COUNTRY*
*!THIS PAGE HAS BEEN BLOCKED IN YOUR COUNTRY!*
*Just kidding, LRS wiki is omnipresent :)*
Censorship means intentional effort towards preventing exchange of certain kind of information among other individuals, for example suppression of [free speech](free_speech.md), altering old works of art for political reasons, forced takedowns of [copyrighted](copyright.md) material from the [Internet](internet.md) etc. Note that thereby censorship does **NOT** include some kinds of data or information filtering, for example censorship does not include filtering out [noise](noise.md) such as [spam](spam.md) on a forum or static from audio (as noise is a non-information) or PERSONAL avoidance of certain information (e.g. using [adblock](adblock.md) or hiding someone's forum posts ONLY FOR ONESELEF). **Censorship is always wrong** -- in a [good society](less_retarded_society.md) there is never a slightest reason to censor anything, therefore whenever censorship is deemed the best solution, something within the society is deeply fucked up. In current society censorship, along with [propaganda](propaganda.md), brainwashing and misinformation, is extremely prevalent and growing -- it's being pushed not only by [governments](government.md) and [corporations](corporation.md) but also by harmful terrorist groups such as [LGBT](lgbt.md) and [feminism](feminism.md) who force media censorship (e.g. that of [Wikipedia](wikipedia.md) or search engines) and punishment of free speech (see [political correctness](political_correctness.md) and "[hate speech](hate_speech.md)").
Sometimes it is not 100% clear which action constitutes censorship: for example categorization such as moving a forum post from one thread to another (possibly less visible) thread may or may not be deemed censorship -- this depends on the intended result of such action; moving a post somewhere else doesn't remove it completely but can make it less visible. Whether something is censorship always depends on the answer to the question: "does the action prevent others from information sharing?".
There exist **tools for bypassing censorship**, e.g. [proxies](proxy.md) or encrypted and/or distributed, censorship-resistant networks such as [Tor](tor.md), [Freenet](freenet.md), [I2P](i2p.md) or [torrent](torrent.md) file sharing. Watch out: using such tools may be illegal or at least make you look suspicious and be targeted harder by state surveillance.
## Examples
TODO

@ -1,6 +1,6 @@
# Chess
Chess is an old two-player board [game](game.md), perhaps most famous and popular among all board games in [history](history.md). It is a [complete information](complete_information.md) game that simulates a battle of two armies on a 8x8 board with different battle pieces. Chess has a world-wide competitive community and is considered an intellectual sport but is also a topic of active research (as the estimated number of chess games is bigger than [googol](googol.md), it is unlikely to ever be solved) and [programming](programming.md) (many chess engines, [AI](ai.md)s and frontends are being actively developed).
Chess is an old two-player board [game](game.md), perhaps most famous and popular among all board games in [history](history.md). It is a [complete information](complete_information.md) game that simulates a battle of two armies on a 8x8 board with different battle pieces. Chess is also called the King's Game, it has a world-wide competitive community and is considered an intellectual [sport](sport.md) but is also a topic of active research (as the estimated number of chess games is bigger than [googol](googol.md), it is unlikely to ever be solved) and [programming](programming.md) (many chess engines, [AI](ai.md)s and frontends are being actively developed).
{ There is a nice black and white indie movie called *Computer Chess* about chess programmers of the 1980s, it's pretty good, very oldschool, starring real programmers and chess players, check it out. ~drummyfish }

@ -1,6 +1,8 @@
# Dog
Here is our dog. He doesn't judge you, he loves unconditionally. No matter who you are or what you did, this doggo will always be your best friend <3 We should all learn from this little buddy.
Here is the dog! he doesn't judge you; dog [love](love.md) is unconditional. No matter who you are or what you ever did, this buddy will always love you and be your best friend <3 By this he is giving us a great lesson.
He loves when you pet him and take him for walks, but most of all he probably enjoys to play catch :) Throw him a ball!
Send this to anyone who's feeling down :)

@ -18,10 +18,6 @@ Sometimes these sets may greatly overlap and LRS is at times just a slightly dif
One way to see LRS is as a philosophy that takes only the [good](good.md) out of existing philosophies/movements/ideologies/etc. and adds them to a single unique [idealist](idealism.md) mix, without including [cancer](cancer.md), [bullshit](bullshit.md), errors, propaganda and other negative phenomena plaguing basically all existing philosophies/movements/ideologies/etc.
### How is this different from Wikipedia?
In many ways, our wiki is better e.g. by being more [free](free_culture.md) (completely [public domain](public_domain.md), no [fair use](fair_use.md) [proprietary](proprietary.md) images etc.), less [bloated](bloat.md), better accessible, not infected by [pseudoleftist](psedoleft.md) [fascism](fascism.md) and censorship (we only censor absolutely necessary things, e.g. copyrighted things or things that would immediately put us in jail, though we still say many things that may get us in jail), we have articles that are better readable etc.
### Why this obsession with extreme simplicity? Is it because you're too stupid to understand complex stuff?
I used to be the mainstream, complexity embracing programmer. I am in no way saying I'm a genius but I've put a lot of energy into studying computer science full time for many years so I believe I can say I have some understanding of the "complex" stuff. I speak from own experience and also on behalf of others who shared their experience with me that the appreciation of simplicity and realization of its necessity comes after many years of dealing with the complex and deep insight into the field and into the complex connections of that field to society.
@ -78,6 +74,10 @@ In three words: [anarcho pacifist](anpac.md) [communism](communism.md). For more
This is a good point, we talk about capitalism simply because it is the system of today's world and an immediate threat that needs to be addressed, however we always try to stress that the root issue lies deeper: it is **competition** that we see as causing all major evil. Competition between people is what always caused the main issues of a society, no matter whether the system at the time was called capitalism, feudalism or pseudosocialism. While historically competition and conflict between people was mostly forced by the nature, nowadays we've conquered technology to a degree at which we could practically eliminate competition, however we choose to artificially preserve it via capitalism, the glorification of competition, and we see this as an extremely wrong direction, hence we put stress on opposing capitalism, i.e. artificial prolonging of competition.
### How is this different from Wikipedia?
In many ways. Our wiki is better e.g. by being more [free](free_culture.md) (completely [public domain](public_domain.md), no [fair use](fair_use.md) [proprietary](proprietary.md) images etc.), less [bloated](bloat.md), better accessible, not infected by [pseudoleftist](psedoleft.md) [fascism](fascism.md) and censorship (we only censor absolutely necessary things, e.g. copyrighted things or things that would immediately put us in jail, though we still say many things that may get us in jail), we have articles that are better readable etc.
### WTF I am offended, is this a nazi site? Are you racist/Xphobic? Do you love Hitler?!?!
We're not fascists, we're in fact the exact opposite: our aim is to create technology that benefits everyone equally without any discrimination. I (drummyfish) am personally a pacifist anarchist, I love all living beings and believe in absolute social equality of all life forms. We invite and welcome everyone here, be it gays, communists, rightists, trannies, pedophiles or murderers, we love everyone equally, even you and Hitler.

@ -1,6 +1,6 @@
# Goodbye World
Goodbye world if a [program](program.md) that is in some sense an opposite of the traditional [hello world](hello_world.md) program. What exactly this means is not strictly given, but some possibilities are:
Goodbye world is a [program](program.md) that is in some sense an opposite of the traditional [hello world](hello_world.md) program. What exactly this means is not strictly given, but some possibilities are:
- It just prints *goodbye world*, the programmer writes the program and never touches the language again.
- It is the last program a programmer writes before death, either unknowingly or possibly as a [suicide](suicide.md) note.

@ -30,7 +30,7 @@ Our society is **[anarcho pacifist](anpac.md) and [communist](communism.md)**, m
**Criminality doesn't exist**, there is no motivation for it as everyone has abundance of everything, no one carries guns, people don't see themselves as competing with others in life and everyone is raised in an environment that nurtures their peaceful, collaborative, selfless loving side. People with "criminal genes" have become extinct thanks to natural selection by people voluntarily choosing to breed with non-violent people. Conflict between people is minimized by the elimination of self interest (and need for it) -- a lot of violence in current society comes from disagreement which comes from everyone's different goals (everyone aims to benefit oneself); in our society this is no longer the case, people rarely disagree on essential decisions because decisions are driven by pure facts collected without distortion or suspicion of self interest.
**[Technology](technology.md) is actually simple, efficient, future proof, ecological and generally good and truly helps people**. [Internet](internet.md) is actually nice, it provides practically all [information](information.md) ever digitized, for example there is a global database of all videos ever produced, including movies, educational videos and documentaries, all without ads and [copyright](copyright.md) strikes, coming with all known [metadata](metadata.md), subtitles, annotations, accessible by many means (something akin websites, [APIs](api.md), ...), all videos can be downloaded, mirrored and complex search queries can be performed, unlike e.g. with [YouTube](youtube.md). Satellite images, streams from all live cameras and other sensors in the world are easily accessible in real time. Search engines are much more powerful than [Google](google.md) can dream of as data is organized efficiently and friendly to indexing, not hidden behind paywalls or registrations to websites, which means that for example all text of all e-books is indexed as well as all conversations ever had on the Internet and subtitles of videos. All source code of all programs is available for unlimited use by anyone. There are only a few models of standardized [computers](computer.md), not thousands of slightly different competing products as nowadays. There is a tiny, energy efficient computer model, then a more powerful computer for complex computations, a simple computer designed to be extremely easy to manufacture etc. None of course have malicious features such as [DRM](drm.md), gay teenager aesthetics, consumerist "killer features" or planned obsolescence. All schematics are available. Personal computers, such as what we would nowadays call a phone, last weeks on single battery charge thanks to lack of [bloat](bloat.md) and bullshit, and are far more responsive and faster than computers nowadays despite having lower raw specs because software is written in a good way. Computers and other tools remain working and usable for many decades. The computing world is NOT split by competing standards such as different programming languages, most programmers use just one programming language similar to [C](c.md) that's been designed to maximize quality of technology (as opposed to capitalist interests such as allowing rapid development by incompetent programmers or [update culture](update_culture.md)).
**[Technology](technology.md) is simple, powerful, efficient, [future proof](future_proof.md), ecological, generally good and maximally helps people**. [Internet](internet.md) is actually nice, it provides practically all [information](information.md) ever digitized, for example there is a global database of all videos ever produced, including movies, educational videos and documentaries, all without [ads](ad.md), [DRM](drm.md) and [copyright](copyright.md) strikes, coming with all known [metadata](metadata.md) such as tags, subtitles, annotations and translations and are accessible by many means (something akin websites, [APIs](api.md), physical media ...), all videos can be downloaded, mirrored and complex search queries can be performed, unlike e.g. with [YouTube](youtube.md). Satellite images, streams from all live cameras and other sensors in the world are easily accessible in real time. Search engines are much more powerful than [Google](google.md) can dream of as data is organized efficiently and friendly to indexing, not hidden behind paywalls, [JavaScript](javascript.md) obscurity or registrations to websites, which means that for example all text of all e-books is indexed as well as all conversations ever had on the Internet and subtitles of videos. All source code of all programs is available for unlimited use by anyone. There are only a few models of standardized [computers](computer.md) -- a universal **[public domain computer](public_domain_computer.md)** -- not thousands of slightly different competing products as nowadays. There is a tiny, energy efficient computer model, then a more powerful computer for complex computations, a simple computer designed to be extremely easy to manufacture etc. None of course have malicious features such as [DRM](drm.md), gay teenager aesthetics, consumerist "killer features" or planned obsolescence. All schematics are available. People possibly wear personal wrist-watch-like [computers](computer.md), however these are nothing like today's "[smart](smart.md)" watches/phones -- our wrist computers are completely under the user's control, without any bullshit, spyware, ads and other malicious features, they last weeks or months on battery as they are in low energy consumption mode whenever they're not in use, they run [extremely efficient software](lrs.md) and are NOT constantly connected to the Internet and [updating](update_culture.md) -- as an alternative to connecting to the Internet (which is still possible but requires activating a transmitter) the device may just choose to receive a world-wide broadcast of general information (which only requires a low power consumption receiver) if the user requests it (similarly to how [teletext](teletext.md) worked), e.g. info about time, weather or news that's broadcasted by towers and/or satellites and/or small local broadcasters. Furthermore wrist computers are very durable and water proof and may have built-in solar chargers, so one wrist computer works completely independently and for many decades. They have connectors to attach external devices like keyboards and bigger displays when the user needs to use the device comfortably at home. The computing world is NOT split by competing standards such as different programming languages, most programmers use just one programming language similar to [C](c.md) that's been designed to maximize quality of technology (as opposed to capitalist interests such as allowing rapid development by incompetent programmers or [update culture](update_culture.md)).
**Fascism doesn't exist**, people no longer compete socially and don't live in [fear](fear_culture.md) (of immigrants, poverty, losing jobs, religious extremists etc.) that would give rise to militarist thought, society is multicultural and [races](race.md) highly mixed. There is no need for things such as [political correctness](political_correctness.md) and other censorship, people acknowledge there exist differences -- differences (e.g. in competence or performance) don't matter in a non-competitive society, discrimination doesn't exist.

@ -35,6 +35,8 @@ Are you a failure? Learn [which type](fail_ab.md) you are.
**Before contributing please read the [rules & style](wiki_style.md)! By contributing you agree to release your contribution under our [waiver](wiki_rights.md).** {But contributions aren't really accepted RN :) ~drummyfish }
**STOP [CAPITALISM](capitalism.md) STOP [CAPITALISM](capitalism.md) STOP [CAPITALISM](capitalism.md) STOP [CAPITALISM](capitalism.md) STOP [CAPITALISM](capitalism.md) STOP [CAPITALISM](capitalism.md) STOP [CAPITALISM](capitalism.md)**
We have a **[C tutorial](c_tutorial.md)**! It [rocks](rock.md).
Pay us a visit on the [Island](island.md) and pet our [dog](dog.md)! And come mourn with us in the [cathedral](cathedral.md), because **technology is dying**. The future is dark but we do our best to bring the light, even knowing it is futile.

@ -2,7 +2,7 @@
{ Not my field, learning on the go, watch out for errors! ~drummyfish }
In [artificial intelligence](ai.md) a neural network (also *neural net* or just NN) is a system simulating natural biological neural network, i.e. a biological system found in living organisms, most importantly in our brain. Neural networks are just another kind of [technology](tech.md) inspired by nature's ingenuity -- they try to mimic and simulate the naturally evolved structure of systems such as brain in hopes of making computers learn and "think" like living beings do, and in recent years they started achieving just that, with great success. Neural network are related to the term [deep learning](deep_learning.md) which basically stands for training multi-layered neural networks.
In [artificial intelligence](ai.md) a neural network (also *neural net* or just NN) is a system simulating natural biological neural network, i.e. a biological system found in [living organisms](life.md), most importantly in our [brain](brain.md). Neural networks are just another kind of [technology](tech.md) inspired by nature's ingenuity -- they try to mimic and simulate the naturally evolved structure of systems such as brain in hopes of making computers learn and "think" like living beings do, and in recent years they started achieving just that, with great success. Neural network are related to the term [deep learning](deep_learning.md) which basically stands for training multi-layered neural networks.
Even though neural networks absolutely aren't the only possible model used in [machine learning](machine_learning.md) (see e.g. [Markov chains](markov_chain.md), [k-NN](k_nn.md), [support vector machines](svn.md), ...), they seem to be the most promising one -- nowadays neural networks are experiencing a boom and practically all AI research revolves around them; they already made their way from research to practice, not only do the play games such as [chess](chess.md) on superhuman level, they already create extremely complex art and show some kind of understanding of pictures, video, audio and text on a human level (see [chatGPT](chat_gpt.md), [stockfish](stockfish.md), stable diffusion etcetc.), and even surpass humans at specialized tasks. Most importantly of course people use this for generating [porn](porn.md), see e.g. [deepfakes](deepfake.md). The exceptional results are already being labelled "scary" due to fears of [technological singularity](tech_singularity.md), "taking jobs", possible "unethical uses" etc.

@ -4,4 +4,8 @@
Niger is an African country with a racist name.
How long before [SJWs](sjw.md) rename it [LMAO](lmao.md)?
How long before [SJWs](sjw.md) rename it [LMAO](lmao.md)?
## See Also
- [Chad](chad.md)

@ -2,7 +2,7 @@
{ Open consoles are how I got into [suckless](suckless.md) programming, they taught me about the low-level, optimizations and how to actually program efficiently on very limited hardware. I recommend you grab one of these. ~drummyfish }
Open consoles are tiny [GameBoy](gameboy.md)-like [gaming](game.md) consoles powered by [free software](free_software.md) and [hardware](free_hardware.md), which have relatively recently (some time after 2015) seen a small boom. Examples include [Arduboy](arduboy.md), [Pokitto](pokitto.md) or [Gamebuino](gamebuino.md). These are **NOT** to be confused with the [Raspberry Pi](rpi.md) handhelds that run GameBoy emulators.
Open consoles (also indie handhelds etc.) are tiny [GameBoy](gameboy.md)-like [gaming](game.md) consoles mostly powered by [free software](free_software.md) and [free hardware](free_hardware.md), which have relatively recently (some time after 2015) seen a small boom. Examples include [Arduboy](arduboy.md), [Pokitto](pokitto.md) or [Gamebuino](gamebuino.md). These are **NOT** to be confused with the [Raspberry Pi](rpi.md) (and similar) handhelds that run GameBoy/PS1/DOS [emulators](emulator.md) but rather custom, mostly [FOSS](foss.md) platforms running mostly their own community made games.
In summary, open consoles are:
@ -25,7 +25,7 @@ These nice little toys are great because they are anti-[modern](modern.md), [sim
## Programming
Open consoles can be programmed without proprietary software, GNU/[Linux](linux.md) works just fine. Most of the consoles are [Arduino](arduino.md)-based so the Arduino IDE is the official development tool with [C++](cpp.md) as a language ([C](c.md) being thankfully an option as well). The IDE is "open-source" but also [bloat](bloat.md); thankfully [CLI](cli.md) development workflow can be set up without greater issues (Arduino comes with CLI tools and for other platforms [gcc](gcc.md) cross-compiler can be used) so comfy programming with [vim](vim.md) is nicely possible.
Open consoles can typically be programmed without proprietary software (though officially they may promote something involving proprietary software), GNU/[Linux](linux.md) mostly works just fine (sometimes it requires a bit of extra work but not much). Most of the consoles are [Arduino](arduino.md)-based so the Arduino IDE is the official development tool with [C++](cpp.md) as a language ([C](c.md) being thankfully an option as well). The IDE is "open-source" but also [bloat](bloat.md); thankfully [CLI](cli.md) development workflow can be set up without greater issues (Arduino comes with CLI tools and for other platforms [gcc](gcc.md) cross-compiler can be used) so comfy programming with [vim](vim.md) is nicely possible.
If normies can do it, you can do it too.

@ -37,6 +37,7 @@ These are mainly for [C](c.md), but may be usable in other languages as well.
- **What's fast on one platform may be slow on another**. This depends on the instruction set as well as on compiler, operating system, available hardware, [driver](driver.md) implementation and other details. In the end you always need to test on the specific platform to be sure about how fast it will run. A good approach is to optimize for the weakest platform you want to support -- if it runs fasts on a weak platform, a "better" platform will most likely still run it fast.
- **Mental calculation tricks**, e.g. multiplying by one less or more than a power of two is equal to multiplying by power of two and subtracting/adding once, for example *x * 7 = x * 8 - x*; the latter may be faster as a multiplication by power of two (bit shift) and addition/subtraction may be faster than single multiplication, especially on some primitive platform without hardware multiplication. However this needs to be tested on the specific platform. Smart compilers perform these optimizations automatically, but not every compiler is high level and smart.
- **Else should be the less likely branch**, try to make if conditions so that the if branch is the one with higher probability of being executed -- this can help branch prediction.
- Similarly **order if-sequences and switch cases from most probable**: If you have a sequences of ifs such as `if (x) ... else if (y) ... else if (z) ...`, make it so that the most likely condition to hold gets checked first, then second most likely etc. Compiler most likely can't know the probabilities of the conditions so it can't automatically help with this. Do the same with the `switch` statement -- even though switch typically gets compiled to a table of jump addresses, in which case order of the cases doesn't matter, it may also get compiled in a way similar to the if sequence (e.g. as part of size optimization if the cases are sparse) and then it may matter again.
- **You can save space by "squeezing" variables** -- this is a space-time tradeoff, it's a no brainer but nubs may be unaware of it -- for example you may store 2 4bit values in a single `char` variable (8bit data type), one in the lower 4bits, one in the higher 4bits (use bit shifts etc.). So instead of 16 memory-aligned booleans you may create one `int` and use its individual bits for each boolean value. This is useful in environments with extremely limited RAM such as 8bit Arduinos.
- **You can optimize critical parts of code in [assembly](assembly.md)**, i.e. manually write the assembly code that takes most of the running time of the program, with as few and as inexpensive instructions as possible (but beware, popular compilers are very smart and it's often hard to beat them). But note that such code loses [portability](portability.md)! So ALWAYS have a C (or whatever language you are using) [fallback](fallback.md) code for other platforms, use [ifdefs](ifdef.md) to switch to the fallback version on platforms running on different assembly languages.
- **[Parallelism](parallelism.md) ([multithreading](multithreading.md), [compute shaders](compute_shader.md), ...) can astronomically accelerate many programs**, it is one of the most effective techniques of speeding up programs -- we can simply perform several computations at once and save a lot of time -- but there are a few notes. Firstly not all problems can be parallelized, some problem are sequential in nature, even though most problems can probably be parallelized to some degree. Secondly it is hard to do, opens the door for many new types of bugs, requires hardware support (software simulated parallelism can't work here of course) and introduces [dependencies](dependency.md); in other words it is huge [bloat](bloat.md), we don't recommend parallelization unless a very, very good reason is given. Optional use of [SIMD](simd.md) instructions can be a reasonable midway to going full parallel computation.

Loading…
Cancel
Save