Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; CpS 230 Lab 5: Stone Champion College-Student (scham978)
- ;---------------------------------------------------
- ; Warm-up lab exercise to introduce the basics of
- ; writing, building, and running IA-64 assembly code
- ; programs on Windows.
- ;---------------------------------------------------
- default rel
- ; We use these functions (printf and scanf) from an external library
- extern _printf
- extern _scanf
- ; Begin the "code" section of our output OBJ file
- section .text
- ; Mark the label "main" as an exported/global symbol
- global _main
- ; "main" marks the spot where our code actually is (i.e., calling "main()" takes you here)
- _main:
- ; Boilerplate "function prologue"
- push rbp
- mov rbp, rsp
- sub rsp, 32 ; create shared shadow space
- lea rdi, [prompt1]
- call _printf
- lea rdi, [prompt1]
- lea rsi, [guess]
- call _scanf
- lea rsi, [guess]
- lea rdi, [output]
- call _printf
- ; Boilerplate "function epilogue"/return
- mov rsp, rbp
- pop rbp
- ret
- ; Begin the "data" section of our output OBJ file
- section .data
- guess: dd 0
- prompt1: db "I'm thinking of a number between 1 and 100. What is it? ", 0
- output: db "The guess was %d", 10, 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement