Summer 2003 Lecture 15 07/03/03
|
|
- Beverly Powell
- 6 years ago
- Views:
Transcription
1 Summer 2003 Lecture 15 07/03/03 Initialization of Variables In the C (or C++) programming language any variable definition can have an optional initializer for the variable. How and when the initialization occurs is determined by the storage class of the variable. The syntax is similar to the following: int foo = 10 The term storage class refers to how and when memory space (storage) for the variable is allocated. In C there are basically two options for storage class: static and automatic. The memory for static variables is allocated by the compiler at the time of compilation. In an x86 system, the compiler will reserve space in the program s data segment at compilation time to store the variable. The memory space for automatic variables is allocated at run time on the stack. The compiler will generate code to allocate space for automatic local variables on entry to a procedure and de-allocate the space on exit from the procedure. The storage class assigned to a variable is determined by how and where the variable is defined. All variables defined outside the scope of any procedure (i.e. outside the body of any subroutine or function) must be static. Thus, global variables are, and must be static. By default, variables defined within a procedure (local variables) will be of storage class automatic. It is possible to specify that a local variable within a procedure be given static storage class by using the keyword static at the beginning of the declaration, as follows: static int foo = 10 The assignment of initial values is determined by the variable s storage class. All static variables will be initialized once before execution of the program begins. Generally, this is done by the compiler initializing the memory allocated in the data segment for all initialized variables. Most C compilers for the x86 processors actually generate two data segments one for initialized variables and one for uninitialized variables, which will be combined by the linker into a single segment.
2 Automatic variables are initialized each time that the procedure where they are declared is executed. Because the memory is allocated on the stack automatically on entry to the procedure, the initialization must also be performed on each entry to the procedure.
3 For scalar variables, the initialization could look something like this: C Code: void subr(void) { int x = 1 int y = 2 } x = x+y return x ASM Code subr proc near push bp mov bp,sp sub sp,4 mov [bp-2],1 initialize x mov [bp-4],2 initialize y mov ax,[bp-2] add ax,[bp-4] mov sp,bp pop bp ret subr endp Notice that the compiler would generate code to perform the initialization that would explicitly assign a constant value to the variable. This is essentially the same code that would be generated by an assignment statement. In C, initializing a scalar variable via an initializer on the declaration and via an explicit assignment statement cause the compiler to generate essentially the same code.
4 When assigning initial values to elements of an array, the situation becomes more complex. If an array is: local to a procedure and not declared to be of static storage class, it will be of storage class automatic, and allocated on the stack the same as a scalar variable. If the array is given initializers, it must be initialized according to the same rules. This means that the initialization must be performed each time the subroutine is entered and the compiler must generate code to perform this initialization. If the array was very large, this would require the compiler to generate a large amount of code to perform the initialization on entry to the procedure. Most compilers handle initialization of arrays in a different manner. In most cases, a table of initial values will be created in the initialized data area of the data segment, and the compiler will generate code to copy this table of initial values from its location in the data segment to the appropriate location on entry to the procedure. This will reduce the total size of the program and slightly improve the performance of performing the initialization. Furthermore, in many compiler implementations, most of the work of copying the table of initializers will be performed by a compiler helper function in the run time library and the compiler will only: generate code to set up the parameters to the helper function and call the library function, further reducing the code size overhead of the initialization. Programming Example: The example program shown below illustrates several points. 1) Binary search algorithm 2) Use of table of pointers pointing to variable length data 3) Use of registers to pass parameters to subroutines 4) Using push and pop to preserve registers modified by a subroutine to preserve the register state of the calling procedure Binary Search: Binary search is a search algorithm that can be employed to search ordered (sorted) data. It depends upon the fact that the data is ordered to work. The algorithm works by dividing the data set into smaller and smaller regions until the target item is either found, or found not to be in the set. Two pointers are maintained into the data set. One points to the lower end of the range being considered, the other points to the upper end of the range.
5 At each iteration of the algorithm, the item at the middle of the range is compared to the target value. If the item matches, then the search terminates with success. If the item doesn t match then the range is adjusted by either moving the lower pointer up or the upper pointer down. The determination of which pointer to move is made by whether the item tested was greater than or less than the item being search for. This traps the item being searched for into smaller and smaller ranges until it is found, or the size of the range goes to 0, in which case the item isn t in the data set. Use of pointers for variable length data When maintaining an array of data items of variable length, it is generally less useful to maintain them directly in the table. There are several reasons for this. If items are being inserted and deleted from the table, it makes the insertion and deletion task more difficult if the items in the table are not all the same size. If reordering the items in the table is required (such as when sorting) the task or exchanging items is much more difficult if all items are not the same size. Generally when maintaining a table of large or variable sized items, an array of pointers to the items is maintained. Then, for example, when sorting the data, it is only necessary to exchange pointers to swap items rather than moving all of the data associated with the item.
6 FindStr -- This is an example program to illustrate a binary search of a table of pointers to strings. _DATA segment public byte 'DATA' str0 db "This is string 00",0 str1 db "This is string 01",0 str2 db "This is string 02",0 str3 db "This is string 03",0 str4 db "This is string 04",0 str5 db "This is string 05",0 str6 db "This is string 05",0 str7 db "This is string 07",0 str8 db "This is string 08",0 str9 db "This is string 09",0 str10 db "This is string 10",0 str11 db "This is string 11",0 str12 db "This is string 12",0 str13 db "This is string 13",0 str14 db "This is string 14",0 strtab dw str0,str1,str2,str3,str4,str5,str6,str7 dw str8,str9,str10,str11,str12,str13,str14 srch0 db "Not in table",0 srch1 db "This is string 03",0 srch2 db "This is string 11",0 srch3 db "This is string 00",0 srch4 db "This is string 14",0 srch5 db "Also not in table",0 _DATA _STCK ends segment stack dw 128 dup (?) _STCK ends
7 _TEXT segment public byte 'CODE' assume cs:_text start: mov ax,_data mov ds,ax mov es,ax assume ds:_data,es:_data mov bx,offset strtab mov cx,15 mov dx,offset srch0 mov dx,offset srch1 mov dx,offset srch2 mov dx,offset srch3 mov dx,offset srch4 mov dx,offset srch5 mov ax,4c00h int 21h
8 FindStr - Perform a binary search of a table of a sorted table of strings for a particular string. Input: BX - base address of the string pointer table CX - number of string pointers in the table DX - pointer to the search string Output: AX - returns the index of the search string CF - clear if string found, set if not found FindStr proc near push cx push dx push si push di mov di,dx keep target str ptr in DI mov dx,cx keep high pointer in DX xor cx,cx keep low pointer in CX Find the middle of the current range, and compare that string with the target string fnds20: cmp cx,dx if low ptr >= high ptr jae fnds80 then string isn't in table mov ax,cx add ax,dx shr ax,1 find middle of range mov si,ax add si,si mov si,[bx+si] get pointer to string at middle to SI call CmpStr compare the strings jz fnds90 if match, we found it This one wasn't the one. Adjust the low end up or the high end down. jc fnds30 if *si < *di adjust low end up mov dx,ax jmp fnds20 fnds30: mov cx,ax jmp fnds20
9 String not found in the table. Return CF set fnds80: stc All done fnds90: pop di pop si pop dx pop cx ret FindStr endp CmpStr - compare two zero terminated string Input: SI - pointer to first string DI - pointer to second string Output: CF set if *SI < *DI ZF set if *SI == *DI CmpStr proc near push si push di cpst20: cmpsb jnz cpst90 compare the next byte of the two strings cmp byte ptr [si-1],0 check for end of string jnz cpst20 and repeat if not end cpst90: pop di pop si ret CmpStr endp _TEXT ends end start
Summer 2003 Lecture 14 07/02/03
Summer 2003 Lecture 14 07/02/03 LAB 6 Lab 6 involves interfacing to the IBM PC parallel port Use the material on wwwbeyondlogicorg for reference This lab requires the use of a Digilab board Everyone should
More information1: /********************************************************** 2: * A
1: /********************************************************** 2: * A simple example to illustrate C and assembly language * 3: * interface. The test function is written in assembly * 4: * language (in
More information3: 4: 5: 9: ',0 10: ',0 11: ',0 12: 13:.CODE 14: INCLUDE
1: TITLE Parameter passing via registers PROCEX1.ASM 2: COMMENT 3: Objective: To show parameter passing via registers 4: Input: Requests two integers from the user. 5: Output: Outputs the sum of the input
More informationBLDEA S V.P. DR. P.G. HALAKATTI COLLEGE OF ENGINEERING & TECHNOLOGY, VIJAYAPURA
EXPERIMENT NO.:- 1. BINARY SEARCH Work Space: Register Used Memory Address Data DI 10000H 11H 10001H 11H 10002H 22H 10003H 22H BX 10004H 33H 10005H 33H 10006H 44H 10007H 44H CX 10008H 55H 10009H 55H 24
More informationParameter Passing. Procedure line. Calling procedure line. Most subroutines require parameters Can sometimes pass parameters via registers
Parameter Passing Most subroutines require parameters Can sometimes pass parameters via registers Assume subroutine line will compute the value: y = m*x + b where m,x,b are signed byte values, and y is
More informationAssembler Programming. Lecture 10
Assembler Programming Lecture 10 Lecture 10 Mixed language programming. C and Basic to MASM Interface. Mixed language programming Combine Basic, C, Pascal with assembler. Call MASM routines from HLL program.
More informationSummer 2003 Lecture 4 06/14/03
Summer 2003 Lecture 4 06/14/03 LDS/LES/LSS General forms: lds reg,mem lseg reg,mem Load far pointer ~~ outside of current segment {E.g., load reg w/value @ mem, & seg w/mem+2 XCHG Exchange values General
More informationTopics Introduction to Microprocessors. Chapter 5 Macros and modules. What is macro? How to use macro? (I) How to use macro?
Topics 2102440 Introduction to Microprocessors Macros Subroutines Modules Chapter 5 Macros and modules Suree Pumrin,, Ph.D. 1 2102440 Introduction to Microprocessors 2 What is macro? It is used to automate
More informationCopyright 2000 by Barry B. Brey The CPU Scheduling Processes
Copyright 2000 by Barry B. Brey The CPU Scheduling Processes One method used to schedule processes in a small real-time operating system (RTOS) is via a time slice to switch between various processes.
More informationCOE 205 Lab Manual Experiment N o 12. Experiment N o Using the Mouse
Experiment N o 12 12 Using the Mouse Introduction The mouse is an I/O device that replaces the arrow keys on the keyboard for graphical and text style programs. This experiment shows how to add the mouse
More informationWeek /8086 Microprocessor Programming
Week 5 8088/8086 Microprocessor Programming Multiplication and Division Multiplication Multiplicant Operand Result (MUL or IMUL) (Multiplier) Byte * Byte AL Register or memory Word * Word AX Register or
More informationEE 314 Spring 2003 Microprocessor Systems
EE 314 Spring 2003 Microprocessor Systems Laboratory Project #3 Arithmetic and Subroutines Overview and Introduction Review the information in your textbook (pp. 115-118) on ASCII and BCD arithmetic. This
More informationWeek /8086 Microprocessor Programming II
Week 5 8088/8086 Microprocessor Programming II Quick Review Shift & Rotate C Target register or memory SHL/SAL 0 C SHR 0 SAR C Sign Bit 2 Examples Examples Ex. Ex. Ex. SHL dest, 1; SHL dest,cl; SHL dest,
More informationLecture (08) x86 programming 7
Lecture (08) x86 programming 7 By: Dr. Ahmed ElShafee 1 Conditional jump: Conditional jumps are executed only if the specified conditions are true. Usually the condition specified by a conditional jump
More informationSegmentation in Assembly Language Programming
1 2 Segmentation in General Segmentation in Assembly Language Programming UNIX programs have 3 segments Text segment Executable machine instructions Data segment Initialized data BSS segment (Block Started
More informationA4 Sample Solution Ch3
A4 Sample Solution Ch3 2. AL, AH, BL, BH,CL,CH,DLl, DH 3. AX, BX, CX, DX, SP, BP, SI, DI, CS, DS, ES, SS, FS, GS 4. EAX, EBX, ECX, EDX, ESP, EBP, EDI, ESI 5. RAX, RBX, RCX, RDX, RSP, RBP, RSI, RDI and
More informationComputer Architecture and System Software Lecture 07: Assembly Language Programming
Computer Architecture and System Software Lecture 07: Assembly Language Programming Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements New assembly examples uploaded to
More informationLecture 16: Passing Parameters on the Stack. Push Examples. Pop Examples. CALL and RET
Lecture 1: Passing Parameters on the Stack Push Examples Quick Stack Review Passing Parameters on the Stack Binary/ASCII conversion ;assume SP = 0202 mov ax, 124h push ax push 0af8h push 0eeeh EE 0E F8
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND Segment The "SEGMENT" and "ENDS" directives indicate to the assembler the beginning and ending of a segment and have the following format label SEGMENT [options] ;place the statements belonging
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND 8086 CPU has 8 general purpose registers listed below: AX - the accumulator register (divided into AH / AL): 1. Generates shortest machine code 2. Arithmetic, logic and data transfer 3. One
More informationELEC 242 Using Library Procedures
ELEC 242 Using Library Procedures There are a number of existing procedures that are already written for you that you will use in your programs. In order to use the library procedures that come with the
More informationPESIT Bangalore South Campus
INTERNAL ASSESSMENT TEST 2 Date : 28/03/2016 Max Marks: 50 Subject & Code : Microprocessor (10CS45) Section: IV A and B Name of faculty: Deepti.C Time: 8:30-10:00 am Note: Answer any complete five questions
More informationORG ; TWO. Assembly Language Programming
Dec 2 Hex 2 Bin 00000010 ORG ; TWO Assembly Language Programming OBJECTIVES this chapter enables the student to: Explain the difference between Assembly language instructions and pseudo-instructions. Identify
More informationEXPERIMENT TWELVE: USING DISK FILES
EXPERIMENT TWELVE: USING DISK FILES INTRODUCTION Because just about any program ever written requires the use of a disk file to store or retrieve data, this experiment shows how to create, read, write,
More informationLABORATORY WORK NO. 8 WORKING WITH MACROS AND LIBRARIES
LABORATORY WORK NO. 8 WORKING WITH MACROS AND LIBRARIES 1. Object of laboratory Getting used to defining and using macros, procedure defining and using LIB library librarian. 2. Theoretical considerations
More informationCS-202 Microprocessor and Assembly Language
CS-202 Microprocessor and Assembly Language Lecture 2 Introduction to 8086 Assembly Language Dr Hashim Ali Spring - 2019 Department of Computer Science and Engineering HITEC University Taxila!1 Lecture
More informationEC 333 Microprocessor and Interfacing Techniques (3+1)
EC 333 Microprocessor and Interfacing Techniques (3+1) Lecture 6 8086/88 Microprocessor Programming (Arithmetic Instructions) Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC
More informationUNIVERSITY OF CALIFORNIA, RIVERSIDE
Final Page 1 of 7 UNIVERSITY OF CALIFORNIA, RIVERSIDE Computer Science Department CS61 Machine Organization & Assembly Language Final September 1, 2000 53 Name: Solution Key Student ID#: Please print legibly
More informationModule 3 Instruction Set Architecture (ISA)
Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O
More informationDr. D.M. Akbar Hussain
1 2 Compiler Construction F6S 1 3 4 Compiler Construction F6S 2 5 6 Compiler Construction F6S 3 7 8 Compiler Construction F6S 4 a=b*- c + b*- c 9 a=b*- c + b*- c 10 Compiler Construction F6S 5 a=b*- c
More informationObjectives. ICT106 Fundamentals of Computer Systems Topic 8. Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8
Objectives ICT106 Fundamentals of Computer Systems Topic 8 Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8 To understand how HLL procedures/functions are actually implemented
More informationUNIT 4. Modular Programming
1 UNIT 4. Modular Programming Program is composed from several smaller modules. Modules could be developed by separate teams concurrently. The modules are only assembled producing.obj modules (Object modules).
More informationProcedures and the Stack. Chapter 4 S. Dandamudi
Procedures and the Stack Chapter 4 S. Dandamudi Outline What is stack? Pentium implementation of stack Pentium stack instructions Uses of stack Procedures Assembler directives Pentium instructions Parameter
More informationPESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication
USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication INTERNAL ASSESSMENT TEST 1 Date : 26/02/2018 Marks: 40 Subject
More informationPHY4635/5635 Spring Lecture 8: Program Control Instructions
PHY4635/5635 Spring 2009 Lecture 8: Program Control Instructions Short, Near and Far Jumps Short jump: jump is within +127 to -128 bytes from the address following the jump. Relative jumps : moves with
More informationINSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI
Note: PUSHF / POPF have no operands The figure below shows that if (SS) = 3000H, (SP) = 0042H, so the execution of POP CX loads CX by the word 4050H form the stack segment. The SP is incremented by 2.
More informationLecture (06) x86 programming 5
Lecture (06) x86 programming 5 By: Dr. Ahmed ElShafee 1 TOC Format of DOS programs Format of the.com programs Addressing Modes 1> Immediate Addressing Mode 2> Register Addressing Mode 3> Direct Addressing
More informationLABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS
LABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS 1. Object of laboratory The x86 microprocessor family has a large variety of instructions that allow instruction flow control. We have 4 categories: jump,
More informationMarking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)
Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 02/06/2018 Section 1 Weighting 40% of
More informationPESIT Bangalore South Campus
INTERNAL ASSESSMENT TEST 2 Date : 02/04/2018 Max Marks: 40 Subject & Code : Microprocessor (15CS44) Section : IV A and B Name of faculty: Deepti.C Time : 8:30 am-10:00 am Note: Note: Answer any five complete
More informationCS401 Assembly Language Solved Subjective MAY 03,2012 From Midterm Papers. MC
CS401 Assembly Language Solved Subjective MAY 03,2012 From Midterm Papers MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 MIDTERM FALL 2011 CS401 Assembly Language Q: Affected flag of AND operation
More informationPrograms for Assembly Language Programming
;Program to print lower case alphabets.stack 100 mov dl, 'a' mov cl, 26 print: mov ah, 02h inc dl loop print mov ah, 4ch Programs for Assembly Language Programming ;Program to printf upper case alphabets.stack
More informationSRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)
SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013) UNIT I THE 8086 MICROPROCESSOR PART A (2 MARKS) 1. What are the functional
More informationEECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution
1. (40 points) Write the following subroutine in x86 assembly: Recall that: int f(int v1, int v2, int v3) { int x = v1 + v2; urn (x + v3) * (x v3); Subroutine arguments are passed on the stack, and can
More informationdb "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'
PA4 Sample Solution.model large.stack 100h.data msg1 db "This programs scans a string of up to 256 bytes and counts the repetitions of the number 4206 and sums them.",0dh,0ah,'$' msg2 db "Please enter
More informationMarking Scheme. Examination Paper. Module: Microprocessors (630313)
Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 12/06/2017 Section 1 Weighting 40% of
More informationSummer 2003 Lecture 12 06/26/03
Summer 2003 Lecture 12 06/26/03 Implementing Standard C Control Structures: IF THEN ELSE if (a == b) { mov ax,a blah; cmp ax,b jnz endif blah endif: if (a == b) { true clause else { false clause mov ax,a
More informationAssignment no:4 on chapter no :3 : Instruction set of 8086
Assignment no:4 on chapter no :3 : Instruction set of 8086 1) Describe any two string operation instruction of 8086 with syntax & one example of each. 1] REP: REP is a prefix which is written before one
More informationThe Stack. Lecture 15: The Stack. The Stack. Adding Elements. What is it? What is it used for?
Lecture 15: The Stack The Stack What is it? What is it used for? A special memory buffer (outside the CPU) used as a temporary holding area for addresses and data The stack is in the stack segment. The
More informationIntel 8086: Instruction Set
IUST-EE (Chapter 6) Intel 8086: Instruction Set 1 Outline Instruction Set Data Transfer Instructions Arithmetic Instructions Bit Manipulation Instructions String Instructions Unconditional Transfer Instruction
More informationSelection and Iteration. Chapter 7 S. Dandamudi
Selection and Iteration Chapter 7 S. Dandamudi Outline Unconditional jump Compare instruction Conditional jumps Single flags Unsigned comparisons Signed comparisons Loop instructions Implementing high-level
More informationIt is possible to define a number using a character or multiple numbers (see instruction DB) by using a string.
1 od 5 17. 12. 2017 23:53 (https://github.com/schweigi/assembler-simulator) Introduction This simulator provides a simplified assembler syntax (based on NASM (http://www.nasm.us)) and is simulating a x86
More informationChapter 3. Assembly Language Programming with 8086
Chapter 3 Assembly Language Programming with 8086 UNIT - III Assembly Language Programming with 8086- Machine level programs, Machine coding the programs, Programming with an assembler, Assembly Language
More informationBasic Assembly SYSC-3006
Basic Assembly Program Development Problem: convert ideas into executing program (binary image in memory) Program Development Process: tools to provide people-friendly way to do it. Tool chain: 1. Programming
More informationEx: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.
INSTRUCTOR: ABDULMUTTALIB A H ALDOURI Conditional Jump Cond Unsigned Signed = JE : Jump Equal JE : Jump Equal ZF = 1 JZ : Jump Zero JZ : Jump Zero ZF = 1 JNZ : Jump Not Zero JNZ : Jump Not Zero ZF = 0
More informationX86 Addressing Modes Chapter 3" Review: Instructions to Recognize"
X86 Addressing Modes Chapter 3" Review: Instructions to Recognize" 1 Arithmetic Instructions (1)! Two Operand Instructions" ADD Dest, Src Dest = Dest + Src SUB Dest, Src Dest = Dest - Src MUL Dest, Src
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 7. Procedures and the Stack
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 7 Procedures and the Stack April, 2014 1 Assembly Language LAB Runtime Stack and Stack
More information8086 INSTRUCTION SET
8086 INSTRUCTION SET Complete 8086 instruction set Quick reference: AAA AAD AAM AAS ADC ADD AND CALL CBW CLC CLD CLI CMC CMP CMPSB CMPSW CWD DAA DAS DEC DIV HLT IDIV IMUL IN INC INT INTO I JA JAE JB JBE
More informationCG2007 Microprocessor systems.
CG2007 Microprocessor systems Tutorial 1 Semester 2 AY 2011-12 Ganesh Iyer ganesh.vigneswara@gmail.com http://ganeshniyer.com About Me I have 3 years of Industry work experience in Bangalore, India. I
More informationAssembly Language Lab #5
Islamic University of Gaza Computer Engineering Department 2009 Assembly Language Lab #5 Eng. Tahani Z. Fourah Islamic University of Gaza Lab 5 Addressing Modes The addressing modes are different ways
More informationMemory Organization. 27 December 2016 Pramod Ghimire. Slide 1 of 21
Memory Organization Slide 1 of 21 The assembler uses two basic formats for developing software. One method uses memory models and the other uses fullsegment definitions. MASM uses memory models. The TASM
More information16.317: Microprocessor Systems Design I Fall 2013
16.317: Microprocessor Systems Design I Fall 2013 Exam 2 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationCS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 4: 80X86 INSTRUCTION SET QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS
CS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 4: 80X86 INSTRUCTION SET QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS Q1. IWrite an ALP that will examine a set of 20 memory
More informationWe will begin our study of computer architecture From this perspective. Machine Language Control Unit
An Instruction Set View Introduction Have examined computer from several different views Observed programmer s view Focuses on instructions computer executes Collection of specific set of instructions
More informationMicroprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil
Microprocessor By Mrs. R.P.Chaudhari Mrs.P.S.Patil Chapter 1 Basics of Microprocessor CO-Draw Architecture Of 8085 Salient Features of 8085 It is a 8 bit microprocessor. It is manufactured with N-MOS technology.
More informationELEC 242 Time Delay Procedure
There are many occasions where we wish to time events. If we are using a personal computer, we have a number of ways to do this. The 8088/8086 computer had a Programmable Interval Timer like the 8253/54
More informationEEM336 Microprocessors I. Data Movement Instructions
EEM336 Microprocessors I Data Movement Instructions Introduction This chapter concentrates on common data movement instructions. 2 Chapter Objectives Upon completion of this chapter, you will be able to:
More informationComputer Architecture and System Software Lecture 06: Assembly Language Programming
Computer Architecture and System Software Lecture 06: Assembly Language Programming Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Assignment 3 due thursday Midterm
More informationCSCI516: Program 1 - October 11, 2010 The Program is due: October 25, 2010 in the beginning of the class
CSCI516: Program 1 - October 11, 2010 The Program is due: October 25, 2010 in the beginning of the class For Late Submissions 10 out of 100 points will be taken off. For your first program, you are to
More informationLesson 4. Stack, Procedures and Macros
Lesson 4. Stack, Procedures and Macros Computer Structure and Organization Graduated in Computer Sciences / Graduated in Computer Engineering Graduated in Computer Sciences / Graduated in Computer Engineering
More informationExperiment 3 3 Basic Input Output
Experiment 3 3 Basic Input Output Introduction The aim of this experiment is to introduce the use of input/output through the DOS interrupt. Objectives: INT Instruction Keyboard access using DOS function
More informationSHEET-2 ANSWERS. [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte.
SHEET-2 ANSWERS [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte. TITLE PROG2-3 PURPOSE: TRANSFER 6 WORDS OF DATA PAGE 60,132.MODEL SMALL.STACK 64.DATA ORG 10H DATA_IN DW 234DH,
More informationExperiment 8 8 Subroutine Handling Instructions and Macros
Introduction Experiment 8 8 Subroutine Handling Instructions and Macros In this experiment you will be introduced to subroutines and how to call them. You will verify the exchange of data between a main
More information16.317: Microprocessor Systems Design I Fall 2014
16.317: Microprocessor Systems Design I Fall 2014 Exam 2 Solution 1. (16 points, 4 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationQ. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11]
Q. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11] Answer: 1. Defining Problem 2. Algorithm 3. Flowchart 4. Initialization of checklist 5. Choosing instructions 6. Converting
More information16.317: Microprocessor Systems Design I Fall 2015
16.317: Microprocessor Systems Design I Fall 2015 Exam 2 Solution 1. (16 points, 4 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationExperiment #2. Addressing Modes and Data Transfer using TASM
2.0 Objective Experiment #2 Addressing Modes and Data Transfer using TASM The objective of this experiment is to learn various addressing modes and to verify the actions of data transfer. 2.1 Introduction
More informationObjectives. Saving Interrupt Vectors. Writing a Custom Interrupt Handler. Examples of use of System functions for Input-Output and Interrupts
ICT106 Fundamentals of Computer Systems Week 11 Practical Examples of use of System functions for Input-Output and Interrupts Objectives To illustrate how to write interrupt service routine (ISR) for Intel
More information16.317: Microprocessor Systems Design I Spring 2015
16.317: Microprocessor Systems Design I Spring 2015 Exam 2 Solution 1. (16 points, 4 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by
More informationWe will first study the basic instructions for doing multiplications and divisions
MULTIPLICATION, DIVISION AND NUMERICAL CONVERSIONS We will first study the basic instructions for doing multiplications and divisions We then use these instructions to 1. Convert a string of ASCII digits
More informationChapter 3: Addressing Modes
Chapter 3: Addressing Modes Chapter 3 Addressing Modes Note: Adapted from (Author Slides) Instructor: Prof. Dr. Khalid A. Darabkh 2 Introduction Efficient software development for the microprocessor requires
More informationcomplement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]
The following pages contain references for use during the exam: tables containing the x86 instruction set (covered so far) and condition codes. You do not need to submit these pages when you finish your
More informationOverview of Compiler. A. Introduction
CMPSC 470 Lecture 01 Topics: Overview of compiler Compiling process Structure of compiler Programming language basics Overview of Compiler A. Introduction What is compiler? What is interpreter? A very
More informationCHAPTER SEVENTEEN Assemblers versus Compilers. Intel 80x86 Assembly Language
CHAPTER SEVENTEEN Intel 80x86 Assembly Language In Chapter 15, we developed a generic assembly language and its associated machine code. This language was presented to create a few simple programs and
More informationTHE UNIVERSITY OF TRINIDAD & TOBAGO
THE UNIVERSITY OF TRINIDAD & TOBAGO FINAL ASSESSMENT/EXAMINATIONS DECEMBER 2012 Course Code and Title: Microprocessor Architecture & Interfacing Programme: Computer Engineering Technician Date and Time:
More informationECOM Computer Organization and Assembly Language. Computer Engineering Department CHAPTER 7. Integer Arithmetic
ECOM 2325 Computer Organization and Assembly Language Computer Engineering Department CHAPTER 7 Integer Arithmetic Presentation Outline Shift and Rotate Instructions Shift and Rotate Applications Multiplication
More informationCONTENTS. 1. Display a Message Display a one Digit Number Accept a Character from keyboard and display the character 4
University of Kashmir, North Campus Course Code Course Name Course Instructor MCA-104-DCE Assembly Language Programming Bilal Ahmad Dar CONTENTS 1. Display a Message 2 2. Display a one Digit Number 3 3.
More informationAssembly Language. Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology. Overview of Assembly Language
4345 Assembly Language Assembly Language Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology Assembly Language 3-1 Overview of Assembly Language Advantages: Faster as compared
More informationCertified Ethical Hacker. Module 25 Writing Virus Codes
Certified Ethical Hacker Module 25 Writing Virus Codes Module Objective This module will familiarize you with the following: Introduction of viruses Prerequisites for virus writing Tools required for virus
More informationLogic Instructions. Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Segment 4A
Segment 4A Logic Instructions Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Course Instructor Mohammed Abdul kader Lecturer, EEE, IIUC Basic
More informationQ1: Define a character string named CO_NAME containing "Internet Services" as a constant?
CS 321 Lab Model Answers ١ First Lab : Q1: Define a character string named CO_NAME containing "Internet Services" as a constant? ANS: CO_NAME EQU ' Internet Services' Q2: Define the following numeric values
More informationLab 3. The Art of Assembly Language (II)
Lab. The Art of Assembly Language (II) Dan Bruce, David Clark and Héctor D. Menéndez Department of Computer Science University College London October 2, 2017 License Creative Commons Share Alike Modified
More informationreply db y prompt db Enter your favourite colour:, 0 colour db 80 dup(?) i db 20 k db? num dw 4000 large dd 50000
Declaring Variables in Assembly Language As in Java, variables must be declared before they can be used Unlike Java, we do not specify a variable type in the declaration in assembly language Instead we
More informationComputer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine
Computer Organization & Assembly Language Programming CSE 2312 Lecture 15 Addressing and Subroutine 1 Sections in 8088 Code TEXT section, for the processor instructions. DATA section for the initialization
More informationWINTER 12 EXAMINATION Subject Code : Model Answer Page No : / N. a) Describe the function of SID and SOD pins of 8085 microprocessor
Subject Code : Model Answer Page No : / N Q.1) SOLVE ANY FIVE : (20 MARKS) a) Describe the function of SID and SOD pins of 8085 microprocessor Ans: - SID: - (2 Mark) Serial Input Data SID pin is used to
More information.code. lea dx,msg2. Page 1/8. Problem 1: Programming in Assembly [25 Points]
Problem : Programming in Assembly [ Points] The following assembly program is supposed to: receive three integer numbers from the console, call a function, name sort, function sort arranges the three input
More informationEE 332 Real Time Systems Midterm Examination Solution Friday February 13, :30 pm to 4:30 pm
EE 332 Real Time Systems Midterm Examination Solution Friday February 13, 2004 2:30 pm to 4:30 pm Student Name Student Number Question Mark #1 / 15 #2 / 20 #3 / 25 TOTAL / 60 General: Two hours (2:30 pm
More informationProgramming in Module. Near Call
Programming in Module Main: sub1: call sub1 sub ax,ax sub1 sub1 proc near sub ax,ax endp sub1 sub1 proc Far sub ax,ax endp Near Call sub1 sub1 Main: call sub1 sub1: sub ax,ax proc near sub ax,ax endp SP
More informationQuestion Bank Part-A UNIT I- THE 8086 MICROPROCESSOR 1. What is microprocessor? A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic device that reads binary information
More informationConstants and. Lecture 7: Assembly Language Programs. Expressions (cont.) Constants and. Statements. Expressions
Lecture 7: Assembly Language Programs Basic elements of assembly language Assembler directives Data allocation directives Data movement instructions Assembling, linking, and debugging Using TASM Constants
More information