📄 str_ldr.asm
字号:
;******************************************************************************
; TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
;
; Property of Texas Instruments
; For Unrestricted Internal Use Only
; Unauthorized reproduction and/or distribution is strictly prohibited.
; This product is protected under copyright law and trade secret law
; as an unpublished work.
;
; Created 1999, (C) Copyright 1999 Texas Instruments. All rights reserved.
;
;
; Filename : str_ldr.asm
;
; Description : fast store/load back to/from memory
;
; Project : Satustar
;
; Author : freygagn@tif.ti.com Francois Reygagne.
;
;*******************************************************************************
.state16 ; thumb mode
.ref edata ;defined by armas
.global $str_ldr
OK .equ 0x0001
BAD .equ 0x0002
;--------------------------------------------------------------
; Fast store/load back test -
;--------------------------------------------------------------
; Input : R0 = start address -
; Output: R0 = result (1 for OK, 2 for bad) -
;--------------------------------------------------------------
$str_ldr:
ldr r1,addr_const ;R1 = address of const
ldr r1,[r1,#0] ;R1 = 0x11121314
str r1,[r0,#0] ;Write to memory 0x11121314 into the RAM
;at the start address given by R0
ldr r2,[r0,#0] ;Read it back
;check value read back is OK
cmp r1,r2 ;Compare R1 and R2
bne its_bad ;IF R1 != R2 THEN GOTO its_bad
;--------------------------------------------------------------
; ITS_OK -
;--------------------------------------------------------------
; Set result R0 to 1 for OK and goto the_end -
;--------------------------------------------------------------
its_ok:
mov r0,#OK ;Fill result R0=OK=1 test is ok
b the_end ;GOTO the_end
;--------------------------------------------------------------
; ITS_BAD -
;--------------------------------------------------------------
; Set result R0 to 2 for bad and goto the end -
;--------------------------------------------------------------
its_bad:
mov r0,#BAD ;Fill result R0=BAD=2 test is bad
;--------------------------------------------------------------
; THE_END -
;--------------------------------------------------------------
; Set Process Counter to Link Register to return to caller -
;--------------------------------------------------------------
the_end:
mov pc,lr ;PC=Link Register
;-------------------------------------------
; C O N S T A N T S --
;-------------------------------------------
;
addr_const .word const
const .word 0x11121314
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -