i am coding a program for my web site (http://www.ChronicGames.net) that will be able to download text files with my current stock listed in them and display it in combo and list boxes. you the select what format you want, then it displays the items in that format, then you choose one and view a picture / details of that item.

i have a lot of functionality implemented but i have this really annoying bug that i have absolutely no idea whats causing it. :(
it is the code to add the items from the text files to the list box.
it adds some of the data but then stops half way through an item. this happens in the same place every time. it never happens after a certain amount of characters for each list tho. grrr. i have narrowed the bug down to this piece of code by checking the value of ecx at different points. basically ecx gets to 0 before it should... (ecx being how many bytes are left in the buffer)

EDI is pointing at the beginning of itemstring at this point too, and ESI is pointing at the buffer containing the downloaded file, minus the header.

invoke SendAndRecvProc
invoke HeaderFilterProc

; ECX is correct at this point <<<<<<-----------------------------

invoke RtlZeroMemory,addr itemstring, 1024


lodsb ; load character from esi...
dec ecx

.if al != 13 ; if not at the end of a line...

stosb ; move the byte to edi (itemstring)

.elseif al == 13 ; if we are at the end of a line...

invoke SendMessage, list_item_hand, LB_ADDSTRING, 0, addr itemstring
invoke SendMessage, list_item_hand, LB_SETITEMDATA, eax, 0DEADBEEFh

invoke RtlZeroMemory, addr itemstring, 1024
lea edi, itemstring ; EDI points to the beginning of itemstring

inc esi
dec ecx


cmp ecx, 0 ; did we reach the end?
jne nextgochar ; if not, then jump to nextgochar

invoke SendMessage, list_item_hand, LB_ADDSTRING, 0, ADDR itemstring
invoke SendMessage, list_item_hand, LB_SETITEMDATA, eax, 0DEADBEEFh

; ------------------------------------------------------------

the idea is to add the item when it reaches the end of a line, and when the file is at an end as there wont be any more data. duh.
as i said it is simply ECX getting to 0 before it should. it partially works, with the correct data entered up to a specific point. but then ecx gets to 0 so it adds whatevers in the buffer and carries on... grrrrrrr. any help appreciated.

Posted on 2001-10-02 14:27:38 by skud
Off hand the first thing that occurs to me would be that ecx isn't preserved throughout API calls.

Since esi,edi and ebx are preserved through API calls try using one of the instead.
Posted on 2001-10-02 14:47:15 by Eóin

ha. thats been pissing me off for so long. jesus.
in some tut i read it was used as the counter so naturally i assumed it wouldnt cause any probs.

thanks a TON.

PS. anyone who's interested heres the prog.
it may not work depending on when you use it cos im just using a temporary host. and make sure your online when you click connect or it gets a little .... unstable, and takes ages to realise it cant connect. NB. thanks to Nokturnal for the cool about box and links, and for various other things hes helped me with ;)
Posted on 2001-10-02 14:58:02 by skud
forgot the file :D
Posted on 2001-10-02 15:03:29 by skud
Skud, if you'll use one of that registers remember to save them before changing it value and b4 returning from the procedure pop them back ... I mean...
La_saraza proc

push esi ;save
mov esi, 1234 ;use
pop esi ;restore.

La_saraza endp
Posted on 2001-10-02 17:56:57 by magicmac
cool, 12 people downloaded.
could you tell me what you think, and any advice etc.

Posted on 2001-10-03 14:08:48 by skud
Looks cool enough...

My only thought is you shouldnt assume eveyone has a large window settng. I run on 800x600.. and i cant resize the window to fit..

Posted on 2001-10-03 16:00:45 by NaN

Nokturnal said that too. i use 1024x768 on a 17" monitor.
its fine on mine. takes up about 3/4 of the sreen....

Posted on 2001-10-04 10:46:39 by skud
Heh, im a student, i cant afford such luxuiries :)

Posted on 2001-10-04 16:55:32 by NaN
NaN, if you plan on coding a lot, one of the most important things
is a good an large monitor. I would say 1024x768 is the smallest
semi-comfortable resolution. I personally run 1280x1024 on a 17"
monitor, this is usually very comfortable. I can run a lot of stuff at
once, and I can watch a lot of code. It's really really nice. I'd rather
have a 700mhz athlon with a 17" monitor than a 1400mhz athlon
with a 15".

Oh well, /me raving as usual.:rolleyes:
Posted on 2001-10-04 19:11:49 by f0dder
I would get one if i could afford it..

After all, my disapline is Electrical Eng., I just *really* enjoy the control i get outa programming assembly. (I will admit it, im a control freak). Most poeple i know in my class resent everything there is to do with asm, (mainly due to horribly bad prof's).

So i have to prioritize my buget... and thus my last 400$ investment was for a new lazer printer (seeing my existing one doesnt have *ANY* manufactures that make its tonner cartrige type.... (that sucked! 1 tonner == 1 printer).

But i do *want* a 19" (hehe).. it would rock! but heh, back to reality, im expected to use minimal goverment assistance is to combat rising tuition costs.. :(

Buty one day tho, one day... :)

Posted on 2001-10-05 02:21:45 by NaN
what size monitors do you use then?
17" a luxery??
1024x768 a big resolution?
jesus man.
i consider 50" flat screen a luxury!!
and im a student too.
maybe monitor prices are higher in the US but i somehow doubt it.
try looking for end of line monitors... or repaired ones... or that have some defect like a tiny black pen mark on the casing.
i got my 17" flat screen for ?100 - about $150.
and $400 for a lazer printer!!
where to did you get that from?

if you look you can get amazing deals on-line.
thats how my business operates (more like WILL operate ;).

Posted on 2001-10-05 10:32:26 by skud