0% found this document useful (0 votes)
3K views18 pages

Cos2621 2017 10 e 1

Toturial letter

Uploaded by

Lebo Modika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
3K views18 pages

Cos2621 2017 10 e 1

Toturial letter

Uploaded by

Lebo Modika
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 18
FINAL UNISA Sea C0S2621 Computer Organisation STUDENT NUMBER Oct/Nov 2017 TOENTITY NUMBER Ree ETE FOR USE BY EXAMINATION INVIGILATOR Question No [or 1 oe | as of 3 1 Subject Number of paper 08 Date of examination Total /Totaal | WARNING 5 Acandidate who wrthout authonsaton takes ino the examnabon venue any book docuent or object which could asst hehe the exammation and does Not hand over such malenst fhe iwioiater beara re ofc comynercemert ofthe examination wa be iy at nfnnging the Ursversy¢ pxamnaton roguahoes and wal be lable fo punishment as geternned by Counc gh werk may be dona ony onthe amination question paar and must be labeled as such onetes may be made on an part ofthe body. suchas fehanés or Ovary gatment Ths pgelpoper iste property ofthe Unversity and wider no creuetanees may the candidate retan tor take fot of he ‘romnation venue NB PLEASE COMPLETE THE ATTENDANCE REGISTER ON THE BACK PAGE TEAR OFF AND HAND TO THE INVIGILATOR UNIVERSITY EXAMINATIONS. UNIVERSITETSEKSAMENS UNISAlEe cos2621 October/November 2017 COMPUTER ORGANISATION Duration 2 Hours. 100 Marks EXAMINERS. FIRST DR AP ABIDOYE SECOND MRS S VALLABHAPURAPU Use of a non-programmable pocket calculator is permissible Closed book examination Ts cxamination question paper remains the property ofthe Univer of South Aiea and may not be This paper consists of the following 1 11 pages with questions (p 2-10) 2 An additional 2 empty pages (p 11-12) for additional space 3. An appendix (p Hv) INSTRUCTIONS 1 Answer all questions in the space provided below the questions Use the additional blank pages at the back if necessary and wnte the question number in the space provided 2. All rough work must be done in this question and answer book 3. The mark for each question 's given in brackets next to the question 4. The appendix contains a hist of IBM PC Assembly Language instructions GOOD LUCK! [TURN OVER} 2 cose6e1 OctiNov 2017 jeneral Knowledge [30] Question 1: Indicate which one of alternatives (1) to (5) you consider to be the correct one by putting *** (3 stars) next to the corresponding answer for each question a) A contains electronics for exchange data, control, and status signals with an 10 module plus the electronics for controlling the disk read/write mechanism (2) Cdrnve Command drive Disk drive Processor Cache asona b) Two addresses are dedicated to keyboard input from a particular terminal Address 516 refers to the data register and address 517 refers to the ‘ ie) memory status register 'solated /0 input register output register oseons ©) Which one of the following instruction would you use if you want to branch to the label TEST if the sign flag is set? (2) JN TEST JZ TEST JS_ TEST JNS TEST JNP TEST aeons d) The provides signals that control the operation of the Anthmetic and Logic unit (ALU) and the movement of the data into and out of the ALU 2 Data Bus Antennae Magnetic drive Temporary memory Processor e) The major functions or requirements for an (/O module fall into the following categones except : i) aaons error detection processor communication device communication error control data buffenng osons (TURN OVER) f) Given A and B as input and F as out function, the algebraic expression for XOR 1s 3 cosa621 OciNov 2017 (2) 9) Which of the following are characteristics of Blu-ray DVDs 2 a_ ltean store more than 20 GB per side b Ithas slightly more storage density as normal DVDs ¢. Ituses a short wave-length 405 nm laser d_ Ituses a red-blue laser e. There are two versions available read-only (BD-ROM) and recordable many (BD-M) 1 only a,b andd 2 onlyaandc 3 onlyaande 4 a,b,candd 5 onlybandd h) Suppose a machine has seven (7) general-purpose 32-bit registers How many bits must be reserved to the machine code instruction in order to address any one of these seven registers? 2) ) AS oon a oaona one goes down the memory hierarchy, the following occur except 2] 1 (Decreasing frequency of access of the memory by the processor 2 Increasing capacity 3 Decreasing access time 4 Decreasing cost 5. None of the answers given above 1s correct )) Which one of the following binary codes have even parity (assume that the left-most bit 1s the panty bit)? 2] arona 10101110 10101010 10100111 11110001 00000001 [TURN OVER}, 4 cosz6a1 QctiNov 2017 k) Suppose AL contains the value 8Ah What will be the result of the following instruction? [2] sar arena ) orona m) The. al,3 14h E2n 50n Fin None of the above flushes the internal cache memory after wniting dirty lines to memory fa} INVD WBINVD INVLPG Los SGDT module transfers the entire block of data, one word at a time, directly to or from memory 2 1 o oe Data cache DMA ROM EPROM Address register nl) Which one of the following is NOT a reason for wnting programs in assembly language rather than using a high-level programming language? a 1 2 3 4 5 Code 1s often much faster Insight into the problem often allows real improvement in performance The program logic is easy to follow It allows complete access to hardware tt can be used to wntte function libraries that are compatible with multiple operating systems ©) The result of the following hexadecimal addition 1s. (2 ECh + 98h asona 184n 24An 182h Aan None of the above [TURN OVER} 5 coset OctiNov 2017 Question 2: [16] 4) Explain four reasons why peripheral devices are not duecily connected to the system bus (6 marks) b)_ Discuss five sequence of hardware events that occur when an Input/output (/O) device completes an YO operation (40 marks) [TURN OVER] 6 cosz6a1 Oct/Nov 2017 Question 3 [10] a) Convert [19 and 1319 to binary number (4 marks) Hint: show all your workings b) Determine the product of the binary numbers you obtained 1 (a) (2 marks) ©) Compared with the peneil-and-paper approach, explain two ways to make computerised muluplication more efficient (4 matks) [TURN OVER} 7 cosz621 OctNov 2017 Question 4 [14] a) Explain the term ‘gate an a digital logie circuit, (2 marks) b) Given the following four gates AND, OR, NOT and NAND, draw the graphical symbol, express the algebraic function and compute the Truth Table for each gate in the table below (12 marks) Name ‘Graphical Symbol Algebraic Function Truth Table ] ‘AND OR NOT NAND [TURN OVER] coszee1 OctiNov 2017, Question 5: (a) Write a program using two-address machine mstractions to execute y ae Gon (b) Explain the following stack addressing terms 1 Stack Pointer (SP) PUSH 15) (5 marks) (2 marks) (2 marks) (TURN OVER} 9 082621 OcuNav 2017 m= POP: (2 marks) (©) Write short notes on memory management (4 marks) [TURN OVER] cosz621 QcuNov 2017 Question 6: (15) 4a) List and explain two (2) characteristics of Reduced Instruction Set Architectures (RISC) (6 marks) (9 marks) b) Write an assembly Language to execute the following Display a user prompt to key in a number < 10 Read a number (< 10) from the keyboard Convert from ASCII to numenc Display an error message if the number 1s out of range ‘Test whether the number 1s even or odd If the number 1s even, display the message ‘Number 1s even’, otherwise display the message ‘Number 1s oud” NB Do not use division by 2 (Hint If the nght-most bit of the number 1s equal to 1, the number is odd ) [TURN OVER] u cosz621 QcuNov 2077 Question __ (continued): [TURN OVER] 2 cos2621 OctiNov 2017 Question __ (continued): (TURN OVER} 1 082621 OW 2017 APPENDIX (DOS INTERRUPT 20h - terminate program (DOSINTERRUPT 21h ‘AH Purpose Description 0 Terminate progam Terminates exeeution of mara 1 Keyboard put Wats Tor Keyboard anpat doplaye and retumeiw AL 2 Display owipar Displays the charaoierm DL on the Seen 3 Tony spat ‘Wa Tora characier Wom Tho comm ancaon® por aad pals Wan AL, 4 “RoeTiary omer ‘Galpors the charactor DL To the Communieaions por 5 Prater output ‘pas the character DL wo te peter 6 Keyboard apa ecionins both vaput and Sutput Tean alse dtermune The mp sates Screen output like the other ppt functions does not wat for an saput charactor Also noe tht the input charatiers not automaucally displayed and thatthe CU-Breakcosnuen! des not ertnate te operas AS Usual the Dl. segites contains the pa characte and the AL. rege receives the mput character You ask for mput by placing the valve FPR inthe DL regsicr On return fom the function the zcro flag is set no characters ready. the zero ag is clear xt meany a Character was read mothe AL register Ifthe DL eeiscecontamns any \lue other than FFA (iat chat ers seat 10 the anard outpat devce Also compare wih tuncuons 7 and & 7 ‘Keyboard mputao coho | Wass Fora character {om the keyboard and puis an AL “Tie characer ss no dsplayed on the sere 8 ‘Reybeard put no coho] Wan fora character fom the Keyboard returis Wim AL and Z enna when Ci Break ms pressed 9 Display ie We have sch Mat fueuons 2 and 6 can Usplay single Characters Bat Funct 94 auch easier to use fox more than one character” OF ‘coaise-non-deplayable characters (such as catage return, tne fed and Ese) can ato he incluged sn the sting To use this function you. place the sinng somewhen. 1m memory and terminate with adele sign The address of the strmg s placed n the DS DX reaisters Set AH register 199 and execute the INT 218 wssetion 0A Buiered Reprod Reals chareters from the Keyboard avo memory butler DS DX poins othe input blfor Ist byte = max number of ‘characters and 2nd byte = actual numberof characters caered ‘The sng 9 stone fen the dd ye onwards 0B Check eyo ‘Checks to ace Ha chorale avaiable From the Keyhoant Sets AL@FFh iva Status character 1s ead) Otherwise AL=0. 0C Tica pho ‘Ceas keyhoaud butfor and peifoens the INT 21h Keyboard input function ac "Fermanate pga ‘Reus cara 9 DOS INSTRUCTIONS (Note thatthe first operand jy always the destination operand ) ADD: ADD binary numbers Adds the source operand to the destination operand and stores the result un the destination opeiand Format. ADD operand operand? lags: OF, SF, ZF, AF, PF. CF AND: ANDS the busi tbe source and destination operands ‘The results stored in the destination Format: AND operandl,operand2. Flags: OF, SF_ZF AF=! Pk Cl (TURN OVER] CALL: Format cLe Format cmp. Format a coszea! QwNov 2017 CALL: a near or far procedure Deerements the SP (stack pointer) by 2 (or 4 fora fa call) H the procedure 1s NEAR (in the same segment) Pushes she current locauon (only the offset) of the ext imsiructzon onto the stack and transfers contiol tothe destination [Fthe procedure 1s FAR (in a different Seymnenty Pushes the current location (heh Segment and offset) of the MUX! tasteuc ton ante the shack and {ransters control (othe destination CALL operand Flags Nom. Cleat Curry Flag cLe Flags CF=0 CoMPares the contents of operandT and operand? Compares the destination tothe Source by doing an impliod subtraction ofthe source from the destination ‘The values ol the operands Jo not change CMP operand! operand? Flags OF. SF, ZF AF PF CF DB/DW/DD These operations are structions to the assembler DB pw bp DEC Format biv Format HLT Format: Format IMUL: Format INC Format: INT Format: Allocates one byte of storage Allocates two bytes ot storage Allocates four bytes of storage DECrement Subtracts | {rom a byte or word DECK, Flags. OF DEC mem AP PE DIVide unsigned Divides an unsigned (the leftmost but 1s treated as par ofthe data und not as a sign) dividend by an unsigned divisor If the divisor 1 8 buts the dividend 1s assumed to be in AX, the quoltent vs stored in AL and the remainder m AH Tl the divisor w 16 buts, the dividend 6 assumed to be aw DX AX. the ‘quotient ss stored in AX and the temainder in DX DIV res Flags: all undefined DIV mem HALT Stops the CPU unit a hardware wnterrupe oLcurs HLT Flags: None Integer (signed) DIVision Divides a signed dividend by a signed divisor Compare with DIV Dividend Drssor Quotient” Remamder operand) (operand) AX (16 buts) rey/mem (8 bus) AL AH DX AX (bus) rep/mem(I6 bus) AX. Dx IDIV reg Flags Ak CP OF PF SF ZF (all undefined) IDIV mem (We need only specity operand? as ether AX or AL 1s used as operand! by default) Integer (Signed) MULuplication Performs a signed sntoger multiplication on ether AL or 4X Compare with MUL Multiphcand Multiples Product operand) operand?) AL (8 bts) regémem (8 bus) AX AX (16 bitsy regémem(16 bis) _ DX AX IMUL, IMUL mem ‘We need only specity operand? as enher AX or AL 1s used ss epotandl by default) Flags OF CF, SF.ZF AF and PF (all undetined) INCrement Adds | 102 register oF memory position “The operation does not affect the carry flag Plags: OF, SF, ZF, AF, PF ANTertupt Generates « soloware interrupt, which in cure calls ¢ rouune yn BIOS or DOS INT ammed Flags TF, IF [TURN OVER) m 082621 ‘OeuNov 2017 JMP;__Uncondaroaal JuMP Jumps unconditionally oa label or memory positon Format. JMP operand Flags: None Conditional Jumps Jcondition Jumps wa specilic Nag condition 1s true JAINBE Jump sf Above or Jump af Not Below/Bqual JABUJNB Jump sf Abovelbqual or Jump if Not Below JB/INAE Jump tf Below or Jump if Not Above/Equal IBEAINA Jumps Below/Equat or Jump if Not Above Ic Sump af Carty EXZJECKA Jump st CX as Zato oF Wf ECX is Zevo SEAL Sump it Equal or Jump af Zeto JGIINLE Jump Greater or Jump sf Not Less/Equal GENE Jump! Greates/Equal or Jump 1! Not Lass SLINGE imp if Less. Jump at Not Greater/Fgual SLENG —— Jump if Lew/Equal or Jump if Net Greater INC ‘Tump sf No Carry JNEINZ Jump sf Not Equal or Jump sf Not Zero JNO ‘Jump sl No Overflow JNPPO Jump if No Panty or Jump if Panty Odd INS ‘ump if No Sign - jumps af an operation set the sign to postive Jo ‘Jump if an operation caused an Overflow SPAPE Jump on Panty or Jump if Panty Even as ‘Jump stan operation set the Sign to negative Format- Jump condmion short label Flags: None in all cases ‘lump_eondition mem LEA: — Load Effective Address Calculates and loads the 16-bit eflective address (oftset) of a memory position into register Format LFA reg men) Flags: Nooe LOOP: LOOP until complete Executes a routine a specified number of mes The CX register must be loaded wrth the eration count before the start ofthe loop Loop appears atthe end of the loop st decrements CX and causes a jump iF CX 1s not equal to zero If CX20, the next nsiruction aficr LOOP 1s executed Format’ LOOP short_label Flags: Non LOOPE/LOOPZ: LOOP while Equal or while Zeto These instructions are sumatar w LOOP except that they terminate if CX=O oF if the ZF flag 1s st t0 zero (Le a.aon-7er0 condition) LOOPNE/ LOOP wile Not Equal or loop while Not Zero Similar LOOP except thal they LOOPNZ — terminate sf CX=0 oF f the ZF flag is set to 1 (zero condition) MOV: —MOVe data Moves (actually copies) a byte or word from a source (operand?) to a destination. ‘operand (operand) Format: MOV operat, operand? Flags None MUL: —MULuply unsigned integers Muluphes AX or AL by a source operand of 16 oF 8 bytes respectively ln the tust case the product i stored 1m AX DX and in the second ease the product 1s stored in AX Multiplicand Multiplier Product (opurandt) (operand2) AX (16 bits) reg/mem (16 bits) DX AX AL (8 bis) regfroern (8 buts) AX Format: MUL reg Flags: Attccts CF and OF Ab, Pr. St and ZF are MUL mem undefined (We need only specily operand? ay ener AX or AL 1s used 3s uperandl by delaull ) NEG: NEGate NEG calculates the two's complement of a binary value Format: NEG operand Flags: OF, SF. ZF, AF PF CF NOP NOOPeration Do nothing (TURN OVER] w cosz621 QcuNov 2017 Format NOP Flags: None NOP Performs logical NOL on an operand Format NOT optane Flags: None OR. Performs aJogical OR on two operands “The result 1s stored sn operand I (the destination operand) Format: OR operand! operand? Flags: OF=0, CF=0 SF ZF and PE are allocied AF 6 undetined POP —POPs.a word from the sack into the operand Format: POP operand Flags. None PUSH. PUSH. 4 word ome the siach Format PUSH operand Flags None RCLIRCR: Rotate bits Left or Right through the Carry Nag RCL rotates (shits) the desunation operand tothe It a number of times as specitied by the source operand The carry lag 1s copred into the least significant bit and the most sigauficant bi 1s copied ante the carry flag wath each shitt. The CL. register oF 4 Constant may be used 10 Lonirol the numb ol rotations: CR rotates (shifts) the destination operand to the right a sumber of times as specified hy the source uperan The carry Mog is copred into the most sgeaficant but and the least sigeaficant bits copied into the eatry flag with cach shift. The CL. regisier oF a constant may be used to control the number of rolauons Format: RCLIRCR reg 1 RCLIRCR ment Flags. OF, CF RCURCRiegCL—— RCR/RCR mem,CL REPREPE/REPZ/ REPeat string Used as a pretix to MOYS/MOYSB/MOVSW/MOVSD/REPNI/REPNZ, operations taoted each tame the REP repeats « string operation + spucsfid number of umes CX ts used as «counter and as de Instruction 1s repeated The operation repeats untsl CX=0 REPE/REPZ repeats a string operation until CX=0 or ZP=0 REPNZIREPNE repeats sirimg operation until CX=0 or Zi Format REP/REPEIREPZ/IREPNE/REPNZ steing_operation Flags Depends on the associated string operalvon RETRETN/RETF RETum trom a procedure previously entered by a NEAR or FAR CALL NEAR RET/RETN ireturn near) pops the word at the top of the stack into IP and incremunts SP by 2 FAR RETVRETE pops the 2 words at the top of the stack snto IP and CS and increments SP by 4 An optional immediate 8_but operand (called a pop_salue) added to the SP Format RET Flags: None RET operand ROLIROR Rotate Lett or Right ROL rotates (shifts) the destination operand to the left a number of times as specified by the source operand. The lettinost (most significant) bres rotated ico the Teast sigmificant position The most significant bit also enaves into the carey flay foreach shift. The CL register ora constant may be used to contra} the number of rotations ROR routes (sfults) the destination operand to the night a number of umes as specatied by the source operand The rghtmost (est significant) bit rotates nto the mast signiticant position the leat significant bit alse Moves tthe catty flag for each shift The Cl. regiser or a constant may be used to contro the number of rotations Format ROLIROR reg,} ROL/ROR mm,1 Flags: OF CF ROLIROR reg,CL ROLIROR mem,CL SALISAR, —Shiit Aruhmett: Lett or Right ‘SAL shifts the destinavon operand (o the left number of umes as specitied hy the source operand Zero ¥s shifted mio the Teast sugnutiant but and the most sgeaficant bit is shifid into the carry Mag tor cach shal) ‘The CL register oF a venstant may be used as a source operand ‘SAR shafis the desunation operand 10 the night a number of times as specitied by the source cperand The most significant but retains ts previous value which means thatthe sign bits duplicated with each shift The least signficant bit is shifted tno the carry flog with each shill The CL register ora constant may be used as source operand Format: SALSAR r2g.t Flags: CF,OF PF.SF,ZF (AF undefined) SAUSAR mem, SALSAR reg CL (TURN OVER} v 6033262} OcvNov 2017 ‘SALISAR mem CL SSBB: SuBtract with Bovrow Subtracts the souice operand ftom the destination operand and then subiacts the value of CF from the destination SBB used in multuword subtraction to canry an overflowed 1 Bi. inio the next stage of anthmetic Format: SBBregreg SBB reg ummed SBB 1eg mem — SBE mem immed SBB memeg SB AL immed SBB AX immed Flags OF SF ZF AF PF CF SCASISCASB/SCASW. SCAn Sing. Scans a sting in memory potnted to by ES DI fox a value chat matches a value mn AL o AX Format: SCAS opctand SCASB (match wih ALY SCASES operand SCASW (match with AX) Flags OF SF ZF AF PF CF SHLISHR. — SHLt logical Lett or SHUtt logical Right SHL 1s denuical SAT ‘SHIR stuf bus to the night a specified number of wanes and fils the bis on the left with O'S ‘The CL register or a constant (for some assemblers the constant may only be a 1) may be used to control the number of shits Formats; SHLISHRegimmed — SHL/SHR reg CL. SHLISAR mem :mmed — SHL/SHR mem CL Flags OF, SF, ZF AF (undefined) PF CF STC, SeTCany flay Sets the CF 10 Format STC Flags: CP=1 STD SeT Direction Nag Sets the DF flag 10 1 This causes SI and/or DI to be decremented by string operations which 1 turn causes string operations fo process strings irom right io left Format STD Flags DP=1 STOSISTOSB/ Store suing STOSWISTOSD Stores eutber AL (byte) or AX (Word) 1n the memory position adéressed by ES DI. Dl s meremented tt DPa0 and DI is decremented DF=I (compare with STD) Format: STOS mem STOSB (stores AL) Flags. None STOS ES mem STOSW (stores AX) SUB+ — SUBuact Subtracis the source operand ftom the destination operand Format: SUB operandi operand? Flags: OF SF 2. AF PF CF TEST TEST bus Tests individual bits in the destinavon operand against those inthe source operand TEST performs ‘logical AND but the destination operand is not affected Format: TEST reg.ceg TEST regmem TEST mem tog TEST AX.immed Flags: OF=0 SF, ZF AF (undefined), PF CF=0 XCHG EXCHanGes operands Exchanges the contents of the two operands, Format: XCHG operand! operand2 Flags None XOR: —EXclusive OR. Pertorms a logical exclusive OR on the bus in two operands Format: XOR operandl,operand? Flags. OF <0 SF ZF AF (undefined) PF CF=0 ° UUNISA 2017

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy