What is the best way of doing repeating tasks?by Ben (no login)By best, I mean fast. What I mean is this: For example, I have 50 stored integers somewhere in my memory. I need to add a certain number to all of them. In QBasic it might look like: for i=0 to 199 integers(i)=integers(i)+10 next There is no way of doing this in one instruction as far as I know in assembly. One way: mov [var],199 label1: ;code mov di,[var] add [es:di],10;something like this sub [var],1 ;or maybe dec instruction more approiate cmp [var],0 jne label1 there is also loop where i can do mov cx,199 label1: mov di,cx push cx;I might need cx add [es:di],10 pop cx loop label1 and I think there are other options which I'm still not aware of. So what is the best option here? And those that use cx will have me push cx and that will add more instrucitons and slow it down. Ben |
| Response Title | Author and Date |
| Re: What is the best way of doing repeating tasks? | on Jul 2, 9:55 AM |
| OK, thanks | Ben on Jul 2, 1:31 PM |
| I like the 386 manual (*URL) | on Jul 6, 8:38 PM |
| Oh, I forgot... | on Jul 18, 6:13 PM |
| And don't forget the MMX instruction set... | on Jul 25, 4:59 AM |