I'm wondering, Does assembler support if staments? (like a C program) Tried something very simple:
org 0h sjmp BEGIN org 50h BEGIN: IF R0 == #45 MOV A, #54 CPL A ELSE MOV A, #45 CPL A ENDIF END
C-like IF statament would make life much easier Get "the bible" and for this read chapter 2 Erik here are the links to "the bible" Chapter 1 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf chapter 2 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf chapter 3 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf
This simple example it's just a #ifdef for set/equ. That's too bad, C-like IF statament would make life much easier. Thank you both for reply.
Does assembler support if staments Yes, but not in the way that you mean. There are several conditional statements you can use in assembly, but the can only check the values of SET, EQU, or other fixed expressions. They cannot check things that change at runtime. Refer to: http://www.keil.com/support/man/docs/a51/a51_ap_conditional.htm Jon
IF R0 == can not be done ITS CODE, you can not do an not an IF on a register cjne AR0,#45,not45 mov a,#-54 sjmp done not45: mov a,#-45 done:
View all questions in Keil forum