Sliver, feel for ya man - been there dozens of times. It just
needs to become heavy scar tissue, then your good for life!
:) :) :)
Posted on 2002-02-21 00:53:24 by bitRAKE
:)

The problem the error was on the next command after the "lea" statement...

So I spent those 30 minutes changing things around like

mov .weapon, edi

mov .weapon,

lea .weapon, edi

lea .weapon,

lea edx, edi
mov .weapon, edx

then I went to using the local stack... Anyway, I think you get the picture...

I'm gonna upload my new thing *hopefully* in about an hour *hopefully*...

some cool new additions :)

This has been seriously a great learning expereince...

Sliver
Posted on 2002-02-21 01:01:44 by Sliver
Ok given an input of

3 5 0 0 1
3 5 3 5 0
3 5 5 3 5

This code is supposed to break up and handle each line individually. Now the readline proc works... however when the file is being converted using atodw I get some strange outcomes...

here is what it print using debug.inc

eax = -1984453087
eax = 136165533/
eax = 26426401
eax = 26401
eax = 1
eax = -1981448088
eax = 1364660328
eax = 29431400
eax = 31400
eax = 0
eax = -1979450083
eax = 1366658333
eax = 31429405
eax = 29405
eax = 5

I noticed that only the last digit seems to be recognized and I tested this fact by only having one digit on the line and it worked... however, I'm not content with this outcome and still want to have the whole line parsed.... Any ideas?

Code listed below:



mov ecx,0

@OuterOuterloop:
push ecx

mov ecx, 0
@Outerloop:
push ecx

xor eax, eax
.while eax == 0
invoke ReadALine, pointer, ADDR buffer
add pointer, ecx
.endw
mov esi, offset buffer

mov ecx, 0
@Innerloop:
push ecx

.while (BYTE PTR [esi] == ' ')
inc esi
.endw
invoke atodw, esi
PrintDec eax
inc esi

pop ecx
inc ecx
cmp ecx, 5
jnz @Innerloop


pop ecx
inc ecx
cmp ecx, 3
jnz @Outerloop

pop ecx
inc ecx
cmp ecx, 1
jnz @OuterOuterloop


Posted on 2002-02-21 02:46:48 by Sliver
Quick question:

Why doesn't this work...



invoke szMid, edi, ADDR Buf, edx, eax
lea edx, Buf
mov [esi].rname, edx ;<---error here


Given a structure described like:



LOCATIONS struct
north dd 0
south dd 0
east dd 0
west dd 0
neast dd 0
nwest dd 0
seast dd 0
swest dd 0
rname db 24 DUP (0) <--- this is the string I want to change
numberofritem dd 0
ritem dd 2 DUP (0)
LOCATIONS ends


Basically the rname is defined already and I want to change the value at runtime to another string, but when I try to do that it says "invalid instructions operand"

I can change all the other code at run time, just not the string...

Also, the StdOut works perfectly and displays the word... so why can't I change over the locations

PLEASE HELP ME!!!!

Sliver
Posted on 2002-02-22 19:09:29 by Sliver
Sliver, the problem is that in your struct you have allocated 24 bytes to actually contain a string. However in the code you post you try to put a pointer to a string in the struct rather than the string itself.

Perhaps a simple solution would be to have szMid to put the substring directly into the struct for you.

invoke szMid, edi, ADDR .rname, edx, eax

That should hopefully work.
Posted on 2002-02-22 19:35:29 by Eóin

Quick question:

Why doesn't this work...



invoke szMid, edi, ADDR Buf, edx, eax
lea edx, Buf
mov [esi].rname, edx ;<---error here


Given a structure described like:



LOCATIONS struct
north dd 0
south dd 0
east dd 0
west dd 0
neast dd 0
nwest dd 0
seast dd 0
swest dd 0
rname db 24 DUP (0) <--- this is the string I want to change
numberofritem dd 0
ritem dd 2 DUP (0)
LOCATIONS ends


Basically the rname is defined already and I want to change the value at runtime to another string, but when I try to do that it says "invalid instructions operand"

I can change all the other code at run time, just not the string...


Hi sliver,
it seems the rname field in ur structure is the 1st of ur string
and not a pointer to a string
So u cant copy edx thats a dword into a byte thats the reason of ur error and anyway if u wanna substitute the rname string with the one pointed by edx u've to copy the edx pointed string
into the rname field byte a byte this way:

mov esi,buffer
mov edi,offset_of_the_rname_field_in_the_structure
copia:
mov al,
mov ,al
test al,al
jnz copia

Altrimenti se sai quanti byte devi copiare di preciso puoi fare:
mov ecx,len_str
mov esi,buffer
mov edi,offset_of_the_rname_field_in_the_structure
repz movsb

See ya
NikDH
Posted on 2002-02-22 19:42:49 by NikDH
Well, time for another update....

What this comes with:
-Text parsing / Map support :)
(now it builds the world based on the "World.txt" supplied)

//999 = not an exit, all other number will become the pointer
//to the other rooms
//ROOM 0 <aka temple>
// Room:N S E W NE NW SE SW #ofroomitems (1st ritem, 2s ritem) 'name'
999 3 1 999 999 999 4 999 1 1 0 'The Temple'

-You can now have weapons in the inventory and weapons disappear after they've been "picked up"

Movement : n,s,e,w,nw,ne,sw,se
Map : m
Help : h
Exit : x
Get item : g
list items: l


Sliver

ps. Still can't fight and no monsters yet.... still tryint o figure all that stuff out...

pps. all suggestions welcome
Posted on 2002-02-24 10:57:07 by Sliver
Here it is, the long awaited XY proggy. As I stated on the accompanying readme file, this is just to give you an example of the XY concept I was talking about. Though this one is already D3D ready, I disabled the D3D routines. Once I get the map editor, map loading into full working condition, I'll add directx functionality and probably add dll's for weapons, armors, enemies, items...

The only thing that always stumped me is the map stuff. I'll do a little research on other games, on how they do those custom maps. Though, I have an idea for it, It would be much better if I research more on this. If I can produce this, it'll no longer be a static 3x3 map but a custom map based on the map editor. It could be 16x16 or 9x9, anything the user desires.

Controls:

Right Mouse Button: Main Menu
Up Key: Move Up
Down Key: Move Down
Right Key: Move Right
Left Key: Move Left

This proggy is still based on the 3x3 map:


[ 0 ] [ 1 ] [ 2 ]
[ 3 ] [ 4 ] [ 5 ]
[ 6 ] [ 7 ] [ 8 ]


I suggest when you run the program, you should open up also the gif file I created on the first version of the game. Or you can refer to the crude map above. Why? the constant popup of a messagebox might annoy you in the long run :)


Happy ASMing!!!


And before I forgot, you can then use the calculated room location to the appropriate, parallel room structure, where in this structures contains the data for your weapons, enemies...That way, you don't need to fiddle with N, S, NE, SW location structure members, thus reducing instruction, less memory...
Posted on 2002-02-24 22:54:53 by stryker
If you see this line of code sub eax, 1 -> chage this to dec eax. I'm so ashamed I forgot the dec instruction :)
Posted on 2002-02-25 13:19:19 by stryker
I like the way you're going with your application -- maybe a cooperative is in order?

:) :) :)

I'm having fun writing this program (and seeing how your approach the same topic with different ideas)... Keep up the good work

Sliver
Posted on 2002-02-25 16:57:54 by Sliver
I'll start coding for the game this summer, since I'm a little bit busy nowadays. So you might not hear from me soon on updating this project. But if you have questions or need some ideas just ask, I'll response but I won't update the recent version of the game until summer vacation. :) Ooops, you'll be finished by that time :)
Posted on 2002-02-26 20:18:07 by stryker