chapter 7 Logic, shift and rotate instructionswarda aziz
this is a solution to exercise of chapter 7 from Assembly language programming and organization of the IBM PC.
If you find any mistakes in my solution , please discuss with me. as i am also a human and can do mistakes.
The document summarizes information about flags registers in processors and flow control instructions in assembly language. It defines status and control flags that determine how the processor responds. It describes how jump, compare, and loop instructions can control program flow and provides examples of conditional jumps, unconditional jumps, IF-THEN structures, and WHILE, FOR, and REPEAT loops.
Introduction to ibm pc assembly languagewarda aziz
The Solution manual of COAL
Chapter NO 4. exercise
if anyone has Questions Regarding this exercise.
contact me on my given Email-ID.
i will guide you. Thank you!
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...warda aziz
this pdf covers solution to chapter 8 and 9 of assembly language and organization of the IBM PC. if you find any mistakes in my writing , please disccuss with me.
assembly language programming and organization of IBM PC" by YTHA YUEducation
This document contains solutions to chapters 1 through 10 of a manual on assembly language programming and organization of the IBM PC. It includes contents, chapter summaries, programming exercises and their solutions. Appendices provide information on how to run programs and some useful procedures.
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...Bilal Amjad
This document discusses one-dimensional and two-dimensional arrays in assembly language. It covers topics such as:
- Declaring and initializing one-dimensional arrays
- Addressing individual elements using offsets from the base address
- Common addressing modes like register indirect, based, indexed, and based indexed to access array elements
- Storing two-dimensional arrays in row-major or column-major order and calculating element addresses
- Code examples to sum elements of a one-dimensional array and clear a row or column of a two-dimensional array
This document provides an overview of assembly language programming on the 8086 processor. It includes examples of assembly code using MOV, MUL, and other instructions. It then summarizes various 8086 instruction types like data transfer, arithmetic, logical, and control flow instructions. For each type, it lists some common instructions and provides brief descriptions and examples.
This document contains solutions to 12 questions related to assembly language programming and flow control instructions. The questions cover a range of topics including IF-THEN-ELSE logic, loops, arithmetic operations, character input/output, and string manipulation. Detailed assembly code solutions are provided for each question involving decision structures, loops, arithmetic sequences, reading/displaying characters, and finding the longest consecutive alphabetically increasing substring in a string.
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...Bilal Amjad
This document contains presentation slides on bit shifting, multiplication, division, and their implementation in assembly language. It discusses:
- Using left and right bit shifts to perform multiplication and division by powers of 2
- The different instructions for signed vs unsigned multiplication and division (MUL, IMUL, DIV, IDIV)
- How multiplication and division results are stored in registers
- Examples of multiplying and dividing word and byte variables in assembly code
Binary and hex input/output (in 8086 assembuly langyage)Bilal Amjad
This document discusses binary and hexadecimal input/output algorithms. It contains pseudocode to convert character input into binary representations in a register and output binary values as characters. For binary input, each '0' or '1' character is converted and shifted left into a register. For hexadecimal input, characters are converted and shifted left by 4 bits into a register. To output, the register is rotated right and each 4-bit value is converted to a character.
This document provides an outline for a course on 8086 Assembly Language Programming. It begins with an introduction to machine language and assembly language. It then covers topics like the organization of the 8086 processor, assembly language syntax, data representation, variables, instruction types, memory segmentation, program structure, addressing modes, and input/output. The document is intended to guide students through the key concepts needed to program in 8086 assembly language.
The document discusses the instruction set of x86 processors. It describes different types of instructions like data transfer, arithmetic, control flow and flag instructions. It provides examples of using MOV, ADD, SUB, CMP and other instructions. It explains concepts like immediate and memory operands, registers, flags, loops and conditional jumps. Key points covered are data transfer using MOV, arithmetic using ADD, SUB, INC, DEC, MUL, DIV, comparison using CMP, and flow control using LOOP, JCXZ and other jump instructions.
1) There are two types of multiplication instructions - MUL and IMUL. MUL handles unsigned data while IMUL handles signed data. Both affect the carry and overflow flags.
2) MUL multiplies operands in registers like AL, AX, or groups of registers and stores the product in a larger register. IMUL preserves the sign of the product.
3) There are two division instructions - DIV and IDIV. DIV handles unsigned data and IDIV handles signed data. Both can divide operands of 8, 16, or 32 bits and affect all status flags. The quotient goes to a register and remainder to another, depending on operand size.
This document summarizes various arithmetic, logic, and shift instructions in x86 assembly language.
It describes increment, decrement, negation, comparison, addition, subtraction, multiplication, division, and logic instructions. It provides syntax examples and explains how they affect flags and can be used for tasks like inputting and outputting decimal numbers.
Shift instructions like logical and arithmetic shifts are covered, along with how they can perform multiplication and division via left and right shifts. Rotate instructions are also introduced. Application examples show how instructions can be combined to perform operations like converting between ASCII and binary representations.
Chapter 5The proessor status and the FLAGS registerswarda aziz
solution manual to COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE CHAPTER 5.
If you find any mistake in the manual please share with me ... it will be appreciated
The document discusses assembly language programming concepts including shift, rotate, flag control, compare, and jump instructions. It provides examples and problems to explain the usage and effects of various instructions. Key points include:
- Shift instructions move bits within a register or memory location based on a count. Common instructions are SHR, SAR, SHL, ROL, ROR.
- Flag control instructions modify status flags. Common ones are LAHF, SAHF, CLC, STC.
- Compare instruction CMP performs subtraction without affecting operands and updates flags.
- Jump instructions conditionally transfer control based on status flag values like JO, JB, JE, JL.
Pro
This document discusses assembly language programming. It provides an overview of assembly language, how it relates to machine language, and how assemblers are used to convert assembly code into machine-readable object code. It also describes the basic components of assembly language instructions, including opcodes and operands, and different addressing modes for specifying operands in memory or registers. Common addressing modes like immediate, register, direct, register indirect, and based indexed modes are defined through examples.
This document provides information on 8088 microprocessor instruction set. It discusses:
1) The basic components of a program including instructions and machine code.
2) Examples of instruction formats and operations for data transfer, arithmetic, logical, and shift instructions.
3) Details on multiplication and division instructions including examples of multiplying and dividing operations.
4) Key benefits of assembly language such as taking up less memory and executing faster than high-level languages.
This document discusses BCD and ASCII encoding and arithmetic instructions in 8086 microprocessors. It defines BCD and ASCII encoding, explaining packed and unpacked BCD. It then describes the DAA, DAS, AAA, AAD, AAM, AAS instructions used to perform and adjust BCD and ASCII arithmetic. DAA and DAS are used to adjust the results of addition and subtraction of packed BCD numbers. AAA, AAS, AAD, and AAM are used to adjust the results of ASCII arithmetic operations like addition, subtraction, division, and multiplication to produce the correct unpacked BCD forms.
This presentation discusses logic and shift/rotate instructions in assembly language. It defines logic instructions like AND, OR, XOR and NOT and shows their truth tables. It explains how to use masks with these instructions to modify selective bits. It also covers shift/rotate instructions like SHL, SHR, ROL and ROR and how they manipulate bits by shifting them left or right in different ways. Examples are given to demonstrate how to use these instructions to clear, set or toggle bits using masks, as well as how shift/rotate instructions modify registers and flags.
The document discusses various types of operands and addressing modes in x86 assembly language. It describes three basic operand types: immediate, register, and memory. It covers different addressing modes for accessing memory operands, including direct, register indirect, indexed, based, and based-indexed addressing. Examples are provided to illustrate how to copy a string and sum elements of an array using these addressing modes. Key registers used for 32-bit and 16-bit memory addressing are also outlined.
This document contains a solution manual for chapter 1 of a book on assembly language programming and the IBM PC. It provides answers to 10 multiple choice and short answer questions about computer memory, microprocessors, and assembly language concepts. The questions cover topics like memory addressing, data representation, components of the microprocessor like the EU and BIU, and advantages of high-level languages versus assembly languages.
This document discusses text mode programming and display pages. It explains that in text mode, the screen is divided into 80 columns by 25 rows. Graphics adapters divide display memory into pages, with one page holding one screen of data. The active display page is the page currently being displayed. The document provides examples of how to select a specific display page and clear the screen.
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Bilal Amjad
The document discusses various high-level programming constructs like IF-THEN-ELSE, WHILE loops, FOR loops, and CASE statements and how they can be implemented using assembly language instructions. Conditional jumps, unconditional jumps, flags, and other instructions like LOOP, CMP, and JCXZ are used to emulate the flow control and conditional behavior of these high-level constructs. Examples are provided to demonstrate how to write assembly code equivalents for high-level statements like checking if a character is a capital letter, counting characters in a line, and displaying patterns based on conditions.
This document provides an introduction to a course on computer organization and assembly language. It will cover the main hardware components of a computer system, including memory, the CPU, and I/O ports. It will also discuss how instructions are executed in the fetch-execute cycle. Students will learn assembly language and how it maps to the underlying machine language understood by the CPU. They will be assessed through quizzes, assignments, a project, and a final exam.
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...Bilal Amjad
This document discusses one-dimensional and two-dimensional arrays in assembly language. It covers topics such as:
- Declaring and initializing one-dimensional arrays
- Addressing individual elements using offsets from the base address
- Common addressing modes like register indirect, based, indexed, and based indexed to access array elements
- Storing two-dimensional arrays in row-major or column-major order and calculating element addresses
- Code examples to sum elements of a one-dimensional array and clear a row or column of a two-dimensional array
This document provides an overview of assembly language programming on the 8086 processor. It includes examples of assembly code using MOV, MUL, and other instructions. It then summarizes various 8086 instruction types like data transfer, arithmetic, logical, and control flow instructions. For each type, it lists some common instructions and provides brief descriptions and examples.
This document contains solutions to 12 questions related to assembly language programming and flow control instructions. The questions cover a range of topics including IF-THEN-ELSE logic, loops, arithmetic operations, character input/output, and string manipulation. Detailed assembly code solutions are provided for each question involving decision structures, loops, arithmetic sequences, reading/displaying characters, and finding the longest consecutive alphabetically increasing substring in a string.
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...Bilal Amjad
This document contains presentation slides on bit shifting, multiplication, division, and their implementation in assembly language. It discusses:
- Using left and right bit shifts to perform multiplication and division by powers of 2
- The different instructions for signed vs unsigned multiplication and division (MUL, IMUL, DIV, IDIV)
- How multiplication and division results are stored in registers
- Examples of multiplying and dividing word and byte variables in assembly code
Binary and hex input/output (in 8086 assembuly langyage)Bilal Amjad
This document discusses binary and hexadecimal input/output algorithms. It contains pseudocode to convert character input into binary representations in a register and output binary values as characters. For binary input, each '0' or '1' character is converted and shifted left into a register. For hexadecimal input, characters are converted and shifted left by 4 bits into a register. To output, the register is rotated right and each 4-bit value is converted to a character.
This document provides an outline for a course on 8086 Assembly Language Programming. It begins with an introduction to machine language and assembly language. It then covers topics like the organization of the 8086 processor, assembly language syntax, data representation, variables, instruction types, memory segmentation, program structure, addressing modes, and input/output. The document is intended to guide students through the key concepts needed to program in 8086 assembly language.
The document discusses the instruction set of x86 processors. It describes different types of instructions like data transfer, arithmetic, control flow and flag instructions. It provides examples of using MOV, ADD, SUB, CMP and other instructions. It explains concepts like immediate and memory operands, registers, flags, loops and conditional jumps. Key points covered are data transfer using MOV, arithmetic using ADD, SUB, INC, DEC, MUL, DIV, comparison using CMP, and flow control using LOOP, JCXZ and other jump instructions.
1) There are two types of multiplication instructions - MUL and IMUL. MUL handles unsigned data while IMUL handles signed data. Both affect the carry and overflow flags.
2) MUL multiplies operands in registers like AL, AX, or groups of registers and stores the product in a larger register. IMUL preserves the sign of the product.
3) There are two division instructions - DIV and IDIV. DIV handles unsigned data and IDIV handles signed data. Both can divide operands of 8, 16, or 32 bits and affect all status flags. The quotient goes to a register and remainder to another, depending on operand size.
This document summarizes various arithmetic, logic, and shift instructions in x86 assembly language.
It describes increment, decrement, negation, comparison, addition, subtraction, multiplication, division, and logic instructions. It provides syntax examples and explains how they affect flags and can be used for tasks like inputting and outputting decimal numbers.
Shift instructions like logical and arithmetic shifts are covered, along with how they can perform multiplication and division via left and right shifts. Rotate instructions are also introduced. Application examples show how instructions can be combined to perform operations like converting between ASCII and binary representations.
Chapter 5The proessor status and the FLAGS registerswarda aziz
solution manual to COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE CHAPTER 5.
If you find any mistake in the manual please share with me ... it will be appreciated
The document discusses assembly language programming concepts including shift, rotate, flag control, compare, and jump instructions. It provides examples and problems to explain the usage and effects of various instructions. Key points include:
- Shift instructions move bits within a register or memory location based on a count. Common instructions are SHR, SAR, SHL, ROL, ROR.
- Flag control instructions modify status flags. Common ones are LAHF, SAHF, CLC, STC.
- Compare instruction CMP performs subtraction without affecting operands and updates flags.
- Jump instructions conditionally transfer control based on status flag values like JO, JB, JE, JL.
Pro
This document discusses assembly language programming. It provides an overview of assembly language, how it relates to machine language, and how assemblers are used to convert assembly code into machine-readable object code. It also describes the basic components of assembly language instructions, including opcodes and operands, and different addressing modes for specifying operands in memory or registers. Common addressing modes like immediate, register, direct, register indirect, and based indexed modes are defined through examples.
This document provides information on 8088 microprocessor instruction set. It discusses:
1) The basic components of a program including instructions and machine code.
2) Examples of instruction formats and operations for data transfer, arithmetic, logical, and shift instructions.
3) Details on multiplication and division instructions including examples of multiplying and dividing operations.
4) Key benefits of assembly language such as taking up less memory and executing faster than high-level languages.
This document discusses BCD and ASCII encoding and arithmetic instructions in 8086 microprocessors. It defines BCD and ASCII encoding, explaining packed and unpacked BCD. It then describes the DAA, DAS, AAA, AAD, AAM, AAS instructions used to perform and adjust BCD and ASCII arithmetic. DAA and DAS are used to adjust the results of addition and subtraction of packed BCD numbers. AAA, AAS, AAD, and AAM are used to adjust the results of ASCII arithmetic operations like addition, subtraction, division, and multiplication to produce the correct unpacked BCD forms.
This presentation discusses logic and shift/rotate instructions in assembly language. It defines logic instructions like AND, OR, XOR and NOT and shows their truth tables. It explains how to use masks with these instructions to modify selective bits. It also covers shift/rotate instructions like SHL, SHR, ROL and ROR and how they manipulate bits by shifting them left or right in different ways. Examples are given to demonstrate how to use these instructions to clear, set or toggle bits using masks, as well as how shift/rotate instructions modify registers and flags.
The document discusses various types of operands and addressing modes in x86 assembly language. It describes three basic operand types: immediate, register, and memory. It covers different addressing modes for accessing memory operands, including direct, register indirect, indexed, based, and based-indexed addressing. Examples are provided to illustrate how to copy a string and sum elements of an array using these addressing modes. Key registers used for 32-bit and 16-bit memory addressing are also outlined.
This document contains a solution manual for chapter 1 of a book on assembly language programming and the IBM PC. It provides answers to 10 multiple choice and short answer questions about computer memory, microprocessors, and assembly language concepts. The questions cover topics like memory addressing, data representation, components of the microprocessor like the EU and BIU, and advantages of high-level languages versus assembly languages.
This document discusses text mode programming and display pages. It explains that in text mode, the screen is divided into 80 columns by 25 rows. Graphics adapters divide display memory into pages, with one page holding one screen of data. The active display page is the page currently being displayed. The document provides examples of how to select a specific display page and clear the screen.
Assembly Language Programming By Ytha Yu, Charles Marut Chap 6 (Flow Control ...Bilal Amjad
The document discusses various high-level programming constructs like IF-THEN-ELSE, WHILE loops, FOR loops, and CASE statements and how they can be implemented using assembly language instructions. Conditional jumps, unconditional jumps, flags, and other instructions like LOOP, CMP, and JCXZ are used to emulate the flow control and conditional behavior of these high-level constructs. Examples are provided to demonstrate how to write assembly code equivalents for high-level statements like checking if a character is a capital letter, counting characters in a line, and displaying patterns based on conditions.
This document provides an introduction to a course on computer organization and assembly language. It will cover the main hardware components of a computer system, including memory, the CPU, and I/O ports. It will also discuss how instructions are executed in the fetch-execute cycle. Students will learn assembly language and how it maps to the underlying machine language understood by the CPU. They will be assessed through quizzes, assignments, a project, and a final exam.
Assembly Language Programming By Ytha Yu, Charles Marut Chap 1(Microcomputer ...Bilal Amjad
This document discusses computer languages and microprocessor-based systems. It describes how machine language uses binary instructions to directly control a processor's circuitry. Assembly language and high-level languages were developed to bridge the gap between machine language and what is convenient for humans. Assembly language uses symbolic names for operations and memory locations and converts to machine language via an assembler. High-level languages like Pascal and COBOL use expressions and symbols from English and convert to machine language via a compiler. Advantages of assembly language include better performance and access to hardware for some applications where speed and size are critical.
The Intel 8086 is a 16-bit microprocessor that can access up to 1 MB of memory. It has a 20-bit address bus and supports 64K I/O ports. The 8086 has two main units - the Bus Interface Unit (BIU) and the Execution Unit (EU). The BIU handles fetching instructions from memory and performing bus operations, while the EU decodes and executes instructions. The 8086 uses a segmented memory architecture with four segment registers - code, data, extra, and stack - to access the 1 MB address space.
This document outlines the topics that will be covered in a lecture on computer organization and assembly language, including: number systems and conversions; digital logic gates; important terminology; processor memory designs; the internal workings of CPUs including the ALU, program counter, and instruction decoder; and a review of the history of computer architecture based on assigned reading materials. Performance is dependent on factors beyond just processor speed such as the instruction set, programming language, compiler efficiency, and programmer coding skills.
This document outlines the course objectives, rules, and content for a computer organization and assembly language lecture series. The course will cover computer architecture and components, assembly language, instruction set design, and performance assessment. Students will complete assignments, quizzes, labs, and a final group project involving code demonstration and reporting. Rules address submission deadlines, collaboration, and consequences for violations.
This document contains information about converting regular expressions to finite automata. It discusses Kleene's theorem, which states that any language that can be defined by a regular expression can also be defined by a finite automaton and vice versa. It then provides steps for converting a regular expression to an NFA-Λ and converting an NFA-Λ to a finite automaton. The document concludes by recommending reviewing a textbook chapter on these topics.
Computer organization involves fetching instructions from memory and executing them. There are two main approaches to implementing the control unit: hardwired control and microprogrammed control. Hardwired control uses combinational logic to generate control signals based on the instruction and state, while microprogrammed control stores control sequences as microinstructions in a separate control store.
The document outlines the basics of processor operation, including the instruction cycle, representation of machine instructions, and types of instructions. It discusses how the processor clock synchronizes activities and how the program counter increments to fetch each subsequent instruction from memory. The core instruction cycle stages are fetch, decode, and execute, where the processor fetches instructions and data from memory, decodes the operation, and executes it by performing the required operation.
The FLAGS register is a status register in Intel x86 microprocessors that contains the current state of the processor. It contains status flags like the carry flag, parity flag, zero flag, and sign flag that indicate the outcome of arithmetic operations. It also contains control flags like the interrupt flag and direction flag that control interrupt handling and string processing direction. The FLAGS register is 16-bits wide in 8086 processors and has been expanded to 32-bits and 64-bits in subsequent processors while maintaining backwards compatibility.
Computer Organization and Assembly Languagefasihuddin90
This document provides an introduction to the CS-401 course on computer architecture and assembly language programming. It outlines the basic components of a computer, including the processor, memory, and buses that connect them, and describes how data is stored and addressed in memory at the basic level of binary digits.
This document discusses assembly language fundamentals and MS-DOS functions using software interrupts. It covers the INT instruction, interrupt vector table, common interrupts like INT 10h for video and INT 21h for MS-DOS services. It provides examples of using INT 21h functions for input/output, including reading/writing characters and strings, reading the date/time, and displaying the date and time. The document is intended as an overview and introduction to assembly language and MS-DOS function calls.
The document discusses stack and subroutines in assembly language programs. It explains that stack is used to store return addresses and save register contents. Subroutines allow breaking programs into modules and use CALL and RET instructions. An example program adds two numbers stored in memory locations and returns the result.
The document discusses assembly language instruction addressing and execution. It covers loading an *.exe program by accessing it from disk and storing it in memory segments. The boot process and loading of an *.exe file is explained. Examples are provided to illustrate instruction execution and addressing, showing how the instruction address is determined from segment registers and offsets.
This document outlines the basics of assembly language, including basic elements, statements, program data, variables, constants, instructions, translation to assembly language, and program structure. It discusses statement syntax, valid names, operation and operand fields. It also covers common instructions like MOV, ADD, SUB, INC, DEC, and NEG. Finally, it discusses program segments, memory models, and how to define the data, stack, and code segments.
The document provides an introduction to assembly language programming. It explains that assembly language uses mnemonics to represent machine instructions, making programs more readable compared to machine code. An assembler is needed to translate assembly code into executable object code. Assembly language provides direct access to hardware and can be faster than high-level languages, though it is more difficult to program and maintain.
This document provides information about assembly language and software interrupts in assembly language programs. It discusses general purpose registers, segment registers, directives used in assembly programs like .CODE and .DATA, and provides an example of a simple "Hello World" assembly language program. It also describes common software interrupts like INT 21h for MS-DOS services and lists some common functions accessed through INT 21h like displaying text, reading keyboard input, and getting the system time and date.
The document discusses assembly language programming and tools used in the assembly language development process. It provides information on assembly language instructions like LOOP, HLT, WAIT, ESC, and NOP. It also discusses assembler directives such as ASSUME, DB, DW, DD, DQ, DT, END, ENDP, ENDM, ENDS, EQU, EVEN, INCLUDE, MACRO and their usage. Additionally, it covers machine language, assembly language, high-level languages and advantages/disadvantages of each. Finally, it lists common assembly language development tools like editors, assemblers, linkers, locators, loaders and debuggers.
Microprocessor chapter 9 - assembly language programmingWondeson Emeye
This document provides an overview of assembly language programming concepts for the 8086 processor. It discusses variables which are stored in registers, assignment using MOV instructions, input/output using INT 21h to call operating system functions and pass parameters in registers, and complete program examples that demonstrate displaying characters, reading input, and terminating programs. It also provides sample programs and exercises for students to practice core concepts like loops, conditional jumps, arithmetic operations on numbers in various formats.
This document provides an introduction to assembly language programming fundamentals. It discusses machine languages and low-level languages. It also covers data representation and numbering systems. Key assembly language concepts like instructions format, directives, procedures, macros and input/output are described. Examples are given to illustrate variables, assignment, conditional jumps, loops and other common programming elements in assembly language.
This document discusses assembly language programming concepts and provides examples of assembly language programs for the 8086 processor. It covers variables, assignment, input/output, and control flow. It also provides examples of complete assembly language programs that display characters, read keyboard input, and print strings. The document concludes with sample programming exercises involving operations like addition, subtraction, and conditional branching.
This document contains instructions for Experiment #3 of an EE lab manual. It discusses arithmetic instructions in assembly language such as addition, subtraction, multiplication, and division. It provides examples of using these instructions and defines pre-lab and lab exercises involving writing assembly programs to perform arithmetic operations on numbers stored in memory locations. Students are asked to write programs that add and multiply numbers, convert letters between cases, calculate an average of input numbers, calculate a factorial, and modify existing programs.
The document provides an introduction to assembly language programming including:
- The basic elements of assembly language such as instructions, directives, constants, identifiers, and comments.
- A flat memory program template that includes TITLE, MODEL, STACK, DATA, CODE, and other directives.
- An example program that adds and subtracts integers and calls a procedure to display registers.
- An overview of the assemble-link-debug cycle used to develop assembly language programs.
Here are the key points about scanf():
- scanf() is used to read/input values from the keyboard or standard input device.
- It follows the same format specifier conventions as printf() for data types (%d for int, %f for float, %c for char etc).
- The address of operator & is used before variables in the argument list to tell scanf() to store the input directly into the memory location of the variables.
- This is necessary because normally function arguments in C are passed by value, so scanf() would just get a copy of the variable instead of modifying the original one. The & takes the address to allow direct modification.
So in summary, scanf
Here is a program to calculate the sum of two multi-word numbers where the result can exceed 65535:
.MODEL SMALL
.STACK 100H
.DATA
NUM1 DW 1234H, 5678H
NUM2 DW 9ABCH, DEF0H
RESULT RESD 1
.CODE
MAIN PROC FAR
MOV AX, @DATA
MOV DS, AX
MOV AX, WORD PTR NUM1
MOV BX, WORD PTR NUM1+2
ADD AX, WORD PTR NUM2
ADC BX, WORD PTR NUM2+2
MOV RESULT, AX
MOV RESULT+2, BX
MOV
The document discusses several topics related to computer architecture and assembly language programming:
1. It describes the von Neumann architecture model and key components like the ALU, control unit, and memory.
2. It summarizes Moore's Law and how increasing transistor density has allowed for higher performance chips over time.
3. It provides an overview of some early Intel processors like the 8086 and techniques used to increase processor speed like pipelining.
4. It includes brief explanations of common assembly language concepts like registers, memory addressing, and arithmetic and logical instructions.
The document discusses an example assembly language program that implements a delay of 0.01 seconds using an 8051 microcontroller. It explains that the program uses nested loops and a subroutine to achieve the fixed, loop, and adjustment times needed for the desired delay. Registers R0 and R1 are used to control the loop counts. The program returns after completing all loops and the subroutine to produce the accurate 0.01 second delay.
The document discusses the SIC and SIC/XE machine architectures and assembler concepts. It explains the three main data structures used by an assembler: the operation code table (OPTAB), symbol table (SYMTAB), and location counter (LOCCTR). It provides pseudocode for Pass 1 and Pass 2 of the assembling process. It also describes addressing modes, instruction formats, and how relocation is handled for generating relocatable object code.
Introduction to Assembly Language & various basic thingsishitasabrincse
This document provides an introduction to IBM PC assembly language, including assembly language syntax, program data types, variables, constants, basic instructions, program structure, and input/output instructions. It discusses assembly language statements, name, operation, and operand fields. It also covers data types, variables, constants, basic instructions like MOV, ADD, SUB, INC, DEC, and NEG. The document explains how high-level language statements translate to assembly code and outlines program segments for code, data, and stack. It provides examples of memory models and using directives like .DATA, .STACK, .CODE to define segments. Finally, it discusses input and output functions and using the LEA instruction.
IoT Based Smart Energy Meter using Raspberry Pi and Arduino Bilal Amjad
This project, design and implemented a low-cost IoT based energy monitoring system (smart energy meter) for real-time monitoring of all electrical parameters i.e. AC voltage, AC current, active power, total energy consumption, power factor, frequency, and tariff. The design is based on a low-cost PZEM-004T, using a non-invasive Current Transformer
(CT) sensors, Arduino and Raspberry pi. Electrical measurements are done by PZEM-004T and CT sensors through Arduino. Raspberry pi communicates with Arduino through serial communication to retrieve these sensor’s data and send it to the server via internet. As a result, the developed energy monitoring system can successfully record the voltage, current, active power, power factor, frequency, accumulative power consumption and tariff. Consumers will be able to
see their electricity usage and the tariff according to the energy usage in real-time through web and mobile application. In case of any fault e.g., short circuit or power supply cut off, the consumer will receive a text message on his mobile number. Moreover, consumers will be able to receive the tariff on a weekly or monthly basis.
Power Systems analysis with MATPOWER and Simscape Electrical (MATLAB/Simulink) Bilal Amjad
The report analyses the power flow studies done in MATPOWER, some three-phase circuits and the operation of the DFIG wind turbine using Simcape Electrical library in Simulink.
The work was submitted to the University of Bradford as a part of the coursework during my MSc program.
Solar Radiation monthly prediction and forecasting using Machine Learning tec...Bilal Amjad
The whole world is trying to reduce the CO2 emission by using renewable energy resources
(RERs) instead of fossil fuels especially for electricity generation. One of the main RERs for
electricity is the sun. Soler panels are used are used for capturing the energy of the sun using photovoltaic
(PV) cells. The output of PV’s depends on the weather and climate.
So, it is very important to know how much energy can be harvested in upcoming years or months
by predicting the solar energy for a particular area of earth, using historical data. In this work, two
machine learning techniques are used to forecast solar radiation using historical data. This will
help the energy companies in planning and designing of long-term goals for sustainable electricity
generation.
A presentation on "Big Data in Smart Grid" by MSc students at the University of Bradford, submitted as a part of coursework. It addresses the challenges, opportunities and issues related to Big Data and Data Protection in Smart Grid.
Flexibility of Power System (Sources of flexibility & flexibility markets)Bilal Amjad
This presentation gives a detail explanation of power system flexibility, flexibility in traditional power system, future flexibility needs and resources and flexibility markets.
bubble sorting of an array in 8086 assembly languageBilal Amjad
The document describes bubble sort algorithm and includes code to implement it in assembly language. It lists group members and provides examples of bubble sort on sample data. It also includes pseudo code of the bubble sort procedure that sets the offset address and array size as inputs, sorts the array in ascending order, and returns the sorted array as output. The code segment implements bubble sort by getting input from the user, calling the bubble sort procedure to sort it, and displaying the sorted output.
assembly language programming organization of IBM PC chapter 9 part-2(decimal...Bilal Amjad
This document contains source code for decimal input and output in assembly language. It discusses algorithms for converting decimal numbers to binary representations for input, and binary representations back to decimal for output. The input algorithm reads characters, converts them to digits, and multiplies a running total by 10 before adding the digit value. The output algorithm divides the number by 10 repeatedly to extract digits, converts them to characters, and prints them to display the number in decimal form.
The document lists the group members working on limits of complex functions. It then provides two definitions of limits - the first conceptual definition, and the second more precise "epsilon-delta" definition introduced by Bernard Bolzano in 1817. It explains that the epsilon refers to how close the function value needs to be to the limit, while delta refers to how close the input needs to be to still satisfy the epsilon condition. Some examples are then worked out to demonstrate the limit concept. Applications of limits in various engineering and science fields are discussed, such as fluid mechanics, mechanical design, astronomy, business, and medicine. It concludes by noting that what qualifies as "close enough" can depend on the context and precision needed.
This document describes a simple combination lock circuit that uses XOR gates to compare a 4-bit entered code to a stored key code. If the bits match, a green "Go" LED lights up, and if they do not match, a red "No Go" LED lights up. The circuit includes XOR gates, NOR gates, switches to enter the code, LEDs, resistors, and a pushbutton to submit the code for comparison.
The document describes a 4-bit comparator circuit that compares two 4-bit binary numbers and outputs whether they are equal, if the first number is less than the second, or if the first is greater. It provides examples of the circuit comparing different 4-bit inputs and correctly outputting the relationship between the numbers. The comparator circuit has applications in electronic locks and security devices to compare binary passwords.
This document discusses orthogonal trajectories and provides examples of finding orthogonal trajectories for different families of curves. It begins by defining orthogonal trajectories as curves that intersect each other at right angles. It then provides a method for finding the differential equation that describes the orthogonal trajectories for a given family of curves. Several examples are worked out, such as finding the orthogonal trajectories of the family of parabolas with equation y = x^2. Applications to equipotential lines and electric fields and electromagnetic waves are also mentioned.
Sorting Order and Stability in Sorting.
Concept of Internal and External Sorting.
Bubble Sort,
Insertion Sort,
Selection Sort,
Quick Sort and
Merge Sort,
Radix Sort, and
Shell Sort,
External Sorting, Time complexity analysis of Sorting Algorithms.
ADVXAI IN MALWARE ANALYSIS FRAMEWORK: BALANCING EXPLAINABILITY WITH SECURITYijscai
With the increased use of Artificial Intelligence (AI) in malware analysis there is also an increased need to
understand the decisions models make when identifying malicious artifacts. Explainable AI (XAI) becomes
the answer to interpreting the decision-making process that AI malware analysis models use to determine
malicious benign samples to gain trust that in a production environment, the system is able to catch
malware. With any cyber innovation brings a new set of challenges and literature soon came out about XAI
as a new attack vector. Adversarial XAI (AdvXAI) is a relatively new concept but with AI applications in
many sectors, it is crucial to quickly respond to the attack surface that it creates. This paper seeks to
conceptualize a theoretical framework focused on addressing AdvXAI in malware analysis in an effort to
balance explainability with security. Following this framework, designing a machine with an AI malware
detection and analysis model will ensure that it can effectively analyze malware, explain how it came to its
decision, and be built securely to avoid adversarial attacks and manipulations. The framework focuses on
choosing malware datasets to train the model, choosing the AI model, choosing an XAI technique,
implementing AdvXAI defensive measures, and continually evaluating the model. This framework will
significantly contribute to automated malware detection and XAI efforts allowing for secure systems that
are resilient to adversarial attacks.
This paper proposes a shoulder inverse kinematics (IK) technique. Shoulder complex is comprised of the sternum, clavicle, ribs, scapula, humerus, and four joints.
Passenger car unit (PCU) of a vehicle type depends on vehicular characteristics, stream characteristics, roadway characteristics, environmental factors, climate conditions and control conditions. Keeping in view various factors affecting PCU, a model was developed taking a volume to capacity ratio and percentage share of particular vehicle type as independent parameters. A microscopic traffic simulation model VISSIM has been used in present study for generating traffic flow data which some time very difficult to obtain from field survey. A comparison study was carried out with the purpose of verifying when the adaptive neuro-fuzzy inference system (ANFIS), artificial neural network (ANN) and multiple linear regression (MLR) models are appropriate for prediction of PCUs of different vehicle types. From the results observed that ANFIS model estimates were closer to the corresponding simulated PCU values compared to MLR and ANN models. It is concluded that the ANFIS model showed greater potential in predicting PCUs from v/c ratio and proportional share for all type of vehicles whereas MLR and ANN models did not perform well.
Data Structures_Linear data structures Linked Lists.pptxRushaliDeshmukh2
Concept of Linear Data Structures, Array as an ADT, Merging of two arrays, Storage
Representation, Linear list – singly linked list implementation, insertion, deletion and searching operations on linear list, circularly linked lists- Operations for Circularly linked lists, doubly linked
list implementation, insertion, deletion and searching operations, applications of linked lists.
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...Infopitaara
A Boiler Feed Pump (BFP) is a critical component in thermal power plants. It supplies high-pressure water (feedwater) to the boiler, ensuring continuous steam generation.
⚙️ How a Boiler Feed Pump Works
Water Collection:
Feedwater is collected from the deaerator or feedwater tank.
Pressurization:
The pump increases water pressure using multiple impellers/stages in centrifugal types.
Discharge to Boiler:
Pressurized water is then supplied to the boiler drum or economizer section, depending on design.
🌀 Types of Boiler Feed Pumps
Centrifugal Pumps (most common):
Multistage for higher pressure.
Used in large thermal power stations.
Positive Displacement Pumps (less common):
For smaller or specific applications.
Precise flow control but less efficient for large volumes.
🛠️ Key Operations and Controls
Recirculation Line: Protects the pump from overheating at low flow.
Throttle Valve: Regulates flow based on boiler demand.
Control System: Often automated via DCS/PLC for variable load conditions.
Sealing & Cooling Systems: Prevent leakage and maintain pump health.
⚠️ Common BFP Issues
Cavitation due to low NPSH (Net Positive Suction Head).
Seal or bearing failure.
Overheating from improper flow or recirculation.
RICS Membership-(The Royal Institution of Chartered Surveyors).pdfMohamedAbdelkader115
Glad to be one of only 14 members inside Kuwait to hold this credential.
Please check the members inside kuwait from this link:
https://www.rics.org/networking/find-a-member.html?firstname=&lastname=&town=&country=Kuwait&member_grade=(AssocRICS)&expert_witness=&accrediation=&page=1
Fluid mechanics is the branch of physics concerned with the mechanics of fluids (liquids, gases, and plasmas) and the forces on them. Originally applied to water (hydromechanics), it found applications in a wide range of disciplines, including mechanical, aerospace, civil, chemical, and biomedical engineering, as well as geophysics, oceanography, meteorology, astrophysics, and biology.
It can be divided into fluid statics, the study of various fluids at rest, and fluid dynamics.
Fluid statics, also known as hydrostatics, is the study of fluids at rest, specifically when there's no relative motion between fluid particles. It focuses on the conditions under which fluids are in stable equilibrium and doesn't involve fluid motion.
Fluid kinematics is the branch of fluid mechanics that focuses on describing and analyzing the motion of fluids, such as liquids and gases, without considering the forces that cause the motion. It deals with the geometrical and temporal aspects of fluid flow, including velocity and acceleration. Fluid dynamics, on the other hand, considers the forces acting on the fluid.
Fluid dynamics is the study of the effect of forces on fluid motion. It is a branch of continuum mechanics, a subject which models matter without using the information that it is made out of atoms; that is, it models matter from a macroscopic viewpoint rather than from microscopic.
Fluid mechanics, especially fluid dynamics, is an active field of research, typically mathematically complex. Many problems are partly or wholly unsolved and are best addressed by numerical methods, typically using computers. A modern discipline, called computational fluid dynamics (CFD), is devoted to this approach. Particle image velocimetry, an experimental method for visualizing and analyzing fluid flow, also takes advantage of the highly visual nature of fluid flow.
Fundamentally, every fluid mechanical system is assumed to obey the basic laws :
Conservation of mass
Conservation of energy
Conservation of momentum
The continuum assumption
For example, the assumption that mass is conserved means that for any fixed control volume (for example, a spherical volume)—enclosed by a control surface—the rate of change of the mass contained in that volume is equal to the rate at which mass is passing through the surface from outside to inside, minus the rate at which mass is passing from inside to outside. This can be expressed as an equation in integral form over the control volume.
The continuum assumption is an idealization of continuum mechanics under which fluids can be treated as continuous, even though, on a microscopic scale, they are composed of molecules. Under the continuum assumption, macroscopic (observed/measurable) properties such as density, pressure, temperature, and bulk velocity are taken to be well-defined at "infinitesimal" volume elements—small in comparison to the characteristic length scale of the system, but large in comparison to molecular length scale
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxRishavKumar530754
LiDAR-Based System for Autonomous Cars
Autonomous Driving with LiDAR Tech
LiDAR Integration in Self-Driving Cars
Self-Driving Vehicles Using LiDAR
LiDAR Mapping for Driverless Cars
☁️ GDG Cloud Munich: Build With AI Workshop - Introduction to Vertex AI! ☁️
Join us for an exciting #BuildWithAi workshop on the 28th of April, 2025 at the Google Office in Munich!
Dive into the world of AI with our "Introduction to Vertex AI" session, presented by Google Cloud expert Randy Gupta.
How to use nRF24L01 module with ArduinoCircuitDigest
Learn how to wirelessly transmit sensor data using nRF24L01 and Arduino Uno. A simple project demonstrating real-time communication with DHT11 and OLED display.
2. • Assembly language program occupies code, data and
stack segment in memory
• Same organization reflected in assembly language
programs as well
• Code data and stack are structured as program segments
• Program segments are translated to memory segments
by assembler
2
3. Size of code and data, a program can have is determined by
specifying a memory model using .MODEL directive
MODEL memory_model
Model Description
SMALL code in one segment
data in one segment
MEDIUM code in more than one segment
data in one segment
COMPACT code in one segment
data in more than one segment
LARGE code in more than one segment
data in more than one segment
no array larger than 64k bytes
HUGE code in more than one segment
data in more than one segment
arrays may be larger than 64k bytes 3
4. • A program’s data segment contains all the
variable definitions.
• Constant definitions are often made here as well,
but they may be placed elsewhere in the program
since no memory allocation is involved.
.data directive to declare a data segment
.DATA
WORD1 DW 2
WORD2 DW 5
MSG DB ‘THIS IS A MESSAGE’
MASK EQU 10010111B
4
5. • The purpose of the stack segment declaration
is to set aside a block of memory (the stack
area) to store the stack.
• The stack area should be big enough to
contain the stack at its maximum size.
.STACK 100H
• If size is omitted, by default 1kB is set aside
5
6. • The code segment contains a program’s
instructions.
.CODE name
• Inside a code segment, instructions are organized
as procedures.
name PROC
; body of the procedure
name ENDP
• The last line in the program should be the END
directive, followed by name of the main
procedure.
6
8. .MODEL SMALL
.STACK 100H
.DATA
; data definitions go here
.CODE
MAIN PROC
; instructions go here
MAIN ENDP
; other procedures go here
END MAIN
8
9. • CPU communicates with the peripherals
through IO ports
– IN and OUT instructions to access the ports
directly
• Used when fast IO is essential
• Seldom used as
– Port address varies among compluter models
– Easier to program IO with service routine
9
11. • I/O service routines
The Basic Input/Output System (BIOS) routines
The DOS routines
• The INT (interrupt) instruction is used to
invoke a DOS or BIOS routine.
• INT 16h
– invokes a BIOS routine that performs keyboard
input.
11
12. • INT 21h may be used to invoke a large number
of DOS functions.
• A particular function is requested by placing a
function number in the AH register and
invoking INT 21h.
12
13. Input:
AH = 1
Output:
AL = ASCII code if character key is pressed
= 0 if non-character key is pressed
13
14. MOV AH, 1 ; input key function
INT 21h ; ASCII code in AL
14
15. Input:
AH = 2
DL = ASCII code of the display character or
= control character
Output:
AL = ASCII code of the display character or
= control character
15
16. • MOV AH, 2 ; display character function
MOV DL, ‘?’ ; character is ‘?’
INT 21h ; display character
16
17. ASCII Code HEX Symbol Function
7 BEL beep
8 BS backspace
9 HT tab
A LF line feed (new line)
D CR carriage return (start of current
line)
17
18. • ECH.ASM will read a character from the
keyboard and display it at the beginning of the
next line.
• The data segment was omitted because no
variables were used.
• When a program terminates, it should return
control to DOS.
• This can be accomplished by executing INT
21h, function 4Ch.
18
19. TITLE ECHO PROGRAM
.MODEL SMALL
.STACK 100H
.CODE
MAIN PROC
; display prompt
MOV AH, 2 ; display character function
MOV DL, '?' ; character is '?'
INT 21H ; display it
; input a character
MOV AH, 1 ; read character function
INT 21H ; character in AL
MOV BL, AL ; save it in BL
; go to a new line
MOV AH, 2 ; display character function
MOV DL, 0DH ; carriage return
INT 21H ; execute carriage return
MOV DL, 0AH ; line feed
INT 21H ; execute line feed
; display character
MOV DL, BL ; retrieve character
INT 21H ; and display it
; return to DOS
MOV AH, 4CH ; DOS exit function
INT 21H ; exit to DOS
MAIN ENDP 19
21. • An editor is used to create the preceding
program.
• The .ASM is the conventional extension used
to identify an assembly language source file.
21
22. • The Microsoft Macro Assembler (MASM) is
used to translate the source file (.ASM file)
into a machine language object file (.OBJ file).
• MASM checks the source file for syntax errors.
• If it finds any, it will display the line number of
each error and a short description.
• C:>MASM File_Name;
22
23. • The Link program takes one or more object
files, fills in any missing addresses, and
combines the object files into a single
executable file (.EXE file)
• This file can be loaded into memory and run.
• C:>LINK File_Name;
23
24. • To run it, just type the run file name.
• C:>File_Name
24
25. Input:
DX = offset address of string.
= The string must end with a ‘$’ character.
25
26. • LEA is used to load effective address of a
character string.
• LEA destination, source
• MSG DB ‘HELLO!$’
LEA DX, MSG ; get message
MOV AH, 9 ; display string function
INT 21h ; display string
26
27. • When a program is loaded into memory, DOS
prefaces it 256 byte PSP which contains
information about the program
• DOS places segment no of PSP in DS and ES
before executing the program
• To correct this, a program containing a data
segment must start with these instructions;
MOV AX, @DATA
MOV DS, AX
27
28. Print String
Program
.MODEL SMALL
.STACK 100H
.DATA
MSG DB 'HELLO!$'
.CODE
MAIN PROC
; initialize DS
MOV AX, @DATA
MOV DS, AX ; intialize DS
; display message
LEA DX, MSG ; get message
MOV AH, 9 ; display string function
INT 21H ; display message
; return to DOS
MOV AH, 4CH
INT 21H ; DOS exit
MAIN ENDP
END MAIN 28
29. • CASE.ASM begins by prompting the user to
enter a lowercase letter, and on the next line
displays another message with the letter in
uppercase.
• The lowercase letters begin at 61h and the
uppercase letters start at 41h, so subtraction
of 20h from the contents of AL does the
conversion.
29
30. .MODEL SMALL
.STACK 100H
.DATA
CREQU0DH
LF EQU0AH
MSG1 DB 'ENTER A LOWER CASE LETTER: $'
MSG2 DB CR, LF, 'IN UPPER CASE IT IS: '
CHAR DB ?, '$'
.CODE
MAIN PROC
; intialize DS
MOV AX, @DATA ; get data segment
MOV DS, AX ; intialize DS
; print user prompt
LEA DX, MSG1 ; get first message
MOV AH, 9 ; display string function
INT 21H ; display first message
30
31. ; input a character and convert to upper case
MOV AH, 1 ; read character function
INT 21H ; read a small letter into AL
SUB AL, 20H ; convert it to upper case
MOV CHAR, AL ; and store it
; display on the next line
LEA DX, MSG2 ; get second message
MOV AH, 9 ; display string function
INT 21H ; display message and upper case
letter in front
; DOS exit
MOV AH, 4CH
INT 21H ; DOS exit
MAIN ENDP
END MAIN
31