asmfile1.asm
来自「用c和汇编实现相同的功能」· 汇编 代码 · 共 51 行
ASM
51 行
/* 用汇编实现的作业2的要求*/
.section/dm dm_ovly_1;
.var ONE = 1;
.var VAR1= 1;
.global ONE;
.global VAR1;
.section/pm program;
.global START;
.extern PAGE4INC, PAGE5DEC; // external PM modules which reside in external PM overlay regions
.extern ONE, VAR1;
// Beginning of main program
START:
mstat = 0x10; // cinfigure core for integer mode
dmovlay = 1;
ax0 = dm(VAR1); // read value of memory mapped variable that lives in external DM overlay region #1 into ax0
ay0 = dm(ONE);
pmovlay = 4; // jump to external DM overlay region #4
call PAGE4INC; // Call the PAGE4INC function which lives in external PM overlay #4
dmovlay = 1;
ax0 = dm(VAR1);
ay0 = dm(ONE);
pmovlay = 5; // jump to internal PM overlay region #5
call PAGE5DEC; // Call the PAGE5DEC function that lives in internal PM overlay #5
DONE:
idle; // wait here until an interrupt occurs
jump DONE; // jump back to "idle" instruction after returning from interrupt subroutine
START.end:
.section/pm pm_ovly_4;
.global PAGE4INC;
.extern VAR1;
PAGE4INC:
AR = AX0 +AY0; //实现+1的功能
DM(VAR1) = AR; //再次存入DM中VAR1的位置
RTS;
PAGE4INC.end:
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?