News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Thanks, Demonstration

Started by raleeper, August 27, 2007, 09:43:53 PM

Previous topic - Next topic

raleeper

1.  Thanks to all who have responded to my previous questions!

    I couldn't have gotten to where I am - at least as quickly - without your suggestions.

    And you help even when you don't, in that a] knowing that there is help out there gives me the strength to go on, and b] I often solve problems just in the process of formulating questions.  And then there are the cases where you suggest one thing and I decide to do it [something] a different way, but later find the suggestion valuable for a related purpose.

2.  I originally described my project as "converting a DOS program for windows", but I find that what I need to do, and am doing, is to rewrite the program from the ground up.

    So - I figure I'm about 19% through this, and at a point where a demonstration might be of some interest.

    The zip file below needs to be unzipped into c:\lfw or g:\lfw to function as intended.  Those are the places where lfw.exe will look for the "rider file", which in this case is the lf-format version of the program's source code.  (Hit 'page down' or '1' for the source code)

    I haven't solved the character set problem yet, so for much of the pseudo-code you will have to imagine that the hollow squares are left arrows.  I will ask you also to imagine that the square root symbol at the end of many lines is a down arrow.

    It is very much a work in progress and some things don't work as they should, in particular command F11, choose font.  Also, I haven't yet put in the code to destroy/release the objects used.

http://www.intergate.com/~rale/lfw.zip


Best Wishes,

raleeper (Robert A. Leeper)

Tipidy

Extracted lfw and got an error message everytime I tried to execute the binary file, you know the one where it asks you to send or don't send...  :dazzled: I am running Windows XP if you were curious  :wink

raleeper

Quote from: Tipidy on August 28, 2007, 05:31:36 AM
Extracted lfw and got an error message everytime I tried to execute the binary file, you know the one where it asks you to send or don't send...  :dazzled: I am running Windows XP if you were curious  :wink

I don't know what the problem is.  Sorry.  It works on my XP system.  Also, I don't recognize that error message.  Could you describe it more fully?

sinsi

Here's what happens on my system - XP home, sp2
Quote
Faulting application lfw.exe, version 0.0.0.0, faulting module lfw.exe, version 0.0.0.0, fault address 0x00001783.
Error was c0000005 - access violation

Edit: tried in win95 osr2
Quote
LFW caused an invalid page fault in
module LFW.EXE at 0137:00401783.
Registers:
EAX=20202020 CS=0137 EIP=00401783 EFLGS=00010202
EBX=00000000 SS=013f ESP=0064fc40 EBP=0064fc94
ECX=00000000 DS=013f ESI=00661559 FS=251f
EDX=00000001 ES=013f EDI=00417cf9 GS=0000
Bytes at CS:EIP:
8a 33 8b 73 04 83 c3 08 38 36 72 f6 77 23 46 8b
Stack dump:
00401388 004012e2 00000094 0064fc58 000005fe 00000000
00000000 00000000 00000400 000002d1 00000000 00000000
0064fbf8 bff71923 00000000 004012f5
Light travels faster than sound, that's why some people seem bright until you hear them.

raleeper

Quote from: sinsi on August 28, 2007, 06:16:21 AM
Here's what happens on my system - XP home, sp2
Quote
Faulting application lfw.exe, version 0.0.0.0, faulting module lfw.exe, version 0.0.0.0, fault address 0x00001783.
Error was c0000005 - access violation

Edit: tried in win95 osr2
Quote
LFW caused an invalid page fault in
module LFW.EXE at 0137:00401783.
Registers:
EAX=20202020 CS=0137 EIP=00401783 EFLGS=00010202
EBX=00000000 SS=013f ESP=0064fc40 EBP=0064fc94
ECX=00000000 DS=013f ESI=00661559 FS=251f
EDX=00000001 ES=013f EDI=00417cf9 GS=0000
Bytes at CS:EIP:
8a 33 8b 73 04 83 c3 08 38 36 72 f6 77 23 46 8b
Stack dump:
00401388 004012e2 00000094 0064fc58 000005fe 00000000
00000000 00000000 00000400 000002d1 00000000 00000000
0064fbf8 bff71923 00000000 004012f5


It's crashing because ebx is not initialized and is 0 when it hits the mov dh, [ebx] (8A 33) instruction.  But why this should happen is beyond me.

ebx should have gotten its value from mov ebx, [mfa] a few lines back.  mfa should have been initialized in wmmap, which gets called early in processing WM_PAINT in the windows procedure.

I guess I am doing something wrong, so that the exe file is incomplete and needs symbol files or something.

Maybe someone else can help.

Sorry.

thomas_remkus

I am also happy to feel invited on this forum. There are so many people here with outstanding knowledge and skills I always find strength here when I'm feeling challenged. Thanks to everyone.

pcMike

It crashes here as well, under Vista.

I looked at the source but it was very difficult to follow what it's doing. (ie: no commenting)

Regards, Mike

tenkey

Quote from: raleeper on August 28, 2007, 08:54:05 AM
It's crashing because ebx is not initialized and is 0 when it hits the mov dh, [ebx] (8A 33) instruction. But why this should happen is beyond me.

ebx should have gotten its value from mov ebx, [mfa] a few lines back. mfa should have been initialized in wmmap, which gets called early in processing WM_PAINT in the windows procedure.

WM_PAINT calls displ which calls dsp which uses EBX, ESI, and EDI.

When you return from a window procedure (your WProc), registers EBX, ESI, and EDI must have the same value they had when the procedure was called. Different builds and different call chains will use EBX, ESI, and EDI in different ways. The OS relies on EBX, ESI, and EDI not being changed by a window procedure.

Your window procedure is a "callee".

Standard register "saving" conventions followed by the OS:

Caller save registers - caller must save and restore registers if it wants to keep values across a call:
EAX, ECX, EDX
Callee save registers - callee must save and restore registers if it wants to use these registers
EBX, ESI, EDI
Stack frame registers - there is a standard usage for these registers
ESP - built in stack pointer
EBP - if set up by PROC, used to access arguments and local (stack) data, standard prologue and epilogue will save EBP at the start of a PROC and restore it on a RET (effectively, this is a callee save register)

In addition, the DF flag controlled by the SETD and CLRD instructions must be cleared before calling an API, and before returning to the OS. It is always cleared at the start of the program, and at the start of a procedure called from the OS.
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8