Api4000m, Integrated, Series – Rainbow Electronics API4000M User Manual
Page 4: Circuits inc. voice otp module, Single register operation, Operation between two registers, Sound & melody control

INTEGRATED
API4000M
SERIES
CIRCUITS INC. VOICE OTP MODULE
4
3. Single Register Operation
Instruction Format
Code
Cycle
Bytes
Instruction Description
SHIFTL Rn ﹔
2n 1 1
Each Bit of Rn Shift to left Bit,shift 0 to D0.
i.e. D7←D6←D5←D4←D3←D2←D1←D0←0.
SHIFTR Rn ﹔
3n 1 1
Each Bit of Rn Shift to right Bit,shift 0 to D7.
i.e. 0→D7→D6→D5→D4→D3→D2→D1→D0.
DEC Rn ﹔
An 1 1
The value of Rn subduct 1,set the solution to Rn. (Rn
Í
Rn-1)
INC Rn ﹔
Bn 1 1
The value of Rn add 1,set the solution to Rn.(Rn
Í
Rn+1)
4. Operation between two Registers
Instruction Format
Code
Cycle
Bytes
Instruction Description
ADDR Rn, Rm ﹔
D0
2
2
Rn add Rm, set the amount to Rn..(Rn,ÍRn+Rm)
ADDRI Rn, Rm ﹔
D1 2 2
Rn add Rm and Carry, set the amount to Rn. (Rn
Í
Rn+Rm+C)
ADDRC Rn, Rm ﹔
D2 2 2
Rn add Rm, only set Carry but don’t change the value
of Rn and Rm. (Rn+Rm Î C?)
SUBR Rn, Rm ﹔
D4 2 2
Rn subduct Rm, set the difference to Rn. (Rn,ÍRn-Rm)
SUBRI Rn, Rm ﹔
D5 2 2
Rn subduct Rm and Carry, set the difference to Rn.
(Rn ÍRn-Rm-C)
SUBRC Rn, Rm ﹔
D6 2 2
Rn subduct Rm, only set Carry but don’t change the
value of Rn and Rm. (Rn-Rm Î C?)
ANDR Rn, Rm ﹔
D8 2 2
Rn logical AND Rm, set the solution to Rn.
(RnÍRn AND Rm)
MOVR Rn, Rm ﹔
D9
2
2
Set the value of Rm to Rn. ( RnÍRm)
5. Sound & Melody Control
Instruction Format
Code
Cycle
Bytes
Instruction Description
LDSPADB Cn, Sn ﹔
1n
2
4
Set the start address of Sound.
LDSPADF Cn, Sn ﹔
9n
2
4
Set the end address of Sound.
LDMYAD Mn ﹔
CF
2
4
Set the start address of Melody.
PLAYSP Cn, Data ﹔
CE 2 3
Play
Sound(PS4).
TEMPO Rn ﹔
8E
1
2
Set Rn to Tempo value of Melody (PS5).
GAIN Rn ﹔
8F
1
2
Set Rn to the volume of output sound (PS6).
PS :
(1). Cn ﹕Code of Channel, n = 1A , 1B , 2A , 2B , 3A , 3B , 4A , 4B.
(2). Sn ﹕Code of Sound,sort by sequence,n = 0 ~ 9999.
(3). Mn ﹕Code of Melody Song, sort by sequence n = 0 ~ 9999.
(4). Data : Code of Sound Sample Rate, the value is during 0 ~ 31, reference B.Sound Processor to get
more description.
(5). Reference C. Melody Processor to get more description of Tempo Code.
(6). Volume is during 0 ~ 63,0 is mute,63 is MAX volume.