cp-1_lect_14 - 0 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0 Add to R3...

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

View Full Document Right Arrow Icon
Addressing mode example Address Instruction Comments x30F6 1 1 1 0 0 0 1 1 1 1 1 1 1 1 0 1 R1 Ÿ PC – 3 = x30F4 x30F7 0 0 0 1 0 1 0 0 0 1 1 0 1 1 1 0 R2 Ÿ R1 + 14 = x3102 x30F8 0 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 M[PC - 5] R2 M[x30F4] x3102 x30F9 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 0 R2 ¾ 0 x30FA 0 1 1 1 0 1 0 0 0 1 0 0 1 1 1 0 M[R1+14] R2 M[x3102] ~ 0 LEA ADD ST AND STR
Background image of page 1

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

View Full DocumentRight Arrow Icon
Control Instructions o Branch n Conditional n Unconditional PC-Relative BRz x0D9
Background image of page 2
Building loops using BR Counter control Sentinel control
Background image of page 3

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

View Full DocumentRight Arrow Icon
Sample Program Address Instruction Comments x3000 1 1 1 0 0 0 1 0 1 1 1 1 1 1 1 1 R1 Ÿ x3100 (PC+0xFF) x3001 0 1 0 1 0 1 1 0 1 1 1 0 0 0 0 0 R3 ¾ 0 x3002 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 0 R2 ¾ 0 x3003 0 0 0 1 0 1 0 0 1 0 1 0 1 1 0 0 R2 ¾ 12 x3004 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 If Z, goto x300A (PC+5) x3005 0 1 1 0 1 0 0 0 0 1 0 0 0 0 0 0 Load next value to R4 x3006
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0 Add to R3 x3007 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 Increment R1 (pointer) X3008 0 0 0 1 0 1 0 0 1 0 1 1 1 1 1 1 Decrement R2 (counter) x3009 0 0 0 0 1 1 1 1 1 1 1 1 1 0 1 0 Goto x3004 (PC-6) LDR JMP Instruction (Unconditional branch) TRAP Instruction vector routine x23 input a character from the keyboard x21 output a character to the monitor x25 halt the program A sample program 01 ; Program to multiply an integer by the number 6 02 .ORIG x3050 03 LD R1, SIX 04 LD R2, NUMBER 05 AND R3, R3, #0 ; R3 holds the product 06 ; The inner loop 07 AGAIN ADD R3, R3, R2 08 ADD R1, R1, # -1 ; for iterations 09 BRp AGAIN 0A ; 0B HALT 0C ; 0D NUMBER .BLKW 1 0E SIX .FILL x0006...
View Full Document

This note was uploaded on 05/07/2010 for the course CS&IS TA C162 taught by Professor Kavitha during the Spring '09 term at Birla Institute of Technology & Science.

Page1 / 7

cp-1_lect_14 - 0 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0 Add to R3...

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

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