Re: What is the best way of doing repeating tasks?by (Login T3sl4)R FYI, you can use MASM (or any other Macro Assembler) to produce the control structures (equivalent to FOR, DO, IF, etc.), if you so desire.
An in-place addition might look like this: -=-=- MOV AX,val ; amount to add LDS SI,dest_ptr ; 4 byte pointer to array MOV CX,numwords ; entries in array looptop: ADD [SI],AX ADD SI,+2 LOOP looptop ; DEC CX: JNZ looptop is better on Pentium RET -=-=- Mind that you'll get best performance in blocks of whatever the cache size is. Less and you're not using the full capacity, just too much and you need a slow-ass memory access to fill in the extra bytes. The penalty for a cache hit is pretty big. Now, if you're doing this in DOS, nothing matters at all. You could write some truely abysmal assembly and it will still run very fast. The days of hand-optimizing assembly have passed. Hell, people are still using QuickBasic, now that's saying something. Tim |
| Response Title | Author and Date |
| OK, thanks | Ben on Jul 2, 1:31 PM |
| I like the 386 manual (*URL) | on Jul 6, 8:38 PM |