Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;Dennis Boone
- ;; CS 371 Assignment 1 olly and masm
- include 371-prologue.inc ; suck in standard prologue
- .const
- BUFFER_LENGTH equ 20 //declaring a constant number to be the buffer length
- .data
- a dd 2 ;assigning variables as dd numbers to use for axsquared + bx + c
- b dd 3
- r dd 1 ;r will be c
- x dd 4
- unsigned_integer_format BYTE "%lu ", 0
- .data?
- buffer BYTE BUFFER_LENGTH dup(?)
- result dd ? ;;declaring result uninitialized for later use
- .code
- main proc
- mov eax, x ;;move x to eax so we can use the mul function to multiply x by itself
- mul x ;this is practically x times x
- mul a ; ax squared
- mov result, eax ;eax data which is ax squared is stored in unitialized variable
- mov eax, b ;overwriting the eax number to be b since eax data was already stored in result
- mul x ; equivalent of bx
- add result, eax ;adding this to result so its now ax squared plus bx
- mov ebx, r ;moving r which is my c into a register and adding it to result
- add result, ebx
- push result
- push offset unsigned_integer_format
- push offset buffer
- call wsprintf ;procedure for printing
- add esp, 12 ;;offsetting to go into stack
- push offset buffer
- call StdOut
- push 0 ; standard exit
- call ExitProcess
- main endp
- end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement