📄 ex7p1qxx.asm
字号:
;----------------------------------------------------------------------------
; Program Name: ex7p1Qxx.asm
;
; Description: This is an example to show how to multiply numbers
; represented using Q-notation. It implements the following:
;
; N1xN2 = N1 * N2
;
; where
; N1 and N2 are 16-bit numbers in Q15 notation
; N1xN2 is the 16-bit result in Q15 notation
;
; Author: Avtar Singh, SJSU
;-----------------------------------------------------------------------------
.mmregs ; memory-mapped registers
.data ; sequential locations
N1: .word 4000h ; N1 = 0.5 (Q15 number)
N2: .word 2000h ; N2 = 0.25 (Q15 number)
N1xN2: .space 10h ; space for N1 x N2
.text
.ref _c_int00
.sect ".vectors"
RESET: b _c_int00 ; Reset vector
nop
nop
_c_int00:
stm #N1, AR2 ; AR2 points to N1
ld *AR2+, T ; T reg = N1
mpy *AR2+, A ; A = N1 * N2 in Q30 notation
add #1, 14, A ; round the result
sth A, 1, *AR2 ; save N1 * N2 as Q15 number
nop
nop
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -