News:

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

Newbie Question number infinity plus one

Started by Wez, December 18, 2007, 12:18:39 AM

Previous topic - Next topic

Wez

Hi, I'm new MASM, therefore I have a few questions...

I'm trying to keep track of some values as they go through a series of calculations, so I kept 'print' ing out the value as they went through each step but kept coming out with some very strange numbers so I experimented with all the GP registers and confirmed my suspicions. What I'm asking is, is there a fix for this, which include file has the print and str$ macros? or am I just doing it all wrong and need to use some other instruction?

The experiment code is as follows:

mov eax, 16
mov ebx, 32
mov ecx, 64
mov edx, 128
mov esi, 256
mov edi, 512

print str$(eax)
print str$(ebx)
print str$(ecx)
print str$(edx)
print str$(esi)
print str$(edi)

print chr$(13, 10)

print str$(eax)
print str$(ebx)
print str$(ecx)
print str$(edx)
print str$(esi)
print str$(edi)

exit

What I expected was:

16
32
64
128
256
512

16
32
64
128
256
512

But instead I got:

16
32
2011667995
1
256
512

2
32
2011667995
1
256
512

Leaving the only general purpose registers for calculations in my book is, ebx, esi, and edi.
Is this right?

Thank you in advance for any help

Wez
:red :red

hutch--

Hi Wez,

It is important to make sure you build the exe as a CONSOLE mode app. In MASM32 its a menu option, if you are coding the app and building it in a different manner you need to set the linker option to CONSOLE so that data can be displayed in a console.

With an app built in this manner you would normally run it from the console, CMD.EXE or COMMAND.COM in early windows versions.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Wez

Hi, thanks for the help, but I've moved away from the console idea. Now I've got a dialog with a nice progress bar, but I'm still having trouble displaying the table of values. Any pointers where I can find this sort of info?

dsouza123

This example reuses an dialog program that has been slightly modified
to have 16 edit items across  0 to F, and 16 edit items down  0 to F,
but is only sparsely defined, only row 0 and column 4 are implemented.

See the resouce source file  rsrc.rc  for the definition of the sparse pseudo grid.

It puts numeric text in edit items.
It gets/converts the numeric text into a number, placed into a register.
Does some calculations with the numbers.


[attachment deleted by admin]

u

Or you can draw the graphics/text directly in the window via GDI:


InvalidateRect
UpdateWindow

on WM_PAINT, do:
BeginPaint
<some dwordToAscii proc>
<some strlen proc>
TextOut
EndPaint



Ahh, also - that whole thing with "...exe has encountered a problem" - you definitely must get rid of it, and make Windows show vital info (register-values) and install OllyDbg to see easily where and why your app crashed. For non-crashing stuff, VKDebug is immensely useful, too (it comes with the MASM32 package by default).
x86 + Windows is the absolutely easiest platform to develop for, once you have:
- a decent IDE or text-editor
- both debuggers
- an offline copy of MSDN'98, (it's much faster to load and browse than the online version or any newer version, and also has "locate this article in contents" command). Simplified .hlp files with tiny excerpts of the documentation for each API function.... simply don't cut it when you get serious. I cannot accent on this enough.

It's all aeons ahead of MPLAB :)
Please use a smaller graphic in your signature.

Jimg

#5
Or you can use the report view of a listview control.  Listview has a pretty awful api for a beginner though.  Also, you can use a grid control.  RaGrid and BrilliantGrid are two that come to mind.

edit:
Or here's a copy of the grid I'm writing.  It's a work in progress, but should be good enough for what you're asking for.

[attachment deleted by admin]

Wez

#6
Thanks for the help everyone. I've gone back to the console idea, now that I compile it correctly (Thanks Hutch) I can display the table of values but I'm having trouble with dereferencing the values, is there a handy way of keeping these straight or maybe a watch window to see whats going on or even an emulator possibly??? I'll keep plugging away, when I run out of ideas I'll post what code I have and see where we can go from there.

Thanks Again
Wez