Hi all,

I am new to this forum and also to using MASM32.

I have this program (see below) that I am trying to assemble to begin learning to use the editor, MASM32, editor, etc.

What is happening is this:

I OPEN the file containing the code below, click on the Qeditor Project/built All and nothing happens!!! No messages no nothing.

Please tell me what I am doing that is wrong or better yet, tell me how to do it.

I am running a Windows XP, the source code is at D:\ASM\masm32\XXXXXXXX.asm

I should be getting error messages gigen that I am missing a couple of libs.

Please help>

Best, Firmo

; UIPChello.asm Displays UIPC link data in a message box
; Made by Andrea "Kefren" Brunori. kefren@digitalrice.com http://oaqm.cjb.net
; This source file is a loose translation of the equivalent C contained in the C_SDK.
; Use this at yuor own risk.
; This source is meant for MASM32. If you need the package visit these sites:
; http://win32asm.cjb.net
; http://www.asmcommunity.net/board/
; http://www.pbq.com.au/home/hutch/masm.htm
; In order to compile, you'll need the some .lib that are supplied with MSVC and other
; compilers. They are required by the FSUIPC_User.lib. You will also need to adjust the
; paths in HelloWorld.inc to point your MASM32 Include and Lib directories.



;--------- Initializing the assembler flags ----------
.686
.387
.k3d
.MODEL flat,stdcall
option casemap:none
;--------- Done ---------------------------------------


;--------- All includes are in a separate file --------
include HelloWorld.inc
;--------- Done ---------------------------------------



; The FSUIPC_User.lib retrieves some data for us when we open the link with FSUIPC.dll,
; storing these data in three variables. In order to access these variables we need to
; declare them as external in our source code.
;--------- Declaring external functions ---------------
externdef FSUIPC_Version:DWORD
externdef FSUIPC_FS_Version:DWORD
externdef FSUIPC_Lib_Version:DWORD
;--------- Done ---------------------------------------

.Data
AppName db "FSUIPC.dll Hello World!",0
SimVer db "Sim is: ",0
SimTime db "Sim time is: ",0
NextLine db 13,10,0
SC db ":",0
IPCVer db " FSUIPC Version = ",0


;-------- Building Error Pointers Array ----------------
Error0 db "Okay",0
Error1 db "Attempt to Open when already Open",0
Error2 db "Cannot link to FSUIPC or WideClient",0
Error3 db "Failed to Register common message with Windows",0
Error4 db "Failed to create Atom for mapping filename",0
Error5 db "Failed to create a file mapping object",0
Error6 db "Failed to open a view to the file map",0
Error7 db "Incorrect version of FSUIPC, or not FSUIPC",0
Error8 db "Sim is not version requested",0
Error9 db "Call cannot execute, link not Open",0
Error10 db "Call cannot execute: no requests accumulated",0
Error11 db "IPC timed out all retries",0
Error12 db "IPC sendmessage failed all retries",0
Error13 db "IPC request contains bad data",0
Error14 db "Maybe running on WideClient, but FS not running on Server, or wrong FSUIPC",0
Error15 db "Read or Write request cannot be added, memory for Process is full",0

ErrorArr dd OFFSET Error0,OFFSET Error1,OFFSET Error2,OFFSET Error3,OFFSET Error4,OFFSET Error5,OFFSET Error6,OFFSET Error7,OFFSET Error8,OFFSET Error9,OFFSET Error10,OFFSET Error11,OFFSET Error12,OFFSET Error13,OFFSET Error14,OFFSET Error15
;-------- Done ------------------------------------------




;-------- Building FS Versions Strings array ------------
Fs98 db "FS98",0
Fs2k db "FS2000",0
Cfs2 db "CFS2",0
Cfs1 db "CFS1",0
Fly db "Fly!",0
FS2k2 db "FS2002",0
UnkFS db "Unknown FS",0
FsVerArr dd 0,OFFSET Fs98, OFFSET Fs2k, OFFSET Cfs2, OFFSET Cfs1, OFFSET Fly, OFFSET FS2k2, OFFSET UnkFS
;-------- Done -------------------------------------------





.Data?
hInstance HINSTANCE ?
Result dd ?
Time db 3 dup(?)
Hour db 3 dup(?)
Minute db 3 dup(?)
Second db 3 dup(?)
FSUIPCVer db 7 dup(?)
chMsg db 128 dup(?)



.Code

start:
;---------- Normal startup stuff --------------------
invoke GetModuleHandle,NULL
mov hInstance,eax
;---------- Done ------------------------------------


;---------- Opening the link with FSUIPC.dll --------
invoke FSUIPC_Open,SIM_ANY,ADDR Result
cmp eax, FALSE
je Error
;---------- Done ------------------------------------
; OK. We are linked, and we already have retrived some data. We'll process
; them later. Now, as an example of retrieving data, let's get the FS clock
; time.

;---------- Setting the read block ------------------
invoke FSUIPC_Read,0238h,3,ADDR Time,ADDR Result
cmp eax,FALSE
je Error
;---------- Done ------------------------------------
; If we wanted to read/write more data at once, we could put our additional
; request here.

;---------- Processing the requests -----------------
invoke FSUIPC_Process,ADDR Result
cmp eax,FALSE
je Error
;---------- Done ------------------------------------
;The data needs some work before we can output it in the MessageBox.
;Let's go. Luckily, MASM32 has some routines that help us.
;---------- Converting the Time data to ASCII -------
xor eax,eax
mov al,Time[0]
invoke dwtoa,eax,ADDR Hour
xor eax,eax
mov al,Time[1]
invoke dwtoa,eax,ADDR Minute
xor eax,eax
mov al,Time[2]
invoke dwtoa,eax,ADDR Second
;---------- Done ------------------------------------


; We said we retrieved some data when we opened the link. Now, we need
; to process them, in order to show them in the MessageBox. This time,
; we're on our own, but it's not so hard.
;---------- Converting the FSUIPC_Version to ASCII --
mov eax,FSUIPC_Version
mov dx,ax
shr eax,16
mov ecx,eax
and cl,0fh
add cl,48
mov FSUIPCVer[4],cl
shr eax,4
mov ecx,eax
and cl,0fh
add cl,48
mov FSUIPCVer[3],cl
shr eax,4
mov ecx,eax
and cl,0fh
add cl,48
mov FSUIPCVer[2],cl
shr eax,4
mov ecx,eax
and cl,0fh
add cl,48
mov FSUIPCVer[0],cl

mov cl,46
mov FSUIPCVer[1],cl
test dl,0
je Itszero
add dl,96
Itszero:
mov FSUIPCVer[5],dl

mov dl,0
mov FSUIPCVer[7],dl
;----------- Done ---------------------------------


; MASM32 helps us once again.
;--------- All strings become one -----------------
mov eax,FSUIPC_FS_Version
cmp eax,7
jb @F
mov eax,7
@@:
invoke szMultiCat,11,ADDR chMsg,ADDR SimVer, FsVerArr, ADDR IPCVer, ADDR FSUIPCVer, ADDR NextLine, ADDR SimTime, ADDR Hour,ADDR SC, ADDR Minute, ADDR SC, ADDR Second
;--------- Done -----------------------------------


;--------- Let's show results and quit ------------
invoke MessageBox,NULL,ADDR chMsg,ADDR AppName,MB_OK
invoke FSUIPC_Close ; Let's close the link, OK?
invoke ExitProcess,NULL
;--------- Done -----------------------------------



;--------- Error processing routine ---------------
Error:
mov edx,Result
invoke MessageBox,NULL,ErrorArr,ADDR AppName, MB_OK
invoke FSUIPC_Close ; Closing a link if already closed is OK, so no problem.
invoke ExitProcess,NULL
;--------- Done -----------------------------------

end start
Posted on 2002-10-22 13:49:25 by firmo
quote:

D:\ASM\masm32\XXXXXXXX.asm

I think Masm32 main directory has to be on the root directory in order for your Qeditor to work properly.

So it would be:

D:\masm32\XXXXXXXX.asm

But you should have got an error saying Program not found
Posted on 2002-10-22 13:55:43 by IwasTitan
Hi Titan,

Thanks for the repply.

That did it. Now all I have to do is run after the error messages.

Best, Firmo
Posted on 2002-10-22 14:54:00 by firmo