progs/example1b.s
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 26 Sep 2017 12:03:24 +0100
changeset 533 98ae49ffc262
parent 396 2f4296a0ab21
permissions -rw-r--r--
updated

_foo:   
  push    %ebp                     ; push current sp onto stack
  mov     %esp,%ebp                ; current sp into esp
  sub     $0x10,%esp               ; subtract 16 from esp
  movl    $0x64636261,-0x6(%ebp)   ; store abcd in ebp - 6
  movw    $0x65,-0x2(%ebp)         ; store e in ebp - 2
  movl    $0x34333231,-0x10(%ebp)  ; store 1234 in ebp - 16
  movl    $0x38373635,-0xc(%ebp)   ; store 5678 in ebp - 12
  movw    $0x39,-0x8(%ebp)         ; store 9    in ebp - 8
  leave                            ; pop last sp into ebp
  ret                              ; pop return address and 
                                   ; go back to main