Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/03/04 09:09
Read: times


 
#61821 - RE: Fastest 16bit INC/DEC
Responding to: ???'s previous message
Here is what Keil C51 suggests:

I wrote the routine first in C51 as:

unsigned int num;

void main(void)
{
    num = num + 1;

    num = num - 1;
}


Here is the resulting assembly language as seen in the Keil simulator.....

7:         num = num + 1;
8 :
C:0x0003    0509     INC      0x09
C:0x0005    E509     MOV      A,0x09
C:0x0007    7002     JNZ      C:000B
C:0x0009    0508     INC      num(0x08)
9:         num = num - 1;
C:0x000B    1509     DEC      0x09
C:0x000D    7002     JNZ      C:0011
C:0x000F    1508     DEC      num(0x08)
10: }
C:0x0011    22       RET

So translating this back into "source code" of your format it could look like...

Inc16:
    INC  LOW
    MOV  A, LOW
    JNZ  L1
    INC  HIGH
L1: (...)


Dec16:
    DEC  LOW
    JNZ  L2
    DEC  HIGH
L2: (...)


Michael Karas




List of 10 messages in thread
TopicAuthorDate
Fastest 16bit INC/DEC            01/01/70 00:00      
   RE: Fastest 16bit INC/DEC            01/01/70 00:00      
      RE: Fastest 16bit INC/DEC            01/01/70 00:00      
         RE: Fastest 16bit INC/DEC            01/01/70 00:00      
            RE: Fastest 16bit INC/DEC            01/01/70 00:00      
               RE: Fastest 16bit INC/DEC            01/01/70 00:00      
                  RE: Fastest 16bit INC/DEC            01/01/70 00:00      
                     RE: Fastest 16bit INC/DEC            01/01/70 00:00      
                        RE: Fastest 16bit INC/DEC            01/01/70 00:00      
   RE: Fastest 16bit INC/DEC            01/01/70 00:00      

Back to Subject List