Source code: Difference between revisions

Rtim (talk | contribs)
mNo edit summary
Ilyagredasov (talk | contribs)
No edit summary
Tags: Mobile edit Mobile web edit
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''Source code''' is a collection of text files containing instructions that a computer either runs as-is (interpretation) or translates into an executable file beforehand (compilation / assembly). Source code is written using a human-readable computer language so that it can be translated by a compiler or an interpreter. It's also possible to decompile an executable file, though decompilers aren't as common.
'''Source code''' is a collection of text files containing instructions that a computer either runs as-is (interpretation) or translates into an executable file beforehand (compilation/assembly). Source code is written using a human-readable computer language so that it can be translated by a compiler or an interpreter. It's also possible to decompile an executable file, though decompilers aren't as common.


The language used changes how the source code is read, and just like emulation it too has its own high and low-level types. If a program were written in an assembly language (which often involves taking advantage of system-specific attributes), an assembler would write the machine code "word for word," reflecting how the machine takes instructions. If a program were written in a low-level language, a compiler would read the code and translate the equivalent in machine code. If a program were written in a high-level language, it would often work without requiring a compiler. Some compilers and interpreters also do error checking to make sure the programmer's code is either properly written or formatted. Many languages also check that the code won't inherently cause bugs, such as Rust.
The language used changes how the source code is read, and just like emulation it too has its own high and low-level types. If a program were written in an assembly language (which often involves taking advantage of system-specific attributes), an assembler would write the machine code "word for word," reflecting how the machine takes instructions. If a program were written in a low-level language, a compiler would read the code and translate the equivalent in machine code. If a program were written in a high-level language, it would often work without requiring a compiler. Some compilers and interpreters also do error checking to make sure the programmer's code is either properly written or formatted. Many languages also check that the code won't inherently cause bugs, such as Rust.
Line 6: Line 6:


==Language levels==
==Language levels==
Software can be programmed in many different languages (even multiple in one program), and just like [[High/Low level emulation|high and low level emulation]], they have different levels of abstraction. Here are the different ones, from lowest to highest.
Software can be programmed in many different languages (even multiple in one program), and just like [[High/Low level emulation|high and low-level emulation]], they have different levels of abstraction. Here are the different ones, from lowest to highest.


===Assembly===
===Assembly===
Line 20: Line 20:


===High===
===High===
High-level languages push away most system specific quirks in favor of instructions intended to work on any platform. This was pioneered by Java, whose goal was for developers to "write once, run anywhere".
High-level languages push away most system-specific quirks in favor of instructions intended to work on any platform. This was pioneered by Java, whose goal was for developers to "write once, run anywhere".


In high-level languages, many of the same instructions can be run across different architectures and platforms. They may have a compiler, a compiler cache, a [[dynamic recompilation|dynamic recompiler]], and/or an interpreter.
In high-level languages, many of the same instructions can be run across different architectures and platforms. They may have a compiler, a compiler cache, a [[dynamic recompilation|dynamic recompiler]], and/or an interpreter.
Line 27: Line 27:
[[wikipedia:Esoteric programming language|Esoteric languages]] are built around a specific idea or a joke, as part of a challenge. These languages are intended to be comedic, confusing, and/or thought-provoking.
[[wikipedia:Esoteric programming language|Esoteric languages]] are built around a specific idea or a joke, as part of a challenge. These languages are intended to be comedic, confusing, and/or thought-provoking.


One example includes [[wikipedia:Brainfuck|Brainfuck]], a <abbr title="Meaning it can solve any problem a Turing machine can.">Turing-complete</abbr> programming language with only eight one-character commands (as opposed to the thousands of standard languages and architectures) and one instruction pointer. Another is [[wikipedia:Shakespeare Programming Language|Shakespeare]], a programming language designed to resemble a Shakespearean play. There's also [https://github.com/dylanbeattie/rockstar Rockstar], a language designed around "the lyrical conventions of 1980s hard rock and power ballads", meant to lampoon the software industry's use of "rockstar developers" in recruiting.
One example includes [[wikipedia:Brainfuck|Brainfuck]], a <abbr title="Meaning it can solve any problem a Turing machine can.">Turing-complete</abbr> programming language with only eight one-character commands (as opposed to the thousands of standard languages and architectures) and one instruction pointer. Another is [[wikipedia:Shakespeare Programming Language|Shakespeare]], a programming language designed to resemble a Shakespearean play. There's also [https://github.com/RockstarLang/rockstar Rockstar], a language designed around "the lyrical conventions of 1980s hard rock and power ballads", meant to lampoon the software industry's use of "rockstar developers" in recruiting.


==Version control==
==Version control==
Line 36: Line 36:
Software is copyrightable, but the source code can be made available to users however the author chooses. A copyright license is a legal document that tells people how the software can be used and what limitations come with using it.
Software is copyrightable, but the source code can be made available to users however the author chooses. A copyright license is a legal document that tells people how the software can be used and what limitations come with using it.


;Public domain:There is no copyright (i.e. No Rights Reserved). Works enter the public domain when they:
The more successful emulation projects are often open-source (though you definitely will find exceptions).
:# were released before the current copyright expiry date. This is why old paintings, plays, and books are so commonly quoted and used in modern works, because they'd have to negotiate the rights with the author otherwise. Most software is not released this way because it is still covered by the current American copyright term.
:# are dedicated through a license like Creative Commons Zero or the Unlicense. This is the only option for modern works to be released into the public domain because, per the Berne Convention, copyright is seen as opt-out, not opt-in. If a public domain dedication can't be made (probably because the jurisdiction doesn't recognize the public domain), then the license grants users the equivalent freedoms.
;Open-source:The program is released under a copyright license that permits four freedoms: that it can be run at any time, studied and modified for the user's own purposes, distributed to anyone, and improved for everyone else. This bypasses most of the issues encountered with public domain works. For anything else copyrightable, the term "open content" often applies.
:It's worth noting that open-source does not replace copyright. And likewise, the license cannot be removed after the work has been released under it. To see the various open-source licenses available, see [https://choosealicense.com/ choosealicense.com]. Also see [https://choosealicense.com/appendix/ the appendix] at the same website.
;Source-available:The program is released under a copyright license more restrictive than an open-source license, but the source code is still publically available. The biggest example is [[Snes9x]], which is released under a non-commercial license. This license makes it not open-source, as it restricts the users' commercial use.
;Closed source / Proprietary:The program's source code isn't available. Often because the ecosystem behind the platform is closed, sometimes by nature (like Windows and Android), or sometimes by force (like every modern console).
:;Freeware:The source code isn't available but the program is still free.
:;Shareware / Trialware:A limited demo version of the program is free. This was common for [[POS_(Pong_Consoles)_CPUs_and_Other_Chips#Intel_CPU.27s|DOS]] games.
 
The more successful emulation projects are often open source (though you definitely will find exceptions).


==See also==
==See also==
* [[Dynamic recompilation]]
* [[Dynamic recompilation]]
* [[ROM Hacking Resources]]
* [[ROM hacking resources]]
<!--
<!--
==References==
==References==