?? data.asm
字號:
;/******************************************************************************/
;/* exam.asm */
;/* */
;/* This is proprietary information, not to be published -- DIGIPRO DATA */
;/* Copyright (C) 2002, DigiPro Information Co.,Ltd. All Rights Reserved. */
;/* */
;/* Author: Wu DingMing */
;/* Date: August 12, 2002 */
;/******************************************************************************/
T .set 00EH
BRC .set 01AH
SWWSR .set 028H
CLKMD .set 058H
PADD .set 1F00H ;PROGRAM_MEMORY ADDRESS
DADD .set 2000H ;DATA_MEMORY ADDRESS
.def _main
.def _c_int00
.def _DELAY
.text
_c_int00:
RPT #1000H
NOP
LD #40H,DP
STM #4000H ,SP
ADDM #7FFH,*(SP)
ANDM #0FFFEH,*(SP)
SSBX INTM ;禁止中斷
STM #07FFFH,SWWSR ;置外部等待時間
STM #06004H,CLKMD
LD #0FFFFH,A
CALL _DELAY
STM #087FBH,CLKMD
LD #0FFFFH,A
CALL _DELAY
B _main
_main: CALL INIT_DATA ;;初始化程序區為0,數據區為0-127
NOP
NOP
CALL WRITE_A ;;將1#數據區的內容寫到1#程序區
NOP
NOP
CALL READ_A ;;將1#程序區的內容寫到2#數據區
NOP
NOP
CALL MOVE_DP ;;將2#數據區的內容寫到2#程序區
NOP
NOP
CALL MOVE_PD ;;將2#程序區的內容寫到3#數據區
NOP
NOP
CALL MOVE_DD ;;將3#數據區的內容寫到4#數據區
NOP
NOP
B $
_DELAY: STLM A,BRC
RPTB _DELAY1-1
NOP
NOP
NOP
NOP
_DELAY1:RET
INIT_DATA:
STM #PADD,AR2
RPTZ A,#03FFH
STL A,*AR2+
NOP
NOP
NOP
LD #0,A
STM #DADD,AR2
STM #127,BRC
RPTB _INIT_DATA1-1
STL A,*AR2+
ADD #1,0,A
NOP
NOP
_INIT_DATA1:
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This routine uses the MVDD instruction to move
; information in data memory to other data memory
; locations.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOVE_DD:
STM #DADD+100h,AR2 ;Load pointer to source in data memory.
STM #DADD+180h,AR3 ;Load pointer to
;destination in data memory.
RPT #127 ;Move 128 value.
MVDD *AR2+,*AR3+
RET
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This routine uses the MVDP instruction to move external
; data memory to internal program memory.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
MOVE_DP:
STM #DADD+80h,AR1 ;Load pointer to source in data memory.
RPT #127 ;Move 128 to program memory space.
MVDP *AR1+,#PADD+80H
RET
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This routine uses the MVPD instruction to move external
; program memory to internal data memory.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOVE_PD:
STM #DADD+100h,AR1 ;Load pointer to destination in data memory.
RPT #127 ;Move 128 words from external
MVPD #PADD+80h,*AR1+ ;program to internal data memory.
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This routine uses the READA instruction to move external
; program memory to internal data memory. This differs
; from the MVPD instruction in that the accumulator
; contains the address in program memory from which to
; transfer. This allows for a calculated, rather than
; pre-determined, location in program memory to be
; specified. READA can access locations in program memory
; beyond 64K word boundary
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
READ_A:
LD #PADD,A
STM #DADD+80h,AR1 ;Load pointer to destination in data memory.
RPT #127 ;Move 128 words from external
READA *AR1+ ;program to internal data memory.
RET
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This routine uses the WRITA instruction to move data
; memory to program memory. The calling routine must
; contain the destination program memory address in the
; accumulator. WRITA can access program memory address
; beyond 64K word boundary
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WRITE_A:
LD #PADD,A
STM #DADD,AR1 ;Load pointer to source in data memory.
RPT #127 ;Move 128 words from data
WRITA *AR1+ ;memory to program memory.
RET
.end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -