W05_10_ARM_Progr1 - 10 ARM Programming 1 CSC 230 Department...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
10 ARM Programming 1 CSC 230 Department of Computer Science University of Victoria 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
31 29 70 Status 28 30 64 CPSR - egative register N Negative Z - Zero C - Carry V- Overflow ondition code flags Processor mode bits Interrupt disable bits I/O (see later) Mode 0-4 Purpose Name Bit Condition code flags Review Overflow: =1 if arithmetic V 28 Interrupt mask (later) Interrupt 6-7 N, Z, V and C Carry: =1 if carry-out results om operation else 0 C 29 overflows, else 0 are set by operations and then used for Zero: =1 if result from operation is 0, else 0 Z 30 from operation, else 0 decision making in branch instructions. 2 Negative:=1 if result from operation is negative, else 0 N 31
Background image of page 2
Assembly Language Programming ± Assembly language = symbolic form of machine language Î Specific to a particular processor type ± An assembler is a relatively simple program that translates symbolic assembly language to numeric achine language machine language An assembler is much simpler than a compiler because: ssembly language syntax and semantics are much 9 assembly language syntax and semantics are much simpler than high-level languages; 9 the program can be translated essentially line by line; 9 there aren't the issues of context and structure that a high-level language compiler has to deal with. 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Assembly Language Programming An assembly language program consists of a sequence of statements including: assembler language instructions: each corresponds to an executable machine language instruction assembler directives: ey provide direction to the assembler; e g used for they provide direction to the assembler; e.g. used for creating data areas, determining the placement of code and data in memory etc. macros: Some assemblers support macros - a single statement which may be expanded into many 4 y p y
Background image of page 4
(1) Given: general rchitectural framework architectural framework Î General syntax and semantics for assembly languages Initial chapter in textbook (2) Given: choice of processor Î Processor syntax and semantics for THE GENERAL assembly language for that processor In ARM Reference books (3) Given: choice of processor and an implementation of an Example: ARM Assembler Î syntax and semantics for THE ssembly language for HAT instructions as used in the GNU Assembler or in ARMSim# 5 assembly language for THAT processor and Assembler
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Assembly Language Source Code LABEL: OPCODE OPERAND(s) COMMENT optional as required optional Use tabs between fields to keep code in nice columns For many assembly languages, a label must start in column 1 opcode: mnemonic for machine language instruction or an assembler directive operands: symbols, constants, expressions Î must follow appropriate addressing mode 6
Background image of page 6
@ Sample ARM Instructions and code layout (in Lab as well) @========= Text (Code) ========= text Begin the "text" (code) segment .text @ Begin the text (code) segment .global _start @ Export "_start" symbolic address _start: ldr r4,=n @ Load address of var 'n' in r4 ldr r1,[r4] @ Load value of 'n' from address (in R4) mov r0,#0 @ Initialize R0 to 0 (zero) ov 2,#2 Initialize R2 to 2 mov r2,#2 @ Initialize R2 to 2 add
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 36

W05_10_ARM_Progr1 - 10 ARM Programming 1 CSC 230 Department...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online