Additionally assemblers are designed to automatically

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: assembler for the data items of the assembly language program of Figure 12.4. The next instruction of the assembly language program is CLA FRST, which the assembler translates into 10 1000 by translating CLA into 10 with the help of Figure 12.3 and FRST into 1000 with the help of Figure 12.5. Similarly, the assembler will translate the instruction ADD SCND into 14 1001, and the instruction STA ANSR into 30 1002. Finally it translates the next instruction HLT into 00, thus providing the complete machine language program for the given assembly language program. The resulting machine language program is shown in Figure 12.6. Memory location 0000 0001 0002 0003 1000 Contents Comments Opcode Address 10 1000 Clear and add the number stored at FRST to A register 14 1001 Add the number stored at SCND to the contents of A register 30 1002 Store the contents of A register into ANSR 00 Halt Reserved for FRST 1001 Reserved for SCND 1002 Reserved for ANSR Figure 12.6. The equivalent machine language program for the assembly language program given in Figure 12.4. Advantages of Assembly Language over Machine Language Assembly languages have the following advantages over machine languages: 1. Easier to understand and use. Due to the use of mnemonics instead of numeric op-codes and symbolic names for data locations instead of numeric addresses, assembly language programs are much easier to understand and use as compared to machine language programs. Assembly language programming also saves a lot of time and effort of the programmer because it is easier to write as compared to machine language programs. 2. Easier to locate and correct errors. Because of the use of mnemonic op-codes and symbolic names for data locations, and also because programmers need not keep track of the storage locations of the data and instructions, fewer errors are made while writing programs in assembly language, and those that are made are easier to find and correct. Additionally, assemblers are designed to automaticall...
View Full Document

Ask a homework question - tutors are online