Skip to main content
gamedev.net
🔒 Locked

Need help with a basic assembly program..

Started by rubsnick 6 replies 1.1k views
Original Post
rubsnick
rubsnick
I'm using MASM assembly (Kip R Irvine thing) and i"m using visual studio 2008 with his projects and stuff. This is what the professor recommended and wants. So I wrote a program in Assembly to add three numbers together.... but whenever I run it it just doesn't show up in the dark window. @_@ It works it has no issues but it won't show.... is there something I"m missing?

Here's the code

TITLE MASM Template (main.asm)

; Description:
;
; Revision date:

INCLUDE Irvine32.inc
.data
number1 DWORD 3
number2 DWORD 2
number3 DWORD 1
sum DWORD ?

.code
main PROC

mov eax, number1
add eax, number2
add eax, number3
mov sum, eax
mov eax, 0
ret

main ENDP

END main
alvaro
alvaro
That program doesn't call any output functions. Why would it show anything?
rubsnick
rubsnick
Yeah.... so how to I make it appear? I mean which would be the best function...
Palidine
Palidine
[google] "MASM print"
rubsnick
rubsnick
Quote:
Original post by Palidine
[google] "MASM print"


Why thank you.. sorry for the noobish questions I'm just really new to assembler...
rubsnick
rubsnick
Quote:
Original post by rubsnick
Quote:
Original post by Palidine
[google] "MASM print"


Why thank you.. sorry for the noobish questions I'm just really new to assembler...


Well... that didn't work..... I can't seem to find any decent things for this.... *sigh* Apparently some of the programs from the Author of the book don't display either...So i'm assuming we don't have to display them eh?
Erik Rufelt
Erik Rufelt
You need to call for example printf, so you first need to learn about function calls. You could also move the sum into eax, which should make it the exit code of the process. Depending on how you run your program, the exit-code should be visible in the debugger window. Now you set it to zero, so the debug window should say something like "The program '........' has exited with code 0 (0x0).", which could be replaced with any number you wish to output.
Beyond_Repair
Beyond_Repair
Might add that you can probably also view the register values change by stepping through the code in your debugger.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.