prog11.asm

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

ASM
40
字号
;  PROG11 - Stack Operations
;
;  This Application uses Simulator to Demonstrate how the 8051's
;   Stack can be used and some pitfalls to watch out for.
;
;  This program will run in the UMPS simulator for a DS80C320.
;
;  Myke Predko
;  98.02.12
;
;  Hardware Notes:
;   This program is only meant to run on the Simulator

;  Variable Declarations
;  R0 in Bank 0 is used as a Counter/GP Variable
TestVariable EQU 00Ah           ;  Value that can be overwritten by Stack

;  Mainline
 org 0                          ;  Execution Starts Here

  mov    TestVariable,#055h     ;  Load Test Variable with a Dummy Value

  clr    A                      ;  Start Saving Data from the Stack

  mov    R0,#8                  ;  Just Loop Around 3x to Make Sure "TestVariable"
				;   is Trashed
StackLoop:                      ;  Push the Contents of the Stack Pointer

  push   ACC                    ;  Save the Contents of the Accumulator

  inc    A                      ;  Change the Value of "A"

  djnz   R0,StackLoop           ;  Loop Around 3x

  mov    A,TestVariable		;  Note that TestVariable HAS Changed


Loop:                           ;  Loop Here Forever when Finished
  ajmp   Loop

⌨️ 快捷键说明

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