The document discusses programming basics and assembly language. It defines a program as a set of instructions that directs a computer to perform tasks. Programs must be converted to binary before execution. Assembly language uses mnemonics like ADD, LDA, STA to represent machine-level instructions. It has directives like ORG, END and symbolic addresses to help the assembler convert programs to binary. Sample assembly language programs are provided to add and subtract numbers using loops and memory locations for operands and results.
Programming the Basic Computer and AssemblerMitul Patel
This document covers programming in basic computer architecture, focusing on machine language, assembly language, and various types of programming structures. It details machine instructions, the role of assemblers, program loops, arithmetic and logic operations, and input-output programming. Additionally, the document discusses the translation of high-level programming languages into machine code and provides examples of assembly language and exercises.
This document discusses computer programming at the assembly language level. It covers topics like machine language, assembly language, assemblers, program loops, arithmetic and logic operations, subroutines, and I/O programming. It provides examples of assembly language programs for tasks like adding numbers, multiplying integers, and input/output of characters. Key concepts explained include machine code, symbolic code, assembler passes, pseudo-instructions, program loops, double-precision arithmetic, logic operations, shift operations, and subroutine calls.
The document provides an introduction to basic computer programming, emphasizing the relationship between hardware and software and outlining instruction sets and machine language. It explains the structure of assembly language programs, details the process of translation from symbolic to machine code using assemblers, and introduces concepts like program loops, arithmetic operations, and subroutines. Additionally, it discusses the implementation of operations through software and hardware and includes examples of instruction sets, code structures, and error diagnostics.
basic computer programming and micro programmed controlRai University
- The document discusses basic computer programming concepts and their relation to hardware representation of instructions. It introduces instruction sets, machine language, assembly language, and the translation process from symbolic to binary code using an assembler.
- The assembler performs two passes: the first generates an address symbol table by assigning memory locations to labels and operands, and the second translates the symbolic code to binary using lookup tables for instructions, operands, and the address symbol table.
- Assembly language allows the use of symbolic names for instructions, addresses, and operands, making programs more human-readable compared to binary or machine language.
Mca i-u-3-basic computer programming and micro programmed controlRai University
This document discusses basic computer programming and microprogrammed control. It introduces some basic programming concepts and their relation to hardware representation of instructions. It describes how a program may be dependent or independent of the computer that runs it. It also discusses machine language, assembly language, and the translation process from symbolic code to binary code using an assembler. Examples are provided of assembly language programs for addition and multiplication.
Bca 2nd sem-u-3.1-basic computer programming and micro programmed controlRai University
The document discusses basic computer programming and microprogrammed control. It introduces basic programming concepts and their relation to hardware instruction representation. It then provides details on:
1. The instruction set of a basic computer including operations like AND, ADD, LDA, STA, etc.
2. The hierarchy of programming languages from low-level machine language to high-level languages like C++.
3. Details on assembly language including symbolic addressing, memory reference vs non-memory reference instructions, and pseudo instructions.
B.sc cs-ii-u-3.1-basic computer programming and micro programmed controlRai University
1. The document discusses basic computer programming concepts and their relation to hardware instruction sets. It introduces an instruction set for a basic computer and describes machine language, assembly language, and the translation process from symbolic to binary code using an assembler.
2. It provides an example assembly language program to subtract two numbers and explains loops in programs using a Fortran example to add 100 numbers.
3. Programming techniques for arithmetic and logic operations like multiplication and double precision addition are demonstrated through examples.
This document discusses programming loops in machine language and assembly language. It provides an example of a Fortran program that adds 100 numbers in a loop and the equivalent assembly language program. The assembly language program uses pointers and counters to iterate through the array of numbers, adding each element to the accumulator and incrementing the pointer until the counter reaches 0, at which point the sum is stored and the program halts.
The CPU is made up of 3 major parts: the register set, control unit, and arithmetic logic unit. The register set stores intermediate values during program execution. The control unit generates control signals and selects operations for the ALU. The ALU performs arithmetic and logic operations. Computer architecture includes instruction formats, addressing modes, instruction sets, and CPU register organization. Registers are organized in a bus structure to efficiently transfer data and perform microoperations under control of the control unit. Common instruction fields are the operation code, address fields, and addressing mode fields. Instructions can be classified by the number of address fields as zero-address, one-address, two-address, or three-address instructions. Common addressing modes specify how operands
mca is a microcontroller and accmulator is a third year cousegauravsharma4365
Chapter 2 focuses on 8051 assembly language programming, detailing instruction sets, addressing modes, and assembler directives, with the goal of providing students an understanding of the 8051 programming model. It categorizes instructions into five groups, provides explanations on assembly language elements, and discusses various addressing modes such as direct, register indirect, and immediate addressing. The chapter concludes with examples of programming tasks to enhance practical skills in manipulating data and performing operations using the 8051 microcontroller.
The document discusses memory operations in assembly language, particularly focusing on optimizing a loop that zeroes a range of memory and the expected performance in a 5-stage pipeline. It includes modifications like loop unrolling to achieve a higher memory zeroing rate of two bytes per cycle and features specific assumptions about register values. Additionally, it addresses MIPS code optimization for floating-point operations and explains the SPARC register groups and their usage in context with CPU design considerations.
The document provides information about programming basic computer operations like arithmetic, logic, and input/output operations using machine language and assembly language. It describes machine language and assembly language programming, including the use of pseudo instructions and address symbol tables. It provides examples of programming multiplication, loops, and double precision addition in assembly language.
This document discusses various topics related to C programming language including hardware components, algorithms, flowcharts, programming concepts like variables, data types, operators, functions etc. It provides examples of C code to find even or odd number, a program to calculate area and perimeter of a circle. It also explains the different steps involved in program development like problem statement, analysis, design, implementation, compilation and execution.
This document discusses various topics related to C programming language including hardware components, algorithms, flowcharts, programming concepts like variables, data types, operators, functions etc. It provides examples of C code and explains the steps involved in program development like problem statement, analysis, design, implementation, compilation and execution. Key terms related to C like keywords, tokens, constants and conversion specifiers are also defined.
Computer organization and architecture Chapter 1 (3).PPTXjamsibro140
Chapter 1 of the document provides an introduction to computer organization and architecture, emphasizing the distinction between hardware structure and functional interactions. It covers fundamental components like logic gates, registers, and flip-flops, explaining their roles in digital systems. Additionally, it discusses Boolean algebra, combinational and sequential circuits, including various flip-flop types and their applications in counters and registers.
The document discusses various C programming concepts like algorithms, flowcharts, tokens, data types, operators, functions, and hardware components of a computer. It includes questions and answers on these topics. Key points covered are definition of algorithm and flowchart, different types of tokens in C, differences between while and do-while loops, definition of software and its types, and examples of standard header files.
This document provides an overview of implementing a processor that executes a subset of the MIPS instruction set. It describes the basic components needed, including an instruction memory to store and fetch instructions, registers to hold data, an ALU to perform arithmetic and logical operations, multiplexers to direct data flow, and a program counter to keep track of the next instruction address. The implementation is built up incrementally, first explaining how instructions are fetched and the program counter updated. It then describes adding components for R-type instructions like arithmetic and logical operations. Finally, it discusses adding units to support load/store memory instructions by sign-extending offsets and calculating effective addresses. The goal is to explain at a high level how the MIPS
The document discusses the central processing unit and its components. It describes the general register organization and stack organization of a CPU. It discusses the instruction formats used in CPUs, including three address, two address, one address, zero address, and RISC instruction formats. It also covers addressing modes and data transfer and manipulation instructions used in CPUs.
This document provides an overview of two's complement multiplication and division in computer organization and assembly language. It discusses how to perform two's complement multiplication by sign extending both integers to twice as many bits and taking bits from the least significant bit of the result. It also explains the process of division, which involves setting an initial quotient of 0, incrementing the quotient if the dividend is greater than or equal to the divisor, and finding the remainder using two's complement arithmetic. Examples of two's complement multiplication and division are provided to illustrate the concepts.
The document discusses the intricacies of one-pass and two-pass assemblers in system programming, detailing how assembly language programs are translated into machine code. It highlights processes such as forward references, symbol management, and various assembler directives, including ORIGIN, EQU, and LTORG. Additionally, it explains the structural design and tasks performed during each pass of a two-pass assembler.
This document provides an overview of ARM instruction set architecture. It discusses various ARM instruction types including data processing instructions, load-store instructions, branch instructions, and software interrupt instructions. It provides examples of common instructions like MOV, CMP, LDM, STM, BX and SWI. It also explains related concepts like conditional execution, barrel shifter operations, and stack operations using load-store multiple instructions.
- CY (carry flag) is set when there is a carry out from the D7 bit during addition/subtraction. It can be directly set or cleared.
- AC (auxiliary carry flag) is set if there is a carry from D3 to D4 during addition/subtraction. It is used for BCD operations.
- P (parity flag) reflects the number of 1s in the accumulator register. It is set if there is an odd number of 1s and cleared if there is an even number.
- OV (overflow flag) is set when a signed number operation result is too large, indicating overflow into the sign bit. It detects errors in signed arithmetic.
The document discusses the design of a data path architecture for digital signal processors (DSPs), detailing components such as registers, multipliers, and arithmetic logic units (ALUs). It covers the functionality of important modules like the multiply-accumulate (MAC) unit, control unit, and shifter, while emphasizing the design's focus on performance, efficiency, and application in various technologies. The presentation includes specific control signals, data-width considerations, and findings related to low-power applications and integration challenges.
cse211 power point presentation for engineeringVishnuVinay6
The document outlines the internal organization and function of a digital computer, detailing how micro-operations, instruction codes, and memory structures work together to execute programs. It highlights the importance of the stored program concept, the structure of instruction codes, and the role of registers and control signals during instruction execution. Additionally, it describes various instruction types, their operational codes, and the timing control mechanisms essential for executing a sequence of operations in a CPU.
A Typed Assembly Language for Non-interference.pdfYasmine Anino
This document presents a typed assembly language called SIF for checking non-interference properties of assembly programs. SIF includes pseudo-instructions like cpush and cjmp that impose a stack discipline on the control flow to simulate block structures lost during compilation. The document defines the syntax and type system of SIF, which uses security types and a program counter label to prevent explicit and implicit information flows. Well-typed SIF programs are proved to satisfy non-interference when assembled to untyped machine code.
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & ImpactAlqualsaDIResearchGr
Invited keynote at the Artificial Intelligence Symposium on AI-powered Research Innovation, taking place at ENSEM (L'École Nationale Supérieure d'Électricité et de Mécanique), Casablanca on June 21, 2025. I’ll be giving a keynote titled: "Generative AI & Scientific Research: Catalyst for Innovation, Ethics & Impact". Looking forward to engaging with researchers and doctoral students on how Generative AI is reshaping the future of science, from discovery to governance — with both opportunities and responsibilities in focus.
#AI hashtag#GenerativeAI #ScientificResearch #Innovation #Ethics #Keynote #AIinScience #GAI #ResearchInnovation #Casablanca
1. Thinking, Creative Thinking, Innovation
2. Societies Evolution from 1.0 to 5.0
3. AI - 3P Approach, Use Cases & Innovation
4. GAI & Creativity
5. TrustWorthy AI
6. Guidelines on The Responsible use of GAI In Research
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptxresming1
This gives an introduction to how NLP has evolved from the time of World War II till this date through the advances in approaches, architectures and word representations. From rule based approaches, it advanced to statistical approaches. from traditional machine learning algorithms it advanced to deep neural network architectures. Deep neural architectures include recurrent neural networks, long short term memory, gated recurrent units, seq2seq models, encoder decoder models, transformer architecture, upto large language models and vision language models which are multimodal in nature.
More Related Content
Similar to UNit-4.pptx programming the basic computer (20)
This document discusses programming loops in machine language and assembly language. It provides an example of a Fortran program that adds 100 numbers in a loop and the equivalent assembly language program. The assembly language program uses pointers and counters to iterate through the array of numbers, adding each element to the accumulator and incrementing the pointer until the counter reaches 0, at which point the sum is stored and the program halts.
The CPU is made up of 3 major parts: the register set, control unit, and arithmetic logic unit. The register set stores intermediate values during program execution. The control unit generates control signals and selects operations for the ALU. The ALU performs arithmetic and logic operations. Computer architecture includes instruction formats, addressing modes, instruction sets, and CPU register organization. Registers are organized in a bus structure to efficiently transfer data and perform microoperations under control of the control unit. Common instruction fields are the operation code, address fields, and addressing mode fields. Instructions can be classified by the number of address fields as zero-address, one-address, two-address, or three-address instructions. Common addressing modes specify how operands
mca is a microcontroller and accmulator is a third year cousegauravsharma4365
Chapter 2 focuses on 8051 assembly language programming, detailing instruction sets, addressing modes, and assembler directives, with the goal of providing students an understanding of the 8051 programming model. It categorizes instructions into five groups, provides explanations on assembly language elements, and discusses various addressing modes such as direct, register indirect, and immediate addressing. The chapter concludes with examples of programming tasks to enhance practical skills in manipulating data and performing operations using the 8051 microcontroller.
The document discusses memory operations in assembly language, particularly focusing on optimizing a loop that zeroes a range of memory and the expected performance in a 5-stage pipeline. It includes modifications like loop unrolling to achieve a higher memory zeroing rate of two bytes per cycle and features specific assumptions about register values. Additionally, it addresses MIPS code optimization for floating-point operations and explains the SPARC register groups and their usage in context with CPU design considerations.
The document provides information about programming basic computer operations like arithmetic, logic, and input/output operations using machine language and assembly language. It describes machine language and assembly language programming, including the use of pseudo instructions and address symbol tables. It provides examples of programming multiplication, loops, and double precision addition in assembly language.
This document discusses various topics related to C programming language including hardware components, algorithms, flowcharts, programming concepts like variables, data types, operators, functions etc. It provides examples of C code to find even or odd number, a program to calculate area and perimeter of a circle. It also explains the different steps involved in program development like problem statement, analysis, design, implementation, compilation and execution.
This document discusses various topics related to C programming language including hardware components, algorithms, flowcharts, programming concepts like variables, data types, operators, functions etc. It provides examples of C code and explains the steps involved in program development like problem statement, analysis, design, implementation, compilation and execution. Key terms related to C like keywords, tokens, constants and conversion specifiers are also defined.
Computer organization and architecture Chapter 1 (3).PPTXjamsibro140
Chapter 1 of the document provides an introduction to computer organization and architecture, emphasizing the distinction between hardware structure and functional interactions. It covers fundamental components like logic gates, registers, and flip-flops, explaining their roles in digital systems. Additionally, it discusses Boolean algebra, combinational and sequential circuits, including various flip-flop types and their applications in counters and registers.
The document discusses various C programming concepts like algorithms, flowcharts, tokens, data types, operators, functions, and hardware components of a computer. It includes questions and answers on these topics. Key points covered are definition of algorithm and flowchart, different types of tokens in C, differences between while and do-while loops, definition of software and its types, and examples of standard header files.
This document provides an overview of implementing a processor that executes a subset of the MIPS instruction set. It describes the basic components needed, including an instruction memory to store and fetch instructions, registers to hold data, an ALU to perform arithmetic and logical operations, multiplexers to direct data flow, and a program counter to keep track of the next instruction address. The implementation is built up incrementally, first explaining how instructions are fetched and the program counter updated. It then describes adding components for R-type instructions like arithmetic and logical operations. Finally, it discusses adding units to support load/store memory instructions by sign-extending offsets and calculating effective addresses. The goal is to explain at a high level how the MIPS
The document discusses the central processing unit and its components. It describes the general register organization and stack organization of a CPU. It discusses the instruction formats used in CPUs, including three address, two address, one address, zero address, and RISC instruction formats. It also covers addressing modes and data transfer and manipulation instructions used in CPUs.
This document provides an overview of two's complement multiplication and division in computer organization and assembly language. It discusses how to perform two's complement multiplication by sign extending both integers to twice as many bits and taking bits from the least significant bit of the result. It also explains the process of division, which involves setting an initial quotient of 0, incrementing the quotient if the dividend is greater than or equal to the divisor, and finding the remainder using two's complement arithmetic. Examples of two's complement multiplication and division are provided to illustrate the concepts.
The document discusses the intricacies of one-pass and two-pass assemblers in system programming, detailing how assembly language programs are translated into machine code. It highlights processes such as forward references, symbol management, and various assembler directives, including ORIGIN, EQU, and LTORG. Additionally, it explains the structural design and tasks performed during each pass of a two-pass assembler.
This document provides an overview of ARM instruction set architecture. It discusses various ARM instruction types including data processing instructions, load-store instructions, branch instructions, and software interrupt instructions. It provides examples of common instructions like MOV, CMP, LDM, STM, BX and SWI. It also explains related concepts like conditional execution, barrel shifter operations, and stack operations using load-store multiple instructions.
- CY (carry flag) is set when there is a carry out from the D7 bit during addition/subtraction. It can be directly set or cleared.
- AC (auxiliary carry flag) is set if there is a carry from D3 to D4 during addition/subtraction. It is used for BCD operations.
- P (parity flag) reflects the number of 1s in the accumulator register. It is set if there is an odd number of 1s and cleared if there is an even number.
- OV (overflow flag) is set when a signed number operation result is too large, indicating overflow into the sign bit. It detects errors in signed arithmetic.
The document discusses the design of a data path architecture for digital signal processors (DSPs), detailing components such as registers, multipliers, and arithmetic logic units (ALUs). It covers the functionality of important modules like the multiply-accumulate (MAC) unit, control unit, and shifter, while emphasizing the design's focus on performance, efficiency, and application in various technologies. The presentation includes specific control signals, data-width considerations, and findings related to low-power applications and integration challenges.
cse211 power point presentation for engineeringVishnuVinay6
The document outlines the internal organization and function of a digital computer, detailing how micro-operations, instruction codes, and memory structures work together to execute programs. It highlights the importance of the stored program concept, the structure of instruction codes, and the role of registers and control signals during instruction execution. Additionally, it describes various instruction types, their operational codes, and the timing control mechanisms essential for executing a sequence of operations in a CPU.
A Typed Assembly Language for Non-interference.pdfYasmine Anino
This document presents a typed assembly language called SIF for checking non-interference properties of assembly programs. SIF includes pseudo-instructions like cpush and cjmp that impose a stack discipline on the control flow to simulate block structures lost during compilation. The document defines the syntax and type system of SIF, which uses security types and a program counter label to prevent explicit and implicit information flows. Well-typed SIF programs are proved to satisfy non-interference when assembled to untyped machine code.
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & ImpactAlqualsaDIResearchGr
Invited keynote at the Artificial Intelligence Symposium on AI-powered Research Innovation, taking place at ENSEM (L'École Nationale Supérieure d'Électricité et de Mécanique), Casablanca on June 21, 2025. I’ll be giving a keynote titled: "Generative AI & Scientific Research: Catalyst for Innovation, Ethics & Impact". Looking forward to engaging with researchers and doctoral students on how Generative AI is reshaping the future of science, from discovery to governance — with both opportunities and responsibilities in focus.
#AI hashtag#GenerativeAI #ScientificResearch #Innovation #Ethics #Keynote #AIinScience #GAI #ResearchInnovation #Casablanca
1. Thinking, Creative Thinking, Innovation
2. Societies Evolution from 1.0 to 5.0
3. AI - 3P Approach, Use Cases & Innovation
4. GAI & Creativity
5. TrustWorthy AI
6. Guidelines on The Responsible use of GAI In Research
Deep Learning for Natural Language Processing_FDP on 16 June 2025 MITS.pptxresming1
This gives an introduction to how NLP has evolved from the time of World War II till this date through the advances in approaches, architectures and word representations. From rule based approaches, it advanced to statistical approaches. from traditional machine learning algorithms it advanced to deep neural network architectures. Deep neural architectures include recurrent neural networks, long short term memory, gated recurrent units, seq2seq models, encoder decoder models, transformer architecture, upto large language models and vision language models which are multimodal in nature.
International Journal of Advanced Information Technology (IJAIT)ijait
International journal of advanced Information technology (IJAIT) is a bi monthly open access peer-
reviewed journal, will act as a major forum for the presentation of innovative ideas, approaches,
developments, and research projects in the area advanced information technology applications and
services. It will also serve to facilitate the exchange of information between researchers and industry
professionals to discuss the latest issues and advancement in the area of advanced IT. Core areas of
advanced IT and multi-disciplinary and its applications will be covered during the conferences.
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.Mark Billinghurst
This is lecture 4 in the course on Rapid Prototyping for XR, taught by Mark Billinghurst on June 11th, 2025. This lecture is about High Level Prototyping.
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...Mark Billinghurst
This is lecture 6 in the course on Rapid Prototyping for XR, taught on June 13th, 2025 by Mark Billinghurst. This lecture was about using AI for Prototyping and Research Directions.
For any number of circumstances, obsolescence risk is ever present in the electronics industry. This is especially true for human-to-machine interface hardware, such as keypads, touchscreens, front panels, bezels, etc. This industry is known for its high mix and low-volume builds, critical design requirements, and high costs to requalify hardware. Because of these reasons, many programs will face end-of-life challenges both at the component level as well as at the supplier level.
Redesigns and qualifications can take months or even years, so proactively managing this risk is the best way to deter this. If an LED is obsolete or a switch vendor has gone out of business, there are options to proceed.
In this webinar, we cover options to redesign and reverse engineer legacy keypad and touchscreen designs.
For more information on our HMI solutions, visit https://www.epectec.com/user-interfaces.
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management ProcessIJDKP
Data mining and knowledge discovery in databases have been attracting a significant amount of research, industry, and media attention of late. There is an urgent need for a new generation of computational theories and tools to assist researchers in extracting useful information from the rapidly growing volumes of digital data.
This Journal provides a forum for researchers who address this issue and to present their work in a peer-reviewed open access forum. Authors are solicited to contribute to the Journal by submitting articles that illustrate research results, projects, surveying works and industrial experiences that describe significant advances in the following areas, but are not limited to these topics only.
Multi-proposer consensus protocols let multiple validators propose blocks in parallel, breaking the single-leader throughput bottleneck of classic designs. Yet the modern multi-proposer consensus implementation has grown a lot since HotStuff. THisworkshop will explore the implementation details of recent advances – DAG-based approaches like Narwhal and Sui’s Mysticeti – and reveal how implementation details translate to real-world performance gains. We focus on the nitty-gritty: how network communication patterns and data handling affect throughput and latency. New techniques such as Turbine-like block propagation (inspired by Solana’s erasure-coded broadcast) and lazy push gossip broadcasting dramatically cut communication overhead. These optimizations aren’t just theoretical – they enable modern blockchains to process over 100,000 transactions per second with finality in mere milliseconds redefining what is possible in decentralized systems.
Structured Programming with C++ :: Kjell BackmanShabista Imam
Step into the world of high-performance programming with the Complete Guidance Book of C++ Programming—a definitive resource for mastering one of the most powerful and versatile languages in computer science.
Whether you're a beginner looking to learn the fundamentals or an intermediate developer aiming to sharpen your skills, this book walks you through C++ from the ground up. You'll start with basics like variables, control structures, and functions, then progress to object-oriented programming (OOP), memory management, file handling, templates, and the Standard Template Library (STL).
Industrial internet of things IOT Week-3.pptxKNaveenKumarECE
Ad
UNit-4.pptx programming the basic computer
1. Unit - 4
r ra a
P og mming the B sic
r
Compute
Prof. Kinjal Parmar
Computer Engineering Department
A. D. Patel Institute of Technology
Mob: 8160251841
Email:[email protected]
Computer Organization Architecture
3. • ar d
Bin y co e
– a r a d ra d
This is sequence of inst uctions n ope n s
ar a a r r a
in bin y th t list the ex ct ep esent tion of
r a a ar r
inst uctions s they ppe in compute
r
memo y.
a
Loc tion r d
Inst uction Co e
0 0010 0000 0000 0100
1 0001 0000 0000 0101
10 0011 0000 0000 0110
11 0111 0000 0000 0001
100 0000 0000 0101 0011
101 1111 1111 1110 1001
110 0000 0000 0000 0000
a r ad a d
Oct l o hex ecim l co e
a a ra a
This is n equiv lent t nsl tion of
ar d a r
the bin y co e to oct l o
ad a r r a
hex ecim l ep esent tion.
a
Loc tion r
Inst uction
000 2004
001 1005
002 3006
003 7001
004 0053
005 FFE9
006 0000
Category of Program
4. Category of Program
• Symbolic code
– The user employs symbols (letters, numerals, or special characters) for the
operation part, the address part, and other parts of the instruction code.
– Each symbolic instruction can be translated into one binary coded instruction
by a special program called an assembler and language is referred to as an
assembly language program. a
Loc tion r
Inst uction Comment
000 LDA 004 ad r ra d
Lo fi st ope n into AC
001 ADD 005 dd d ra d
A secon ope n to AC
002 STA 006 r a
Sto e sum in loc tion 006
003 HLT a r
H lt compute
004 0053 r ra d
Fi st ope n
005 FFE9 d ra d a
Secon ope n (neg tive)
006 0000 r r
Sto e sum he e
5. Category of Program
High-level programming languages
These are special languages developed to reflect the procedures used in the
solution of a problem rather than be concerned with the computer hardware
behavior. E.g. Fortran, C++, Java, etc.
The program is written in a sequence of statements in a form that people prefer
to think in when solving a problem.
However, each statement must be translated into a sequence of binary
instructions before the program can be executed in a computer.
INTEGER A, B, C
DATA A, 83 B,-23
C = A + B
END
6. Pseudo Instruction
• A pseudo instruction is not a machine instruction but rather an
instruction to the assembler giving information about some phase of
the translation.
Symbol r a r r
Info m tion fo the Assemble
ORG N ad a r r a r
Hex ecim l numbe N is the memo y loc tion fo the
r r ra d d
inst uction o ope n liste in the following line.
END d r ra
Denotes the en of symbolic p og m.
DEC N d d a r r d ar
Signe ecim l numbe N to be conve te to bin y.
HEX N ad a r r d ar
Hex ecim l numbe N to be conve te to bin y
7. Assembler
An assembler is a program that accepts a symbolic language program and
produces its binary machine language equivalent.
The input symbolic program is called the source program and the resulting
binary program is called the object program.
The assembler is a program that operates on character strings and produces an
equivalent binary interpretation.
8. a
Loc tion r
Inst uction
ORG 100
100 LDA SUB
101 M
C A
102 INC
103 M
ADD IN
104 STA DIF
105 HLT
106 MIN, DEC 83
107 SUB, DEC -23
108 DIF, HEX 0
END
Symbol a
Loc tion
MIN 106
SUB 107
DIF 108
A.L.P. to subtract 2 numbers
9. First Pass of an assembler
LC ← 0
a d
Sc n next line of co e
a
L bel
r addr
Sto e ess in
a
symbol t ble
r
togethe with
a
v lue of LC
r
Inc ement LC
Set LC
ORG
END
Go to
d
secon
a
p ss
r a
Fi st p ss
no no
no
yes
yes
yes
10. First Pass of an assembler
the first pass, the assembler checks to see if the instructions are legal in the current
assembly mode.
On the first pass, the assembler performs the following tasks:
• Checks to see if the instructions are legal in the current assembly mode.
• Allocates space for instructions and storage areas you request.
• Fills in the values of constants, where possible.
• Builds a symbol table, also called a cross-reference table, and makes an entry in this
table for every symbol it encounters in the label field of a statement.
11. LC ← 0
a d
Sc n next line of co e
d
Pseu o-
r
inst uction
r ar
Sto e bin y
a
equiv lent of
r
inst uction in
a
loc tion given
by LC
r
Inc ement LC
Set LC
ORG END
d a
Secon p ss
Yes No
No
No
Yes Yes
Done
r
Conve t
ra d
ope n to
ar a d
bin y n
r
sto e in
a
loc tion
given by LC
MRI
No
a d
V li non-
MRI
r
inst uction
ra
Get ope tion
d a d
co e n set
bits 2-4
ar addr
Se ch ess-
a r
symbol t ble fo
ar a
bin y equiv lent of
addr
symbolic ess
a d
n set bits 5-16
I
r
Set fi st
bit to 1
r
Set fi st
bit to 0
Yes No
a ar ar
Assemble ll p ts of bin y
r a d r
inst uction n sto e in
a
loc tion given by LC
Yes
rr r
E o in
line of
d
co e
No
Yes
r
DEC o HEX
Second Pass of an assembler
12. Second Pass of an assembler
During the second pass, the assembler examines the operands for symbolic references to
storage locations and resolves these symbolic references using information in the symbol
table.
On the second pass, the assembler:
• Examines the operands for symbolic references to storage locations and resolves these
symbolic references using information in the symbol table.
• Ensures that no instructions contain an invalid instruction form.
• Translates source statements into machine code and constants, thus filling the
allocated space with object code.
• Produces a file containing error messages, if any have occurred.
13. Program Loops
• A program loop is a sequence of instructions that are executed many
times, each time with a different set of data.
• A system program that translates a program written in a high-level
programming language to a machine language program is called a
compiler.
14. A.L.P. to add 100 numbers
1 ORG 100 / r r ra
O igin of p og m is HEX 100
2 LDA ADS / ad r addr ra d
Lo fi st ess of ope n s
3 STA PTR / r r
Sto e in pointe
4 LDA NBR / ad
Lo minus 100
5 STA CTR / r r
Sto e in counte
6
LOP,
CLA / ar a a r
Cle ccumul to
7 ADD PTR I / dd a ra d
A n ope n to AC
8 ISZ PTR / r r
Inc ement pointe
9 ISZ CTR / r r
Inc ement counte
10 BUN LOP / a a a
Repe t loop g in
11 M
STA SU / r
Sto e sum
12 HLT / a
H lt
ADS,
13 HEX 150 / r addr ra
Fi st ess of ope n
PTR,
14 HEX 0 / a r r d
This loc tion ese ve
NBR,
15 DEC -100 / a a d
Const nt to initi lize c
CTR,
16 HEX 0 / a r r d
This loc tion ese ve
M
SU ,
17 HEX 0 / r r
Sum is sto e he e
18 ORG 150 / r ra d
O igin of ope n s is H
19 DEC 75 / r ra d
Fi st ope n
118 DEC 23 / a ra d
L st ope n
119 END / d r ra
En of symbolic p og
.
.
.
15. A.L.P. to Add Two Double-Precision Numbers
1 ORG 100 / r r ra
O igin of p og m is HEX 100
2 LDA AL / ad
Lo A low
3 ADD BL / dd arr
A B low, c y in E
4 STA CL / r
Sto e in C low
5 CLA / ar
Cle AC
6 CIL / r a r arr
Ci cul te to b ing c y into AC(16)
7 ADD AH / dd a d arr
A A high n c y
8 ADD BH / dd
A B high
9 STA CH / r
Sto e in C high
10 HLT / a
H lt
16. Subroutines
ORG 100
100 LDA X
101 BSA SH4
102 STA X
103 LDA Y
104 BSA SH4
105 STA Y
106 HLT
107 HEX 1234
X,
108 HEX 4321
Y,
109 HEX 0
10A CIL
10B CIL
10C CIL
10D CIL
10E M
AND
10F BUN S
110 HEX FF
MSK,
END
SH4,
• A set of common instructions that can be used
in a program many times is called a subroutine.
• Each time that a subroutine is used in the main
part of the program, a branch is executed to the
beginning of the subroutine.
• After the subroutine has been executed, a
branch is made back to the main program.
• A subroutine consists of a self contained
sequence of instructions that carries a given
task.
17. A.L.P. to input one character & output one character.
1 ORG 100 / r r ra
O igin of p og m is HEX 100
2 SKI / a
Check input fl g
3 BUN CIF / a ra a a
Fl g = 0, b nch to check g in
4 INP / a ara r
Fl g = 1, input ch cte
5 OUT / r ara r
P int ch cte
6
CHR,
STA CHR / r ara r
Sto e ch cte
7 HLT
8 - / r ara r r
Sto e ch cte he e
9 END
CIF,
1 ORG 100 / r r ra
O igin of p og m is H
2 LDA CHR / ad ara r
Lo ch cte into A
3 SKO / a
Check output fl g
4 BUN COF / a ra
Fl g = 0, b nch to ch
5 OUT / a ara
Fl g = 1, output ch
CHR,
6 HLT
7 HEX 0057 / ara r
Ch cte is “W”
8 END
COF,
r ra
Input P og m r ra
Output P og m
18. Booth Multiplication Algorithm
• The booth algorithm is a multiplication algorithm that allows us to multiply
the two signed binary integers in 2's complement, respectively.
• It is also used to speed up the performance of the multiplication process. It
is very efficient too.
• It works on the string bits 0's in the multiplier that requires no additional bit
only shift the right-most string bits and a string of 1's in a multiplier bit
weight 2k
to weight 2m
that can be considered as 2k+ 1
- 2m
.
20. Working of Booth Algorithm
1. Set the Multiplicand and Multiplier binary bits as M and Q,
respectively.
2. Initially, we set the AC and Qn + 1 registers value to 0.
3. SC represents the number of Multiplier bits (Q), and it is a sequence
counter that is continuously decremented till equal to the number of
bits (n) or reached to 0.
4. A Qn represents the last bit of the Q, and the Qn+1 shows the
incremented bit of Qn by 1.
21. Working of Booth Algorithm
5. On each cycle of the booth algorithm, Qn and Qn + 1 bits will be checked on the
following parameters as follows:
• When two bits Qn and Qn + 1 are 00 or 11, we simply perform the arithmetic shift
right operation (ashr) to the partial product AC. And the bits of Qn and Qn + 1 is
incremented by 1 bit.
• If the bits of Qn and Qn + 1 is shows to 01, the multiplicand bits (M) will be added
to the AC (Accumulator register). After that, we perform the right shift operation
to the AC and QR bits by 1.
• If the bits of Qn and Qn + 1 is shows to 10, the multiplicand bits (M) will be
subtracted from the AC (Accumulator register). After that, we perform the right
22. Working of Booth Algorithm
6. The operation continuously works till we reached n - 1 bit in the booth
algorithm.
7.Results of the Multiplication binary bits will be stored in the AC and QR
registers.