Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
ALLAMA IQBAL OPEN UNIVERSITY, ISLAMABAD (Department of Computer Science) WARNING 1. 2. PLAGIARISM OR HIRING OF GHOST WRITER(S) FOR SOLVING THE ASSIGNMENT(S) WILL DEBAR THE STUDENT FROM AWARD OF DEGREE/CERTIFICATE, IF FOUND AT ANY STAGE. SUBMITTING ASSIGNMENTS BORROWED OR STOLEN FROM OTHER(S) AS ONE’S OWN WILL BE PENALIZED AS DEFINED IN “AIOU PLAGIARISM POLICY”. Course: Computer Organization and Assembly (3453) Level: BS (CS) Semester: Spring, 2016 Total Marks: 100 ASSIGNMENT No. 1 Note: All questions carry equal marks Q. 1 a) b) Q. 2 a) b) Q. 3 a) b) In which kind of problem domains, assembly language can be readily applied? How a program is loaded into memory and then executed? What is the role of segment registers to generate real-mode memory addresses? Generate the physical addresses of the following data or instructions or data: CS = 0AC2 h IP = 200h DS = 30A0 h BX = 4AC0 h SS = 9002 h SP = 1010 h Describe the typical arrangement of elements found in IBM PC in first 1 Mega Byte. What is the role of FLAG register during the execution of program? Q. 4 When Intel microprocessor operates in 32-bit mode then how can it generate addresses to address the memory above 1MB using protected-mode memory management? Q. 5 a) b) Define an array of 100 elements of type and initialize with the maximum value an element can store. If we omit the ‘$’ at the end of a string data definition (give below), what possibly can happen to that program during execution? (Greeting DB “Glad to meet you”) 1 ASSIGNMENT No. 2 Note: All questions carry equal marks Q. 1 Consider the double word 12347856H? How this double word will be stored in memory in little endian format? What is its equivalent in big endian format? Q. 2 Write a program to set and clear. a) Zero Flag b) Sign Flag c) Over flow Flag d) Carry Flag Q. 3 What is the role of stack in Intel Microprocessor? Write its major applications. Q. 4 a) b) How conditional jumps that use the FLAGS work in Assembly language? Will the following code jump to the label named Target (Yes/No)? Explain reason in each. mov ax, 8109h cmp ax, 26h jg Target Q. 5 Write a program in Assembly Language to read input string from the user (terminated by ENTER key). Then prompt the user to find the occurrence of first digit (entered by the user) in the string and return its index number. 3453 Computer Organization and AssemblyCredit Hours: 4(3 + 1) Recommended Book: Assembly Language for Intel-Based Computers, 3rd Edition, by Kip R. Irvine Course Outlines: Unit-1 a) b) c) Introduction Context of Assembly Language Introduction to assembly language, Assembly Language Applications Data representation Binary numbers, Converting Binary to Decimal, Hexadecimal Number, Signed Numbers, Character Storage Introducing Assembly Language Language Instructions, A Sample Debug Program, Debug Commands 2 Unit-2 a) b) c) Unit-3 a) b) c) d) Unit-4 a) b) c) d) e) Unit-5 a) b) c) Hardware and Software Architecture 16-BIT Intel Processor Architecture Central Processing Unit, Registers, Status and Control Registers, Flags; Instruction Execution Cycle, Intel Microprocessor Family 32-BIT Intel Processor Architecture Improved Execution Cycle, 32-bit Register Set Operating System and Memory Memory Architecture, Video display, Absolute Address Calculation-Video Adapter, Memory (RAM), Video RAM Assembly Language Fundamentals Basic Elements Constants and Expressions, Statements, Names, Sample Hello Program Assembling Linking and Debugging Microsoft Assembler (MASM) Data Allocation Directive Define Byte (DB), Define Word (DW), Define Doubleword (DD) Symbolic Constants Equal-Sign Directive, EQU Directive, TEXTEQU Directive Instructions MOV Instruction Operands with Displacements, XCHG Instruction Arithmetic Instructions INC and DEC Instructions, ADD Instruction, SUB Instruction, 1 lags Affected by ADD and SUB Basic Operand Types Register Operands, Immediate Operands, Direct Operands, Direct Offset Operands Extended Addition and Subtraction ADC Instruction, SBB Instruction Multiplication and Division MUL Instruction, IMUL Instruction, DIV Instruction, IDIV Instruction, CBW, CWD, CDQ, and CWDE Instructions, Preventing Divide Overflow Using the Assembler More About the Assembler and Linker Source Listing File, Map File, Assembling and Linking with MS-DOS Batch Files, Memory Models, Target Processor Directives Operators and Expressions Arithmetic Operators, OFFSET, SEG, PTR, LABEL, AND EVEN JMP and LOOP Instructions JMP Instructions, LOOP Instruction LOOP, LOOPW, LOOPD Instructions 3 d) Unit-6 a) b) c) Unit-7 a) b) c) Indirect Addressing Indirect Operands, Displacement Base an Indexed Operands, Base-Index with Conditional Processing Boolean and Comparison Instructions The Flags Register, AND Instruction, OR Instruction, XOR Instruction," NOT Instruction, NEG Instruction, TEST Instruction, CMP Instruction, CMPXCHG Instruction Integer Arithmetic Shift and Rotate Instructions, SHL Instruction, SHLD/SHRD Instructions, SHR Instruction, SAL and SAR Instructions, ROL Instruction, ROR Instruction, RCL and RCR Instructions Sample Applications Shifting Multiple Bytes on the 8086, Fast Multiplication and Division Conditional Jumps Code Generation for Conditional Jumps, Conditional Jump Examples Conditional Loops LOOPZ and LOOPE Instructions, LOOPNZ and LOOPNE Instructions High-Level Logic Structures Simple IF Statement, Compound IF Statement, WHILE Structure, REPEATUNTIL Structure, CASE Structure, Table of Procedure Offsets. Unit-8 a) b) c) d) e) f) g) Software Interrupts INT Instruction, Redirecting Input-Output MS-Dos Function Calls Output Functions, Input Functions, Date/Time Functions BIOS-Level Keyboard Input (INT16H) BIOS-Level Video Control (INT 10H) Disk Storage Fundamentals Drive and Directory Manipulation Unit-9 a) b) c) d) Procedures and Interrupts, Stack Operations Procedures, Procedure Parameters Structures Macros Macros with Parameters, Defining a Macro, Example: mDisplayiStr, Macro, mGotoRowCol macro e) ======= 4