Hello again. Sorry to be filling up the board with all of these newbie problems lately. Anyway, I'm having a very strange problem with my program. I am using bitRAKE's fpc macro, com (d3d), and local variables inside of a proc. The three of these things in one proc result in a crash. If I remove any one of them, it works again. That's not the oddest part though. If I copy and paste the function into another function, and call which ever proc is defined second, there is no problem. I've included my code if anyone could take a look at it (or even not look at it but point out possible solutions to look into). It requires some MSVC++ libraries to get d3dx to link, so not everyone will be able to build and run it. This is just baffling me to no end. :confused:
Posted on 2003-06-15 07:21:42 by AlexEiffel
Did you ret?
Posted on 2003-06-15 10:22:59 by comrade
Probably somehow the stack is corrupted.
Posted on 2003-06-15 10:49:13 by roticv
Yes, I'm doing a ret. After playing around with it more, I've also found that sometimes after I add or remove stuff (from where ever, not just the proc), things start working correctly again. Then I will add or move some more stuff and it stops.
Posted on 2003-06-15 10:49:19 by AlexEiffel
Works great - no error. :)

What version of MASM are you using? I'm using VS.Net and fresh install of dx9sdk (retail DLLs). I just loaded the ASM file into RadASM, changed the directories, and assembled and ran it.
Posted on 2003-06-15 11:58:46 by bitRAKE
I'm using masm v8. I'm also using VS.Net. Does it work even if you call the other function instead of the one I have being called? I posted it calling the function defined second which always seems to work. If you call the first function instead, it should crash. Thanks for testing it out bitRAKE. :)
Posted on 2003-06-15 20:29:37 by AlexEiffel
I'm sorry, should have noticed right away that your using an old version of the fpc macro.
; bitRAKE's Floating point constant macro

fpc MACRO val:REQ
LOCAL w,x,y,z[b][COLOR=red],dummy[/COLOR][/b]

;; split type and value, defaulting to REAL4
z INSTR 1,<&val>,<! > ;; TAB doesn't work!
IF z EQ 0
y TEXTEQU <REAL4>
x TEXTEQU <&val>
ELSE
;; REAL4 REAL8 or TBYTE
y TEXTEQU @SubStr(<&val>,1,z-1) ;; Type
x TEXTEQU @SubStr(<&val>,z+1,) ;; Value
ENDIF

;; replace . with _
z INSTR 1,x,<!.>
IF z EQ 0
w TEXTEQU x
x CATSTR x,<.0> ;; prevent error message
ELSE
w CATSTR @SubStr(%x,1,z-1),<_>,@SubStr(%x,z+1,)
ENDIF

;; replace - with _
z INSTR 1,w,<!->
IF z NE 0
w CATSTR @SubStr(%w,1,z-1),<_>,@SubStr(%w,z+1,)
ENDIF

;; figure out global name for constant
z SIZESTR y ;; use last char for size distiction
w CATSTR <__>,w,<r>,@SubStr(%y,z,1)

IF (OPATTR(w)) EQ 0 ;; not defined
[b][COLOR=red] dummy EQU $ ;; MASM error fix[/COLOR][/b]
CONST$fp SEGMENT
w y x
CONST$fp ENDS
ENDIF
EXITM w
ENDM
The highlighted line fixes an internal MASM error when switching segments within a macro.
Posted on 2003-06-15 21:21:00 by bitRAKE
Awesome. Thanks a lot for helping me out :grin:
Posted on 2003-06-16 02:13:15 by AlexEiffel