News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

ml.exe 10 strange behaviour

Started by HellRaider, March 16, 2013, 11:03:42 PM

Previous topic - Next topic

HellRaider

I was trying out ArTeam Win32 Assembler Coding -> "Customising Your Keygen" tutorial

Everything works fine for ml.exe provided in masm32v11r.zip. But when i upgraded ml to v10 (Visual Studio 2010) it started showing error in that particular example only. Also it did not produce any executable.

C:\WinAsm\f-CustomKeygen.asm(71) : error A2070:invalid instruction operands

Line 71 : invoke uFMOD_PlaySong,addr table,xmSize,XM_MEMORY

Any help other than suggesting to stick with old version will be appreciated...... Thanks


Vortex

Hi HellRaider,

Dave is right. You should read the forum rules before asking support to build a keygen.

hutch--

Apart from removing any reference to keygens, what you need to do is compare the function prototype to the data sizes in your own calling of the function.

Also if you are not in a position to debug ML 10.00, use 9.00, seemed to do everything fine.

HellRaider

With due respect :dazzled: @dedndave and @Vortex, I did not ask for coding a keygen......
Basically i was trying to play .xm file using ufmod library

Thanks @hutch--, any pointer how to debug ml 10.
I cant understand why when passing .xm as table the program doesn't work (works fine in default ml). But it works fine when passing .xm directly as resource.

Not working:
invoke uFMOD_PlaySong,addr table,xmSize,XM_MEMORY

Working Code:
invoke uFMOD_PlaySong,123,xmSize,XM_RESOURCE
.rc
123 RCDATA DISCARDABLE "C:\WinAsm\uFMOD\chiptune.xm"





@compare the function prototype to the data sizes in your own calling of the function.
how??

dedndave

here is the thing...

if you can't get through the first post without mentioning keygen's,
then assembly language may not be your cup of tea

when you register for the forum, you confirm that you have read the rules
if you want to play with the big dogs, you have to be able to absorb a lot of documentation

you could have asked for help without mentioning keygen's, at all - DOH
that's your bad, not ours - don't try to turn it back on Vortex and me - lol


as for the difference between the working and non-working code...

with the incomplete code example, we cannot really say what the problem is
i.e., we do not know how "table" and "xmSize" are defined
we can assume that you have included ufmod.inc, so that XM_MEMORY and XM_RESOURCE are defined as equates


here is what i recommend...

create a small example program, using just uFMOD_PlaySong
try not to name it "keygen.asm"   :P
attach the entire project so that we don't each have to write a program to offer assistance
by doing that, we can see how you have defined the variables, prototypes, and so on

also - let us know which version of the library you are using

HellRaider

#6
; ufmod-1.25.2a-win32

.386
.model flat, stdcall
option casemap:none

include windows.inc
include kernel32.inc
include user32.inc
includelib kernel32.lib
includelib user32.lib
include C:\WinAsm\uFMOD\ufmod.inc
includelib C:\WinAsm\uFMOD\ufmod.lib
includelib winmm.lib

.data
include C:\WinAsm\uFMOD\chiptune.inc
xmSize equ $ - table

.data?
hInstance   dd ?

.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax

;error -> option 1
;invoke uFMOD_PlaySong,addr table,xmSize,XM_MEMORY

;works fine -> option 2
;invoke uFMOD_PlaySong,123,hInstance,XM_RESOURCE

invoke Sleep,10000
invoke ExitProcess,0
end start



.rc file for option2
123 RCDATA DISCARDABLE "C:\WinAsm\uFMOD\chiptune.xm"

Vortex

xmSize equ $ - table

I assume table is defined in chiptune.inc


HellRaider

yes.

include C:\WinAsm\uFMOD\chiptune.inc

works fine for default ml
but not working in ml 10

dedndave

that means we cannot build the sample project without it   :P
i managed to find a file that is named chiptune.xm, at 16,417 bytes
but - that isn't an INC file - lol

i noticed that you have the line
includelib winmm.lib
but, i don't see the INC file to go with it
probably not the problem, but i thought i'd mention it

you can attach zip files to your post - see the Attachments and other options link under the reply window

jj2007

#10
Quote from: HellRaider on March 17, 2013, 04:38:55 AM
Not working:
invoke uFMOD_PlaySong,addr table,xmSize,XM_MEMORY

The problem is not addr table, but rather xmSize. You may use

mov eax, xmSize
invoke uFMOD_PlaySong,addr table, eax, XM_MEMORY

If you want to save the extra byte, here is a solution that works with ML 6.15 and ML 10.0:

include chiptune.inc
xmSize CATSTR %($ - table)

Looks kinda weird, of course. Don't call it a bug in ML 10.0, it's certainly a feature :greensml:

By the way, JWasm will assemble your proggie more than twice as fast as ML 10.0, and it accepts the old syntax.

dedndave

that seems strange
i wonder if this would work
invoke uFMOD_PlaySong,addr table, dword ptr xmSize, XM_MEMORY

also - beware of possible problems using the $ operator
i seem to recall there was a masm bug with that one

one possible work-around for the bug might be
.data
include C:\WinAsm\uFMOD\chiptune.inc
xmEnd label byte
;
;
invoke uFMOD_PlaySong,addr table, dword ptr (xmEnd-table), XM_MEMORY

you may not even need the "dword ptr" or parens

HellRaider

Quote from: jj2007 on March 18, 2013, 08:41:11 AM
include chiptune.inc
xmSize CATSTR %($ - table)


Worked like a charm... :eusa_clap:

dedndave