Lab 1 – Assembly Language and Interfacing Start date: Week 3 Due date: Week 4 1.

Slides:



Advertisements
Similar presentations
EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions  Read Almy, Chapters 5 and 6.  Homework #3 and Lab #3 due next week.  Quiz next.
Advertisements

Code Composer Department of Electrical and Computer Engineering
Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.
The 8051 Microcontroller and Embedded Systems
Programming 68HC11.
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
EE 362 Microprocessor Systems and Interfacing © 1-1 Lecture 1: Introduction to Microprocessor Based Systems Microprocessor Architecture Microprocessor.
Assembly 01. Outline Binary vs. Text Files Compiler vs. Assembler Mnemonic Assembly Process Development Process Debugging Example 1 this analogy will.
Lab6 – Debug Assembly Language Lab
The 68HC11 Microcontroller Minnesota State University, Mankato
H. Huang Transparency No.1-1 The 68HC11 Microcontroller Chapter 1: Introduction to 68HC11 The 68HC11 Microcontroller.
Chapter 3 Assembly Language: Part 1. Machine language program (in hex notation) from Chapter 2.
1 Lab Session-IV CSIT-120 Spring 2001 Lab 3 Revision and Exercises Rev: Precedence Rules Lab Exercise 4-A Machine Language Programming The “Micro” Machine.
Programming and Problem Solving
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Chapter 4 H1 Assembly Language: Part 2. Direct instruction Contains the absolute address of the memory location it accesses. ld instruction:
8051 ASSEMBLY LANGUAGE PROGRAMMING
EET 2261 Unit 2 HCS12 Architecture
CS2422 Assembly Language & System Programming September 26, 2006.
© 2010 Kettering University, All rights reserved..
ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265.
Assembly & Machine Languages
Chapter 2 Software Tools and Assembly Language Syntax.
Writing an Assembly-language program Atmel assembly language CS-280 Dr. Mark L. Hornick 1.
Assembly Language Programming for the MC68HC11. Assembly language programming  Recall the 4 design levels for software development: – Application – High.
P.1ECE 331, Prof. A. Mason Professor Andrew Mason Michigan State University Spring 2013 ECE 331: PC Lab 1: Using HC12 ASM Simulators.
Dr Masri Ayob TK 2633: Microprocessor & Interfacing Lecture 7: Assembly Language.
Physics 413 Chapter 1: Introduction to the HCS 12 Microcontroller.
Chapter 3 Elements of Assembly Language. 3.1 Assembly Language Statements.
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
Objectives Implement pointers using indexed addressing modes Use pointers to access arrays, strings, structures, tables, and matrices Present finite-state.
Programming With C.
Lab 0: Groups and Equipment Start date: Week #2 Due date: no report 1.
Computer Systems Week 7: Looping and Input/Output with 3-bit Alma Whitfield.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
ME4447/6405 The George W. Woodruff School of Mechanical Engineering ME4447/6405 Microprocessor Control of Manufacturing Systems and Introduction to Mechatronics.
1 Segments and Pseudo Operations Program Development.
Assembly Language ELEC 330 Digital Systems Engineering Dr. Ron Hayne.
ECE 265 – LECTURE 11 Editing and the Assembler (updated 11/11/10) 12/15/ ECE265.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
1 Microcontroller Fundamentals & Programming Addressing Modes.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
1 EKT 225 MICROCONTROLLER I CHAPTER ASSEMBLY LANGUAGE PROGRAMMING.
Embedded Systems Lecture 5 January 25 th, 2016.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
EE345 Chapter 2 Lecture 3 April Instruction and addressing modes 1.Extended Addressing 2.Direct Addressing 3.Inherent Addressing 4.Immediate Addressing.
ECE 3430 – Intro to Microcomputer Systems
EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions
Use of MPLab software Paul Cockshott.
Addressing Modes in Microprocessors
ECE 3430 – Intro to Microcomputer Systems
Assembly Language (continue)
ECE 3430 – Intro to Microcomputer Systems
ECE 3430 – Intro to Microcomputer Systems
The 8051 Microcontroller and Embedded Systems
Wed. Sept 6 Announcements
PRU-ICSS Programming with CCS
Chapter 4 Addressing modes
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ME4447/6405 Microprocessor Control of Manufacturing Systems and
Lecture 4: MIPS Instruction Set
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
COMS 361 Computer Organization
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
8051 ASSEMBLY LANGUAGE PROGRAMMING
Chapter 6 Programming the basic computer
Presentation transcript:

Lab 1 – Assembly Language and Interfacing Start date: Week 3 Due date: Week 4 1

Agenda Lab Objectives Connecting to the board (review) About the board Assembly language structure and commands Assembler directives Compiling / downloading / running D-Bug12 commands 2

Board Setup Connect board to power supply Connect to the PC through USB 3

Connecting Open MiniIDE Compiler options (terminal  options) COM(X) 9600 baud rate Ensure compiler is asm12.exe in assembler tab Terminal  connected Ensure you have a terminal (terminal  show terminal window) Press the reset button on the board You should see a D-Bug12 message 4

About the board CISC – many instructions (we will only go over a few, there are many outlined in the text or in the manual) A, B and D registers are the main registers for instructions X and Y registers can be used for instructions or addressing 5

About the Board D register is 16 bits A and B are 8-bit PARTS of the D register AB D 6

About the Board X and Y are both 16 bits X and Y can also be used for addressing Covered later in class when you talk about addressing modes 7

About the board Memory There are only certain areas in memory that you can use These areas can be used for data or code There are commands to load from and store to RAM 8

About the Board Other Functionality (covered as needed in later labs) I/O ports A/D ports Timers Interrupts Serial ports Etc. 9

Assembly Language Structure 4 fields Label Operation Operand Comment start ldaa #$03 ;load a reg 10

Assembly Language Structure Label Used to mark a certain part of the code Useful when doing branches / jumps Can use them almost like a GOTO You make them up, so can be any word you want Labels are optional, use where needed start ldaa #$03 ;load A reg 11

Assembly Language Structure Operation Describes the operation you want to do Many operations available because CISC Ex. Add, subtract, or, load, store, branch start ldaa #$03 ;load A reg 12

Assembly Language Structure Operand Describes what you want to do the operation to Manual will tell you what operands you need with what operations #$03 = immediate, $03 = direct $=hex, %=binary, nothing = decimal start ldaa #$03 ;load A reg 13

Assembly Language Structure Comment Start with a semi-colon for comment to end of line Very helpful in assembly code because it can be hard to understand start ldaa #$03 ;load A reg 14

Assembly Instructions - load LDAA, LDAB, LDD, LDX, LDY Load a register with a value Syntax: (label) LDAA value LDAA #$30 = load register A with the value $30 LDAA $30 = load register A with the value held in memory location $30 15

Assembly Instructions - store STAA, STAB, STD, STX, STY Store the value in a register to a memory location Syntax: (label) STAA memory_location STAA $30 = store the value in register A to memory location $30 16

Assembly Instructions - Add Ex. ADDA, ADDB, ADDD, ABA More in manual ADDA, ADDB = add 8-bit operand to register A or B (label) ADDA $30 = add the value in memory location $30 to A, and store in A (label) ADDA #$30 = add the value $30 to A and store in A ADDD = add 16-bit operand to register D ABA = add registers A and B and store in A 17

Assembly Instructions - SWI SWI stands for software interrupt Use it to end your programs and to get back out to the D-Bug12 prompt No operand 18

Compiler Directives Compiler directives give instructions to the compiler Reserve space, set memory locations etc. Not actually executed like an instruction 19

Compiler Directives - org Org is used to tell the compiler where to put the program in memory Unlike high level languages, where the program gets put anywhere it fits, in assembly you have to tell the compiler where to start putting the program You can have multiple orgs in a program, ex to separate space for data and for the program (try not to have too many though) 20

Compiler Directives – org con’t There are only certain areas on the board your can use for your program/data A memory map of the system shows where you can put your code/data See appendix You have from $1000 to $4000 $1000 is good for the program because it is big Ex. org $

Compiler Directives - RMB RMB stands for reserve memory byte Operand is the number of bytes to reserve You can then use these to store data If they are labelled you can refer to them by the label (label) RMB 2 22

Compiler Directives - EQU EQU = equate Like C #define Compiler will go through and substitute before the code is compiled Requires a label to use label EQU $30 23

Compiler Directives - other BSZ = block set zero Like RMB, but fills the blocks with 0’s FCB = form constant byte Stores values specified in memory (label) FCB $30 (label) FCB 30, $40, ‘a’ FDB = form double byte Same as FCB, but 16 bits FCC = form constant character (label) FCC ‘hello world’ 24

Example org $1000 val0RMB1 threeEQU$03 org$1100 startLDAA#three STAAval0 SWI 25

Compiling Save as “whatever.asm” you have to type the “.asm” part too Press the build button Check the output window for errors and warnings 26

Downloading and Running To load: Type “load” at the prompt Click the download button Select your s-record file (.s19) To run Figure out where your program starts (your probably used an ORG right before, so wherever you ORG’d to) ex. At $1100…type “g 1100” 27

D-Bug12 commands Once your program has exited, you can use D-Bug12 to analyze the output Important ones: load g md mm rd Others in Lab 0 28

D-Bug12 commands - md md = memory display Md ( ) Shows the contents of memory starting at the start address Ex, you ORG’d at $1000 and then used RMB to store some data. To see it, type: md

D-Bug12 commands - mm To modify a memory location mm Ex, you load data from a certain memory location at 800, but you want to change it without recompiling mm

D-Bug12 commands - RD rd = register display Use it to see the contents of all the user registers, flags, stack points and PC No operands, just “rd” 31

Academic Misconduct Reports and demos are submitted as a group, but it is a SINGLE group effort You may talk with other groups but sharing code or reports is NOT ALLOWED Copying code/reports from previous years is also NOT ALLOWED If we find copying we are REQUIRED to report it 32