We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
today, only a few derivatives will not 'run' the stack to 0xff you did not mention which derivative you were using.
Most beginners makes omissions in their first visit to the forum, no 'blame', just remember.
Erik