answersLogoWhite

0


Best Answer

Machine language is error prone simply because it is so difficult to write programs using nothing more than binary notation. Every instruction, every register and every memory address has to be converted to binary. Just one bit out of place would render the code invalid. Trying to find one errant bit amongst many millions is no easy task.

Of course we don't actually use binary (base-2) to write machine code. Any base that is itself a power of 2 will do. Binary is 2^1 while 2^2 is base-4, 2^3 is base-8 (octal) and 2^4 is base-16 (hexadecimal). The advantage of using these higher bases is that instead of entering machine code one bit at a time, we can enter a group of bits using just one symbol. If we divide binary data into groups of 2 bits, then there can be only 4 possible combinations (00, 01, 10 and 11). Base-4 only has 4 possible digits (0, 1, 2 and 3) so it is trivial to map each group of 2 bits to just one base-4 digit. If we divide binary data into groups of 3 bits then there would be 8 possible combinations, each of which can be represented by just one octal digit. And if we divide into groups of 4 bits we get 16 possible combinations each of which can be represented with just one hexadecimal digit. A byte is usually 8 bits long, so if one hexadecimal digit represents half a byte (a nybble) then two hexadecimal digits represent a full byte.

Converting from hexadecimal to binary is so trivial that we can easily write a simple machine code program to perform the conversion for us. This reduces the chances of making errors during input by a factor of 4. However, reducing the chances of error doesn't eliminate errors. Programmer's are only human and if a programmer can make mistakes using a high-level language, then the odds of making a mistake in low-level machine code is greatly multiplied. No matter how much time you spend designing, one mistake is all it takes. And if a mistake is made, finding it is easier said than done.

To reduce the chances of mistake even further, it is best to steer clear of machine code altogether and use assembly language. Assembly language is a symbolic language, so just as binary values can be symbolised through hexadecimal notation, operation codes can be symbolised through easy-to-remember mnemonics. That is, instead of having to remember that code 80 moves a memory address into a register and that 81 moves a register value to that memory address, we need only remember that MOV does both and will translate to the appropriate instruction according to the operands we provide. Assembly language also allows us to use any notion that is most convenient, including decimal, octal, hexadecimal or even binary itself. Every register has a unique identifier and we can also give static, global and constant data user-defined names, so we don't need to keep track of every memory address. We can also insert comments!

Although assembly language is not machine code, the translation from assembly language to machine code is virtually 1:1, there is very little in the way of abstraction. We still won't eliminate programming errors, but at least we have a fighting chance of locating them and ultimately fixing them.

Writing machine code programs in assembly is nonetheless a laborious process. So much so that machine code programmers often prefer to use high-level languages like C and C++ to do the bulk of the work to generate the assembly language which they can then tweak further by hand where necessary. However, C++ in particular produces such good machine code by itself that programmers rarely need to "bang the metal". Indeed, many of the optimisations utilised by the C++ compiler came from the tricks of the trade used by machine code programmers themselves. As a result, C++ can often produce machine code that surpasses anything that can be produced by hand -- but even when it can't, tweaking machine code is so much easier when you don't have to write every single bit from scratch.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

It have so many causes,

1:If someone doesnt know simple language then how he/she will know machine language

2:If someone knows then after it he/she do any error then also machine cant do the same task

3:and finally machine is machine i mean that it cant have sense.it just do what u want but in machine language..........

This answer is:
User Avatar

User Avatar

Lesley Lilian

Lvl 2
1y ago

Machine programming language is error prone simply because it is so difficult to write programs using nothing more than binary notation

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the difficulties in writing programs in machine language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why are few programs written in binary form?

The lower-level the language, the harder it is to write programs in. It takes a long time to write a program in machine language...and it is way more trouble than writing it in an abstracted language.


What are the merits and demerits of machine language?

Merits: Machine language allows for direct communication with the computer hardware, resulting in very fast and efficient execution of instructions. It is also not dependent on any translator programs for execution. Demerits: Writing programs directly in machine language is very complex and error-prone, making it difficult for programmers to work with. It is also platform-dependent, meaning programs may need to be rewritten for different hardware architectures.


Is the java programming language is a complete language or is it useful only for writing programs for the web?

It can be used for lots of programs, not just for the Web.


What are the application of c plus plus plus plus language?

Writing computer-programs in it.


What code do computers use?

Computers Use Machine Language, which a normal person can't understand If you want to understand then you have to uncderstand that machine language into Human Language, they used Language Like C+++ for writing any program.


Which was the first language used for writing artificial intelligence programs?

IPL-I (Information Processing Language) designed 1956 but that was never implemented.


What is theRealtime use of C language?

Writing programs in it... what else it could be? its a mathematical oriented language used for efficient number crunching


What does the term standard unit mean?

Standard Unit is a language used for writing programs for computer systems.


What is Programming languege and why we use programming languege andexplain it?

A computer can do many different things, depending on the program provided to the computer. The program is a list of instructions.Rather than learn the "machine language", which is the underlying instructions the computer can execute, nowadays people usually program in a "programming language", which is closer to a human natural language, usually English. The instructions in this programming language are then converted into machine language, by programs specifically designed for that purpose (assemblers, compilers, and - in a way - interpreters). Writing in a programming language is much easier than learning the machine language.


What is compiler writing tool?

they are tools to help developed compilers


How can you improve your c language by sitting home only?

Sitting won't help you, try writing programs instead.


What is structured assemly language programming and C programming?

A way of writing computer programs that are human readable (and understandable to programmers).