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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/14/05 10:00
Read: times


 
#103680 - Try using a simulator
Responding to: ???'s previous message

Nowhere do you setup the stack pointer - so it normally resets to address 8 (from my memory). AS to whether your problem is caused by stack problems - try using a simulator. Then you'll see what you code is doing.

Just some advice - learn how to use memory to store your variables - your code is starting to get unmanageable relying on fixed registers.

Without reformatting your code I had trouble trying to follow the logic. The comments weren't too bad, but the structure left a lot to be desired.

Also write some string routines - makes printing stuff easier!
;
; DPTR-> string in rom terminated by 0x00
; prints string to ????
; zaps DPTR,A
;
pstring
clr a
movc a,@a+dptr ;grab char
jz ps_end ;exit if char == 0x00
call pchar ;output the char
inc dptr ;->++
sjmp pstring

ps_end
ret



printing a string then becomes:

mov dptr,#msg_ok
call pstring


msg_ok db 'Ok',0




List of 11 messages in thread
TopicAuthorDate
Stack pointer causing code to loop?            01/01/70 00:00      
   Try using a simulator            01/01/70 00:00      
      declaring variables            01/01/70 00:00      
         careful            01/01/70 00:00      
   push and pull            01/01/70 00:00      
      Correct            01/01/70 00:00      
         ah.. so if I change...            01/01/70 00:00      
            Uh, no            01/01/70 00:00      
               in same sub            01/01/70 00:00      
                  Try a Ring Buffer            01/01/70 00:00      
   code changed so push/pops in same sub            01/01/70 00:00      

Back to Subject List