The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: Neil on February 19, 2009, 06:50:36 PM

Title: problem testing program
Post by: Neil on February 19, 2009, 06:50:36 PM
I've just started testing my (Almost) finished program, checking for bugs etc. it runs perfectly stable on my machine & also on my wifes laptop, both running Vista32 bit. I also gave my son a copy to check out, his machine was puchased at the same time as mine with an identical spec, on his machine it is completely unstable, crashing all the time. I've checked for corrupted files etc without any joy, I've also tried to post a copy on this forum to see if it is unstable on anyone elses machine, but it gets rejected probably because there isn't enough room on the server. In the meantime if anyone has got any suuggestions why this might happen please let me hear them because I'm totally baffled  :dazzled:
Title: Re: problem testing program
Post by: PBrennick on February 19, 2009, 06:59:51 PM
Perhaps he as tweaked something or messed with Compatibility mode. I do not have access to a Vista machine so I am a little bit at a loss here. What is the fuction of the program, anywho?

If you cannot get the help you need, email the program to me so I can look at the code.

Paul
Title: Re: problem testing program
Post by: donkey on February 19, 2009, 07:24:01 PM
Use a file sharing site to host the project then post a link, then others can test for stability on their systems or perhaps find your problem.

Haven't tried this one but they allow 5GB

http://www.4shared.com/
Title: Re: problem testing program
Post by: ecube on February 19, 2009, 08:25:19 PM
megashares is the best file host, they allows you to password protect upload, don't require a registration, is free, and they allow massive files and give you a link to delete anytime you want.

as far as the application crashing depending what it does other applications could be conflicting with it. Or perhaps you're relying on a assumed file/registry entry etc that's not there and don't do the problem error handling.
Title: Re: problem testing program
Post by: Farabi on February 20, 2009, 04:22:35 AM
Quote from: Neil on February 19, 2009, 06:50:36 PM
I've just started testing my (Almost) finished program, checking for bugs etc. it runs perfectly stable on my machine & also on my wifes laptop, both running Vista32 bit. I also gave my son a copy to check out, his machine was puchased at the same time as mine with an identical spec, on his machine it is completely unstable, crashing all the time. I've checked for corrupted files etc without any joy, I've also tried to post a copy on this forum to see if it is unstable on anyone elses machine, but it gets rejected probably because there isn't enough room on the server. In the meantime if anyone has got any suuggestions why this might happen please let me hear them because I'm totally baffled  :dazzled:

On which OS it is crash?
As far as I test my software on many machine, it always at memory access it cause a crash. Maybe you need to add more bytes than you need to prevent this to be happen. If it crash on vista, maybe you can try it to run it as administrator.
Title: Re: problem testing program
Post by: Neil on February 20, 2009, 08:45:00 AM
Thanks for all your suggestions, I think what I'll first do is give it to some of my friends & see how they get on. The only difference I can think of between my son's & my own machine is that he hasn't got masm32 installed, but I can't see that should be a problem with a standalone program. Thanks for your offer Paul , but the code is 5500 lines long & not fully commented, I'm in the process of doing that at the moment, I tend to write my programs with pen & paper & type them in later, that way I can work out screen layouts etc. beforehand.
Title: Re: problem testing program
Post by: Neil on February 20, 2009, 10:09:45 AM
I've tested it on 2 of my friends machines, one who lives just around the corner from me so I could see it for myself, this one is running XP Home & there is no problem. I've had had a reply from another friend running XP Professional & he has reported no problems. This still leaves me with the mystery of why it won't run on my son's machine & puts a doubt in my mind that it might happen on others. It's a pity I can't post it on this forum so that A few more (expert) users could test it.
I've seen another post where Hutch is trying to sort out the problem of server space, perhaps he'd like to comment on that.
Title: Re: problem testing program
Post by: PBrennick on February 20, 2009, 01:15:22 PM
Neil,
There is, and always has been a 256k limitation for each upload. this makes sense to me. If he did not have that in place, he would be swamped with bandwidth sappers.

The exe does not need to be in the attachment (usually). Everything else can usually be spread through several zips. Even though there is a 256k limitation, you can work around that by doing what I said. It is not convenient, but it is a way. There are several free sites for posting your code, why not make use of one of them? The two suggested by Donkey and E^Cube are excellent. Windows Live offers 25gb of free storage via SkyDrive. Chances are, if you use HotMail, Messenger or similar stuff from MS and partners; you already have a Windows Live ID. If you look at my crappy website, the attachments you see are NOT hosted on FreeHosting, but are on SkyDrive. They also give you those kewl links using iframe tags.

Here is an idea, help us help you.  :U

Paul
Title: Re: problem testing program
Post by: Neil on February 20, 2009, 01:45:49 PM
Thanks paul, the zipped up installation file is 95.5k so i don't think file size is a problem. There is a recent posting with somebody else having the same problem & hutch was looking in to it. In the meantime I have posted it on a file sharing site & am awaiting the url so I can post it on this forum.
Title: Re: problem testing program
Post by: Neil on February 20, 2009, 02:13:33 PM
I'm giving it one more try to post it here. If it succeeds the installation file will create a folder (Lottery) on the root of drive C.
It's a console application, it did star out as a GUI but I decided it was better suited to a console. The program is a UK lottery database program which analyses the all the prevous draws & displays numerous facts obout it. It also provides my attempt at a prediction. It's probably of greater interest to UK members of this forum, but all I'm interested in now is does it run OK.
It doesn't mess with the registry so once it's finished with just delete the folder.

[attachment deleted by admin]
Title: Re: problem testing program
Post by: Neil on February 20, 2009, 02:15:42 PM
It looks as though it's succeeded this time (4th try) I don't know what was wrong before.
Title: Re: problem testing program
Post by: sinsi on February 20, 2009, 03:06:04 PM
With windows7, it crashes all over the place.
QuoteException code: 0xc0000005, Fault offset: 0x00003e6a - view previous draws
Exception code: 0xc0000005, Fault offset: 0x000059d4 - prediction->hot numbers->left arrow
Title: Re: problem testing program
Post by: PBrennick on February 20, 2009, 03:17:27 PM
With Windows XP, HE, SP3

Main Menu 4, left arrow, crashes (right arrow seems to do nothing) - Same as Sinsi's test
Main Menu 5 crashes. - Same as Sinsi's test
Main Menu 6, 1 crashes
Main Menu 6, 2 crashes

Everything else seems stable but I did not do any persistent testing. For the above, it was not necessary. Main Menu 5 displays a continuous stream of incrementing numbers followed by a string of zeroes. When it reaches 0020004330 000000000000 (I added the space) it shoots an exception. The stream has no formatting which, I think, was not what you desired because everywhere else the formatting is excellent.

The exceptions are consistent. They just always crash.

You should post the source so we can better help you. This has the makings of a fantastic app. You have put a lot of effort into it and for a console app, it looks impressive. I hope the bugs can be worked out.

Paul
Title: Re: problem testing program
Post by: Neil on February 20, 2009, 03:30:57 PM
Thanks paul,
It's been 8 months of work getting this far. What I can't understand is why it crashes on some PC's & not others.
Anyway here's the source it's in 2 files Data & Code, I was going to split the code up into smaller files but decided against it.
As I said it's not all commented I've been busy today adding some, but there is still along way to go, also it's a bit gritty, a throw back to my DOS days, I'm working on that as well.

[attachment deleted by admin]
Title: Re: problem testing program
Post by: sinsi on February 20, 2009, 04:05:31 PM
What are ldw/stw? Trying to build it gives me syntax errors.
Title: Re: problem testing program
Post by: Neil on February 20, 2009, 04:25:47 PM
Sinsi,
They are 2 macros I added into macros Asm :-

    ; ----------------------
    ; fast lodsw replacement
    ; ----------------------
      ldw MACRO
        mov ax, [esi]
        add esi,2
      ENDM


    ; ----------------------
    ; fast stosw replacement
    ; ----------------------
      stw MACRO
        mov [edi], ax
        add edi,2
      ENDM
Title: Re: problem testing program
Post by: Neil on February 22, 2009, 08:16:28 AM
I've fired up my old computer (out of the attic) & the program runs perfectly OK on it, so I am unable to reproduce at home the unstability manifesting itself elsewhere. What I've decided to do is finish writing the program then install masm32 & Olly on my son's PC (He lives quite near) & see if I can get to the bottom of this mystery unless of course anyone else can come up with a possible solution.
Title: Re: problem testing program
Post by: sinsi on February 22, 2009, 08:40:40 AM
One thing I noticed, using windbg near those crash addresses, was
- loading a value in ax
- and eax,65535
which left eax as FFF6 (signed maybe?), then that was added to ESI (a pointer to a buffer) - this put ESI pointing to memory 64K past the buffer, there's the access violation.

From a quick look at the code, you seem to be mixing 8-bit, 16-bit and 32-bit code (e.g. "mul ten", "mul tn") which seems ok but is a bit hard to follow...and can have consequences in later code. Is this a straight port from 16-bit (DOS) code?

edit: I tried the program in NT4, 98 and 2000 (via virtualpc) and all showed the same crashes.
Title: Re: problem testing program
Post by: Neil on February 22, 2009, 08:59:04 AM
Sinsi,
The mul tn, ten etc were ported directly from DOS purely as a time saver as I knew they worked, I shall probably be changing them when I refine the code later.
The and eax,65535 is used to clear the hi 16 bits of eax because it's not possible to add ax to esi, I also use it in other parts of the program so that I can use print ustr$(eax) & do away with converting the value to ascii.
Title: Re: problem testing program
Post by: Neil on February 22, 2009, 10:37:13 AM
I'm busy cutting a tree down at the moment so I haven't got much time for programming.
Sinsi that value left in eax does seem rather bigger than it should be, could you give me the line number where it is.
Title: Re: problem testing program
Post by: Neil on February 22, 2009, 03:21:41 PM
I've had time now to look at the code & I think I've found what you were looking at :-

    mul tn            ;get total numbers of balls drawn
    lea esi,Binary    ;point at database
    and eax,65535

When I check the value of eax it's 35A2h which is what it should be.
this is at line 4463
Title: Re: problem testing program
Post by: PBrennick on February 22, 2009, 03:47:16 PM
Neil,
To add AX and ESI all you need to do is a Sign Extend.

QuoteIn the x86 instruction set, used by the main microprocessors of all common PCs, there are two ways of doing sign extension:

    * using the instructions cbw, cwd, cwde, and cdq ("convert byte to word", "c. word to doubleword", "c. w. to extended dw.", and "c. dw. to quadword", respectively; in the x86 context, a byte has 8 bits, a word 16 bits, a doubleword and extended doubleword 32 bits, and a quadword 64 bits);
    * using one of the sign extended moves, accomplished by the movsx ("move with sign extension") family of instructions.

The sign is preserved. These methods are preferable as they are less prone to errors.

hth,
Paul
Title: Re: problem testing program
Post by: Neil on February 22, 2009, 04:35:26 PM
Hi Paul,
I'm using unsigned numbers, so correct me if I'm wrong, I don't think it would work in my case, thats why i'm blanking the Hi 16 bits of eax before using the add instruction.
Title: Re: problem testing program
Post by: Neil on February 22, 2009, 04:38:38 PM
Thinking about it a bit more, changing my data to dd instead of dw would do away with the problem altogether.
Title: Re: problem testing program
Post by: Neil on February 22, 2009, 05:06:00 PM
Paul I wasn't thinking straight (I've had a busy day), you're right I don't use negative numbers so bit 15 of ax would be zero & wouldn't change the value overall :red
Title: Re: problem testing program
Post by: Neil on February 23, 2009, 09:20:49 AM
I've tried replacing this :-

    mov ax,evens
    and eax,65535

with

    mov ax,evens
    cwd

Now the program crashes on my computer, ax never contains a value greater than 6.
I'm getting even more confused now :eek

Title: Re: problem testing program
Post by: sinsi on February 23, 2009, 09:45:09 AM
QuoteThe and eax,65535 is used to clear the hi 16 bits of eax because it's not possible to add ax to esi
The trouble is (as far as I've followed that one problem) is that your cursor position seems to be a negative (FFF6), so when you 'and eax,FFFF' you are adding FFF6 to ESI.
Using CWD only sign-extends AX into DX:AX, you need something like    movsx eax,evensThis will give you the correct value in EAX (FFFFFFF6) and not DX:AX
Title: Re: problem testing program
Post by: Neil on February 23, 2009, 09:52:52 AM
Thanks sinsi,
I'll look into that.
Still the big mystery is that it's been tested on 8 different PC's, 4 on which it runs perfectly & 4 on which it crashes.
Title: Re: problem testing program
Post by: Neil on February 23, 2009, 09:59:12 AM
sinsi,
movsx has cured that one, I was using edx it bit further on in the loop & of course cwd was corrupting it :U
Title: Re: problem testing program
Post by: jj2007 on February 23, 2009, 02:09:53 PM
cwd doesn't work, but there are two other instructions which perform the job:

   xor eax, eax
   mov ax, 0fff6h  ; create a test case
   cwde
   print str$(eax), 9

   xor eax, eax
   mov ax, 0fff6h  ; create a test case
   movsx eax, ax
   print str$(eax)

From Intel Hex Opcodes And Mnemonics (opcodes.hlp):

CWDE - Convert Word to Extended Doubleword (386+)
        Usage:  CWDE
        Modifies flags: None
        Converts a signed word in AX to a signed doubleword in EAX by
        extending the sign bit of AX throughout EAX.

MOVSX - Move with Sign Extend (386+)
        Usage:  MOVSX   dest,src
        Modifies flags: None
        Copies the value of the source operand to the destination register
        with the sign extended.

cwde is one byte short, movsx needs three bytes.
Title: Re: problem testing program
Post by: Neil on February 23, 2009, 03:02:00 PM
Thanks for the info jj :thumbu
Title: Re: problem testing program
Post by: Neil on February 23, 2009, 04:45:46 PM
Right I've made some mods to the program & it now works on my son's PC, where before it was crashing.
Can some of you retest it & see if the instability has been cured,
thanks

[attachment deleted by admin]
Title: Re: problem testing program
Post by: Mark Jones on February 23, 2009, 09:39:10 PM
Hi Neil, I started the app, generated a few numbers, then chose "View Previous Draws" and screen after screen of the following appeared:


00000000020004238000000000000000020004239000000000000000020004240000000000000000
02000424100000000000000002000424200000000000000002000424300000000000000002000424
40000000000000000200042450000000000000000200042460000000000000000200042470000000
00000000020004248000000000000000020004249000000000000000020004250000000000000000
02000425100000000000000002000425200000000000000002000425300000000000000002000425
40000000000000000200042550000000000000000200042560000000000000000200042570000000
00000000020004258000000000000000020004259000000000000000020004260000000000000000
02000426100000000000000002000426200000000000000002000426300000000000000002000426


Followed by a page fault at 0x403E92h. Using XP SP3.
Title: Re: problem testing program
Post by: Neil on February 24, 2009, 08:47:22 AM
Thanks Mark,
Looks like back to the drawing board once again :(
Title: Re: problem testing program
Post by: z941998 on September 18, 2009, 07:47:55 AM
Hi Neil,

Any luck since you last posted (Feb 2009).

I am interested in your source code availability.

I have written a program for the Power Ball and Gopher 5 here in Minnesota and want to make some updates.  I also kinda the graphics approach you have taken.

I would like to privately discuss theories with you.  Contact me at stevenlong@usfamily.net

Thanks
Steve