Assembly Language. Operand Size. The internal registers. Computers operate on chunks of data composed of a particular number of bits.
|
|
- Melina Rich
- 6 years ago
- Views:
Transcription
1 1 2 Chapter 6 Assembly Language Operand Size 8 bits 16 bits Computers operate on chunks of data composed of a particular number of bits. The 68K has a 32-bit architecture and a 16-bit organization. Internal registers hold 32 bits Can perform operations on 32-bits Has a 16 bit external data bus - operands must be moved in and out of memory as two 16 bit words Some internal data paths are 16 bit. 68K can handle 16 bit and 8 bit values Byte-wide memory A 100C 100E Word -wide memory The 68K has a byte-addressable architecture Successive bytes are stored at consecutively numbered byte addresses Any byte can be individually written to or read from. 16-bit words are composed of 2 bytes and are stored at consecutive even addresses: 0,2,4, bit longwords are stored at addresses 0, 4, 8, C C 32 bits Longword-wide memory 3 4 When we store a 32 bit longword, where do the bytes go? Consider the example of storing $ into memory location $. The 68K would store it as : Where the most significant byte is at the lowest address. This order is called Big -Endian. If the bytes are stored in the opposite order, with the most significant byte at the highest address like: Where the least significant byteis at the lowest address, we call the order Little-Endian. When we encounter a command like MOVE.W DO,1234 The following bit copy is performed: In th 68K all addresses are 32 bit values This should allow for an address space of 2 32 bytes = 4 G of memory. Here 2 10 = K 2 20 =1,048,576 1M, 2 30 = 1,073,741,824 1 G However, the original design was for a 64 pin package which limited it somewhat. The address bits A 24-A 31 are not connected to pins and cannot access memory. This effectively forces the address bus to 24 bits and the original 68K can only access 2 24 = or 16 M of memory. The internal registers The 68K has a register-to -memory architecture. This means typical instructions will specify one operand in memory and the others as a register like: ADD $1234,D d 08 -d 15 d 00 -d 07 which causes the contents of location $1234 to be added to D The 68K consists of 8 32-bit data registers, 8 32-bit address registers, an 8 bit condition code register, an 8 bit status byte (used by operating system to define the operating mode of the 68K) and a 32-bit program counter.
2 5 6 The programmer's view of the 68K: d 16 d 15 d 00 d 31 d 08 d 07 D0 D1 D2 D3 D4 D5 D6 D7 a 31 a 16 a 15 a 00 A0 A1 A2 X N Z V C A3 A4 A5 A6 A7 PC CCR All of the data registers are general-purpose, commands which can be applied to D0 can be applied to any data register. We know one advantage of multiple data registers is to store frequently used data on chip for quicker access. The number of internal data registers is a function of economics. Most instructions store the op -code and operand register in a 16-bit word. It requires 3 bits to describe the 8 data registers. More registers would require more bits, leaving fewer bits dedicated to opcode and hence fewer instructions capable of being described in this length word. Memory requires a 32 bit specification. Instructions that access memory are longer than instructions that access registers. Most high level languages do not allow for the programmer to specify the use of registers for variable allocation this is the compilers job. ************************************************************ C is one of the exceptions: In C there is a storage class specifier called register. It can be applied to local variables and formal parameters in functions. The class specifier is intended to be used where many references will be made to the same variable. The register specifier originally applied only to variables of type int or char (and indeed the C standard permits the compiler to ignore the specifier the current standards state "access to the object be as fast as possible") 7 8 Some C code: int int_power(register int m, register int e) { register int temp; temp=1; for ( ; e ; e--) temp=temp*m; return temp; } Recall we specify operations as either byte, word or longword operations by appending the.b,.w or.l to the mnemonic. Each affects a certain sequence of bits of the operand:.b D 00 D 07.W D 00 - D 15 The remaining bits would remain unchanged. CLR.W D1 Would force the low 16 bits of D1 to 0's The number of actual register variables permitted depends on the environment and implementation of C. For the sake of portability if no registers are available the compiler w ill automatically transform register variables to non register variables, if needed. ********************************************************** When referring to the bits of a data register (for purposes of RTL) we will denote consecutive bits i to j in register Dn by Dn(i:j). If we wanted to refer to bits 16 through 31 of register D5 we would write D5(16,31) D1 XXXXXXXXXXXXXXXX Where X stands for whatever was already there. If [D1] = $ then after CLR.W D1 we have [D1] =$ Assembly form RTL form ADD.L D0,D1 [D1(0:31)] [D1(0:31)]+[D0(0:31)] ADD.W D0,D1 [D1(0:15)] [D1(0:15)]+[D0(0:15)] ADD.B D0,D1 [D1(0:7)] [D1(0:7)]+[D0(0:7)] We can omit the slice notation unless we are meaning to emphasize what bits we are working on.
3 9 10 The affect on the carry bit of the.b,.w or.l is determined only by the corresponding bits for that size operation. Consider the following example: [D0] = $ , [D1] = $ABCDEF98 In hexadecimal 68K Address Registers The 68K's eight 32-bit address registers A0 A7 act as pointer registers, since they hold the address of some memory location. This will be important wen dealing with arrays, matrices, tables and vectors ABCDEF98 BE EF A0 A6 are identical in the way they are treated. A7 has the additional responsibility of being a stack pointer for storing subroutine addresses. Assemble code Register D1 CCR carry bit C ADD.B D0,D1 [D1]=ABCDEF10 [C] = 1 ADD.W D0,D1 [D1]=ABCD4610 [C] = 1 ADD.L D0,D1 [D1]=BE [C] = 0 It is easy to make an error if we do not pay attention to using consistent size operations on data registers. Consider the following: MOVE.B XYZ,D0 Copy contents of location XYZ to D0 SUB.B #5,D0 Subtract 5 from D0 CMP.W #12,D0 IS D0 > 12 BGT Test Branch on Greater than Notice on the MOVE.B we are only changing bytes d 00 d 07. The same is true when we subtract 5 from D0. When we get to the third step, however we are comparing d 00 d 15 to the word representation of 12. The problem is we don't have any idea what is in d 08 d 15. We may or may not wind up with the desired result. Many of the operations we did with data registers can be done with address registers with a few differences: Operations on address registers do not normally affect the CCR's bits All operations on the address registers are longword operations (Ai's are treated as single entities. Any.W operation is automatically extended to a.l operation.b operations are not permitted The contents of an address are treated as a signed 2's complement value. Performing a.w operation causes the sign bit to be extended from A 15 to A 16 A 31. MOVE.W #$8022,A1 ( = ) has the effect [A1] $FFFF MOVE.W #$6121,A2 ( = ) has the effect [A2] $ Why do we allow for negative addresses? We can interpret a negative address as a move backwards. Example: Suppose A1 contains 1280 and A2 contains -40. Adding A1 and A2 results in a composite address 1240, 40 units in address lower than A1. The 68K has special mnemonics for operations that modify addresses. Some examples (destination operand is address register) ADDA.L D1,A3 ADDA = add to address register MOVEA.L D1,A2 MOVEA = move to address register SUBA.W D1,A3 SUBA=subtract from address register Using an address register to access a data element: A0 Contains address of the start of data structure A1 Will contain address of start of ith element D0 i MULU #12,D0 MOVEA.L A0,A1 ADDA.L D0,A1 12-byte data block item 0 12-byte data block item i 12-byte data block item 49 Calculate offset Copy base address to A1 Add offset to A1 Example: Address register A0 points to the beginning of a data structure in memory. The structure is made up of 50 items numbered 0 through 49. Each of the 50 items i s 12 bytes long. D0 contains the number of the item w wish to access. We wish to put the address of the item in A1. We will use the operation MULU #n,di which multiplies the 16-bit low order word in Di by n and puts a 32-bit product in Di As you can see the instruction set is rather primitive compared to high level languages. Any type of complex operation will be implemented by a sequence of primitive instructions.
4 13 14 An Introduction to the 68K instruction set Data Movement The largest set of instructions in most programs are for data movement. When we omit the.w,.l or.b qualifier we will assume a default of.w, where it makes sense. Two-operand instructions will have the format Operation source,destination Example: MOVE D3,D4 copies the contents of D3 into D4 Some 68K movement instructions Assembly RTL MOVE Di,Dj [Dj] [Di] MOVE P,Di [Di] [M(P)] MOVE Di,P [M(P)] [Di] EXG Di,Dj [TEMP] [Di], [Di] [Dj], [Dj] [TEMP] SWAP Di [Di(0:15)] [Di(16:31)], [Di(16:31)] [Di(0:15)] LEA P,Ai [Ai] P LEA Load Effective Address In the next example we will demonstrate these instructions using our assembler: Create a text file: samp.x68 ORG $ MOVE.L #$ ,D0 MOVE.B D0,D1 MOVE.W D0,D2 MOVE.L D0,D3 EXG D0,A0 SWAP D3 MOVEA.L data,a1 LEA data,a1 STOP #$2700 DATA DC.L $ABCDDCBA END $ From the DOS prompt type (and see the respone): C:\WINDOWS\Desktop\assem\68Ksim>x68k samp -L [X68K PC-2.2 Copyright (c) University of Teesside 1989,99] No errors reported. Two Files should have been created in your directory : Samp.bin, Samp.lis First we will look at Samp.lis to see what the assembler did Samp.lis (you should be able to open this with any text editor) Source file: SAMP.X68 Assembled on: at: 07:01:50 by: X68K PC-2.2 Copyright (c) University of Teesside 1989,99 Defaults: ORG $0/FORMAT/OPT A,BRL,CEX,CL,FRL,MC,MD,NOMEX,NOPCO ORG $ C MOVE.L #$ ,D MOVE.B D0,D MOVE.W D0,D A 2600 MOVE.L D0,D C C188 EXG D0,A E 4843 SWAP D MOVEA.L DATA,A F LEA DATA,A C 4E STOP #$ ABCDDCBA DATA: DC.L $ABCDDCBA END $ Lines: 12, Errors: 0, Warnings: 0. Next we will use the simulator to run our assembled code: C:\WINDOWS\Desktop\assem\68Ksim>e68k samp [E68K PC-2.2i Copyright (c) University of Teesside 1989,99] Address space 0 to ^ (10240 kbytes). Loading binary file "SAMP.BIN". Start address: 00, Low: 0000, High: At this point we will create a log of our interaction with the simulator at the '>' prompt type : log fun.log > log fun.log I will step through the program, and when done show y'all the Log file. (remember typing "quit" at the simulators prompt will quit the simulator, df display formatted registers and tr- trace, to exit trace mode type a '.') Logging to "FUN.LOG" started. >df PC=00 SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >MOVE.L #$ ,D0 >tr PC= SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >MOVE.B D0,D1 PC= SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >MOVE.W D0,D2 PC=00100A SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >MOVE.L D0,D3 PC=00100C SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >EXG D0,A0 PC=00100E SR=2000 SS=00A00000 US= X=0 A0= A1= A2= A3= N=0 D0= D1= D2= D3= V= >SWAP D3
5 17 18 PC= SR=2000 SS=00A00000 US= X=0 A0= A1= A2= A3= N= >MOVEA.L $1020,A1 PC= SR=2000 SS=00A00000 US= X=0 A0= A1=ABCDDCBA A2= A3= N= >LEA.L $1020,A1 PC=00101C SR=2000 SS=00A00000 US= X=0 A0= A1= A2= A3= N= >STOP #$2700 Processor halted at: PC= SR=2700 SS=00A00000 US= X=0 A0= A1= A2= A3= N= >DC.W $ABCD Returning to command-mode after "OPCODE 1010 EMULATION" exception. Arithmetic and Logical operations Asembly Form RTL ADD Di,Dj [Dj] [Di] + [Dj] ADDX Di,Dj [Dj] [Di] + [Dj] + [X] SUB Di,Dj [Dj] [Di] - [Dj] SUBX Di,Dj [Dj] [Di] + [Dj] - [X] MULU Di,Dj [Dj(0:31)] [Di(0:15)] [Dj(0:15)] DIVU Di,Dj [Dj(0:15)] [Dj(0:31)]/ [Di(0:15)] integer part [Dj(16:31)] remainder NEG Di [Di] 0 [Di] NEGX Di [Di] 0 - [Di] [X] AND Di,Dj [Dj] [Di] [Dj] OR Di,Dj [Dj] [Di]+[Dj] EOR Di,Dj [Dj] [Di] [Dj] NOT Dj [ Dj] [ Dj] >quit Here [X] is the contents of the X bit of the CCR (usually a copy of the carry bit) The multiplication and division are specific with regards to what they operate on. The other operations can be designated.b,.l or.w MULU Di,Dj [Dj(0:31)] [Di(0:15)] [Dj(0:15)] Multiplies two 16 bit operands and stores as 32 bit result Suppose D0 = $1234 and D1=$0202 Then MULU D0,D1 leaves $00248C68 in D1 DIVU Di,Dj [Dj(0:15)] [Dj(0:31)]/ [Di(0:15)] integer part [Dj(16:31)] remainder Divides a 32 bit operand by a 16 bit operand and stores as a 32 bit result with the low 16 bits being the quotient and the high 16 bits the remainder. Suppose D1 = $ = and D0=$4 Then DIVU D0,D1 leaves $ C in D1 (8497/4 = 2124 R 1, and =84C 16) Another point: Computers execute instructions even if the instructions don't make sense. Higher level languages are often strongly typed and would prevent the programmer from doing such things. Consider the following assembly language program that adds the ASCII representation for character 'A' to that of character 'B' The code: ORG $ MOVE.B Char1,D0 MOVE.B Char2,D1 ADD.B D0,D1 STOP #$2700 Char1 DC.B 'A' Char2 DC.B 'B' END $ The.lis file after assembled: Source file: SAMP.X68 Assembled on: at: 09:54:45 by: X68K PC-2.2 Copyright (c) University of Teesside 1989,99 Defaults: ORG $0/FORMAT/OPT A,BRL,CEX,CL,FRL,MC,MD,NOMEX,NOPCO ORG $ MOVE.B CHAR1,D MOVE.B CHAR2,D C D200 ADD.B D0,D E 4E STOP #$ CHAR1: DC.B 'A' CHAR2: DC.B 'B' END $ Lines: 9, Errors: 0, Warnings: 0. The Log file for a run: Logging to "FUN.LOG" started. >df PC=00 SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >MOVE.B $1012,D0 >tr PC= SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >MOVE.B $1013,D1
6 21 22 PC=00100C SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >ADD.B D0,D1 PC=00100E SR=200A SS=00A00000 US= X=0 A0= A1= A2= A3= N=1 D0= D1= D2= D3= V= >STOP #$2700 Processor halted at: PC= SR=2700 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >DC.W $4142 quit What is the meaning of what is in D1? 2 2 X + Y Here is a program to calculate Z = X Y For X=50, Y= Answer should be : Or = 69 R 22 The assembly code: ORG $ X DC.W 50 ;value for x Y DC.W 12 ;value for y Z DS.W 1 ;create space for result ORG $1200 MOVE.W X,D0 ;Copy X to D0 MULU D0,D0 ;square X MOVE.W Y,D1 ;Copy Y to D1 MULU D1,D1 ;square Y ADD.L D0,D1 ; X^2 +Y^2 into D1 MOVE.W X,D0 ;Copy X to D0 SUB.W Y,D0 ; X-Y in D0 DIVU D0,D1 ;put(x^2+y^2)/(x-y)into D0 MOVE.W D1,Z ;Put result out to memory Z STOP #$2700 END $1200 ;End with address entry point The assembled code : Source file: SAMP.X68 Assembled on: at: 14:16:33 by: X68K PC-2.2 Copyright (c) University of Teesside 1989,99 Defaults: ORG $0/FORMAT/OPT A,BRL,CEX,CL,FRL,MC,MD,NOMEX,NOPCO ORG $ X: DC.W C Y: DC.W Z: DS.W ORG $ MOVE.W X,D C0C0 MULU D0,D MOVE.W Y,D A C2C1 MULU D1,D C D280 ADD.L D0,D E 3038 MOVE.W X,D SUB.W Y,D C0 DIVU D0,D C11004 MOVE.W D1,Z C 4E STOP #$ END $1200 Lines: 16, Errors: 0, Warnings: The log file (with comment) Logging to "FUN.LOG" started. >df PC= SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >MOVE.W $,D0 >tr PC= SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >MULU.W D0,D = PC= SR=2000 SS=00A00000 US= X=0 D0=000009C4 D1= D2= D3= V= >MOVE.W $1002,D = =9C4 16 PC=00120A SR=2000 SS=00A00000 US= X=0 D0=000009C4 D1= C D2= D3= V= >MULU.W D1,D =C 16 PC=00120C SR=2000 SS=00A00000 US= X=0 D0=000009C4 D1= D2= D3= V= >ADD.L D0,D = =90 16 PC=00120E SR=2000 SS=00A00000 US= X=0 D0=000009C4 D1=00000A54 D2= D3= V= >MOVE.W $,D = =A54 16 PC= SR=2000 SS=00A00000 US= X=0 D0= D1=00000A54 D2= D3= V= >SUB.W $1002,D0 Copied into D0 PC= SR=2000 SS=00A00000 US= X=0 D0= D1=00000A54 D2= D3= V= >DIVU.W D0,D1 Subtracted from and put in D0, D0=38 10 = PC= SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >MOVE.W D1,$1004 A54 16 = / = R = R 16 16
7 25 PC=00121C SR=2000 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >STOP #$2700 Processor halted at: PC= SR=2700 SS=00A00000 US= X=0 D0= D1= D2= D3= V= >ORI.B #$00,D0 MD - Memory Display command MD C q >quit
Multiplies the word length <ea> times the least significant word in Dn. The result is a long word.
MATHEMATICAL INSTRUCTIONS Multiply unsigned MULU ,dn Action Notes: Example: Multiplies the word length times the least significant word in Dn. The result is a long word. 1. The lowest word of
More informationModule 7: Address Registers & Array Processing
Module 7: Address Registers & Array Processing Special instructions for address registers CMPA, MOVEA, SUBA, ADDA LEA Understanding arrays Array applications 2006 munim@utm.my,athif@fke.utm.my,kamal@bip.utm.my
More information68000 Architecture, Data Types and Addressing Modes. 9/20/6 Lecture 2 - Prog Model 1
68000 Architecture, Data Types and Addressing Modes 9/20/6 Lecture 2 - Prog Model 1 Lecture Overview Assembler Language Programmers Model Registers Addressing Modes 9/20/6 Lecture 2 - Prog Model 2 Assembler
More information68000 Instruction Set (2) 9/20/6 Lecture 3 - Instruction Set - Al 1
68000 Instruction Set (2) 9/20/6 Lecture 3 - Instruction Set - Al 1 Lecture Overview The 68000 Instruction Set continued The understand and effectively use an architecture must understand the register
More information... Executing conditional instructions
1 2 Executing conditional instructions Our design to this point has been the SISD (single instruction single data) architecture This is fine if we wish to execute in a purely sequential mode We now wish
More informationTutorial 1 Microcomputer Fundamentals
Tutorial 1 Microcomputer Fundamentals Question 1 What do these acronyms mean? (a) CPU? (b) ROM? (c) EPROM? (d) RWM? (e) RAM? (f) I/O? What role does the CPU play in a computer system? Why is ROM an essential
More informationAddressing Modes. To review data transfer instructions and applying the more advanced addressing modes.
Addressing Modes Aims To review 68000 data transfer instructions and applying the more advanced addressing modes. Intended Learning Outcomes At the end of this module, students t should be able to Review
More informationPhysics 116B Winter 2006: Problem Assignment 8
Physics 116B Winter 2006: Problem Assignment 8 Due Wednesday, March 15 1. You may use a calculator for the following: (a) Convert to decimal: $9F03. (b) Express in binary: $3CFA. (c) Convert to hexadecimal:
More informationLab Cover Page. Lab Date and Time: Teaching Assistant to whom you are submitting
Student Information First Name School of Computer Science Faculty of Engineering and Computer Science Last Name Student ID Number Lab Cover Page Please complete all fields: Course Name: Structure and Application
More informationCPE/EE 421 Microcomputers
CPE/EE 421 Microcomputers Instructor: Dr Aleksandar Milenkovic Lecture Note S07 Outline Stack and Local Variables C Programs 68K Examples Performance *Material used is in part developed by Dr. D. Raskovic
More informationSection 1--Computer architecture: organization of the cpu and memory, address and data bus, fetch-execute cycle
Here are some sample exams and questions that you can study for your first exam. These are actual problems that have been used on old exams. I have tried to eliminate all the problems of types which will
More informationMachine Language and Assembly Language
Machine Language and Assembly Language In the following lectures, we will learn: How instructions are represented and decoded Introduction to different types of Addressing Modes Most commonly used assembly
More informationSEE 3223 Microprocessors. 4: Addressing Modes. Muhammad Mun im Ahmad Zabidi
SEE 3223 Microprocessors 4: Addressing Modes Muhammad Mun im Ahmad Zabidi (munim@utm.my) Addressing Modes Aims To review 68000 data transfer instruchons and applying the more advanced addressing modes.
More informationAlex Milenkovich 1. CPE/EE 421 Microcomputers: Motorola 68000: Architecture & Assembly Programming. Outline
Outline CPE/EE 421 Microcomputers: Motorola 68000: Architecture & Assembly Programming Instructor: Dr Aleksandar Milenkovic Lecture Notes Programmer s Model Assembly Language Directives Addressing Modes
More information68000 Assembler by Paul McKee. User's Manual
Contents 68000 Assembler by Paul McKee User's Manual 1 Introduction 2 2 Source Code Format 2 2.1 Source Line Format............................... 2 2.1.1 Label Field............................... 2 2.1.2
More information68000 Architecture. To review the the architecture of the microprocessor.
68000 Architecture Aims To review the the architecture of the 68000 microprocessor. Intended Learning Outcomes At the end of this module, students should be able to: Briefly explain the history of microprocessor
More informationEECE416 :Microcomputer Fundamentals and Design Instruction Sets and Groups
EECE416 :Microcomputer Fundamentals and Design 68000 Instruction Sets and Groups 1 Instruction Groups Data Transfer Groups Arithmetic Group Logical Group Shift and Rotate Group Bit Manipulation Group Binary
More informationComputer Architecture 5.1. Computer Architecture. 5.2 Vector Address: Interrupt sources (IS) such as I/O, Timer 5.3. Computer Architecture
License: http://creativecommons.org/licenses/by-nc-nd/3./ Hardware interrupt: 5. If in an eternal device (for eample I/O interface) a predefined event occurs this device issues an interrupt request to
More informationMark Redekopp, All rights reserved. EE 357 Unit 4b. CF Assembly Basics
EE 357 Unit 4b CF Assembly Basics OPERATIONS AND INSTRUCTIONS Coldfire Instruction Classes Data Transfer Move data between processor & memory Move data between registers w/in processor Can specify.b,.w,.l
More informationCPE/EE 421 Microcomputers
CPE/EE 421 Microcomputers Instructor: Dr Aleksandar Milenkovic Lecture Note S06 *Material used is in part developed by Dr. D. Raskovic and Dr. E. Jovanov CPE/EE 421/521 Microcomputers 1 Course Administration
More informationINTRODUCTION TO BRANCHING. There are two forms of unconditional branching in the MC68000.
INTRODUCTION TO BRANCHING UNCONDITIONAL BRANCHING There are two forms of unconditional branching in the MC68000. BRA instruction BRA Program control passes directly to the instruction located at
More informationCPE/EE 421 Microcomputers
CPE/EE 421 Microcomputers Instructor: Dr Aleksandar Milenkovic Lecture Note S04 *Material used is in part developed by Dr. D. Raskovic and Dr. E. Jovanov CPE/EE 421/521 Microcomputers 1 The 68000 Family
More informationAlex Milenkovich 1. CPE/EE 421 Microcomputers: Motorola 68000: Assembly Language and C. Outline
Outline CPE/EE 421 Microcomputers: Motorola 68: Assembly Language and C Instructor: Dr Aleksandar Milenkovic Lecture Notes ACIA Example: Pseudo-code + Assembly Passing parameters In registers Passing by
More informationCS401 - Computer Architecture and Assembly Language Programming Glossary By
CS401 - Computer Architecture and Assembly Language Programming Glossary By absolute address : A virtual (not physical) address within the process address space that is computed as an absolute number.
More informationstack frame where register An is used as the argument pointer.
STACK FRAMES The MC68000 provides two special instructions to allocate and deallocate a data structure called a frame in the stack to make subroutines easier to code. general structure of a frame: SP local
More informationLecture 5 Assembly Programming: Arithmetic
CPE 390: Microprocessor Systems Spring 2018 Lecture 5 Assembly Programming: Arithmetic Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030
More informationPART II: Cap. 6 - Linguaggio macchina M68000
192 CHAPTER 3 ARM, MOTOROLA, AND INTEL INSTRUCTION SETS 3.20 Rewrite the byte-sorting program in Figure 3.15b as a subroutine that sorts a list of 32-bit positive integers. The calling program should pass
More informationLab Reports. Program Description (separate page - ONLY IF REQUIRED)
Lab Reports Reports should be in neat, concise form and turned in on time. The best reports will cover all vital information in detail without excessive verbiage on unnecessary details. Your report will
More informationRui Wang, Assistant professor Dept. of Information and Communication Tongji University.
Instructions: ti Language of the Computer Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Computer Hierarchy Levels Language understood
More information17. Instruction Sets: Characteristics and Functions
17. Instruction Sets: Characteristics and Functions Chapter 12 Spring 2016 CS430 - Computer Architecture 1 Introduction Section 12.1, 12.2, and 12.3 pp. 406-418 Computer Designer: Machine instruction set
More informationProgram Development. Chapter 5
Chapter 5 Program Development Expected Outcomes Distinguish between various codes in the programming language Explain the role of assembler and compiler Distinguish between different data types Use directive
More informationINTRODUCTION TO BRANCHING
INTRODUCTION TO BRANCHING UNCONDITIONAL BRANCHING There are two forms of unconditional branching in the MC68000. BRA instruction BRA Program control passes directly to the instruction located at
More informationLab 2 Use Traps. Lab 2 Input and Output 2 nd Semester. Lab 2 English. Lab 2 Pseudocode
Lab 2 Input and Output Lab 2 Use Traps Write (i.e. design and implement) an assembly language program that will accept user input from the keyboard and echo this to the terminal screen. Input should terminate
More informationInterfacing Compiler and Hardware. Computer Systems Architecture. Processor Types And Instruction Sets. What Instructions Should A Processor Offer?
Interfacing Compiler and Hardware Computer Systems Architecture FORTRAN 90 program C++ program Processor Types And Sets FORTRAN 90 Compiler C++ Compiler set level Hardware 1 2 What s Should A Processor
More informationChapter 2 Instruction Set Architecture
Chapter 2 Instruction Set Architecture Course Outcome (CO) - CO2 Describe the architecture and organization of computer systems Program Outcome (PO) PO1 Apply knowledge of mathematics, science and engineering
More informationChapter 7 Central Processor Unit (S08CPUV2)
Chapter 7 Central Processor Unit (S08CPUV2) 7.1 Introduction This section provides summary information about the registers, addressing modes, and instruction set of the CPU of the HCS08 Family. For a more
More informationSISTEMI EMBEDDED. Basic Concepts about Computers. Federico Baronti Last version:
SISTEMI EMBEDDED Basic Concepts about Computers Federico Baronti Last version: 20170307 Embedded System Block Diagram Embedded Computer Embedded System Input Memory Output Sensor Sensor Sensor SENSOR CONDITIONING
More informationENE 334 Microprocessors
Page 1 ENE 334 Microprocessors Lecture 10: MCS-51: Logical and Arithmetic : Dejwoot KHAWPARISUTH http://webstaff.kmutt.ac.th/~dejwoot.kha/ ENE 334 MCS-51 Logical & Arithmetic Page 2 Logical: Objectives
More informationTrap Vector Table. Interrupt Vector Table. Operating System and Supervisor Stack. Available for User Programs. Device Register Addresses
Chapter 1 The LC-3b ISA 1.1 Overview The Instruction Set Architecture (ISA) of the LC-3b is defined as follows: Memory address space 16 bits, corresponding to 2 16 locations, each containing one byte (8
More information1. bit manipulation instructions such as BTST, BCHG
1. bit manipulation instructions such as BTST, BCHG 9. (Exam #2, 1990) If ($53EFE)=$ 0A ($5FFFE)=$ 00 ($53EFF)=$ EE ($5FFFF)=$ 00 ($53F00)=$ FF ($60000)=$ 00 ($53F01)=$ 00 ($60001)=$ 00 ($53F02)=$ 12 ($60002)=$
More informationARM Assembly Language. Programming
Outline: ARM Assembly Language the ARM instruction set writing simple programs examples Programming hands-on: writing simple ARM assembly programs 2005 PEVE IT Unit ARM System Design ARM assembly language
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 informationStudent # (In case pages get detached) The Edward S. Rogers Sr. Department of Electrical and Computer Engineering
ECE 243S - Computer Organization The Edward S. Rogers Sr. Department of Electrical and Computer Engineering Mid-term Examination, March 2005 Name Student # Please circle your lecture section for exam return
More informationPractical Malware Analysis
Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the
More informationH8/300L Series Programming Manual
H8/300L Series Programming Manual Notice When using this document, keep the following in mind: 1. This document may, wholly or partially, be subject to change without notice. 2. All rights are reserved:
More informationWednesday, September 13, Chapter 4
Wednesday, September 13, 2017 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/9 Features of the system Operational cycle Program trace Categories of
More informationMC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes. Summary of HCS12 addressing modes ADDRESSING MODES
MC9S12 Assembler Directives A Summary of MC9S12 Instructions Disassembly of MC9S12 op codes o Review of Addressing Modes o Which branch instruction to use (signed vs unsigned) o Using X and Y registers
More informationInstruction Sets: Characteristics and Functions
Instruction Sets: Characteristics and Functions Chapter 10 Lesson 15 Slide 1/22 Machine instruction set Computer designer: The machine instruction set provides the functional requirements for the CPU.
More informationWednesday, February 4, Chapter 4
Wednesday, February 4, 2015 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/8 Features of the system Operational cycle Program trace Categories of
More informationEE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University
EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1 Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University What is Assembly Language? Assembly language is a programming language
More informationCSC 220: Computer Organization Unit 12 CPU programming
College of Computer and Information Sciences Department of Computer Science CSC 220: Computer Organization Unit 12 CPU programming 1 Instruction set architectures Last time we built a simple, but complete,
More informationMenu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my...
Menu Computer Organization Programming Model for the an example microprocessors (the G-CPU & Motorola 68HC11) Assembly Programming Look into my... See examples on web: DirAddr.asm, ExtAddr.asm, IndAddr.asm,
More informationLECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz
LECTURE #21: G-CPU & Assembly Code EEL 3701: Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz G-CPU Important Notes (see Schwartz s lecture for a general overview) - The
More informationSubroutines. passing data
Subroutines passing data Mechanisms: pass by value pass by result pass by value result/ value return/ copy restore pass by reference pass by name pass by lazy evaluation Techniques: 1. in registers 2.
More informationLevels of Programming. Registers
Levels of Programming COSC 2021: Computer Organization Instructor: Dr. Amir Asif Department of Computer Science York University Handout # 3: MIPS Instruction Set I Topics: 1. Arithmetic Instructions 2.
More informationCPE300: Digital System Architecture and Design
CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10032011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Chapter 3 Number Systems Fixed Point
More informationME4447/6405. Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics. Instructor: Professor Charles Ume LECTURE 7
ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics Instructor: Professor Charles Ume LECTURE 7 Reading Assignments Reading assignments for this week and next
More informationUNIMPLEMENTED INSTRUCTIONS
UNIMPLEMENTED INSTRUCTIONS OVERVIEW: This Programming Assignment will take the sine computation program you wrote for Programming Assignment #4 and implement it as a 68000 assembly language instruction.
More informationappendix a The LC-3 ISA A.1 Overview
A.1 Overview The Instruction Set Architecture (ISA) of the LC-3 is defined as follows: Memory address space 16 bits, corresponding to 2 16 locations, each containing one word (16 bits). Addresses are numbered
More informationEC 413 Computer Organization
EC 413 Computer Organization Review I Prof. Michel A. Kinsy Computing: The Art of Abstraction Application Algorithm Programming Language Operating System/Virtual Machine Instruction Set Architecture (ISA)
More informationComputer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2
Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up
More informationAssembly Language. Instructor: Dmitri A. Gusev. Spring Lecture 10, February 27, CSC : Introduction to Computer Science
Assembly Language Instructor: Dmitri A. Gusev Spring 2007 CSC 120.02: Introduction to Computer Science Lecture 10, February 27, 2007 Basic Definitions Assembly language is a low-level programming language
More informationECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION
ECOM 2325 Computer Organization and Assembly Language Instructor: Ruba A.Salamah INTRODUCTION Overview Welcome to ECOM 2325 Assembly-, Machine-, and High-Level Languages Assembly Language Programming Tools
More information2010 Summer Answers [OS I]
CS2503 A-Z Accumulator o Register where CPU stores intermediate arithmetic results. o Speeds up process by not having to store these results in main memory. Addition o Carried out by the ALU. o ADD AX,
More informationCSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1
CSIS1120A 10. Instruction Set & Addressing Mode CSIS1120A 10. Instruction Set & Addressing Mode 1 Elements of a Machine Instruction Operation Code specifies the operation to be performed, e.g. ADD, SUB
More informationAssembly Assignment 6 - Lottery
Assembly Assignment 6 - Lottery Valdemar Örn Erlingsson Pseudo-Code Again, I write in a language I know very well, C++. Writing real code lets me test all functionality before I start. #include
More informationCOMPUTER ORGANIZATION & ARCHITECTURE
COMPUTER ORGANIZATION & ARCHITECTURE Instructions Sets Architecture Lesson 5a 1 What are Instruction Sets The complete collection of instructions that are understood by a CPU Can be considered as a functional
More information1. Introduction to Assembly Language
www.vchowk.com 1. Introduction to Assembly Language Solved EXERCISE 1 Note: Dear fellows I tried my best to solve this exercise questions if there s any mistake or doubt in any question correct it and
More informationMachine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine
Machine Language Instructions Introduction Instructions Words of a language understood by machine Instruction set Vocabulary of the machine Current goal: to relate a high level language to instruction
More informationToday s objective: introduction to really simple subroutines to simplify program structure for I/O
a 1 st look procedures and functions in high level languages are modeled on subroutines typically, assembly code is very modular with the main routine less than 100 lines long Today s objective: introduction
More informationAssembler Directives and Programming
Assembler Syntax EE 357 Unit 5 Assembler Directives and Programming g An assembler takes a source code file and builds a memory image (binary) executable file Specifies the location in memory (either relative
More informationStored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands
Stored Program Concept nstructions: nstructions are bits Programs are stored in memory to be read or written just like data Processor Memory memory for data, programs, compilers, editors, etc. Fetch &
More informationCSCI 402: Computer Architectures. Instructions: Language of the Computer (1) Fengguang Song Department of Computer & Information Science IUPUI
To study Chapter 2: CSCI 402: Computer Architectures Instructions: Language of the Computer (1) Fengguang Song Department of Computer & Information Science IUPUI Contents 2.1-2.3 Introduction to what is
More informationECE 154A Introduction to. Fall 2012
ECE 154A Introduction to Computer Architecture Fall 2012 Dmitri Strukov Lecture 4: Arithmetic and Data Transfer Instructions Agenda Review of last lecture Logic and shift instructions Load/store instructionsi
More informationWe can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...
COMPUTER ARCHITECTURE II: MICROPROCESSOR PROGRAMMING We can study computer architectures by starting with the basic building blocks Transistors and logic gates To build more complex circuits Adders, decoders,
More informationProcessor design - MIPS
EASY Processor design - MIPS Q.1 What happens when a register is loaded? 1. The bits of the register are set to all ones. 2. The bit pattern in the register is copied to a location in memory. 3. A bit
More informationChapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance
Chapter 1 Computer Abstractions and Technology Lesson 3: Understanding Performance Manufacturing ICs 1.7 Real Stuff: The AMD Opteron X4 Yield: proportion of working dies per wafer Chapter 1 Computer Abstractions
More informationAssembly Programming
Designing Computer Systems Assembly Programming 08:34:48 PM 23 August 2016 AP-1 Scott & Linda Wills Designing Computer Systems Assembly Programming In the early days of computers, assembly programming
More informationTopics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation
Computer Organization CS 231-01 Data Representation Dr. William H. Robinson November 12, 2004 Topics Power tends to corrupt; absolute power corrupts absolutely. Lord Acton British historian, late 19 th
More informationLAB 1: MC68000 CPU PROGRAMMING DATA TRANSFER INSTRUCTIONS
LAB 1: MC68000 CPU PROGRAMMING DATA TRANSFER INSTRUCTIONS OBJECTIVES At the end of the laboratory works, you should be able to write simple assembly language programs for the MC68000 CPU using data transfer
More informationCPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)
CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA) Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka Objective Introduce MSP430 Instruction Set Architecture (Class of ISA,
More informationContents. Slide Set 1. About these slides. Outline of Slide Set 1. Typographical conventions: Italics. Typographical conventions. About these slides
Slide Set 1 for ENCM 369 Winter 2014 Lecture Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Winter Term, 2014 ENCM 369 W14 Section
More informationInstruction Set II. COMP 212 Computer Organization & Architecture. COMP 212 Fall Lecture 7. Instruction Set. Quiz. What is an Instruction Set?
COMP 212 Computer Organization & Architecture Quiz COMP 212 Fall 2008 Lecture 7 Fill in your student number only, do NOT write down your name Open book, but NO calculator, NO discussions, Relax and have
More informationA complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.
1.3a Expressions Expressions An Expression is a sequence of operands and operators that reduces to a single value. An operator is a syntactical token that requires an action be taken An operand is an object
More informationChapter 4. MARIE: An Introduction to a Simple Computer
Chapter 4 MARIE: An Introduction to a Simple Computer Chapter 4 Objectives Learn the components common to every modern computer system. Be able to explain how each component contributes to program execution.
More informationAssembly Language Programming
Experiment 3 Assembly Language Programming Every computer, no matter how simple or complex, has a microprocessor that manages the computer s arithmetical, logical and control activities. A computer program
More informationELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)
ELEC 5200-001/6200-001 Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2) Victor P. Nelson, Professor & Asst. Chair Vishwani D. Agrawal, James J. Danaher Professor Department
More informationOverview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2)
Introduction to the MIPS ISA Overview Remember that the machine only understands very basic instructions (machine instructions) It is the compiler s job to translate your high-level (e.g. C program) into
More informationThe CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:
The CPU and Memory How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram: 1 Registers A register is a permanent storage location within
More information2.2 THE MARIE Instruction Set Architecture
2.2 THE MARIE Instruction Set Architecture MARIE has a very simple, yet powerful, instruction set. The instruction set architecture (ISA) of a machine specifies the instructions that the computer can perform
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 information19 Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd
19 Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd Will you walk a little faster? said a whiting to a snail, There s a porpoise close behind us, and he s treading
More informationMark Redekopp, All rights reserved. EE 357 Unit 5. Assembler Directives and Programming
EE 357 Unit 5 Assembler Directives and Programming Assembler Syntax An assembler takes a source code file and builds a memory image (binary) executable file Specifies the location in memory (either relative
More information3/21/2009. Lecture 15: Data Structure & Parameter Passing. Define Constants with EQU. Define Variables with DC and DS. Define Variables with DC and DS
Define Constants with EQU Lecture 15: Data Structure & arameter assing v The EQU directive is exactly like having a #define in C. It allows the programmer to specify a string that will take the place of
More informationChapter 2A Instructions: Language of the Computer
Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction
More informationCSEE 3827: Fundamentals of Computer Systems
CSEE 3827: Fundamentals of Computer Systems Lecture 15 April 1, 2009 martha@cs.columbia.edu and the rest of the semester Source code (e.g., *.java, *.c) (software) Compiler MIPS instruction set architecture
More informationChapter 1 Microprocessor architecture ECE 3120 Dr. Mohamed Mahmoud http://iweb.tntech.edu/mmahmoud/ mmahmoud@tntech.edu Outline 1.1 Computer hardware organization 1.1.1 Number System 1.1.2 Computer hardware
More informationRecursive Subroutine Calls Example
The purpose of this example is to examine how all parameters, local variables, return addresses, and frame pointers are stored on the stack when a main program calls a procedure "Process" as well as when
More informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
More informationSparse Notes on an MIPS Processor s Architecture and its Assembly Language
Sparse Notes on an MIPS Processor s Architecture and its Assembly Language February 6, 2004 1 Introduction In this notes we are not going in details with the architecture of an MIPS processor, but only
More information