Hi Folks,
Being a noob to C, and only having a little hair left, here's a question.
Simple decision box:
Check to see if location Key_temp is = 0. If not, wait till it changes (done via I-rupt routine).
When it becomes non-zero, then check Month_current to see if it is 12. If so,
then make it 01, then go do some housekeeping.
First, I tried with only the 1st comparison to Key_temp, & here's what I got:
C code: Assembly
void do_month(void){ 199A TST 0xB5
199C Beq *-2 ;abs = 0x199A
while (Key_temp == 0); // wait until there is a key available 199E NOP
199F RTS
if(Key_temp==0x48); //Up - short?
asm{
nop
}
}
The while instruction worked fine, but what happened to the if(Key....) assembly code?
In my real code, the first decision tree (Key_temp=48), should be followed by a second decision,
if (Month_current=12).
When I do the following:
void do_month(void){ 199A TST 0xB5
while (Key_temp == 0); // wait 199C BEQ *-2
199E LDA 0xBC (location Month_current)
if(Key_temp==0x48); //Up - short? 19A0 CMP #0x0C
if(Month_current==12){ 19A2 BNE *-8 ;abs = 0x19AA
Month_current=1; 19A4 MOV #0x01,0xBC
Update_month(); 19A7 JMP 0x19AB
} 19AA RTS
}
Figured I'd see what I'm doing wrong before I go nuts!!
Thanks,
Tim