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.
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
The document provides an introduction to data structures. It defines data structures as representations of logical relationships between data elements that consider both the elements and their relationships. It classifies data structures as either primitive or non-primitive. Primitive structures are directly operated on by machine instructions while non-primitive structures are built from primitive ones. Common non-primitive structures include stacks, queues, linked lists, trees and graphs. The document then discusses arrays as a data structure and operations on arrays like traversal, insertion, deletion, searching and sorting.
Please contact me to download this pres.A comprehensive presentation on the field of Parallel Computing.It's applications are only growing exponentially day by days.A useful seminar covering basics,its classification and implementation thoroughly.
Visit www.ameyawaghmare.wordpress.com for more info
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.
This document provides an overview of the chapters and content covered in a textbook on computer organization and architecture. The chapters cover digital logic circuits, digital components, data representation, register transfer and microoperations, basic computer organization and design, programming and instruction sets, control units, processor design, pipelining and parallel processing, arithmetic, input/output, and memory organization. Key concepts discussed include logic gates, boolean algebra, combinational and sequential circuits, registers, buses, arithmetic and logic operations, and memory.
This is the CSS Tutorial for Beginners that teach the basics of CSS. This tutorial will show the basic structure of a CSS style and will show 3 different methods to apply styles.
This document provides an overview of JavaScript and the DOM (Document Object Model) for a web programming course. It introduces JavaScript as a scripting language used to add interactivity to HTML pages. It describes what JavaScript can do, such as dynamically updating text and reacting to events. It also covers JavaScript syntax, variables, operators, functions, and objects. A significant portion of the document is devoted to explaining the DOM and how it allows JavaScript to access and modify HTML elements and structure programmatically.
Organization of the ibm personal computerswarda aziz
The Solution manual of COAL
Chapter NO 3. exercise
if anyone has Questions Regarding this exercise.
contact me on my given Email-ID.
i will guide you. Thank you!
Here are the steps:
1. MUL BL
- AL (85H) is multiplied by BL (35H)
- The 16-bit result (1B89H) is stored in AX, with the lower byte in AL and the higher byte in AH
So after the multiplication, AX = 1B89H.
Ex2: Assume that each instruction starts from these values:
DX:AX = 1234H, BX = 57H
1. DIV BX → Quotient in AX, Remainder in DX
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!
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.
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.
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 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.
The document discusses fundamentals of assembly language including data types, operands, data transfer instructions like MOV, arithmetic instructions like ADD and SUB, and addressing modes. It provides examples of assembly language code to perform operations like copying a string, converting between Celsius and Fahrenheit, and using various addressing modes.
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.
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
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.
Verilog Tutorial - Verilog HDL Tutorial with ExamplesE2MATRIX
E2MATRIX Research Lab
Opp Phagwara Bus Stand, Backside Axis Bank,
Parmar Complex, Phagwara Punjab (India).
Contact : +91 9041262727
web: www.e2matrix.com -- email: [email protected]
Simulation tools typically accept full set of Verilog language constructs
Some language constructs and their use in a Verilog description make simulation efficient and are ignored by synthesis tools
Synthesis tools typically accept only a subset of the full Verilog language constructs
In this presentation, Verilog language constructs not supported in Synopsys FPGA Express are in red italics
There are other restrictions not detailed here, see [2].
The Module Concept
Basic design unit
Modules are:
Declared
Instantiated
Modules declarations cannot be nested
This document discusses the flag register in the 8086 processor. It contains 9 flag bits that indicate the status of operations. The flags are classified as status flags (bits 0, 2, 4, 6, 7) or control flags (bits 8, 9, 10). It describes the purpose and meaning of each flag like the carry flag, parity flag, auxiliary flag, signed flag, zero flag, and overflow flags. It provides examples of how instructions can affect the different flag values.
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.
The document discusses the instruction set of the 8086 microprocessor. It describes the different types of instructions including data transfer, arithmetic, logic, shift/rotate, branch, loop, and string instructions. It provides details on common instructions like MOV, ADD, SUB, MUL, DIV, CMP, INC, DEC, NEG, CBW and CWD. Examples of assembly language programs are given to perform operations like addition, subtraction, multiplication, division, comparison etc. of 8-bit, 16-bit and 32-bit numbers.
The document discusses string operations in 8086 assembly language. String operations allow copying, searching, storing, and comparing strings of characters in memory. The direction flag (DF) determines whether string operations proceed from left to right or right to left. Instructions like MOVSB, STOSB, LODSB, CMPSB operate on bytes or words in strings and update index registers accordingly based on the DF value. Examples demonstrate using these instructions to copy, store, load, compare, and search strings.
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.
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.
Organization of the ibm personal computerswarda aziz
The Solution manual of COAL
Chapter NO 3. exercise
if anyone has Questions Regarding this exercise.
contact me on my given Email-ID.
i will guide you. Thank you!
Here are the steps:
1. MUL BL
- AL (85H) is multiplied by BL (35H)
- The 16-bit result (1B89H) is stored in AX, with the lower byte in AL and the higher byte in AH
So after the multiplication, AX = 1B89H.
Ex2: Assume that each instruction starts from these values:
DX:AX = 1234H, BX = 57H
1. DIV BX → Quotient in AX, Remainder in DX
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!
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.
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.
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 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.
The document discusses fundamentals of assembly language including data types, operands, data transfer instructions like MOV, arithmetic instructions like ADD and SUB, and addressing modes. It provides examples of assembly language code to perform operations like copying a string, converting between Celsius and Fahrenheit, and using various addressing modes.
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.
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
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.
Verilog Tutorial - Verilog HDL Tutorial with ExamplesE2MATRIX
E2MATRIX Research Lab
Opp Phagwara Bus Stand, Backside Axis Bank,
Parmar Complex, Phagwara Punjab (India).
Contact : +91 9041262727
web: www.e2matrix.com -- email: [email protected]
Simulation tools typically accept full set of Verilog language constructs
Some language constructs and their use in a Verilog description make simulation efficient and are ignored by synthesis tools
Synthesis tools typically accept only a subset of the full Verilog language constructs
In this presentation, Verilog language constructs not supported in Synopsys FPGA Express are in red italics
There are other restrictions not detailed here, see [2].
The Module Concept
Basic design unit
Modules are:
Declared
Instantiated
Modules declarations cannot be nested
This document discusses the flag register in the 8086 processor. It contains 9 flag bits that indicate the status of operations. The flags are classified as status flags (bits 0, 2, 4, 6, 7) or control flags (bits 8, 9, 10). It describes the purpose and meaning of each flag like the carry flag, parity flag, auxiliary flag, signed flag, zero flag, and overflow flags. It provides examples of how instructions can affect the different flag values.
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.
The document discusses the instruction set of the 8086 microprocessor. It describes the different types of instructions including data transfer, arithmetic, logic, shift/rotate, branch, loop, and string instructions. It provides details on common instructions like MOV, ADD, SUB, MUL, DIV, CMP, INC, DEC, NEG, CBW and CWD. Examples of assembly language programs are given to perform operations like addition, subtraction, multiplication, division, comparison etc. of 8-bit, 16-bit and 32-bit numbers.
The document discusses string operations in 8086 assembly language. String operations allow copying, searching, storing, and comparing strings of characters in memory. The direction flag (DF) determines whether string operations proceed from left to right or right to left. Instructions like MOVSB, STOSB, LODSB, CMPSB operate on bytes or words in strings and update index registers accordingly based on the DF value. Examples demonstrate using these instructions to copy, store, load, compare, and search strings.
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.
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 discusses assembly language fundamentals including conditional processing, status flags, Boolean and comparison instructions, conditional jumps, and conditional structures. It provides examples of how to implement if-else statements, while loops, and switch selections using assembly language instructions and directives. It also explains how MASM generates conditional jump code for decision directives based on operand types.
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.
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.
This presentation covers very basics of assembly language with some computer organization concept. I took this session as part of on going series on assembly at NULL Hyderabad meets. PART II will cover instruction sets and more in detail.
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.
Chp6 assembly language programming for pic copymkazree
The document discusses assembly language programming for PIC microcontrollers. It covers number representation in assembler, basic elements of PIC assembly like labels, instructions, operands, and directives. It also discusses assembling and linking a PIC program, subroutines, macros, and local directives. An example program is provided to count from 0 to FF and send the count value to port B using subroutines for displaying and delay.
Part I:Introduction to assembly languageAhmed M. Abed
This document provides an overview of assembly language for the x86 architecture. It discusses what assembly language is, why it is used, basic concepts like data sizes, and details of the x86 architecture like its modes of operation and basic program execution registers including general purpose registers, segment registers, the EFLAGS register, and status flags.
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.
The document discusses fundamentals of assembly language including instruction execution and addressing, directives, procedures, data types, arithmetic instructions, and a practice problem. It explains that instructions are translated to object code while directives control assembly but generate no machine code. Common directives include TITLE, STACK, DATA, CODE, and PROC. Data can be defined using directives like DB, DW, DD, DQ. Instructions like ADD, SUB, MUL, DIV perform arithmetic calculations on registers and memory.
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGFrankie Jones
3.1 UNDERSTANDING INSTRUCTION SET AND ASSEMBLY LANGUAGE
3.1.1 Define instruction set,machine and assembly language
3.1.2 Describe features and architectures of various type of microprocessor
3.1.3 Describe the Addressing Modes
3.2 APPLY ASSEMBLY LANGUAGE
3.2.1 Write simple program in assembly language
3.2.2 Tool in analyzing and debugging assembly language program
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 an introduction to 8086 assembly language programming. It discusses machine code and assembly language, compilers and assemblers, general purpose registers, simple commands, number formats, jumps, labels, logical and shift instructions, and instructions that affect memory. The key points are that assembly language provides a lower-level programming interface than high-level languages, manages memory and registers directly, and uses mnemonics that are assembled into machine code.
This document discusses the EMU8086 emulator and provides examples of assembly language code using it. It introduces EMU8086 as the emulator used in microprocessor courses at the Universidad Don Bosco for its intuitive user interface. Examples are given to demonstrate how to print "Hello World" messages and perform comparisons using the CMP instruction. An additional example shows calculating the sum of elements in a vector and printing the result.
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.
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
The document discusses the instruction set and addressing modes of the Simplified Instructional Computer (SIC). It describes that SIC instructions have a 24-bit format with an 8-bit opcode, 1-bit flag, and 15-bit address. The flag indicates whether direct or indexed addressing is used to calculate the target address. SIC provides basic instructions like load, store, arithmetic, and subroutine calls. It supports two addressing modes - direct and indexed - to determine the target memory location from the address field.
This program is very useful for learning assembly language (Assembler) as it includes an advanced editor, assembler, virtual PC and step-by-step tutorials. It allows executing source code on an 8086 emulator, with machine code fully compatible with later Intel microprocessor generations. The program demonstrates how to sum the elements of a vector and print the result in binary and decimal formats.
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 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.
This document provides an overview of memory and registers in the 8051 microcontroller. It discusses the on-chip ROM and RAM memory, as well as the various registers including the 8-bit registers (A, B, R0-R7) and 16-bit registers (DPTR, PC). It also covers the register banks and stack area in RAM, as well as data types and directives like DB and EQU that can be used to define data. Finally, it discusses addressing modes and instruction formats for the 8051 assembly language.
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.
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.
1) The document introduces 8086 assembly language programming concepts like variables, assignment, input/output, control flow, and subprograms.
2) Variables can be registers and assignment uses MOV instructions. Input/output requires calling operating system functions through software interrupts.
3) Loops can be implemented using conditional jump instructions and labels. A complete program example displays the character 'a' using MOV, INT, and return instructions.
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.
An assembly language is a low-level programming language that corresponds directly to a computer's machine code instructions. It acts as a bridge between machine language and high-level languages. Assembly code uses mnemonics to represent binary machine instructions and is assembled into executable machine code by an assembler. The document provides an overview of CPU components like registers and memory, and demonstrates common assembly language instructions like MOV, ADD, CMP, and JMP.
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.
Arm Cortex material Arm Cortex material3222886.pptManju Badiger
The document discusses instruction sets for the Cortex-M3 processor. It describes the basic syntax and formatting of assembly language instructions, including opcodes, operands, labels, comments. It provides examples of common instructions for data movement between registers and memory, such as MOV, LDR, STR. It also covers arithmetic instructions like ADD, SUB, MUL, and branch instructions like B, BX. Rotations are only right rotations because the ARM architecture does not support left rotations of registers due to asymmetric register sizes.
The document discusses instruction set architecture and the MIPS architecture. It introduces key concepts like assembly language, registers, instructions, and how assembly code maps to high-level languages like C. Specific MIPS instructions for arithmetic like addition and subtraction are presented, showing how a single line of C code can require multiple assembly instructions. Register usage and conventions are also covered.
This document provides an overview of microcontroller architecture and assembly language programming. It discusses the following key points in 3 sentences:
The document introduces PIC microcontrollers and assembly language, noting that assembly language uses mnemonic instructions that must be translated to machine code by an assembler. It explains the assembling and linking process used to convert assembly code to machine code that can be burned into the PIC's program memory. Various PIC assembly language instructions are also described, including MOVLW, MOVWF, logic instructions, and bit manipulation instructions to set and clear bits on I/O ports.
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.
The document provides an overview and tutorial on using the Debug program to debug assembly language programs on DOS and Windows systems. It describes Debug's basic commands for assembling, viewing memory and registers, tracing program execution, and manipulating memory. The commands are grouped into categories for program creation/debugging, memory manipulation, miscellaneous, and input/output. Individual commands like A, D, G, R are explained with examples.
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.
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.
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.
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.
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.
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.
The Fluke 925 is a vane anemometer, a handheld device designed to measure wind speed, air flow (volume), and temperature. It features a separate sensor and display unit, allowing greater flexibility and ease of use in tight or hard-to-reach spaces. The Fluke 925 is particularly suitable for HVAC (heating, ventilation, and air conditioning) maintenance in both residential and commercial buildings, offering a durable and cost-effective solution for routine airflow diagnostics.
We introduce the Gaussian process (GP) modeling module developed within the UQLab software framework. The novel design of the GP-module aims at providing seamless integration of GP modeling into any uncertainty quantification workflow, as well as a standalone surrogate modeling tool. We first briefly present the key mathematical tools on the basis of GP modeling (a.k.a. Kriging), as well as the associated theoretical and computational framework. We then provide an extensive overview of the available features of the software and demonstrate its flexibility and user-friendliness. Finally, we showcase the usage and the performance of the software on several applications borrowed from different fields of engineering. These include a basic surrogate of a well-known analytical benchmark function; a hierarchical Kriging example applied to wind turbine aero-servo-elastic simulations and a more complex geotechnical example that requires a non-stationary, user-defined correlation function. The GP-module, like the rest of the scientific code that is shipped with UQLab, is open source (BSD license).
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.
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.
ELectronics Boards & Product Testing_Shiju.pdfShiju Jacob
This presentation provides a high level insight about DFT analysis and test coverage calculation, finalizing test strategy, and types of tests at different levels of the product.
its all about Artificial Intelligence(Ai) and Machine Learning and not on advanced level you can study before the exam or can check for some information on Ai for project
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.
2. From Book: Chapter 4
Assembly language syntax
Name Field
Operation Field
Operand Field
Comment Field
Program Data
Variables
Outline
IBM PC Assembly language 2
3. Assembly language Syntax
IBM PC Assembly language
Assembly language programs are translated into machine language instructions by an
assembler, so they must be written to conform to the assembler’s specifications.
In this course we will use the Microsoft Macro Assembler (MASM).
Programs consist of statements, one per line
Each statement is either an:
Instruction, which the assembler translates into machine code.
Assembler directive, which instructs the assembler to perform some specific task (ex. Allocating
memory space for a variable or creating a procedure).
3
4. Syntax (Cont.)
IBM PC Assembly language
Both instructions and directives have up to four fields:
[name] operation [operand(s)] [comment]
[Fields are optional]
At least one blank or tab character must separate the fields
The fields do not have to be aligned in a particular column, but they must appear in the
above order.
An example of an instruction:
START: MOV CX,5 ; initialize counter
An example of an assembler directive:
MAIN PROC
4
5. Name Field
IBM PC Assembly language
The name field is used for:
Instruction labels.
Procedure names.
Variable names Ex. Table look-up instruction XLAT (used for translation)
The assembler translates names into memory addresses.
Names:
Can be from 1 to 31 characters long (not case sensitive).
May consist of letters, digits, and the special characters
? . @ _ $ % (Thus, embedded blanks are not allowed).
Names may not begin with a digit
If a period is used it should be the first character
5
7. Operation Field
IBM PC Assembly language
For an instruction, the operation field contains a symbolic operation code (opcode)
The assembler translates a symbolic opcode into a machine language opcode
Opcode symbols often describe the operation’s function (ex. MOV, ADD, SUB)
7
8. Operation Field
IBM PC Assembly language
In an assembler directive, the operation field contains a pseudo-operation code
(pseudo-op).
Pseudo-ops are not translated into machine code, rather, they simply tell the assembler to
do something (ex. The PROC pseudo-op is used to create a procedure).
8
9. Operand Field
IBM PC Assembly language
For an instruction, the operand field specifies the data that are needed to be acted on by
the operation.
An instruction may have zero, one, or two operands
Examples:
NOP ; no operands... does nothing
INC AX ; one operand... adds 1 to the contents of AX
ADD WORD1,2 ; two operands... adds 2 to the contents of memory word WORD1
9
Destination operand
register or memory location
where the result is stored
(note:some instructions
don’t store the result)
Source operand
usually not modified
by the instruction
10. Comment Field
IBM PC Assembly language
The comment field of a statement is used by the programmer to say something about what
the statement does
A semicolon marks the beginning of this field, and the assembler ignores anything typed after
the semicolon.
It is almost impossible to understand an assembly language program without comments.
Good programming practice dictates a comment on almost every line.
10
11. Comment Field (Cont.)
IBM PC Assembly language
Examples:
MOV CX, 0 ; move 0 to CX
MOV CX, 0 ; CX counts terms, initially 0
Thus, comments are used to put the instruction into the context of the program
It is permissible to make an entire line a comment, and to use them to create space in a
program.
11
12. Program Data
IBM PC Assembly language
In an assembly language program we may express data as:
Binary: bit string followed by ‘B’ or ‘b’
Decimal: string of decimal digits followed by an optional ‘D’ or ‘d’
Hex: begins with a decimal digit and ends with ‘H’ or ‘h’
Characters & Character strings: enclosed in a single or double quotes or by there ASCII
codes.
Any number may have an optional sign.
12
13. Program Data (Cont.)
IBM PC Assembly language
Number
Type
13
Number Type
11011 Decimal
1101B Binary
64223 Decimal
-21843D Decimal
1,234 illegal
1BADH Hex
1B4D Illegal
FFFFH Illegal
0FFFFH Hex
14. Variables
IBM PC Assembly language
Variables play the same role in assembly language that they do in HLL
Each variable has a data type and is assigned a memory address by the program
The table below shows the assembler directives that are used to define the variables
14
Stands forPseudo-op
Define ByteDB
Define WordDW
Define Double WordDD
Define QuoteDQ
Define Ten bytesDT
15. Bytes of the Words
IBM PC Assembly language 15
WORD1 DW 1234H
low byte
WORD1
high byte
WORD1+1
16. Variables – Byte & Word
IBM PC Assembly language
Syntax:
name DB initial_value
Example:
ALPHA DB 4 a memory byte is associated with the name
ALPHA, and initialized to 4.
BYT DB ? a memory byte is associated with the name
BYT, and uninitialized.
WRD DW -2 a memory word is associated with the
name WRD, and initialized to -2.
The decimal range is:
Unsigned representation: 0 to 255
Signed representation: -128 to 127
16
17. Variables - Arrays
IBM PC Assembly language
an array is a sequence of memory bytes or words.
Example:
B_ARRAY DB 10H,20H,30H
17
Symbol Address Contents
B_ARRAY 200H 10H
B_ARRAY+1 201H 20H
B_ARRAY+2 202H 30H
18. Variables – Array (words)
IBM PC Assembly language
Example:
W_ARRAY DW 1000,40,29887,329
18
Symbol Address Contents
W_ARRAY 0300H 1000D
W_ARRAY+2 0302H 40D
W_ARRAY+4 0304H 29887D
W_ARRAY+6 0306H 329D
19. 8
The DUP Operator
• It is possible to define arrays whose elements share a common initial
value by using the DUP (duplicate) operator.
• Syntax:
repeat_count DUP (value)
• Example:
DELTA DB 212 DUP (?) creates an array of 212
uninitialized bytes.
GAMMA DW 100 DUP (0) set up an array of 100
words, with each entry
initialized to 0.
20. Character String
IBM PC Assembly language
Any array of ASCII codes can be initialized with a string of characters.
Example:
LETTERS DB 'ABC'
=
LETTERS DB 41H,42H,43H
Inside a string, the assembler differentiates between upper and lowercase.
It is possible to combine characters and numbers in one definition:
Example: MSG DB 'HELLO',0AH,0DH, '$'
20
21. Byte Variables
name DB initial_value
ALPHA DB 4
BYT DB ?
• -128 to 127 for signed interpretation
• 0 to 255 for unsigned interpretation
21
22. Word Variables
name DW initial_value
WRD DW -2
• -32768 to 32767 for signed interpretation
• 0 to 65535 for unsigned interpretation
22
24. Character Strings
• LETTERS DB ‘ABC’
• LETTER DB 41H, 42H, 43H
• MSG DB ‘HELLO’, 0AH, 0DH, ‘$’
• MSG DB 48H, 45H, 4CH, 4CH, 4FH, 0AH, 0DH, 24H
24
25. EQU
• The EQU (equates) pseudo-op is used to assign a name
to a constant.
name EQU constant
• LF EQU 0AH
– MOV DL, 0AH
– MOV DL, LF
• PROMPT EQU ‘TYPE YOUR NAME’
– MSG DB ‘TYPE YOUR NAME’
– MSG DB PROMPT
No memory is allocated for EQU Names
25
Same Machine
Code
26. Few Basic Instructions
• Over a hundred Instructions for 8086
• Some specially designed instructions for
advanced processors
• We discuss six of most useful instructions
26
27. MOV
• The MOV instruction is used to transfer data
between registers, between a register and a
memory location, or to move a number
directly into a register or memory location.
• MOV destination, source
MOV AX, WORD1
MOV AX, BX
MOV AH, ‘A’
27
28. XCHG
• The XCHG operation is used to exchange the
contents of two registers, or a register, and a
memory location.
• XCHG destination, source
XCHG AH, BL
XCHG AX, WORD1
28
29. Legal Combinations of Operands for MOV and XCHG
Destination Operand
Source Operand General
Register
Segment
Register
Memory
Location Constant
General Register Yes Yes Yes No
Segment Register Yes No Yes No
Memory Location Yes Yes No No
Constant Yes No Yes No
29
Destination Operand
Source Operand General
Register
Memory
Location
General Register Yes Yes
Memory Location Yes No
30. Restrictions on MOV and XCHG
ILLEGAL: MOV WORD1, WORD2
MOV AX, WORD2
MOV WORD1, AX
30
31. ADD and SUB
• The ADD and SUB instructions are used to add or
subtract the contents of two registers, a register
and a memory location, or to add (subtract) a
number to (from) a register or memory location.
ADD destination, source
SUB destination, source
ADD WORD1, AX
SUB AX, DX
ADD BL, 5
31
32. Restrictions on ADD and SUB
ILLEGAL: ADD BYTE1, BYTE2
MOV AL, BYTE2 ; AX gets BYTE2
ADD BYTE1, AL ; add it to BYTE1
32
33. Legal Combinations of Operands for ADD and SUB
Destination Operand
Source Operand General
Register
Memory
Location
General Register Yes Yes
Memory Location Yes No
33
34. INC and DEC
• INC (increment) is used to add 1 to the
contents of a register or memory location and
DEC (decrement) subtracts 1 form a register or
memory location.
INC destination
DEC destination
INC WORD1
DEC BYTE1
34
35. NEG
• NEG is used to negate the contents of the
destination.
• NEG does this by replacing the contents by its
two’s complement.
NEG destination
NEG BX
35
36. Type Agreement of Operands
MOV AX, BYTE1 ; illegal
MOV AH, ‘A’
MOV AX, ‘A’ ; move 0041h into AX
36
37. Translation of high-Level Language to
Assembly Language
Statement Translation
B = A
MOV AX, A; move A into AX
MOV B, AX; and then into B
37
38. Translation of high-Level Language to
Assembly Language
Statement Translation
A = 5 – A
MOV AX, 5; put 5 in AX
SUB AX, A; AX contains 5 – A
MOV A, AX; put it in A
A = 5 – A
NEG A ; A = –A
ADD A, 5 ; A = 5 – A
38
39. Translation of high-Level Language to
Assembly Language
Statement Translation
A = B – 2 x A
MOV AX, B; AX has B
SUB AX, A; AX has B – A
SUB AX, A; AX has B – 2 x A
MOV A, AX; move result to A
39
40. • 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
40
41. 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 41
42. • 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
42
43. • 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
43
44. • 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.
44
46. .MODEL SMALL
.STACK 100H
.DATA
; data definitions go here
.CODE
MAIN PROC
; instructions go here
MAIN ENDP
; other procedures go here
END MAIN
46
47. • 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
47
49. • 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.
49
50. • 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.
50
51. Input:
AH = 1
Output:
AL = ASCII code if character key is pressed
= 0 if non-character key is pressed
51
52. MOV AH, 1 ; input key function
INT 21h ; ASCII code in AL
52
53. Input:
AH = 2
DL = ASCII code of the display character or
= control character
Output:
AL = ASCII code of the display character or
= control character
53
54. • MOV AH, 2 ; display character function
MOV DL, ‘?’ ; character is ‘?’
INT 21h ; display character
54
55. 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)
55
56. • 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.
56
57. TITLEECHO PROGRAM
.MODEL SMALL
.STACK 100H
.CODE
MAIN PROC
; display prompt
MOV AH, 2 ; display character function
MOV DL, '?' ; character is '?'
INT21H ; display it
; input a character
MOV AH, 1 ; read character function
INT 21H ; character in AL
MOV BL, AL ; save it in BL
57
58. ; 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
END MAIN
58
60. • An editor is used to create the preceding
program.
• The .ASM is the conventional extension used
to identify an assembly language source file.
60
61. • 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;
61
62. • 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;
62
63. • To run it, just type the run file name.
• C:>File_Name
63
64. Input:
DX = offset address of string.
= The string must end with a ‘$’ character.
64
65. • 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
65
66. • 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
66
67. 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 67
68. • 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.
68
69. .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
69
70. ; 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
70