PageRenderTime 25ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/native/external/espeak/platforms/riscos/s/assemb

http://eyes-free.googlecode.com/
#! | 127 lines | 96 code | 31 blank | 0 comment | 0 complexity | 9c9aae9d137ad65909482ad4f3eff14e MD5 | raw file
  1; 32 bit version
  2
  3; SWI numbers
  4OS_File             *  &8
  5OS_Module           *  &1e
  6XOS_AddCallBack     *  &20054
  7XOS_RemoveCallBack  *  &2005f
  8
  9
 10
 11        GET     h.RegNames
 12        EXPORT  DMA_Handler
 13	EXPORT	AddSineWaves
 14
 15	IMPORT |callback_entry|
 16	IMPORT |sound_entry|
 17	IMPORT |sin_tab|
 18
 19
 20        AREA   Assemb , CODE, READONLY
 21
 22
 23; pointers to data items
 24ADR_callback_entry
 25		DCD    callback_entry
 26ADR_sound_entry
 27		DCD     sound_entry
 28ADR_sin_tab
 29		DCD	sin_tab
 30
 31
 32
 33
 34
 35DMA_Handler
 36;**********
 37; fill the sound buffer of the linear sound handler
 38; preserve r11,r12,r13 (fp,ip,sp)
 39
 40	MOV	r5,ip		; need to save ip
 41	MOV	ip,sp		;set up a stack
 42	STMFD	sp!, {fp,ip,lr}
 43	STMFD	sp!, {r5}
 44
 45	MOV	r12,r0		; put the module_data word in r12
 46	BL	sound_entry     ; call C function through veneer in CMHG
 47
 48	; returns with r0=1 set callback,  r1=module_data address
 49	CMP	r0,#1
 50	BNE	DMA_return
 51
 52;---------
 53	TEQ	pc,pc
 54	MRSEQ	r8, CPSR	; 32bit version of call SWI from IRQ mode
 55	MOVNE	r8,pc
 56	ORR	r9,r8,#3
 57	MSREQ	CPSR_c, r9
 58	TEQNEP	r9,#0
 59	NOP
 60	STR	r14, [r13,#-4]!
 61;---------
 62
 63	; r1=module_data address
 64	LDR	r0,ADR_callback_entry  ; call C function through CMHG veneer
 65	SWI	XOS_AddCallBack
 66
 67;---------
 68	LDR	r14, [r13],#4  ; 32bit version of 'reenter original processor mode'
 69	TEQ	pc,pc
 70	MSREQ	CPSR_c, r8
 71	TEQNEP	r8,#0
 72	NOP
 73;---------
 74
 75DMA_return
 76	LDMFD	sp!,{ip}
 77	LDMFD   sp, {fp,sp,pc}
 78
 79
 80AddSineWaves
 81;total += AddSineWaves(waveph, h_switch_sign, maxh, harmspect);
 82; using this assembler routine increases overall speed by about 7.5%
 83; define the USE_ASSEMBLER_1 macro in speech.h to enable this routine
 84
 85; input:  r0=waveph  r1=h_switch_sign  r2=maxh  r3=harmspect
 86; local:  r5=sin_tab r6=total  r7=h  r8=theta
 87; return(total)
 88	MOV	ip,sp
 89	STMFD	sp!, {r5-r9,ip,lr}
 90	LDR	r5,ADR_sin_tab
 91	MOV	r6,#0		; total = 0
 92	MOV	r0,r0,LSL #16
 93	MOV	r8,r0		; theta = waveph
 94
 95	MOV	r7,#1
 96
 97as1
 98	MOV	ip,r8,LSR #21
 99	LDR	r9,[r5,ip,LSL #1]	; sin_tab[theta >> 5]
100	MOV	r9,r9,LSL #16
101	MOV	r9,r9,ASR #16
102	LDR	ip,[r3,r7,LSL #2]	; harmspect[h]
103	MLA	r6,r9,ip,r6
104
105	ADD	r8,r8,r0		; theta += waveph
106	ADD	r7,r7,#1		; h++
107	CMP	r7,r1
108	BLE	as1
109
110	RSB	r6,r6,#0		; change sign
111
112as2
113	MOV	ip,r8,LSR #21
114	LDR	r9,[r5,ip,LSL #1]	; sin_tab[theta >> 5]
115	MOV	r9,r9,LSL #16
116	MOV	r9,r9,ASR #16
117	LDR	ip,[r3,r7,LSL #2]	; harmspect[h]
118	MLA	r6,r9,ip,r6
119
120	ADD	r8,r8,r0		; theta += waveph
121	ADD	r7,r7,#1		; h++
122	CMP	r7,r2
123	BLE	as2
124
125	MOV	r0,r6
126	LDMFD	sp, {r5-r9,sp,pc}
127   END