ram_fill.asm

来自「8051试验程序 基础教材」· 汇编 代码 · 共 71 行

ASM
71
字号
;-----------------------------------------------------------------------------
;	Copyright (C) 2005 Silicon Laboratories, Inc.
;
;
; 	FILE NAME  	: RAM_FILL.ASM
; 	TARGET MCU	: C8051F2xx
; 	DESCRIPTION	: This program disables the watchdog timer and fills RAM with
;				  	  value equal to address.
;
;  	NOTES:
;	(1)	This note intentionally left blank.
;
;
;-----------------------------------------------------------------------------

;TARGET MCU  : C8051F206, 'F220, 'F221, 'F226, 'F230, 'F231 and F236.
;Uncomment to include SFR declarations for desired derivative

#include <ioC8051F206.h>                    ; SFR declarations
;#include <ioC8051F220.h>                    ; SFR declarations
;#include <ioC8051F221.h>                    ; SFR declarations
;#include <ioC8051F226.h>                    ; SFR declarations
;#include <ioC8051F230.h>                    ; SFR declarations
;#include <ioC8051F231.h>                    ; SFR declarations
;#include <ioC8051F236.h>                    ; SFR declarations

;-----------------------------------------------------------------------------
; EQUATES
;-----------------------------------------------------------------------------


;-----------------------------------------------------------------------------
; VARIABLES
;-----------------------------------------------------------------------------
	
																
;-----------------------------------------------------------------------------
; RESET and INTERRUPT VECTORS
;-----------------------------------------------------------------------------

               ; Reset VectoR
               ASEGN CODE01:CODE,00h
               ljmp  Main              ; Jump beyond interrupt vector space.

;-----------------------------------------------------------------------------
; CODE SEGMENT
;-----------------------------------------------------------------------------


               RSEG     RAM_FILL:CODE  ; Code segment

Main:          ; Disable the WDT. (IRQs not enabled at this point.)
               ; If interrupts were enabled, we would need to explicitly
               ; disable them so that the 2nd move to WDTCN occurs no more
               ; than four clock cycles after the first move to WDTCN.

               mov   WDTCN, #0DEh
               mov   WDTCN, #0ADh

               mov   R0, #00H          ; use R0 as pointer to memory location
loop:          mov   @R0, 0            ; write to indexed address with
                                       ; address value
               djnz  R0, loop          ; check if finished
	
               sjmp  $                 ; loop here forever


;-----------------------------------------------------------------------------
; End of file.

                END

⌨️ 快捷键说明

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