This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DELAY FUNCTION IS NOT RETURNED

Hello everyone.
I'm beginner for ASM programming.
I tried programming by using modular programming method in ASM.
I built 2 modules (seperately): delay_s.a and main.a.
delay_s.a:

;===========================================================================
;Description:
;
;               - in: delay_s_i
;               - out: non
;===========================================================================
;===========================================================================
                                        PUBLIC                  delay_s_i, delay_s
;===========================================================================
;===========================================================================
?DT?delay                       SEGMENT                 DATA
                                        RSEG                    ?DT?delay

delay_s_i:                      DS                              1                       ;reserve 1 byte
;===========================================================================
;===========================================================================
?PR?delay                       SEGMENT                 CODE
                                        RSEG                    ?PR?delay
delay_s:
                                        MOV                             A, delay_s_i
                                        MOV                             B, #14          ;to delay approximately 1s - don't care about it
                                        MUL                             AB                      ;
                                        MOV                             delay_s_i, A
                                        MOV                             A, #0
                                        SETB                    TR0
loop1:                          JNB                             TF0, $
                                        CLR                             TF0
                                        DEC                             delay_s_i
                                        CJNE                    A, delay_s_i, loop1
                                        RET
;============================================================================
;============================================================================
                                        END
;============================================================================


main.a:

extrn code (delay_s)
extrn data      (delay_s_i)
org 0000h
mov sp, #7fh
main:
clr p2.0
mov     delay_s_i, #1
call delay_s
setb    p2.0
mov     delay_s_i, #1
call delay_s
jmp main
end


Compiling is ok.
I used the debug tool to test and i realized that the delay function is not returned to main function. I don't know why.
I need some help please.
Thank you

0