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
Erik; You need to cut some slack for OPS that use the Keil terms for their simulator. Keil calls it a "Debugger" in all their sales documents and in their operation manuals. Yes, it is a simulator but connected to a target board it can rightly be called a "Debugger". So, let the OPS call it a debugger. It's not difficult to discern what they mean. Bradford
It's not difficult to discern what they mean. ... where 'discerning' has led a thread astray
Erik
Hello. I solved my problem. When initializing the stack, i used "MOV SP, #7F", so, I can't use "push" instruction because the address above 7F is SFRS, not for stack. Thanks
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.