📄 sinwaveasm.asm
字号:
.title "sin wave..."
.mmregs
.global _c_int00,_timer
.bss buf,128
.bss con_buf,1
.bss y0,1
.bss y2,1
.bss y1,1
stack_size .set 0x100
stack .usect ".mstack",stack_size
y12 .word 079bch
y11 .word 04b3ch
aa .set 0678eh
bb .set 0c000h
.text
_c_int00:
ssbx intm ;关闭所有中断
ssbx frct ;进行小数运算
stm #stack+stack_size,sp
ld #con_buf,dp ;加载dp的值
stm #0,imr ;屏蔽所有中断
stm #0x2020,pmst ;加载pmst的值,其中iptr=0
; 40h,即中断向量指针2000h
stm #0x0010,tcr ;stop timer0
stm #2499h,prd ;store the div
stm #0x0008,imr ;turn on the interrupt of timer0
mvpd y12,y2
mvpd y11,y1
stm #buf,ar3
stm #128,bk
stm #0x0030,tcr ;set TRB to load PRD to TIM and PSC to TDDR
;nop
stm #0x0000,tcr ;start timer0
rsbx intm ;turn on all interrupt
again:
b again
_timer:
pshm st0
pshm st1
mpy y1,#bb,a
ltd y2
mac #aa,a
sth a,1,y2
ld #buf,dp
sth a,1,*ar3+%
nop
nop
popm st1
popm st0
rete
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -