📄 tmp6010_srt.s
字号:
;place "wreg_init" in an "extern" declaration
;in the C file.
.global _main ;The label for the first line of code. If the
;assembler encounters "_main", it invokes the
;start-up code that initializes data sections
.global __T1Interrupt ;Declare Timer 1 ISR name global
;..............................................................................
;Constants stored in Program space
;..............................................................................
.section .myconstbuffer, code
.palign 2 ;Align next word stored in Program space to an
;address that is a multiple of 2
ps_coeff:
.hword 0x0002, 0x0003, 0x0005, 0x000A
;..............................................................................
;Uninitialized variables in X-space in data memory
;..............................................................................
.section .xbss, bss, xmemory
x_input: .space 2*SAMPLES ;Allocating space (in bytes) to variable.
;..............................................................................
;Initialized variables in X-space in data memory
;..............................................................................
.section .xdata, data, xmemory
.align 32 ;Aligns the next word to be stored (here x_in)
;to a multiple of 32
x_in: .hword 0x1111, 0x2222, 0x3333, 0x4444, 0x5555
;..............................................................................
;Uninitialized variables in Y-space in data memory
;..............................................................................
.section .ybss, bss, ymemory
y_input: .space 2*SAMPLES
;..............................................................................
;Initialized variables in Y-space in data memory
;..............................................................................
.section .ydata, data, ymemory
y_in: .hword 0x1234, 0x5678, 0x9abc, 0xdef0, 0xabab
;..............................................................................
;Uninitialized variables in Near data memory (Lower 8Kb of RAM)
;..............................................................................
.section .nbss, bss, near
var1: .space 2 ;Example of allocating 1 word of space for
;variable "var1".
;..............................................................................
;Initialized variables in Near data memory (Lower 8Kb of RAM)
;..............................................................................
.section .ndata, data, near
var2: .hword 0x1234, 0x5678, 0x9abc, 0xdef0, 0xabab
;..............................................................................
;Code Section in Program Memory
;..............................................................................
.text ;Start of Code section
_main:
CALL _wreg_init ;Call _wreg_init subroutine
;Optionally use RCALL instead of CALL
;<<insert more user code here>>
done:
BRA done ;Place holder for last line of executed code
;..............................................................................
;Subroutine: Initialization of W registers to 0x0000
;..............................................................................
_wreg_init:
CLR W0
MOV W0, W14
REPEAT #12
MOV W0, [++W14]
CLR W14
RETURN
;..............................................................................
;Timer 1 Interrupt Service Routine
;Example context save/restore in the ISR performed using PUSH.D/POP.D
;instruction. The instruction pushes two words W4 and W5 on to the stack on
;entry into ISR and pops the two words back into W4 and W5 on exit from the ISR
;..............................................................................
__T1Interrupt:
PUSH.D W4 ;Save context using double-word PUSH
;<<insert user code here>>
BCLR IFS0, #T1IF ;Clear the Timer1 Interrupt flag Status
;bit.
POP.D W4 ;Retrieve context POP-ping from Stack
RETFIE ;Return from Interrupt Service routine
;--------End of All Code Sections ---------------------------------------------
.end ;End of program code in this file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -