Search found 9 matches

by basil99
Sun Aug 11, 2013 2:38 pm
Forum: Assembly and C Programming in PureBasic
Topic: Need help or advice
Replies: 4
Views: 4022

Re: Need help or advice

Thanks, wilbert

I use wrong syntax for mov [v_DebugVar], ecx. Now I get offset working, and correct chunk size on 32bit ( 10 bytes as you ), also seems jmp ecx works fine.

Think, i can finish this code today ) Thanks again. Its hard to get back into assembly )
by basil99
Sun Aug 11, 2013 1:27 pm
Forum: Assembly and C Programming in PureBasic
Topic: Need help or advice
Replies: 4
Views: 4022

Re: Need help or advice

I think you would need to remove the word offset

I asume you unroll because of speed reasons.
If I remember correctly, lodsd is not very fast.

Yes, i need to unroll to gain more speed. NP ro replace lodsd with mov eax, [esi] / add esi, 4

Also, I tried to remove offset, and debug the value ...
by basil99
Sun Aug 11, 2013 12:06 pm
Forum: Assembly and C Programming in PureBasic
Topic: Need help or advice
Replies: 4
Views: 4022

Need help or advice

Hi!

Just want to unroll a loop, like this:


!mov ecx, ebx

!horloop:

!lodsd
!mov [edi], eax
!add edi, 4

!dec ecx
!jnz horloop


Counter is always limited by some given value, say, 1024. So, idea is to calculate the size
of "chunk", then jump to the entry point, skipping some part of repeating ...
by basil99
Mon Jul 02, 2012 2:22 pm
Forum: Coding Questions
Topic: assembly question
Replies: 14
Views: 2446

Re: assembly question

If you're only moving data from one place to another, why not use the built in 'CopyMemory()' function instead?

If pitch is same for source and destination I think something like this would work OK:

CopyMemory(SourceAdress, DestAdress, (width*4+pitch)*height)


Good idea, mate. I have smth more ...
by basil99
Mon Jul 02, 2012 12:44 pm
Forum: Coding Questions
Topic: assembly question
Replies: 14
Views: 2446

Re: assembly question

Great ! It works.
and I need to learn syntax better.
Thanks a lot for this
by basil99
Mon Jul 02, 2012 11:37 am
Forum: Coding Questions
Topic: assembly question
Replies: 14
Views: 2446

Re: assembly question

Stiil confused (
Seems, need to explain more clear what i'm doing.

1. Third party code prepares a raw RGBA image ( actually BGRA ). I know image adress, image Width and Height, and image Pitch = len of one pixels line. Pitch in general is not equal to Width*4. Also, a destination adress is known ...
by basil99
Mon Jul 02, 2012 10:36 am
Forum: Coding Questions
Topic: assembly question
Replies: 14
Views: 2446

Re: assembly question

If your code is in a procedure you mess up the stack index of the local variables with pushad. Thats why it crashes.

Try this:

!push esi
!push edi

!mov esi, [p.v_S+8]
!mov edi, [p.v_D+8]
!mov ecx, [p.v_DrawWidth+8]

!FDloop:
!mov eax, [esi]
!add esi, 4
!mov [edi], eax
!add edi, 4
!dec ecx ...
by basil99
Mon Jul 02, 2012 9:14 am
Forum: Coding Questions
Topic: assembly question
Replies: 14
Views: 2446

Re: assembly question

Thanks for replies.

l_FDloop don't work, but !FDloop does.
Anyway, I need further assistance.
This assembly code:

EnableASM

PUSHAD

MOV esi, S
MOV edi, D
MOV ecx, DrawWidth

!FDloop:

MOV eax, [esi]
ADD esi, 4
MOV [edi], eax
ADD edi, 4
DEC ecx
JNZ FDloop

POPAD

DisableASM ...
by basil99
Sun Jul 01, 2012 8:01 am
Forum: Coding Questions
Topic: assembly question
Replies: 14
Views: 2446

assembly question

Hi!
Have this simple assembly code in my PB programm

EnableASM

PUSHAD

MOV esi, S
MOV edi, D
MOV ecx, DrawWidth

FDloop:

MOV eax, [esi]
ADD esi, 4
MOV [edi], eax
ADD edi, 4
DEC ecx
JNZ FDloop

POPAD

DisableASM


try to compile and get this error messge:

Purebasic assembler error ...