What language do computers understand?

In summary, the conversation discusses the different languages used to communicate with computers, including machine language, assembly language, and higher level languages. It is mentioned that it is possible to directly manipulate memory using an operating system, but this is not always recommended for safety purposes. The difficulty of creating an operating system is also addressed, with some resources provided for further learning. The conversation also touches on the difference between a computer and a calculator, with the ability to make conditional jumps being a defining factor.
  • #1
Euclid
214
0
I was reading about how to build a computer by yourself. The final step is installing the operating system.
I was wondering, how does the operating system give instructions to the computer? When I write a program in java, for example, I rely on the operating system as a crutch to pass my instructions along. How do I talk directly to a computer?
What if I wanted to build my own operating system? Let's say I wanted to make my computer one glorified calculator. So after I install my OS, every time I turn on my computer, it asks me for two numbers, adds them, displays the answer and asks for two more numbers. Is this hard to do?
Thanks!
 
Computer science news on Phys.org
  • #2
Computers only understand one language: machine language: 01011101.

Humans write programs in a 2nd generation language: assembly language (JMP 0061 00, MOV 2A1B 21A1, etc ). This forms a bridge that (a very few) humans can undestand and the computer can get instructions from. Assembly has very few instructions in it to perform operations, doing very little except the housekeeping required to pass individual bytes from memeory unit to memory unit. The most complex code is built up from countless of these assembly language instructions passing bits and bytes from location to location, or storage to processor, or combining them.

A third generation language is one where we write in at least moderately legible code. It goes on up to fifth gen, where the programmers are more and more abstracted from the actual computer, and lower gen languages do much of the manual labour.


So, look up 'machine language' and 'assembly language'.


And yes, it's very hard to do. Partly because it is very rapidly becoming a lost art.
 
Last edited:
  • #3
Hi DaveC426913,
Thank you for the response.
This is very interesting. How hard is very hard? Roughly speaking, would it take me days, weeks, months or years to get up to speed?
What if I assume the existence of some operating system? Can I use the OS to directly manipulate my memory? By this I mean, can I look directly at a section of the memory and see what is stored there and then change some 0 to a 1? Or does the typical OS restrict this type of direct manipulation (maybe for safety purposes)?
 
  • #4
Euclid said:
This is very interesting. How hard is very hard? Roughly speaking, would it take me days, weeks, months or years to get up to speed?
Like anything, it's entirely proportional to how complex you want to get.

To get the gist, I'll bet you can download some sort of bit editor that will allow you to view and edit your memory registers.

To do anything useful might require a book on the subject.

Euclid said:
What if I assume the existence of some operating system? Can I use the OS to directly manipulate my memory? By this I mean, can I look directly at a section of the memory and see what is stored there and then change some 0 to a 1? Or does the typical OS restrict this type of direct manipulation (maybe for safety purposes)?
Yes, you can do that.

This was very popular years ago with the older computers like Commodores.

Um, I'm not going to be able to point you to the right people to ask about this, but Wiki articles on the subject - particularly the external references at the bottom of the articles - might set you in the right direction.
 
  • #5
Generally operating systems limit the memory that a user program can alter - for safety as you say.
Earlier PC systems like DOS/Win3.1.Win95 didn't and a faulty program could crash the machine.

An operating system also needs a way of controlling the hardware.
In simple systems like DOS this is done by the BIOS, which is the minimalist system that loads from a ROM chip when your machine starts - it's what prints the text on the screen about number of disks and memory size before windows starts.
You can write DOS programs to directly talk to this bios to read the keyboard and send characters to the screen quite easily. See Peter Norton's books about Assembly language programming.

Writing a modern operating system like Linux took a year to get a basic system started. It was originally based on a simple teaching verion of Unix called Minix - if you are interested in undersanding operating systems you should look at this, it is written by Andrew Tannenbaum and is free.
 
  • #6
You can write your own "operating system" capable of accepting keyboard input and displaying something on a VGA screen in about three or four pages of assembly code. It might take you a week if you're new to it; only hours if you're more experienced. Many university computer engineering programs have classes that do exactly these kinds of things.

Get yourself a book on x86 assembly and PC architecture, and it will probably give you everything you need to know. All that you're going to do is write calls to the machine's BIOS to do your keyboard input and text output. Calling the BIOS basically just means stuffing numbers into specific registers and activating interrupts.

- Warren
 
  • #8
You don't need an operating system for the simplest of programs. Intel used to include a "traffic signal" program at the back of the 8051 cpu manual, where there was no memory, just the registers. The program would just loop a fixed number of times to delay for so many seconds, and it could "read" sensors via pin inputs on the 8051 to switch the traffic signal based on sensors and elapsed time.

What makes a computer (versus a calculator) is the ability to do conditional jumps: test for something, then conditionally jump to a new set of instructions, which gives a computer the ability to "make decisions" and "act" upon them.

Here's a link that describes the kinds of basic circuits used in computers, the "latch" being one of the important ones, since it functions as a type of "memory". If you go to the home page, you'll find more basic computer stuff.

http://www.play-hookey.com/digital

Regarding the generation of languages, here's a Wiki link:

http://en.wikipedia.org/wiki/First-generation_programming_language

What Wiki shows at an alternate definition to "5th generation language", GUI input, source code output, used to be called "4th generation language". If I remember correctly, Think C was one of the first of these that was widely available, made for the MacIntosh, which otherwise (usng MPW - Macintosh Programmers Workshop) was a very programmer "un-friendly" environment (until OS-X).

update - Depending on the computer, there's a layer below "machine language". It used to be called micro code befor "micro processor" became a popular term. On a cpu with a limited instruction set, such as a AMD 2901 bit slice cpu that older mini-computers were based on, a typical implementation of the "opcode" of an instruction was to index an 80 bit wide array. In this array, each bit triggered an operation. There were only 80 possible cpu operations (copy A to B, copy B to A, add A to B, xor B to A, ...) so this scheme was reasonably efficient. On other machines, the microcode more closely represents yet another instruction set.

On main-frames, there may be a lot of machine language instructions in the instruction set, such as a IBM 360, which the 390 is a derivative of. These include instructions that can do math on variable legth BCD (binary coded decimal fiels, 4 bits per digit", and even copy / format the BDC fields into a byte oriented field. Now few of the older IBM mainframes truly implemented all these machine language instructions and instead a "trap" would occur and the instruction would be emulated.

Intel cpu's have a lot of instructions as well. Such as the ability to add an immediate value to a memory location without using any registers.
 
Last edited:

What is the language that computers understand?

The language that computers understand is called machine code, which is a series of binary numbers (0s and 1s) that directly correspond to specific instructions and data that the computer can execute.

How do computers understand different languages?

Computers are programmed to understand different languages through the use of compilers and interpreters. These are software programs that translate code written in different programming languages into machine code that the computer can understand and execute.

What is the difference between a high-level language and a low-level language?

A high-level language is a programming language that is easier for humans to read and write, and is further from machine code. Examples include Java, Python, and C++. On the other hand, a low-level language is closer to machine code and is more difficult for humans to read and write. Examples include assembly language and machine code itself.

Can computers understand natural languages like English?

Currently, computers are not able to fully understand natural languages like English. However, there is ongoing research and development in the field of natural language processing which aims to enable computers to understand and respond to human language.

How do programmers communicate with computers?

Programmers communicate with computers by writing code in programming languages that the computer can understand. This code is then translated into machine code and executed by the computer to perform various tasks and operations.

Similar threads

  • Computing and Technology
Replies
13
Views
2K
  • Computing and Technology
Replies
14
Views
2K
  • Computing and Technology
2
Replies
44
Views
3K
Replies
9
Views
2K
  • Computing and Technology
Replies
2
Views
637
Replies
26
Views
2K
  • Computing and Technology
Replies
18
Views
1K
  • Computing and Technology
Replies
9
Views
1K
Replies
23
Views
3K
  • Computing and Technology
Replies
10
Views
2K
Back
Top