Clock for CLD and LODSB in TASM - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Clock for CLD and LODSB in TASM

nklnkl Posts: 14Member
Could somebody tell me what is the purpose of clock in CLD and LODSB? The clock in CLD is 2, while the clock in LODSB is 12. May i know what steps, i should care if i write a program which having this two terms? How is the clock will affect CLD and LODSB?

Comments

  • AsmGuru62AsmGuru62 Posts: 6,519Member
    : Could somebody tell me what is the purpose of clock in CLD and LODSB? The clock in CLD is 2, while the clock in LODSB is 12. May i know what steps, i should care if i write a program which having this two terms? How is the clock will affect CLD and LODSB?
    :
    [blue]The clock is a time for CPU to execute that instruction. LODSB is (read: WAS) 6 times longer than CLD. Of course, these numbers are for very old CPUs. The CPU today are much faster, so CLD may be 1 clock and LODSB may be 2 clocks. Interesting, that latest Intel manuals do not have the CLOCK field anymore - maybe all instructions are timed at a single clock?

    Simply write your code and do not count clocks. When code works - THEN start optimizing. There are few optimization techniques possible. Making your code and data properly aligned and making instructions shorter. Example:

    'xor ax, ax' is better than 'mov ax, 0'

    or

    or ax, ax
    jz AX_IS_ZERO

    is better than

    cmp ax, 0
    je AX_IS_ZERO

    or

    L1:
    ...
    LOOP L1

    is slower than

    L1:
    ...
    DEC DX
    JNZ L1

    and so on... - read the Intel manuals on optimization. Of course, the most speed up in the correct data layout and good algorithms, so design your project BEFORE actual coding.

    [/blue]
Sign In or Register to comment.