1. to Pete or anyone with asm knowledge

I have this problem with some assembly code that I wrote.
This works:

PUSHA
CLD
(some calculations...)
MOV ESI,sprite_pointer
MOV EDI,screen_pointer
MOV ECX,x_dim
horizontal_loop:
LODSB
CMP AL,0
JE no_pixel
STOSB
JMP no_edi_inc
no_pixel:
INC EDI
no_edi_inc:
LOOP horizontal_loop

However, this does not work:

PUSHA
CLD
(some calculations...)
MOV ESI,sprite_pointer
MOV EDI,screen_pointer
MOV ECX,floor(x_dim/2)
horizontal_loop:
LODSW
CMP AL,0
JE low_no_pixel
STOSB
JMP low_no_edi_inc
low_no_pixel:
INC EDI
low_no_edi_inc:
MOV AL,AH
CMP AL,0
JE high_no_pixel
STOSB
JMP high_no_edi_inc
high_no_pixel:
INC EDI
high_no_edi_inc:
LOOP horizontal_loop

Note that I didn't write "floor(x_dim/2)" in the assembly code, the
values are poked into the routine from a procedure using the get_param()
data-system in asm.e. It didn't matter if I used the first  code, as
soon as I tried to poke floor(x_dim/2) into the x_dim variable the
routine caused a CauseWay error. My question is, why ?

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu