Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SECTION .data           ; /* contains initialized data */
  2.  
  3. SECTION .bss            ; /* contains uninitialized data */
  4. rslt RESD 1             ; int rslt;
  5. SECTION .text           ; /* contains code
  6.  
  7. GLOBAL _start           ;
  8.  
  9. _start:                 ; void main(void){
  10.     nop                 ; /* do not remove the "nop" */
  11.     push DWORD 1337     ; /* 5. Parameter */
  12.     mov ax, 1           ;
  13.     shl ax, 10          ; (1 << 10)
  14.     add ax, 256         ; + 256
  15.     push ax             ; /* 4. Parameter */
  16.     push WORD 36        ; /* 3. Parameter */
  17.     mov eax, 1          ;
  18.     shl eax, 14         ; 1 << 14
  19.     push eax            ; /* 2. Parameter */
  20.     push WORD 126       ;
  21.     call addFive        ; int rslt = addive(...);
  22.     mov ebx, 127        ;
  23.     div ebx             ; rslt % 127;
  24.     mov [rslt], edx     ; /* Rest der Divison edx */
  25.                         ; return 0;
  26. end:mov eax, 1          ; /* the exit system call
  27.     mov ebx, edx        ;    no errorcode
  28.     int 80h             ;    execute system call */
  29.                         ; }
  30. addFive:                ; int addFive(short a, /* [ebp+8] */
  31.                         ;             int b, /* [ebp+10] */
  32.                         ;             short c, /* [ebp+14] */
  33.                         ;             short d, /* [ebp+16] */
  34.                         ;             int e /* [ebp+18] */ ) {
  35.     push ebp            ; /* Retten und Neueinstellen ebp */
  36.     mov ebp, esp        ;
  37.     sub eax, eax        ;
  38.     mov ax, [ebp+8]     ; return a +
  39.     add eax, [ebp+10]   ; b +
  40.     add ax, [ebp+14]    ; c +
  41.     add ax, [ebp+16]    ; d +
  42.     add eax, [ebp+18]   ; e;
  43.     pop ebp             ;
  44.     ret 14              ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement