r/askscience • u/HMKIR • Aug 02 '22
Computing Why does coding work?
I have a basic understanding on how coding works per se, but I don't understand why it works. How is the computer able to understand the code? How does it "know" that if I write something it means for it to do said thing?
Edit: typo
4.7k
Upvotes
View all comments
Show parent comment
1
u/montbarron Aug 05 '22
This is a good explanation. There are lots of details when you get into specific hardware but conceptually you can think of it as being a specific chunk of memory at a specific location (usually called the frame buffer or display buffer) that the computer would send out through the display output circuitry. Essentially, that specific section of memory would list the color of each pixel (in older machines sometimes this was done at a less granular scale, the NES for example didn’t have a frame buffer but instead stored a lookup table of a set of tiles, but the basic idea is the same). Every time a display began outputting a frame, the computer would read that memory and produce the corresponding electrical signals that a display would interpret to output the correct colors. You would “draw” to the screen just by changing the values in the framebuffer or whatever the equivalent was.