Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

57
Microprocesso r : Dk Izzati binti Pg Haji Ahmad

Transcript of Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Page 1: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Microprocessor

By: Dk Izzati binti Pg Haji Ahmad

Page 2: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

What is a Microprocessor?

• A microprocessor is a digital electronic component with transistors on a single semiconductor integrated circuit (IC).

• A Central processing unit (CPU) in a

computer system or handheld device consists of

one or more microprocessors.

• Microprocessor is processing device of every

computing device. It is like an artificial brain. It

needs to communicate with outer world.

• For example, It needs to communicate with Input

devices to get data, it needs to communicate with memory

to process data according to instructions written in memory

and finally it needs to communicate with output devices

to display the output.

• To communicate with external world, Microprocessor make use of buses.

• A bus is a group of conducting lines that carries data, address and control signals.

Page 3: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

• There are three microprocessor buses . They are the address bus, data bus and control bus:

• Address bus: used to specify a physical memory address. This can include primary memory (e.g. RAM and ROM) secondary memory (e.g. hard disk drives) and any other connected devices. Monitors, printers, scanners, and keyboards will all be mapped to memory.

• The width of the address bus determines the amount of memory that can be addressed. A 32-bit bus can address 4,294,967,296 (2 ^ 32) bytes of memory. This explains the 4 GB memory restriction on 32-bit operating systems.

• Data bus: connects the microprocessor (CPU) with other devices mapped onto the system. This is often described pictorially using a memory map.

• Unlike the address bus, the data bus is bi-directional (it supports read and write operations). The data bus is not limited to transferring data; it is also used to transfer program instructions.

• Control bus: carries commands from and returns status signals to the microprocessor. The control unit inside a CPU manages the internal control bus — internal to the CPU — and the external control bus.

Page 4: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Microcomputer Block Diagram

Page 5: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

• List of the devices with microprocessors– Pocket Calculators– Digital Watches– Automatic tellers– Smart Telephones– Compact Disk Players– Home Security and Control devices– Realistic video games– Talking dolls and other toys– VCRs– Personal Computers

Page 6: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Kinds of Processors•  Complex Instruction Set Computers (CISC)

– have a large instruction set, with hardware support for a wide variety of operations. In scientific, engineering, and mathematical operations with hand coded assembly language (and some business applications with hand coded assembly language), CISC processors usually perform the most work in the shortest time.

– These types of processors are used in desktops, laptops and servers.

• Reduced Instruction Set Computers (RISC) – have a small, compact instruction set. In most business applications and

in programs created by compilers from high level language source, RISC processors usually perform the most work in the shortest time.

– These types of processors are commonly used in ovens, air conditioners, etc.

Page 7: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Kinds of Processors•  Hybrid processors

– are some combination of CISC and RISC approaches, attempting to balance the advantages of each approach.

• Special purpose processors – are optimized to perform specific functions. Digital signal processors and

various kinds of co-processors are the most common kinds of special purpose processors.

Page 8: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Basic Block Diagram of Microprocessor

Arithmetic and Logic Unit (ALU)

Register Array

Timing and Control unit

The basic units or blocks of microprocessor are ALU, array of registers and control unit:

ALU – Performs all arithmetic and logical operations

Register array – Holds the data temporarily for processing

Control Unit – It supervises/ monitors all the operations carried out in the computer

Page 9: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Flag Reg Instruction Reg

Instruction decoder

Address Buffer A8-A15

B C

D E

H L

Stack Pointer

Program Counter

Incrementer/ DecrementerAddress latch

Data/address Buffer AD0-AD7

Temp. RegAccumulator

Arithmetic and Logic Unit

Timing and Control unit

RAM memory

8-bit_Internal_databus

Intel 8085 Microprocessor Architecture

8- bit External Data bus

ReadWriteClock

Page 10: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Define the various registers

• Accumulator – 8 bit register which holds the latest result from ALU

• B, C, D, E, H and L are general purpose registers

• HL pair can be used for indirect addressing as well

• Program counter – 16 bit register which holds the address of the next instruction to be executed

• Instruction register – It holds the instruction that is currently being processed.

• Stack pointer is used during subroutine calling and execution.

• Address Latch – It increments/ decrements the address before sent to the address buffer

Page 11: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Various Flags• Sign Flag: If the result of the latest arithmetic operation is having MSB ‘1’

(meaning it is a negative number), then the sign flag is set. Otherwise, it is reset to ‘0’ which means it is a positive number.

• Zero flag: If the result of the latest operation is zero, then zero flag will be set; otherwise it be reset.

• Auxiliary Carry Flag: This flag is not accessible to programmer. This flag will be used by the system during BCD operations.

• Parity Flag: If the result of the latest operation is having even number of ‘1’s, then this flag will be set. Otherwise this will be reset to ‘0’. This is used for error checking.

• Carry Flag: If the result of the latest operations exceeds 8-bits then this flag will be set. Otherwise it be reset.

Page 12: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Machine Cycles & Timing of 8085

• Timing Diagram: a graphical representation. It represents the execution time taken by each instruction in a graphical format. The execution time is represented in T-states.

• Instruction Cycle: the time required to execute an instruction is called an instruction cycle.

• Machine Cycle: the time required to access the memory or input/output devices is called machine cycle.

• T-State: the machine cycle and instruction cycle takes multiple clock periods. A portion of an operation carried out in one system clock period is called as T-State.

Page 13: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Machine Cycles & Timing of 8085

Page 14: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Pin Diagram of a Basic 8085 Microprocessor

Page 15: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Pin Description• All the signal can be classified into six groups:

1. Address Bus:The 8085 microprocessor has 8 signal line, A15 - A8 which are unidirectional & used as a high order address bus.

2. Data Bus:The signal line AD7 - AD0 are bidirectional for dual purpose. They are used as low order address bus as well as data bus.

Page 16: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Pin Description3. Control signal and Status signal:

• Control Signal

RD bar - It is a read control signal (active low). It is active then memory read the data.

WR bar - It is write control signal (active low). It is active when written into selected memory.

• Status signal

ALU (Address Latch Enable) - When ALU is high. 8085 microprocessor is use address bus. When ALU is low. 8085 microprocessor is use data bus.

IO/M bar - This is a status signal used to differentiate between i/o and memory operation. When it is high, it indicate an i/o operation and low, it indicate memory operation.

S1 and S0 - These status signal, similar to i/o and memory bar, can identify various operation, but they are rarely used in small system.

Page 17: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Pin Description4. Power Supply and Frequency signal:

• Vcc - +5v power supply.

• Vss - ground reference.

• X, X - A crystal is connected at these two pins. The frequency is internally divided by two operate system at 3-MHz, the crystal should have a frequency of 6-MHz.

• CLK out - This signal can be used as the system clock for other devices.

Page 18: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Pin Description5. Externally initiated signal:

• INTR(i/p) - Interrupt request.• INTA bar (o/p) - It is used as acknowledge interrupt.• TRAP(i/p) - This is non maskable interrupt and has highest priority.• HOLD(i/p) - It is used to hold the executing program.• HLDA(o/p) - Hold acknowledge.• READY(i/p) - This signal is used to delay the microprocessor read or write cycle

until a slow responding peripheral is ready to accept or send data.• RESET IN bar - When the signal on this pin goes low, the program counter is set

to zero, the bus are tri-stated, & MPU is reset.• RESET OUT - This signal indicate that MPU is being reset. The signal can be

used to reset other devices.• RST 7.5, RST 6.5, RST 5.5 (Request interrupt) - It is used to transfer the

program control to specific memory location. They have higher priority than INTR interrupt.

Page 19: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Pin Description6. Serial I/O ports:

• The 8085 microprocessor has two signals to implement the serial transmission serial input data and serial output data.

Page 20: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Microprocessor Operation

• Fetch• Decode• Execute

Page 21: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Fetch – Execute CycleFetch Cycle

• Fetch the Instruction from Main MemoryThe CPU presents the value of the program counter on the address bus. The CPU then fetches the instruction from main memory via the data bus into the Instruction Register.

• Decode the InstructionThe instruction decoder (ID) interprets and implements the instruction

Execute Cycle

• Get Data from Main MemoryFetch required data from main memory to be processed and placed into registers.

• Execute the InstructionControl signals are initialized to process the data using ALU and write the result back to a register.

• Store ResultsThe result generated by the operation is stored in the main memory, or sent to an output device.

Page 22: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Semiconductor Memories

What is Semiconductor memory?

• A device for storing digital information that is fabricated by using integrated circuit technology.

• Semiconductor memory technology is an essential element of today's electronics.

• Indeed as processors have become more popular and the number of microprocessor controlled items has increased so has the requirement for semiconductor memory.

• With the rapid growth in the requirement for semiconductor memories there have been a number of technologies and types of memory that have emerged. Names such as ROM, RAM, EPROM, EEPROM, Flash memory, DRAM, SRAM, SDRAM, and the very new MRAM can now be seen in the electronics literature.

• Each one has its own advantages and area in which it may be used.

Page 23: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Semiconductor Memories

• RAM - Random Access Memory:   As the names suggest, the RAM or random access memory is a form of semiconductor memory technology that is used for reading and writing data in any order as required. It is used for such applications as the computer or processor memory where variables and other stored and are required on a random basis. Data is stored and read many times to and from this type of memory.

• ROM - Read Only Memory:  A ROM is a form of semiconductor memory technology used where the data is written once and then not changed. In view of this it is used where data needs to be stored permanently, even when the power is removed - many memory technologies lose the data once the power is removed.

• PROM:     This stands for Programmable Read Only Memory. It is a semiconductor memory which can only have data written to it once - the data written to it is permanent. These memories are bought in a blank format and they are programmed using a special PROM programmer. Typically a PROM will consist of an array of fuseable links some of which are "blown" during the programming process to provide the required data pattern.

Page 24: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

• EPROM:     This is an Erasable Programmable Read Only Memory. This form of semiconductor memory can be programmed and then erased at a later time. This is normally achieved by exposing the silicon to ultraviolet light. To enable this to happen there is a circular window in the package of the EPROM to enable the light to reach the silicon of the chip. When the PROM is in use, this window is normally covered by a label, especially when the data may need to be preserved for an extended period.

• EEPROM:     This is an Electrically Erasable Programmable Read Only Memory. Data can be written to it and it can be erased using an electrical voltage. This is typically applied to an erase pin on the chip. Like other types of PROM, EEPROM retains the contents of the memory even when the power is turned off. Also like other types of ROM, EEPROM is not as fast as RAM.

Page 25: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

• Flash Memory: Flash memory may be considered as a development of EEPROM technology. Data can be written to it and it can be erased, although only in blocks, but data can be read on an individual cell basis. To erase and re-programme areas of the chip, programming voltages at levels that are available within electronic equipment are used. It is also non-volatile, and this makes it particularly useful. As a result Flash memory is widely used in many applications including memory cards for digital cameras, mobile phones, computer memory sticks and many other applications.

• DRAM:     Dynamic RAM is a form of random access memory. DRAM uses a capacitor to store each bit of data, and the level of charge on each capacitor determines whether that bit is a logical 1 or 0. However these capacitors do not hold their charge indefinitely, and therefore the data needs to be refreshed periodically. As a result of this dynamic refreshing it gains its name of being a dynamic RAM. DRAM is the form of semiconductor memory that is often used in equipment including personal computers and workstations where it forms the main RAM for the computer.

Page 26: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

• SRAM:     Static Random Access Memory. This form of semiconductor memory gains its name from the fact that, unlike DRAM, the data does not need to be refreshed dynamically. It is able to support faster read and write times than DRAM (typically 10 ns against 60 ns for DRAM), and in addition its cycle time is much shorter because it does not need to pause between accesses. However it consumes more power, is less dense and more expensive than DRAM. As a result of this it is normally used for caches, while DRAM is used as the main semiconductor memory technology.

• SDRAM:     Synchronous DRAM. This form of semiconductor memory can run at faster speeds than conventional DRAM. It is synchronised to the clock of the processor and is capable of keeping two sets of memory addresses open simultaneously.

• MRAM:     This is Magneto-resistive RAM, or Magnetic RAM. It is a non-volatile RAM memory technology that uses magnetic charges to store data instead of electric charges. Unlike technologies including DRAM, which require a constant flow of electricity to maintain the integrity of the data, MRAM retains data even when the power is removed. An additional advantage is that it only requires low power for active operation. As a result this technology could become a major player in the electronics industry now that production processes have been developed to enable it to be produced.

Page 27: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Understanding Assembly Language

program

Page 28: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Instruction

• A microprocessor executes instructions given by the user.

• Instructions should be in a language known to the microprocessor.

• Microprocessor understands the language of 0’s and 1’s only

This language is called Machine Language.

• An instruction is a binary pattern designed inside a microprocessor to perform a specific function .

• Intel 8085 has 246 instructions.

• Each instruction is represented by an 8-bit binary value.

Page 29: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

• The instruction set is a collection of pre-defined machine codes, which the CPU is designed to expect and be able to act upon when detected.

• Each machine code of an instruction set consists of two separate fields:

• The opcode is a short code which indicates what operation is expected to be performed. Each operation has a unique opcode.

• The operand, or operands, indicate where the data required for the operation can be found and how it can be accessed (the addressing mode, which is discussed in full later).

• The length of a machine code can vary - common lengths vary from one to twelve bytes in size.

Page 30: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

• Opcodes are also given mnemonics (short names) so that they can be easily referred to in code listings and similar documentation.

Page 31: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Examples

Opcode Operand

MOV C, A

ADD B

MVI A, 32H

MVI B, F2H

Page 32: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Microprocessor understands Machine Language only!

• Microprocessor cannot understand a program written in Assembly language

• A program known as Assembler is used to convert a Assembly language program to machine language

AssemblyLanguageProgram

AssemblerProgram

Machine Language

Code

Page 33: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

A Machine language program to add two numbers

00111110 ;Copy value 2H in register A

0000001000000110 ;Copy value 4H in register B

0000010010000000 ;A = A + B

Page 34: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Assembly Language of 8085

• It uses English like words to convey the action/meaning called as MNEMONICS

• For e.g.– MOV to indicate data transfer– ADD to add two values– SUB to subtract two values

Page 35: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Assembly language program to add two numbers

MVI A, 2H ;Copy value 2H in register AMVI B, 4H ;Copy value 4H in register BADD B ;A = A + B

Note:• Assembly language is specific to a given processor

Page 36: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Instruction Set of 8085

• Consists of– 74 operation codes, e.g. MOV– 246 Instructions, e.g. MOV A,B

• 8085 instructions can be classified as

1. Data Transfer (Copy) instructions

2. Arithmetic instructions

3. Logical and Bit manipulation

4. Branching instructions

5. Machine Control instructions

Page 37: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Example Data Transfer (Copy) Operations /

Instructions1. Load a 8-bit number 4F

in register B

2. Copy from Register B to Register A

3. Load a 16-bit number 2050 in Register pair HL

4. Copy from Register B to Memory Address 2050

5. Copy between Input/Output Port and Accumulator

MVI B, 4FH

MOV A,B

LXI H, 2050H

MOV M,B

OUT 01HIN 07H

Page 38: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Example ArithmeticOperations / Instructions

1. Add a 8-bit number 32H to Accumulator

2. Add contents of Register B to Accumulator

3. Subtract a 8-bit number 32H from Accumulator

4. Subtract contents of Register C from Accumulator

5. Increment the contents of Register D by 1

6. Decrement the contents of Register E by 1

ADI 32H

ADD B

SUI 32H

SUB C

INR D

DCR E

Page 39: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Example Logical & Bit ManipulationOperations / Instructions

1. Logically AND Register H with Accumulator

2. Logically OR Register L with Accumulator

3. Logically XOR Register B with Accumulator

4. Compare contents of Register C with Accumulator

5. Complement Accumulator

6. Rotate Accumulator Left

ANA H

ORA L

XRA B

CMP C

CMARAL

Page 40: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Addressing Modes of 8085

• Addressing modes specify the way in which the address of the operand is given in the instruction.

•          Opcode    [Operands] [;comments]  E.g.:     MVI   B, 05   : Here MVI (Move Immediate) is the opcode part and the rest is the operand part.                 MOV  A , B   : Here MOV is the opcode part and the rest is the operand part.                 ADD   B        : Here ADD is the opcode part and the rest is

the operand part.       

Page 41: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

• The various formats of specifying operands are called addressing modes.

• Addressing modes of 8085:

1. Register Addressing

2. Immediate Addressing

3. Memory Addressing

4. Input/Output Addressing

Addressing Modes of 8085

Page 42: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

1. Register Addressing

• In this addressing mode, a register contains the operand. Depending upon the instruction, the register may be the first operand, the second operand or both.

• Operands are one of the internal registers of 8085.

• Examples:

MOV A, B

ADD C

Page 43: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

2. Immediate Addressing

• In the immediate addressing mode, direct data is given in the operand which move the data in accumulator. It is very fast.

• Value of the operand is given in the instruction itself

• Examples:

MVI A, 20H

LXI H, 2050H

ADI 30H

SUI 10H

Page 44: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

3. Memory Addressing

• One of the operands is a memory location• Depending on how address of memory

location is specified, memory addressing is of two types– Direct addressing– Indirect addressing

Page 45: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

3(a) Direct Addressing

• In the direct addressing mode, address of the operand is given in the instruction and data is available in the memory location which is provided in instruction. We will move this data in desired location.

• 16-bit Address of the memory location is specified in the instruction directly.

• Examples:

LDA 2050H ;load A with contents of memory location with address 2050H

STA 3050H ;store A with contents of memory location with address 3050H

Page 46: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

3(b) Indirect Addressing

• In the indirect addressing mode, the instruction specifies a register which contain the address of the operand. Both internal RAM and external RAM can be access via indirect addressing mode.

• A memory pointer register is used to store the address of the memory location.

• Example:

MOV M, A ;copy register A to memory location whose address is stored in register pair HL

30HA 20H

H50H

L30H2050H

Page 47: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

HL Register

• The HL register is the only register that can be used to specify a memory address.

• It is called a pointer register because it points to a memory location. • The H register contains the high byte of the address, and the L register the

low byte.• High and low bytes may be unfamiliar to you. Consider the decimal number

47. From convention we know that 4 is the number of "tens", and the 7 is the number of "units", high and then low.

• For the hex number 47, 4 is the number of "sixteens", and 7 is the number of "units".

• In the same way for the number 4768, 47 is the number of "two-hundred-fifty-sixes", and 68 is the number of "units".

• We split it this way because the first two digits can fit in the high byte (register) and the second two can fit in the low register.

Page 48: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

MOV Instruction• This instruction is used to copy the data from one place to another.

• The MOV instruction takes two operands.

Syntax:• Syntax of the MOV instruction is:

• The MOV instruction may have one of the following five forms:

Page 49: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

MOV InstructionExamples:

• MOV Rd, Rs (This instruction copies the content of Rs to Rd)

• MOV M, Rs (This instruction copies the content of register Rs to memory location pointed by HL Register)

• MOV Rd, M (This instruction copies the content of memory location pointed by the HL register to the register Rd.)

• *Note: the contents of the source register are not altered.

Page 50: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

MVI Instruction• MVI: move immediate date to a register or memory location.

Examples:

• MVI Rd, #30H (30h is stored in register Rd)

• MVI M, #30H (30h is stored in memory location pointed by HL Reg)

Page 51: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

4. Input/Output Addressing

• 8-bit address of the port is directly specified in the instruction

• Examples:

IN 07H

OUT 21H

Page 52: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

5. Instruction & Data Formats

8085 Instruction set can be classified according to size (in bytes) as

1. 1-byte Instructions

2. 2-byte Instructions

3. 3-byte Instructions

Page 53: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

1. One-byte Instructions

• Includes Opcode and Operand in the same byte

Examples:

Opcode Operand Binary Code

Hex Code

Task

MOV C, A 0100 1111 4FH Copy the contents of the accumulator in the register C.

ADD B 1000 0000 80H Add the contents of register B to the contents of the accumulator.

HLT 0111 0110 76H

Page 54: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

2. Two-byte Instructions

• First byte specifies Operation Code• Second byte specifies Operand

Examples:

Opcode Operand Binary Code Hex Code

MVI A, 32H 0011 11100011 0010

3EH32H

MVI B, F2H 0000 01101111 0010

06HF2H

Page 55: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

3. Three-byte Instructions

• First byte specifies Operation Code• Second & Third byte specifies Operand

Examples:Opcode Operand Binary Code Hex Code

LXI H, 2050H 0010 00010101 00000010 0000

21H50H20H

LDA 3070H 0011 10100111 00000011 0000

3AH70H30H

Page 56: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

An example assembly language program

Address Instruction

202A MVI A, 21 ;Copies 21 into accumulator202C MVI B, 2A ;Copies 2A into B register202E ADD B ;Adds B reg content with Acc and

stores the result in Acc.202F STA 41 FF ; Stores the Acc (the sum) into

the memory location 41 FF.

2032 HLT ; Stops the program

Page 57: Microprocessor By: Dk Izzati binti Pg Haji Ahmad.

Another example assembly language program

Address Instruction

2020 MVI B, 24 ;Copies 24 into accumulator2022 INR B ;Increment B reg content by 12023 MOV A, B ;Copies B register into Acc.2024 SUB B ;Subtracts B reg content from

Acc and stores the result in Acc.

2025 STA 5F FF ; Stores the Acc content into the memory location 5F

FF.2028 HLT ; Stops the program