Assembly Programming - Lesson # 4

Video tutorial on Assembly Programming Lesson # 4



An assembly language is a low-level way to instruct a computer to carry out a task. Computers do not inherently understand instructions from people. At the most basic level, computers understand instructions in binary language, that is, sequences of zeroes and ones. Binary language or machine language is extremely cumbersome to program in, however. Assembly language was invented as a symbolic representation of the underlying sequences of zeroes and ones.

Suppose we were to program a game which, upon a certain action, awards the player with five points. The computer keeps the score in a certain location; the locations are either a storage place within the CPU, called a "register," or in some space in the memory. The computer understands locations and low-level actions called operations. So if the score is kept at register RA, then it understands the command, 0101 1100 0000 0101, where the first four numbers indicate the operation ADD, the next four indicate the register RA, and the last eight indicate the number 5.

Originally computers had to be coded this way; machine language is slow, error-prone, and it can be very hard for one person to understand what another person is trying to code. So computer programmers created assembly language in which the operations, locations, numbers, etc., can be better understood. Thus the equivalent command for the above example would be ADD RA 5. In this hypothetical example, mnemonics are used for the ADD operation and the register RA, and the number 5 is written in digits.

A program called an assembler converts assembly language code into the underlying machine language. In earlier days, even this conversion used up expensive computing resources, so the operation codes, opcodes in short, such as Subtract were abbreviated as SUB, Copy-Move was abbreviated as MOV and in some cases even ADD was abbreviated to A.

Assembly language is mostly a thin layer above the machine structure. Hence the opcodes, registers, and the whole language is very much dependent on the CPU family. So, the Intel x86 family has opcodes such as MOV, MOVSX, and MOVZX, whereas IBM 360 has opcodes such as MVI, MVC, MVZ. When designing a computer or CPU, the designers specify the machine language including the opcodes.

Programmers soon moved to "high-level" languages such as COBOL, Pascal, C++, and SQL. Compilers convert code written in these languages into machine language. Assembly language code is still used for specialized CPUs, however, or for ensuring speed from game consoles to car systems.

Source : http://www.wisegeek.com/what-is-assembly-language.htm

0 comments:

Post a Comment