prog3.asm

来自「包括了各种常用的8051单片机的程序」· 汇编 代码 · 共 47 行

ASM
47
字号
;  PROG3 - Direct Bank Register Addressing
;
;  This Program shows the different methods that Bank Registers (8 Register addresses in 
;   the "current" Bank of the data space) can be accessed directly.  
;
;  This program will run in the UMPS simulator for a DS80C320.  
;
;  Myke Predko
;  98.02.03
;
;  Hardware Notes:
;   This program is only meant to run on the Simulator

;  Variable Declarations
;   R0, R1 and R2 Used for Data/Variable Storage

;  Mainline
 org 0				;  Execution Starts Here

  mov	 R0,#123		;  Load Bank Register 0 with 123
 
  mov	 A,#12			;  Load Bank Register 1 with 12
  mov	 R1,A


  mov	 A,R0			;  Load R2 with the Contents of R0
  mov	 R2,A


  mov	 A,R1			;  Swap the Contents of R1 and R2
  xch	 A,R2

;  Change the Banks

  setb	 PSW.3     		;  Jump to Bank 1

  mov	 R1,A

  mov	 A,R0			;  Load R2 with the Contents of R0
  mov	 R2,A			;   NOTE: the Contents of the Bank Register has Changed

  clr	 PSW.3                  ;  Go back to Bank 0


Loop:				;  Loop Here Forever when Finished
  ajmp	 Loop

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?