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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Louis S
01/21/10 14:27
Read: 166 times


 
#172649 - The loop in ASM
Responding to: Richard Erlacher's previous message
I've been stepping through the low-level code with the assembler. Is there an advantage to explicitly writing the code into an assembly file as opposed to emulator stepping?

In the following code, unsignd char i lives at 0x0437.

    96:                 for (i=0;i<255;i++) 
C:0x031A    900437   MOV      DPTR,#0x0437
C:0x031D    E4       CLR      A
C:0x031E    F0       MOVX     @DPTR,A
C:0x031F    900437   MOV      DPTR,#0x0437
C:0x0322    E0       MOVX     A,@DPTR
C:0x0323    FF       MOV      R7,A
C:0x0324    EF       MOV      A,R7
C:0x0325    C3       CLR      C
C:0x0326    94FF     SUBB     A,#0xFF
C:0x0328    5008     JNC      C:0332
    97:                 { 
    98:                 } 
    99:                  
C:0x032A    900437   MOV      DPTR,#0x0437
C:0x032D    E0       MOVX     A,@DPTR
C:0x032E    04       INC      A
==> C:0x032F    F0       MOVX     @DPTR,A
C:0x0330    80ED     SJMP     C:031F

 


The line with the "==>" is where the loop hangs since location 0x0437 is not populated with A.

I've noticed that when the emulator uses its internal clock at 12 MHz the loop "never" (haven't caught it yet) hangs. When I set the internal emulation clock to 11.059MHz or use my target hardware clock (also 11.059MHz) than the hang comes back. On the scope, the target hardware clock signal looks stable and clean. I'm not too sure on how the emulator POD generates multiple clock frequencies and will look into that.

List of 30 messages in thread
TopicAuthorDate
Simulation vs. Embedded Discrepancy      Louis S      01/15/10 07:14      
   Hardware fault?      Andy Neil      01/15/10 07:39      
      Responding to: Andy Neil's previous message      Louis S      01/15/10 07:51      
   illustration of edge difference?      Erik Malund      01/15/10 08:00      
      SPI Phase/Polarity      Louis S      01/15/10 08:06      
         address instead of value      Andy Neil      01/15/10 08:17      
            Doesn't seem coincidental      Louis S      01/20/10 13:19      
               MOVX command fails      Louis S      01/21/10 09:28      
                  Definitely sounds like a hardware fault!      Andy Neil      01/21/10 12:01      
                  Have you tried doing this in ASM?      Richard Erlacher      01/21/10 12:32      
                     The loop in ASM      Louis S      01/21/10 14:27      
                        I think...      Jez Smith      01/21/10 15:11      
                        Sounds like hardware again      Andy Neil      01/21/10 17:34      
                           If this were reduced to the essentials ...      Richard Erlacher      01/21/10 18:36      
                              Oh Richard      Jez Smith      01/22/10 01:32      
                        What I was after ...      Richard Erlacher      01/21/10 18:30      
                           Reducing to Essentials      Louis S      01/22/10 10:56      
                              RE: Magic Switch On The Compiler      Andy Neil      01/22/10 12:21      
                                 Emulator trace      Louis S      01/22/10 12:59      
                                    Yes      Neil Kurzman      01/23/10 02:39      
                                       SOLVED      Louis S      01/25/10 11:10      
                                          A bit ocnfused      Andy Neil      01/25/10 11:24      
                                             Emulator and AUXR      Louis S      01/25/10 14:15      
                                                Things do tend to work best...      Andy Neil      01/25/10 14:54      
   one guess with a question      Erik Malund      01/21/10 13:46      
      Memory has plenty of gaps      Louis S      01/21/10 14:29      
         That doesn't make sense!      Andy Neil      01/23/10 03:25      
            Sloppy language on my part      Louis S      01/23/10 23:00      
      Am I missing something      Neil Kurzman      01/21/10 19:06      
      questions/request      Erik Malund      01/22/10 06:52      

Back to Subject List