12 Assembly

12 Assembly - CMSC 216 Introduction to Computer Systems...

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

View Full Document Right Arrow Icon
3/11/11 1 CMSC 216 Introduction to Computer Systems Lecture 12 Linked Lists & Assembly Language Jan Plane & Pete Keleher {jplane, keleher}@cs.umd.edu Administrivia • Project 3a due Sunday – 3b posted soon • Read Reek, Chapter 12 • Start reading Bryant and O’Hallaron Chapter 3 (IA-32 instruction set architecture) and 4.1 (Y86 subset) CMSC 216 - Wood, Sussman, Herman, Plane 2
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
3/11/11 2 A SSEMBLY L ANGUAGE ( CONT .) Chapters 3 and 4.1, Bryant and O'Hallaron CMSC 216 - Wood, Sussman, Herman, Plane 3 Y86 data movement instructions Instruction Effect Description irmovl V,R Reg[R] ! V Immediate-to-register move rrmovl rA,rB Reg[rB] ! Reg[rA] Register-to-register move rmmovl rA,D(rB) Mem[Reg[rB]+D] ! Reg[rA] Register-to-memory move mrmovl D(rA),rB Reg[rB] ! Mem[Reg[rA]+D] Memory-to-register move CMSC 216 - Wood, Sussman, Herman, Plane 4 irmovl is used to place known numeric values (labels or numeric literals) into registers rrmovl copies a value between registers rmmovl stores a word in memory mrmovl loads a word from memory rmmovl and mrmovl are the only instructions that access memory - Y86 is a load/store architecture
Background image of page 2
3 Examples of data movement irmovl $55,%edx # d = 55 rrmovl %edx,%ebx # b = d irmovl Array,%eax # a = Array rmmovl %ebx,4(%eax) # a[1] = 55 mrmovl 0(%eax),%ecx # c = a[0] halt .align 4 Array: .long 0x6f .long 0x84 CMSC 216 - Wood, Sussman, Herman, Plane 5 Data movement example, cont. • Assembler output: 0x000: 308237000000 | irmovl $55,%edx # d = 55 0x006: 2023 | rrmovl %edx,%ebx # b = d 0x008: 30801c000000 | irmovl Array,%eax # a = Array 0x00e: 403004000000 | rmmovl %ebx,4(%eax) # a[1] = 55 0x014: 501000000000 | mrmovl 0(%eax),%ecx # c = a[0] 0x01a: 10 | halt | 0x01c: | .align 4 0x01c: | Array: 0x01c: 6f000000 | .long 0x6f 0x020: 84000000 | .long 0x84 • Simulator output: Stopped in 6 steps at PC = 0x1b. Exception 'HLT', CC Z=1 S=0 O=0 Changes to registers: %eax: 0x00000000 0x0000001c %ecx: 0x00000000 0x0000006f %edx: 0x00000000 0x00000037 %ebx: 0x00000000 0x00000037 Changes to memory: 0x0020: 0x00000084 0x00000037 CMSC 216 - Wood, Sussman, Herman, Plane 6
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
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 10

12 Assembly - CMSC 216 Introduction to Computer Systems...

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

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