progs/example1a.s
author Christian Urban <urbanc@in.tum.de>
Sat, 23 Sep 2017 19:52:27 +0100
changeset 523 7a6e8f603e08
parent 396 2f4296a0ab21
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
395
60f64793266f added assembly programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
_main:    
396
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
     2
  push    %ebp              
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
     3
  mov     %esp,%ebp         ; current sp into esp
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
     4
  sub     %0xc,%esp         ; subtract 12 from esp
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
     5
  movl    $0x3,0x8(%esp)    ; store 3 at esp + 8
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
     6
  movl    $0x2,0x4(%esp)    ; store 2 at esp + 4
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
     7
  movl    $0x1,(%esp)       ; store 1 at esp
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
     8
  call    0x8048394 <foo>   ; push return address to stack
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
     9
                            ; and call foo-function 
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
    10
  leave                     ; clean up stack
2f4296a0ab21 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 395
diff changeset
    11
  ret                       ; exit program