?? cpu_basic.s54
字號:
STACK_ADDR .set 0x0500 ;bottom of stack
.mmregs
.global main
;------------------------------------------------------------------------------
.text
main:
stm #STACK_ADDR, SP ;set stack 長立即數(shù)存到MEMORY SP=#STACK_ADDR
stm #0x00a8, PMST ;relocate Interrupt Vector Table
stm #0x0000, SWWSR ;no software wait for all memory
;put a value for future use, *(0x2000) = 0xff80
stm #0x2000, AR2
st #0xff80, *AR2;存儲長立即數(shù)
;================================================
;test SXM
;watch A to understand sign extension
ssbx SXM;狀態(tài)寄存器位置位
nop
ld *AR2, A;將地址處的內(nèi)容加載到累加器
;------------------------
rsbx SXM;狀態(tài)寄存器復(fù)位
nop
ld *AR2, A
;================================================
;================================================
;test OVM
;watch A and B to understand saturation
ssbx SXM
ssbx OVM
ld #0x8000, 16, A
add #0x8000, 16, A
;------------------------
rsbx OVM
ld #0x7fff, 16, B
add #0x7fff, 16, B
;================================================
;================================================
;test C16
;watch B to understand 2-16 mode
ssbx OVM
ld #0x0001, 16, A
add #0x7fff, A
dst A, *AR2
ld #0x0001, 16, A
or #0xffff, A
rsbx C16
nop
dadd *AR2, A, B
;------------------------
ssbx C16
nop
dadd *AR2, A, B
;================================================
;================================================
;test FRCT
;watch B to understand fraction mode
ld #0x1234, 16, A
rsbx FRCT
nop
mpya *AR2
;------------------------
ssbx FRCT
nop
mpya *AR2
;================================================
;================================================
;test TC
;watch TC to understand bit test operation and corresponding flags
bitf *AR2, #0x8000
nop
nop
;------------------------
bitf *AR2, #0x0001
nop
nop
;================================================
;================================================
;test C
;watch C to understand max & min operation and corresponding flags
ssbx SXM
ld #0x7fff, A
ld #0x8000, B
max A
nop
nop
;------------------------
min B
nop
nop
;================================================
;================================================
;test OVA, OVB
;watch OVA to understand overflow
ssbx SXM
rsbx OVA ;clear overflow flag
ld #0x7fff, 16, A
add #0xffff, A
nop
nop
;------------------------
add #0x7fff, 16, A
nop
nop
;================================================
;================================================
;test SMUL
;watch A to understand multiply saturation
ssbx SXM
ssbx OVM
ssbx FRCT
ldm PMST, B
or #0x0002, B
stlm B, PMST
ld #0xffff, A
stm #0x8000, T
st #0x8000, *AR2
nop
nop
mac *AR2, A
nop
nop
;------------------------
ldm PMST, B
and #0xfffd, B
stlm B, PMST
ld #0xffff, A
nop
mac *AR2, A
;================================================
dead_loop:
nop
nop
nop
nop
b dead_loop
;------------------------------------------------------------------------------
;Interrupt Vector Table, for simplicity Only RESET interrupt is defined
.sect "vectors"
int_RESET:
b main
nop
nop
.space 124*16
;end of lab1.s54
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -