📄 init.h
字号:
.title "Include file with I/O register declarations"
* file: INIT.h
* funtion: register address declaraction
*==================================================================
.mmregs ;Include reserved words
* .bss dmem,10 ;Undefined Variables space
* .def ini_d,start,codtx ;Directive for symbl address
;generation in the current module
;-optional
*ini_d: .usect "new",10 ;Example of undefined varibal space
;with the segment's name as "new"
* .data ;Example of including dummy constants
;-optional
* .word 055aah
* .word 0aa55h
* On-chip register equates
* CLKOUT
CLK1 .set 0ffe8h
* Interrupt control
ICR .set 0ffech
* SYNC port
SDTR .set 0fff0h
SSPCR .set 0fff1h
* UART
ADTR .set 0fff4h
ASPCR .set 0fff5h
IOSR .set 0fff6h
BRD .set 0fff7h
* TIMER
TCR .set 0fff8h
PRD .set 0fff9h
TIM .set 0fffah
* Wait states
WSGR .set 0fffch
* Variables
RXBUF .set 0300h
SIZE .set 0020h
DEL .set 0010h
*
* Saram mode
PMST .set 0ffe4h
*
* interrupt-flag register
*IFR .set 00006h
*
* Global-memory allocation register
*GREG .set 00005h
*
* interrupt-mask register
*IMR .set 00004h
*
* clkout1 on or off
*CLK .set 0ffe8h
*
* interrupt-control register
*icr .set 0ffech
*
*
;****************************************
; Expand stake : pop
stkpop .macro
mar *,ar7
lar ar7,#370h
rpt #6h
popd *+
.endm
*
; Expand stake : push
stkpush .macro
mar *,ar7
lar ar7,#370h+7
rpt #6h
pshd *-
.endm
;****************************************
*=====================================================================
* mdiv computting (A * C / B) import: A:302h B:303h C:304h
* output: quotient:302h remainder:303h
*=====================================================================
mdiv .macro
ldp #6h ; point to B1 300h
lt 02h ; SARAM[302h]-->T reg
mpyu 04h ; [302h]*[304h]-->P reg
clrc SXM ;suppresses sign-extension
lacl #0h ; clear ACC
spm 00
sph 02h ; [302h]=P[31..16]
spl 04h ; [304h]=P[15..0]
mpya * ; ACC = P
sub 03h ; [302h]*[304h](ividend) > [303h](divisor) ?
bcnd div?,C ; yes, jump div?
clrc SXM ;suppresses sign-extension
lacl #00h ; no, quotient = 0 --> accl
add 04h,16 ; and remainder = P[15..0] --> acch
b comple?
div?:
clrc SXM ;suppresses sign-extension
lacl 04h ; ACCL=PL
add 02h,16 ; ACCH=PH
rpt #15 ; using subc to complete division
subc 03h
comple?:
sacl 02h ; accl=quotient
sach 03h ; acch=remainder
.endm
*=================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -