I ahve been searching for hours on how to o this.
it is so simple to do in EMU i hve done it in EMu
===============================================
include 'emu8086.inc'
ORG 100h
JMP START
num DW ?
START:
CALL PTHIS
DB 13, 10, 'Enter first number: ', 0
CALL scan_num
MOV num, CX
CALL PTHIS
msg2 DB 13, 10, 'Enter second number: ', 0
CALL scan_num
ADD num, CX
CALL PTHIS
DB 13, 10, 'The sum is: ', 0
MOV AX, num
CALL print_num
JMP exit
RET
DEFINE_SCAN_NUM
DEFINE_PRINT_NUM
DEFINE_PRINT_NUM_UNS
DEFINE_PTHIS
END
========================================
BUT i cannot do this in masm, i cant even oad masm. ahve never done masam before and i need this done in the next hour. please can anyone help me. All the progrm has to do is have 2 inputs and add them thats it. and display the answer. So input 1 and 2 output 3 thats it. it get the inputs from the keyboard and displays them on screen then displays the output on screen.
PLEASe any example code our snippets. our any help would be loved TY for speedy repsone e-mail rvc_shart@yahoo.co.uk
So... you want some MASM code that is equivalent to that EMU code?
Within the Hour?
On a Saturday morning???
How much are you paying? :bdg
Okay, here ya go. Just rearrange the code in the start label in the correct order to form the completed file. :bg
; by Mark Jones 2005 - build as "console assemble and link" in MASM32 v8.2 SP2a
include masm32rt.inc ; "runtime" libs
include shlwapi.inc ; needed for StrToInt func
includelib shlwapi.lib
.data?
num1 DD ? ; operand 1
num2 DD ? ; operand 2
num3 DD ? ; result
.code
start:
mov ecx, [num1] ; load our number values into ecx and
mov edx, [num2] ; edx - see ASMINTRO.HLP about dereferencing
add ecx, edx ; add edx to ecx, hex result in ecx
mov num3, ecx ; save result in num3 dword offset
mov eax, input(" Enter second number: ")
invoke StrToInt,eax ; invoked results always returned in eax
mov num2, eax ; necessary to save values this way because
; StrToInt overwrites eax, ecx, and edx
mov eax, input(" Enter first number: ")
invoke StrToInt,eax ; convert string to integer
mov num1, eax ; copy integer into num1
mov eax, input(13,10,13,10,"Press enter to exit:")
invoke ExitProcess, 0 ; exit gracefully
print chr$(13,10," ADD result: ")
print str$(num3)
end start
Quote from: pantho on June 24, 2005, 08:37:35 PM
BUT i cannot do this in masm, i cant even oad masm.
Just so you know, you don't "load" MASM, you *execute* it to assemble your code.
Quote from: pantho on June 24, 2005, 08:37:35 PM
ahve never done masam before and i need this done in the next hour. please can anyone help me. All the progrm has to do is have 2 inputs and add them thats it. and display the answer. So input 1 and 2 output 3 thats it. it get the inputs from the keyboard and displays them on screen then displays the output on screen.
PLEASe any example code our snippets. our any help would be loved TY for speedy repsone e-mail rvc_shart@yahoo.co.uk
Also, you should read the forum rules. Even if you are in a tight spot, we do not allow homework requests, and we discourage people asking for personal replies.