The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: tamarpe on March 28, 2007, 02:22:45 PM

Title: problem in my program.. plz help
Post by: tamarpe on March 28, 2007, 02:22:45 PM
i use in tasm...
i have a smily, and thinks that need to block my smily and frame
but if i walk on the blocks or frame, my smily eat tham..
what i need to write to block my smily if he walk on the frame or the blocks?
thanks..
here my program-

[attachment deleted by admin]
Title: Re: problem in my program.. plz help
Post by: MichaelW on March 28, 2007, 04:36:57 PM
Before you move the smiley, check the color of the square that the smiley will move into, and if the color is red, then don't move the smiley.
Title: Re: problem in my program.. plz help
Post by: tamarpe on March 28, 2007, 06:30:31 PM
thanks.. but how i write that?
Title: Re: problem in my program.. plz help
Post by: tamarpe on March 28, 2007, 07:43:26 PM
my frames is stars(*)
its what i write in when he walks right

right: ; move to right
cmp al, 'd'
jnz up2
cmp [bx+2],  '*'
jz  next
mov [bx], si
add bx, 2
mov [bx], dx
next:
jmp again

is steel not working..
Title: Re: problem in my program.. plz help
Post by: MichaelW on March 28, 2007, 08:07:05 PM
The frame is '*' but the "hook" on the left is 'S'. You could change them both to the same character, or use something like this to compare the attribute byte (this is MASM syntax, I'm not sure what TASM will require):

CMP BYTE PTR [BX-2+1], 44H
JEĀ  RIGHT

Title: Re: problem in my program.. plz help
Post by: tamarpe on March 28, 2007, 09:09:27 PM
thanks :) :)
its workks  :8)
and how i do if the smily tuch star (*) so the star will move?
Title: Re: problem in my program.. plz help
Post by: MichaelW on March 29, 2007, 01:12:31 AM
You could check the character or attribute (color) or both at [bx] and move the * before you draw the smiley at that location. You still have DI free, so it could be loaded with the character and attribute for the *.
Title: Re: problem in my program.. plz help
Post by: tamarpe on March 29, 2007, 09:48:26 AM
cmp byte ptr [bx+2],  '*'
jz  next2

and where i do the stars i write-
next2:
add bx,2
mov [bx],ax

why is not working?
thanks :)