Texas Instruments MSP50C6xx Calculator User Manual


 
C–– Efficiency
5-51Code Development Tools
DATA MON ;0
DATA TUE ;1
DATA WED ;2
DATA THU ;3
DATA FRI ;4
DATA SAT ;5
DATA SUN ;6
C–– callable speech routines, like the above for speaking days were added.
An integer phrase number is passed on the stack. The routines get this value
from the stack and do a table lookup to get the address of the correct phrase.
The address is loaded into a0 and a0~ is cleared to indicate that the speech
data is in internal ROM. Then speak, which is located in speak.asm, is called.
The final assembly file that was modified was mainasm.asm. The only change
was setting up Timer 1 and enabling the Timer 1 interrupt. The configuration
of Timer 1 is similar to the configuration of Timer 2.
The high level program, main.cmm, was then modified to utilize the new
functionality.
cmm_func main()
{
goasm(); // run any assembly stuff that needs to be run
while(1){ // infinite loop
if(!(inportD()&SW1)){
setTime();
}
if(!(inportD()&SW2)){
speakTime();
}
updateTime();
}
}
The main() routine now reads keys by calling the inportD() which was added
to cmm1.asm as _inportD. The value is compared against a constant to see
if a certain key was pressed and then the function for that key is called. Key
checking and updates to time are all done inside the infinite loop.
Speaking the time is very simple using the routines that were added to
cmm1.asm.
cmm_func speakHours(){
if( hours<10){ // 19
speakOnes(hours);
}
else{ // must be 10, 11, or 12
speakTeens(hours10);
}
}
The appropriate speak function is called and the parameters are passed to it.
The program flow does not return to C–– until the speech file has finished