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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/30/04 20:23
Read: times


 
#67679 - RE: mistake in my code
Responding to: ???'s previous message
Hi Guys,
I apologize for not including the comments. I had written comments but deleted them when I previewed my post. I thought it was difficult to read due to the fact that no spaces are seen between the code and the comment. I am still learning and in the future I will include the comments in my post. Oleg, thank you for the tip, it was as you said, stuck in a never-ending loop. And to Charles thanks for the encouragement, it's appreciated.

.ORG 2010H
MOV DPTR,#0010H ;LOAD DPTR
MOV R0,#40H ;IRAM BACKUP PTR
MOV R1,#50H ;IRAM PTR
MOV R7,#16 ;COUNT=16
GET:CLR A
MOVC A,@A+DPTR ;GET CODE
MOV @R0,A ;SEND TO IRAM
MOV @R1,A
INC DPTR ;INC DPTR
INC R0 ;INC RAM PTR
INC R1
DJNZ R7,GET
LOOP1:MOV R7,#15 ;COUNT=15
MOV R5,#00H ;TRACKS SWAPS
MOV R0,#50H ;INIT R0
LOOP2:MOV A,@R0 ;LOAD VALUE INTO A
MOV R6,A ;KEEP BACKUP COPY
INC R0 ;POINT TO NEXT
CLR C
SUBB A,@R0 ;SUB @R0 FROM A
JC COUNT ;IF CY=1 JUMP TO COUNT
JZ COUNT ;IF SUBB A,@R0=0 JMP COUNT
MOVE:MOV A,@R0 ;LOAD ACC W/ @R0
DEC R0 ;POINT TO PREVIOUS
MOV @R0,A ;MOVE ACC TO PREV.
MOV A,R6 ;MOVE BACKUP TO ACC.
INC R0 ;POINT TO NEXT
MOV @R0,A ;MOVE BACKUP TO NEXT
INC R5 ;TRACK SWAPS
COUNT:DJNZ R7,LOOP2
CJNE R5,#00H,LOOP1 ;END WHEN NO SWAPS
XRAM:MOV DPTR,#2000H ;INIT DPTR
MOV R0,#50H ;INIT IRAM PTR
MOV R7,#16 ;COUNT=16
MOVE2:MOV A,@R0 ;MOVE FROM IRAM
MOVX @ DPTR,A ;TO XRAM
INC R0 ;POINT TO NEXT
INC DPTR ;POINT TO NEXT
DJNZ R7,MOVE2
LJMP 0000
;END




List of 19 messages in thread
TopicAuthorDate
mistake in my code            01/01/70 00:00      
   RE: mistake in my code            01/01/70 00:00      
   RE: mistake in my code            01/01/70 00:00      
      RE: mistake in my code            01/01/70 00:00      
         RE: mistake in my code            01/01/70 00:00      
      RE: mistake in my code            01/01/70 00:00      
         RE: mistake in my code            01/01/70 00:00      
            RE: mistake in my code            01/01/70 00:00      
               RE: mistake in my code            01/01/70 00:00      
         RE: mistake in my code            01/01/70 00:00      
            RE: mistake in my code            01/01/70 00:00      
   RE: mistake in my code            01/01/70 00:00      
   RE: mistake in my code            01/01/70 00:00      
      RE: a comment on comments            01/01/70 00:00      
      RE: mistake in my code            01/01/70 00:00      
         RE: mistake in my code            01/01/70 00:00      
      Comments            01/01/70 00:00      
         RE: Comments            01/01/70 00:00      
            RE: Comments            01/01/70 00:00      

Back to Subject List