Cirrus Logic CS485 Manual de usuario Pagina 14

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 67
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 13
CS485G Spring 2015 14
pushl %ebp # save base pointer
movl %esp,%ebp # new base pointer
pushl %ebx # save old contents of %ebx
movl 8(%ebp), %edx # edx = xp
movl 12(%ebp), %ecx # ecx = yp
movl (%edx), %ebx # ebx =
*
t0 =
*
xp
movl (%ecx), %eax # eax =
*
t1 =
*
yp
movl %eax, (%edx) #
*
xp = t1
movl %ebx, (%ecx) #
*
yp = t0
popl %ebx # restore %ebx
popl %ebp # restore %ebp
ret # return
17 More complex memory-addressing modes
(a) We saw memory and displacement.
(b) This is the most general form: D(Rb,Ri,S)
i. D is the displacement, in bytes, such as 1, 2, 80.
ii. Rb is the base register: any of the 8 integer registers.
iii. Ri is the index register, any register by %esp, and you most
likely don’t want to use %ebp, either
iv. S is a scale, which is any of 1, 2, 4, or 8.
(c) The value it references is Mem[Reg[Rb]+S*Reg[Ri]+D].
(d) Example
i. %edx: 0xf000
ii. %ecx: 0x0100
iii. 0x8(%edx): 0xf000 + 0x8 = 0xf008
iv. (%edx,%ecx): 0xf000 + 0x0100 = 0xf100
v. (%edx,%ecx,4): 0xf000 + 4
*
0x0100 = 0xf400
vi. 0x80(,%edx,2): 2
*
0xf000 + 0x80 = 0x1e080
18 Address computation without referencing
(a) One can compute an address and save it without actually refer-
encing it.
(b) leal src, dest
Vista de pagina 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 66 67

Comentarios a estos manuales

Sin comentarios