⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asmfile1.asm

📁 用c和汇编实现相同的功能
💻 ASM
字号:
/* 用汇编实现的作业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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -