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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/16/04 10:21
Read: times


 
#68604 - RE: STARTUP.A51
Responding to: ???'s previous message
hi,
IDATALOOP:      MOV     @R0,A
                DJNZ    R0,IDATALOOP

The flaw in the code is that it clears R0 as the last thing.

No, it does not. R0 becomes zero itself during DJNZ. Last memory location which is cleared by MOV @R0,A is 0x01 (R1 of registers` bank 0). You need know that DJNZ passes out when variable is 1, not zero. So the routine shown above, when R0 contains 0x01:
- clears memory location 0x01 via MOV @R0,A;
- leaves IDATALOOP loop. At same time, DJNZ decreases value of R0 from 1 to 0 and so all memory include 0x00 (R0) contains zeros.

Regards,
Oleg

List of 22 messages in thread
TopicAuthorDate
Assembly works but C...            01/01/70 00:00      
   RE: Assembly works but C...            01/01/70 00:00      
      RE: Assembly works but C...            01/01/70 00:00      
         RE: Assembly works but C...            01/01/70 00:00      
            RE: Assembly works but C...            01/01/70 00:00      
               RE: Assembly works but C...            01/01/70 00:00      
   RE: Assembly works but C...            01/01/70 00:00      
      RE: Assembly works but C...            01/01/70 00:00      
         STARTUP.A51            01/01/70 00:00      
            RE: STARTUP.A51            01/01/70 00:00      
               RE: STARTUP.A51            01/01/70 00:00      
                  Stand Still...            01/01/70 00:00      
                     RE: Stand Still...            01/01/70 00:00      
                  RE: STARTUP.A51            01/01/70 00:00      
               RE: STARTUP.A51            01/01/70 00:00      
         function for LCD in C...            01/01/70 00:00      
            RE: function for LCD in C...            01/01/70 00:00      
      RE: Assembly works but C...            01/01/70 00:00      
         RE: Assembly works but C...            01/01/70 00:00      
            RE: Assembly works but C...            01/01/70 00:00      
               RE: Assembly works but C...            01/01/70 00:00      
            RE: Assembly works but C...            01/01/70 00:00      

Back to Subject List