Assembly Language
Assembly Language
Every different type of computer/chip has its own set of machine code
instructions.
• Writing programs in machine code is a specialised task that is very time
consuming and often error prone, as the only way to test a program
written in machine code is to run it and see what happens.
• In order to shorten the development time for writing computer
programs, other programming languages were developed, where the
instructions were easier to learn and understand.
• Any program not written in machine code needs to be translated before
the CPU can carry out the instructions, so language translators were
developed.
Assembly Language & Machine Code
• The first programming language to be developed was assembly language,
Assembly Language Programming
• The contents of the contents of the memory location in the operand are
used.
• For example, if the memory location with address 200 contained the value
20 and the memory location with address 20 contained the value 5, the
assembly language instruction LDI 200 would store 5 in the accumulator.
Indexed addressing
• The contents of the memory location found by adding the contents of the
index register (IR) to the address of the memory location in the operand are
used.
• For example, if IR contained the value 4 and memory location with address
204 contained the value 17, the assembly language instruction LDX 200
would store 17 in the accumulator.
Addressing Modes
Immediate addressing
Assembly Language Programming
• LDD 105 the value 0001 0001is loaded into the accumulator
• LDX 101 content of index register converted into 3 , 101+3 =104, content of
104 0101 1101 is placed in the Accumulator.
• LDI 103 memory address of 103 contains the 107, so the content of 107,
1100 001 is placed in the accumulator.
Assembly Language Instructions – Example 3
Assembly Language Programming
Assembly Language Instructions – Example 4
Assembly Language Programming
Assembly Language Instructions – Example 3
Assembly Language Programming
Assembly Language Code – COUNTER
Assembly Language Programming