📄 system.asm
字号:
//////////////////////////////////////////////////////////////////
// Function: System commander
// Service for H/W, keyboard scan
// Input: None
// Output: None
// Functions:
// (In Assembly view)
// call F_System_Initial;
// (In C language view)
// System_Initial();
//////////////////////////////////////////////////////////////////
.include resource.inc;
.include hardware.inc;
.include key.inc;
.external F_SACM_MS01_SetInstrument;
.external F_SACM_MS01_ChannelOn;
.external F_SACM_MS01_ChannelOff;
.public R_SpeechType;
.RAM
.VAR R_SpeechType;
.CODE
.public _System_Initial;
.public F_System_Initial;
_System_Initial: .PROC
F_System_Initial:
//push BP,BP to [SP]; //add if some parameters in
//BP = SP + 1;
//r1 = [BP+3];
//r2 = [BP+4];
call F_Key_Scan_Initial; // For keyboard scan
call F_User_Init_IO; // User define IO
// Add other general initialization here
// test area
jmp L_TestEnd;
r1 = 0;
r2 = 1;
call F_SACM_MS01_SetInstrument;
r1 = 1
r2 = 2;
call F_SACM_MS01_SetInstrument;
r1 = 2;
r2 = 3;
call F_SACM_MS01_SetInstrument;
r1 = 3;
r2 = 4;
call F_SACM_MS01_SetInstrument;
r1 = 4;
r2 = 5;
call F_SACM_MS01_SetInstrument;
r1 = 5;
r2 = 6;
call F_SACM_MS01_SetInstrument;
r1 = 0;
call F_SACM_MS01_ChannelOn;
r1 = 1;
call F_SACM_MS01_ChannelOn;
r1 = 0;
call F_SACM_MS01_ChannelOff;
r1 = 1;
call F_SACM_MS01_ChannelOff;
L_TestEnd:
//r1 =0x0001; // return value
//pop BP,BP from [SP];
retf;
.ENDP;
//****************************************************************
// Function: Main Loop of system
// Input: None
// Output: None
// Using:
// call F_System_ServiceLoop; (in assembly domain)
// System_ServiceLoop(); (in C domain)
//****************************************************************
.public _System_ServiceLoop;
.public F_System_ServiceLoop;
_System_ServiceLoop: .PROC
F_System_ServiceLoop:
call F_Key_DebounceCnt_Down; // calling debounce subroutine for key scan subroutine
call F_Key_Scan_ServiceLoop; // calling key scan subroutine
// Add other general service functions here
R1 = 0x0001; // Clear watch dog
[P_Watchdog_Clear] = R1; //
retf;
.ENDP;
F_User_Init_IO:
R1 = 0x0000; // IOA[15..0] input
[P_IOA_Dir] = R1; //
[P_IOA_Attrib] = R1;
[P_IOA_Data] = R1;
R1 = 0x0000; // IOB[15..0] input
[P_IOB_Dir] = R1; //
[P_IOB_Attrib] = R1;
[P_IOB_Data] = R1;
RETF;
//=====================================================================================
//函数:F_ClearWatchdog ()
//语法:void F_ClearWatchdog (void)
//描述:看清门狗
//参数:无
//返回:无
//=====================================================================================
.code
.public _F_ClearWatchdog;
_F_ClearWatchdog: .proc
R1 = 0x0001;
[P_Watchdog_Clear] = R1;
RETF;
.ENDP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -