=== page 1 === TOSHIBA TLCS-900 CPU 900, 900/L, 900/H CPU Core Different Points There are 3 type CPU core : D 900, @ 900/L, ®@ 900/H in TLCS-900 series and they are different from following points. . . 900 900/L 900/H Different Point oY} | om | com CPU Register mode After reset, the mode issetto | After reset, the mode issetto | MAX (maximum) mode only. MIN (minimum) mode. MAX (maximum) mode. The MAX mode is set by a The MIN mode is set by a "MAX' instruction. "MIN’ instruction. Normal Stack Pointer exist not exist not exist XNSP Interrupt Nesting Counter not exist exist exist INTNEST Figure 1 CPU Different Points CPU900-1 === page 2 === TOSHIBA TLCS-900 CPU 1. OUTLINE The TLCS-900 series has an original Toshiba high-performance 16-bit CPU. Combining the CPU with various I/O function blocks (such as timers, serial I/Os, ADs) creates broad possibilities in application fields. The TLCS-900 CPU, being 16-bit CPU, has a 32-bit/16-bit register bank configuration, therefore it is suitable as an embedded controller. The TLCS-900 CPU features are as follows: (1)TLCS-90 extended architecture @ Upward compatibility on mnemonic and register set levels (2)General-purpose registers e All8 registers usable as accumulator (3)Register bank system @ Minimum mode: eight 16-bit register banks @ Maximum mode: four 32-bit register banks (4)16M-byte linear address space ; 9 types addressing modes (5)Dynamic bus sizing system @ Can consist 8-/16-bit external data bus together ® Supporting system mode and normal mode (900) ® Supporting only system mode (900/L, 900/H) (7)Orthogonal instruction sets @ 8-/16-/32-bit data transfer/arithmetic instructions @ 16-bit multiplication/division 16 X 16 to 32-bits (signed/unsigned) 32+16to16bits --- remainder 16-bits (unsigned/signed) e Bit processing including bit arithmetic @ Supporting instruction for C compiler e Filter calculations : multiplication-addition arithmetic, modulo increment instruction (8)High-speed processing _ © Minimum instructionexecutiontime: 200nsat20Miz @ Pipeline system with 4-byte instruction queue buffer ® 16-bit ALU CPU900-2 === page 3 === TOSHIBA TLCS-900 CPU The 900 has two types of operating modes : system and normal. These modes are switched by instructions or interrupts. In system mode, there are no restrictions on using instructions or registers. The CPU resources effective in system mode are as follows: 1) General-purpose registers @ Four 16-bit general-purpose registers X 8 banks (minimum mode) or Four 32-bit general-purpose registers X 4 banks (maximum mode) @ Four 32-bit general-purpose registers (including system stack pointer : XSP) 2) Status register (SR) : including system mode flag 3) Program counter (PC): 32 bits for maximum mode, 16 bits for minimum mode 4) Control register: parameter register for high-speed micro DMA, etc. 5) Normal stack pointer: accessible as control register (XNSP) 6) All CPU instructions 7) All built-in I/O registers 8) All built-in memories In normal mode, the ineffective CPU resources are as follows: 1) Privileged instructions (PUSH SR, POP SR, EI, DI, RETI, HALT, LDC, etc.) 2) Controlling status register (SR) flags e , , 3) Control register (CR): parameter registers for high-speed micro DMA, etc. 4) Built-in I/O registers (depending on products) Built-in I/O registers which cannot be 96C141B . . 96CM40, 96PM40 ° n: channel number 96C031Z , CPU900-3 === page 4 === TOSHIBA TLCS-900 CPU 5) Built-in memories (depending on products) cocoain Memory blocks whose built-in chip select / wait controller's BnSYS bits are set to 1 (memory space set to system mode) 96CM40, 96PM40 n: channel number 96C031Z : The stack pointers (SP) are provided in both system mode and normal mode, named SYSTEM STACK POINTER and NORMAL STACK POINTER. These pointers are automatically switched when the CPU mode is changed by the NORMAL instruction or an interrupt. In system mode, the normal stack pointer (XNSP) is handled as a control register, and can be accessed by the LDC instruction. The CPU enters system mode by system reset, as well as by interrupt. The CPU changes from system to normal mode by the NORMAL instruction. The NORMAL instruction resets the bit of the status register (SR) to “0”, and sets the CPU to normal mode. Figure (1)-1 shows the mode transition figure. This makes it possible for an OS-less system to configure software by using system mode only. resetting instruction ("NORMAL") E> interrupt or mode instruction (“RETI") Figure (1)-1 The Mode Transition Figure CPU900-4 === page 5 === TOSHIBA TLCS-900 CPU 3. REGISTERS 3.1 Register Structure Figure 3.1 (1) and (2) illustrate the format of registers. The TLCS-900 has two register modes. @® Minimum mode:::::-64K-byte program area/ 16M-byte data area Four 16-bit general-purpose registers X 8 banks + Four 32-bit general-purpose registers + 16-bit program counter + Status register @ Maximum mode:::: 16M-byte program area/ 16M-byte data area Four 32-bit general-purpose registers X 4 banks + Four 32-bit general-purpose registers + 32-bit program counter + Status register The bit in status register (SR) is initialized to “O” and set to Minimum mode by resetting. The “MAX” instruction changes to Maximum mode. The 900 does not have a “MIN” instruction. The stack pointer (SP) is provided for each operating mode (System and Normal mode). The system stack pointer (XSP) is set to 100H by resetting. But the Normal stack pointer (XNSP) is not changed by resetting. CPU900-5 === page 6 === TOSHIBA TLCS-900 CPU [7 > ——} 8 bank — wea wf ow Ta BC pos fe Hit DE es a I HL purpose xsef SP meee) ————— el be (For normal mode) .. F’ registers — 16 bits ——~> /-—___— 32 bits ——————_> Figure 3.1 (1) Register Format (minimum mode: 64K-byte program area) Note : Thedata memory area is 16M-byte. The whole 16M-byte area can be accessed by using the registers (XIX, XTY, XIZ, XSP) or absolute addressing mode. CPU900-6 === page 7 === TOSHIBA TLCS-900 CPU 4 bank es an $= — wali w Tat a XDE ee senerat | xu ———
bit of the status register (SR). When the mode changes from minimum to maximum, the 16-bit general-purpose registers (WA, BC, DE, and HL) are extended to 32-bit general-purpose registers (XWA, XBC, XDE, and XHL). The value of the upper 16 bits (that is, bit 16 to bit 31) are undefined. Those registers need to be initialized before use. Changing the mode from minimum to maximum also extends the program counter to 32 bits which automatically writes “0” to the upper 16 bits. So doing ensures program continuity. CPU900-7 === page 8 === TOSHIBA TLCS-900 CPU 3.2 Register Details 3.2.1. General-purpose bank registers As explained in the previous section, the TLCS-900 has two register formats. Which of the register formats is used depends on whether the mode is minimum or maximum. In either way, the register sets and registers in each bank are used exactly the same. (1) General-purpose Bank Registers in Minimum Mode In minimum mode, the following four 16-bit general-purpose registers consisting of 8 banks can be used. The register format in a bank is shown below. -bi i <—— 16 bits Four 16-bit registers (WA, BC, DE, and | 8 bits | ~ 8 bits —_— bits | HL) are general-purpose registers and can be used as accumulators, index registers, WA Pwr and displacement registers. They can also 8C{ B | c | be used as 8-bit registers (W, A, B,C, D, E, DE a ee ee ee H, and L) to function for example as yy) a ee ee ee accumulators. (2) General-purpose Bank Registers in Maximum Mode In maximum mode, the following four 32-bit general-purpose registers consisting of 4 banks can be used. The register format in a bank is shown below. Four 32-bit registers 32 bits <————- 16 bits (XWA, XBC, XDE, and XHL) [- 8 bits —>|<— 8 bits are general-purpose registers and can be used as an accumulators and index ™®°|_ Ss —Cid|C BC) registers. They can also be E{ Cs | SE) used as 16-bit registers (WA, xm | | CHL) BC, DE, and HL), in which Note: Round brackets(__) signify 16-bit registers. case, the lower 16 bits of the 32-bit registers are assigned. 16-bit registers can be used as accumulators, index registers in index addressing mode, and displacement registers. They can also be used as two 8-bit general-purpose registers (W, A, B, C, D, E, H, and L) to function for example as accumulators. CPU900-8 === page 9 === TOSHIBA TLCS-900 CPU 3.2.2 32-bit General-purpose Registers The TLCS-900 has four 32-bit general-purpose registers (XIX, XITY, XIZ, and XSP). They are fixed, independent of maximum or minimum mode. The register format is shown below. These registers can also be <—_——___—_——. 32 bit register ——————————> used as accumulators, index |< —— 16 bitRegister —>~ registers, and displacement *!* ee ee ee registers. They canbe used XIY[ | either as 16-bit, or 8-bit XIZ ee es ee registers are used as 8-bit Se Se registers are listed later. only 90d The XSP register is utilized for stack pointers. This register is provided for both SYSTEM and NORMAL mode. Stack pointer for SYSTEM mode is called SYSTEM STACK POINTER, and for NORMAL mode is called NORMAL STACK POINTER. NORMAL and SYSTEM stack pointer are independent and switched automatically by change of the CPU operating mode. In both modes, they are referred to as XSP. The system stack pointer (XSP) is not able to be accessed from normal mode. The normal stack pointer (XSP) is able to be accessed from system mode as one of control registers (CR). In this case, it is referred to as XNSP. The XNSP can be accessed using the (privileged) LDC instruction. When an interrupt occurs in the normal mode, the CPU enters system mode. At the same time, the normal stack pointer changes automatically to the system stack pointer (XSP). Then the previous normal stack pointer can be changed as a control register. After return using the RETI instruction, the mode and the stack pointers become normal. After reset, the system stack pointer is initialized to 100H; the normal stack pointer remains undefined. Thus, when changing to normal mode it is necessary to initialize XSP. CPU900-9 === page 10 === TOSHIBA TLCS-900 CPU 3.2.3. Status Register (SR) The status register contains flags indicating the status (operating mode, register format, etc.) of the CPU and operation results. This register consists of two parts. The upper byte of the status register (bits 8 to 15) indicates the CPU status. The lower byte (bits 0 to 7) are referred to as the flag register (F). This indicates the status of the operation result. The TLCS-900 series has two flag registers (F and F'). They can be switched using the EX instruction. (1) Upper Byte of Status Register cme —4 13 12 eg — 0 9 8 © SYSM (S¥Stem Mode) Indicates the CPU operating mode, system or normal. In system mode, all instructions can be executed. In normal mode, privileged instructions cannot be executed. (If forced, a privilege violation interrupt will occur.) Initialized to 1 (system mode) by reset. To change to normal mode, use the “NORMAL” instruction. An interrupt automatically causes the mode to change from normal to system. 7 ae CPU900-10 === page 11 === TOSHIBA TLCS-900 CPU @ —IFF2 to IFFO (Interrupt mask Flip-Flop2 to 0) Mask registers with interrupt levels from 1 to 7. Level 7 has the highest priority. Initialized to 111 by reset. | 000 [Enables interrupts with level 1 or higher. 7 | 001 [Enables interrupts with level 1 or higher. same Enables interrupts with level 2 or higher. Enables interrupts with level 3 or higher. Enables interrupts with level 4 or higher. | 101 | Enables interrupts with level 5 or higher. Enables interrupts with level 6 or higher. Any value can be set using the EI instruction. When an interrupt is received, the mask register sets a value higher by 1 than the interrupt level received. When an interrupt with level 7 is received, 111 is set. Unlike with the TLCS-90 series, the EI instruction becomes effective immediately after execution. @ MAX (MiNimum/MAXimum) Bit used to specify the register mode which determines the sizes of the register banks and the program counter. | 1 | Merummede If the program size exceeds 64K bytes, use the “MAX” instruction to set this register to “1” so that register mode becomes maximum mode. Initialized to “O” (minimum mode) by reset. CPU900-11 === page 12 === TOSHIBA TLCS-900 CPU @ RFP2 to RFPO (Register File Pointer2 to 0) Indicates the number of register file (register bank) currently being used. Initialized to 000 by reset. The values in these registers can be operated on using the following three instructions. RFP2 is fixed to 0 in maximum mode. It remains 0 even if an attempt to change it to 1 using following instructions. e LDF imm ; RFP<—imm (0 to 7) (200 ns at 20 MHz) e INCF ; RFP<-RFP+1 (200 ns at 20 MHz) e DECF ; RFP<-RFP-—1 (200 ns at 20 MHz) (2) Flag Register, F 7 6 5 4 3 2 1 0 ps fz jo] ek for fv [ic |r @ S(Sign flag) “1” is set when the operation result is negative, “0” when positive. (The value of the most significant bit of the operation result is copied.) @ Z(Zero flag) “1” is set when the operation result is zero, otherwise “0”. @ —_H (Half carry flag) “1” is set when a carry or borrow from bit 3 to bit 4 occurs as a result of the operation, otherwise “0”. With a 32-bit operation instruction, an undefined value is set. @ V (Parity/over-flow flag) Indicates either parity or overflow, depending on the operation type. Parity (P): “0” is set when the number of bits set to 1 is odd, “1” when even. An undefined value is set with a 32-bit operation instruction. Overflow (V): “0” is set if no overflow, if overflow “1”. © N (Negative) ADD/SUB flag “0” is set after an addition instruction such as ADD is executed, “1” after a subtraction instruction such as SUB. Used when executing the DAA (decimal addition adjust accumulator) instruction. © C(Carry flag) “1” is set when a carry or borrow occurs, otherwise “0”. CPU900-12 === page 13 === TOSHIBA TLCS-900 CPU ‘Read and write process of status register. Read from bits 0 to 15 ore SR (Privileged instruction) POP dst Only bit 15 @ NORMAL (Privileged instruction) “QO” is written. @ Interrupt “1” is written. Only bits 14 to 12 @® El num (Privileged instruction) A value of “num” is written. Only bit 11 @ MAX (Privileged instruction) "1" is written. Only bits 10 to 8 @ LDF imm ® INCF @ DECF Only bits 7 to 0 @ PUSH F/POP F @ EX F, F’ @ A flag is set indirectly by executing arithmetic instructions etc. 3.2.4 Program Counter (PC) The program counter is a pointer indicating the memory address to be executed next. The program counter bit length depends on whether the register format is in minimum or maximum mode. In minimum mode, the program counter consists of 16 bits, and a maximum program area of 64K bytes (from addresses 000000H to OOFFFFH) can be accessed. In maximum mode, the program counter consists of 32 bits. The size of the program area depends on the number of the address pins that the product has. With 24 address pins (AO to A23), a maximum program area of 16M bytes can be accessed as a linear address space. In this case, the upper 8 bits of the program counter (bits 24 to 31) are ignored. When the register format changes from minimum to maximum mode, the upper word of the program counter (bits 16 to 31) is extended so that the program counter becomes 32 bits long. This automaticaly writes “O” to the upper word of the program counter. So doing ensures program continuity. CPU900-13 === page 14 === TOSHIBA TLCS-900 CPU The program counter is initialized to 8000H by reset. Then, the 900 reads program after 8000H and executed. “normal stack pointer, which can be accessed in system mode. Control registers can be _aocessed by using the LDC instruction (privileged instruction for 900), which can only be ...LrLrmrmrmrmrrC—C~C~C~C~COCOCOCOCOCOCOCOCCiC;wiCtiwtrwt—ritii—riNC*isCNd—zitisSN ll... ...,rtrti<(“(i‘C‘(CCO#ONOi(;’R’RC(COCO(O(O(i;wzw 1 t ADM A aie register 1 1 1 DMA . Ae ination register MA maa S~*d Cd PN a2 ee MAC2) I register () : Word register name (16 bits) < > : Long word register name (32 bits) For micro DMA, refer to “Chapter 4 TLCS-900 LSI Devices”. CPU900-14 === page 15 === TOSHIBA TLCS-900 CPU 3.3 Register Bank Switching Register banks are classified into the following three types. Current bank registers Previous bank registers Absolute bank registers The current bank is indicated by the register file pointer, , (status register bits 8 to 10). The registers in the current bank are used as general-purpose registers, as described in the previous section. By changing the contents of the , another register bank becomes the current register bank. The previous bank is indicated by the value obtained by subtracting 1 from the . For example, if the current bank is bank 3, bank 2 is the previous bank. The names of registers in the previous bank are indicated with a dash (WA', BC', DE'", HL’). The EX instruction (EX A,A') is used to switch between current and previous banks. All bank registers, including the current and previous ones, have a numerical value (absolute bank number) to indicate the bank. With a register name which includes a numerical value such as RWO, RAO, etc., all bank registers can be used. These registers (that is, all registers) are called absolute bank registers. The TLCS-900 series CPU is designed to perform optimally when the current bank registers are operated as the working registers. In other words, if the CPU uses other bank registers, its performance degrades somewhat. In order to obtain maximum CPU efficiency, the TLCS-900 series has a function which easily switches register banks. The bank switching function provides the following advantages: ° Optimum CPU operating efficiency ° Reduced programming size (Object codes) ° Higher response speed and reduced programming size when used as a context switch for an interrupt service routine. Bank switching is performed by the instructions listed below. LDF imm: Sets the contents of the immediate value in . imm: 0 to7 INCF : Increments by 1. DECF : Decrements by 1. In minimum mode, the immediate values used by the LDF instruction are from 0 to 7, in maximum mode 0 to 3. If a carry or borrow occurs when the INCF or DECF instruction is executed, it is ignored. The value of the rotates. For example, if the INCF instruction is executed with bank 7, the result is bank 0. If the DECF instruction is executed with bank 0, the result is bank 7. Note that careless execution of the INCF or DECF instruction may destroy the contents of the register bank. CPU900-15 === page 16 === TOSHIBA TLCS-900 CPU e Example of Register Bank Usage The TLCS-900 series registers are formatted in banks. Banks can be used for processing objectives or interrupt levels. Two examples are given below. When assigning register banks to interrupt processing routines. Register bank 0 = Used for the main program and interrupt processing other than that shown below. Register bank 1 = Used for processing INTO. Register bank 2 = Used for processing timer 0. Register bank 3 = Used for processing timer 1. Register bank 4 = Used for processing A/D converter. Register bank 5 = Used for processing serial I/O. (Data send) Register bank 6 = Used for processing serial I/O. (Data receive) Register bank 7 = Used for processing NMI. For example, if a timer 1 interrupt occurs during main program execution, processing jumps to a subroutine as follows. PUSH/POP processing for the register is unnecessary. LDF 3 ; Sets register bank to 3. 0.2 us (at 20 MHz) RETI ; Returns to previous status including . 1.2 us (at 20 MHz) When assigning register banks to their appropriate interrupt level nesting. Main Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt Interrupt INCF INCF INCF INCF INCF INCF il Notel : In the above example, when interrupt nesting exceeds the number of register banks (8), the becomes 000 and the contents of register bank 0 are destroyed. However, interrupt levels are usually from 1 to 7, so in most cases nesting will not exceed 8 levels.Unless, that is, multiple NMIs occur. If there is any chance of multiple NMIs occurring, do not use the INCF instruction in the NMI processing routine. Note2 : TheINCF instruction is used to execute < + 1. 0.2 ys (at 20 MHz) CPU900-16 === page 17 === TOSHIBA TLCS-900 CPU 3.4 Accessing General-purpose Registers The register access code is formatted in a varied code length on byte basis. The current bank registers can be accessed by the shortest code length. All general-purpose registers can be accessed by an instruction code which is 1 byte longer. General-purpose registers are as follows. @ General-purpose registers in current bank (Minimum mode) a eet 7) ae es On : pee SE) CE ee ee ee (Maximum mode) () : Word register name (16 bits) < > : Long word register name (32 bits) @) General-purpose registers in previous bank (Minimum mode) pe BBC’) OCT Pee’) OE (Maximum mode) @) 32-bit general-purpose registers (Both minimum and maximum modes) QSPH Q'SP) QSPL__ SPH S iP) SPL CPU900-17 === page 18 === TOSHIBA TLCS-900 CPU @ Absolute bank registers (Minimum mode) pet RBO (RBC 10) RCO ono pt RODE 10) RED pe RBA (RBC 11) RCA pone pet RD (RDE 11) REDS pet RBZ (RBC 12) RC2_ oe pt (RDE 12) REZ Pee tS (RBC 13) RCZ pone pe RDB (RDE 13) RES (RBC) RCA on PSR (RDE 4) REA Pt RBS (RBC 15) RCS ons pt RDG (RDE 5) RES PRBS (RBC 16) RCS pone pt RDG (RDE 16) ORES pet RB (RBC 17) ORC? poe pet RT (RDE 17) RET (Maximum mode) i pone fi po () : Word register name (16 bits) < > : Long word register name (32 bits) CPU900-18 === page 19 === TOSHIBA TLCS-900 CPU 4. ADDRESSING MODES The TLCS-900 series has nine addressing modes. These are combined with most instructions to improve CPU processing capabilities. TLCS-900 series addressing modes are listed below. They cover the entire TLCS-90 addressing modes. Te | _ sn 1. Register reg8 reg 16 reg32 2. Immediate ns n16 n32 4. Register indirect (-reg) pre-decrement 5. Register indirect (reg +) post-increment Index (reg + d8) (reg +d16) 7. Register index (reg + reg8) (reg + reg16) Absolute (n8) (Direct addressing mode) (n16) (n24) Relative (PC + d8) (PC +d 16) reg8_ : All 8-bit registers such as W, A, B, C, D, E, H, L, ete. reg 16 : All 16-bit registers such as WA, BC, DE, HL, IX, IY, IZ, SP, etc. reg 32 : All 32-bit registers such as XWA, WBC, XDE, XHL, XIX, XIY, XIZ, XSP, etc. reg : All 32-bit registers such as XWA, WBC, XDE, XHL, XIX, XTY, XIZ, XSP, ete. (Maximum mode) All 16-bit bank registers such as WA, BC, DE, HL, etc. and XIX, XIY, XIZ, and XSP. (Minimum mode) d8 :8-bit displacement (—80H to + 7FH) d16 :16-bit displacement (—8000H to + 7FFFH) n8 :8-bit constant (00H to FFH) n16 :16-bit constant (0000H to FFFFH) n32_ :32-bit constant (00000000H to FFFFFFFFH) CPU900-19 === page 20 === TOSHIBA TLCS-900 CPU Notel : Relative addressing mode can only be used with the following instructions: LDAR, JR, JRL, DJNZ, and CALR Note2 : In minimum mode, register bank blocks (current bank registers and previous bank registers, and bank 0 to 7 registers) consist of 16 bits. When these 16-bit registers are used for addressing, the CPU extends bits 16 to 31 to 0000H for address calculations. CPU900-20 === page 21 === TOSHIBA TLCS-900 CPU (1) Register Addressing Mode In this mode, the operand is the specified register. Example: LD HL,IX CPU n , The IX register contents, 1234H, are loaded to the HL register. (2) Immediate Addressing Mode In this mode, the operand is in the instruction code. Example: LD HL,5678H Program code | 33 | (oP code) n \s6_| The immediate data, 5678H, is loaded to the HL register. CPU900-21 === page 22 === TOSHIBA TLCS-900 CPU (3) Register Indirect Addressing Mode In this mode, the operand is the memory address specified by the contents of the register. Example 1: LD, HL, (XIX)... in both minimum and maximum modes Memory HL —[_33_| Address 345678H ~-, Address 345679H bn ed Memory data, 2233H, at address 345678H is loaded to the HL register. Example 2: LD, HL, (BC) ... in minimum mode Memory HL[4455 | —|_55_| Address 005678H ~<- | 44 | Address005679H Loo Ed In minimum mode, if a bank register (WA, BC, DE, or HL) is used for addressing, address bits 16 to 23 are set to OOH. Example 3: LD HL,(XBC) ... in maximum mode Memory HL|445 5 | -—{_55__| Address 3456781 <-, | 44 | Address 345679H In maximum mode, if a bank register (KWA, XBC, XDE, or XHL) is used for addressing, the values of bits 0 to 23 are output to the address bus. CPU900-22 === page 23 === TOSHIBA TLCS-900 CPU (4) Register Indirect Pre-decrement Addressing Mode In this mode, the contents of the register is decremented by the pre-decrement values. In this case, the operand is the memory address specified by the decremented register. Example 1: LD HL, (- XIX)... in both minimum and maximum modes Memory HL|6677 77 Address 345676H ~<-1 Previous | 66 | Address 345677H_—} 12345678 ~ | I XIX O~—{2| ! Current XIX 12345676 |--}----------------------------2-------1 The pre-decrement values are as follows: When the size of the operand is one byte (8 bits): —1 When the size of the operand is one word (16 bits): —2 When the size of the operand is one long word (32 bits): —4 Example 2: LD A,(-BC) ... in minimum mode Memory A Address 005677 ~<-- PreviousBC |5 67 8 _ S | Example 3: LD XIX,(-XBC) ... in maximum mode Memory XIX}2233 4455 55 Address 33FFFEH <-- qq Address 33FFFFH | Previous|! 2340002 | | }—{ 33 Address 340000H XBC Address 340001H_ —! e8| FS XBC CPU900-23 === page 24 === TOSHIBA TLCS-900 CPU (5) Register Indirect Post-increment Addressing Mode In this mode, the operand is the memory address specified by the contents of the register. After the operation, the contents of the register are incremented by the size of the operand. Example 1: LD HL,(XIX +)... in both minimum and maximum modes Memory HL[s 899 | —|_99 | Address 345678H ~<~7 Address 345679H Previous XIX|123 45678 [-7--7 ~ Q<—{2] [eee ee eee eo eee eee eee eee eee! Example 2: LD XIX,(BC +)... in minimum mode Memory xXIX]/44332211 a Address 005000H <-- 22 AddressQ05001H Previous BC |5 00 0 }-f-+ | 33 |Address005002H —} | tag Address 005003H ~—! Ola] Ta : to Teed CurrentBcC |500 4 Example 3: LD A,(XBC +) ... in maximum mode Memory A|55| [55 _| Address 345678H ~<-- Previous XBC|} 12345678 }----: w @ {1 beet eee CurrentXBC |12345679 CPU900-24 === page 25 === TOSHIBA TLCS-900 CPU (6) Index Addressing Mode In this mode, the operand is the memory address obtained by adding the contents of the specified register to the 8- or 16-bit displacement value in the instruction code. Example 1: LD HL,(XIX + 13H)... in both minimum and maximum modes Memory HL|55 66 —_ 66 _| Address 345683H ~<-1 Address 345684H =! xIxX|12345670 ~ | O-{13] | Example 2: LD HL,(BC + 12344) ... in minimum mode Memory HL |7788 88 _| Address 005234H <-- Address 005235H | COREELS : Lowen Example 3: LD HL,(XBC-1000H) ... in maximum mode Memory HL 166 _| Address 33F000H <-7 Address 33F001H_—s! XBC}1234 0000 ~ | O-~[100 0] ! The displacement values range from —8000H to +7FFFH. CPU900-25 === page 26 === TOSHIBA TLCS-900 CPU (7) Register Index Addressing Mode In this mode, the operand is the memory address obtained by adding the contents of the register specified as the base to the register specified as the 8- or 16-bit displacement. Example 1: LD HL,(XIX + A)... in both minimum and maximum modes Memory HL|2 233 33 Address 345683H ~-> Address 345684H_ é—[alp : nn On Example 2: LD HL,(BC + DE)... in minimum mode Memory HL {2233 33 Address 005234H <--- Address 005235H a Example 3: LD HL,(XBC + DE)... in maximum mode Memory _ CM HL|2 233 33 Address 347678H ~<--1 | 22 |Address347679H =! G)<4 2 000]DE CPU900-26 === page 27 === TOSHIBA TLCS-900 CPU (8) Absolute Addressing Mode In this mode, the operand is the memory address specified by 1 to 3 bytes in the instruction code. Addresses 000000H to OOOOFFH can be specified by 1 byte. Addresses 000000H to OOFFFFH can be specified by 2 bytes. Addresses 000000H to FFFFFFH can be specified by 3 bytes. In this mode, addressing to 256-byte area (OH to FFH) which can be specified by 1 byte is called the direct addressing mode. In the direct addressing mode, a program memory area and execution time can be cut down. Example 1: LD HL,(80H) Memory HL {33 | Address 000080H Address 000081H Example 2: LD HL,(1234H) Memory HL —_- Address 001234H | 44 | Address 001235H Example 3: LD HL,(56789AH) Memory HL 77 Address 56789AH | 66 | Address 56789BH CPU900-27 === page 28 === TOSHIBA TLCS-900 CPU (9) Relative Addressing Mode In this mode, the operand is the memory address obtained by adding the 8- or 16-bit displacement value to the address where the instruction code being executed is located. In this mode, only the following five instructions can be used. LDAR R,$+4+4d16 JR ec, $+2+d8 JRL ~~ ec, $+3+4+d16 CALR $+3+d16 DJNZ r,$+3+d8 ($ : start address of instruction code) In calculating the displacement object code value, the adjustment value (+2 to +4) depends on the instruction type. Example 1: JR 2034H Memory JR instruction code —»| 68 | Address 2000H Displacement —»| 32 | Address 2001H In the above example, the displacement object code value is: 2034H — (2000H + 2) = 32H. CPU900-28 === page 29 === TOSHIBA TLCS-900 CPU 5. INSTRUCTIONS In addition to its various addressing modes, the TLCS-900 series also has a powerful instruction set. The basic instructions are classified into the following nine groups: e@ Load instructions (8/16/32 bits) @ Exchange instructions (8/16 bits) e@ Block transfer & Block search instructions (8/16 bits) e Arithmetic operation instructions (8/16/32 bits) @ Logical operation instructions (8/16/32 bits) e Bit operation instructions (1 bit) @ Special operations, CPU control instructions @ Rotate and Shift instructions (8/16/32 bits) e Jump, Call, and Return instructions Table 5 lists the basic instructions of the TLCS-900 series. For details of instructions, see Appendix A; for the instruction list, Appendix B; for the instruction code map, Appendix C; and for the differences between the TLCS-90 and TLCS-900 series, Appendix D. CPU900-29 === page 30 === TOSHIBA TLCS-900 CPU Table 5 (1) TLCS-900 Series Basic Instructions LD dst, src Load dst value to C flag. STCF bit, dst Store carry flag: copy C flag value to dst. ANDCF bit, sre And carry flag: and src value and C flag, then load the result to C flag. ORCF bit, src Or carry flag: or src and C flag, then load result to C flag. XORCF bit, src Exclusive-or carry flag: exclusive-or src value and C flag, then load result to C flag. RCF Reset carry flag: reset C flag to 0. SCF Set carry flag: set C flag to 1. CCF Complement carry flag: invert C flag value. ZCF Zero flag to carry flag: copy inverted value of Z flag to C flag. BIT bit, sre Bit test: Z flag — not src RES bit, dst Bit reset SET bit, dst Bit set CHG bit, dst Bitchange dst TSET bit, dst Bit test and set: Z flag — not dst dst <1 CPU900-31 === page 32 === TOSHIBA TLCS-900 CPU BS1F A, dst Bit search 1 forward: search dst for the first bit set to 1 starting from the LSB, then set the bit number in the A register. BS1B A,dst Bit search 1 backward: search dst for the first bit set to 1 starting fom the MSB, then set the bit number in the A register. NOP No operation NORMAL Set CPU to normal mode. MAX Set CPU to maximum mode (32-bit bank register and PC). El imm Enable interrupt. IFFeimm DI Disable maskable interrupt. IFFe-7 PUSH SR Push status registers. POP SR Pop status registers. sw imm Software interrupt PUSH PC&SR : JP 8000H + 10Hximm HALT Halt CPU. LDC CTRL - REG, reg Load control: copy the register contents to control register of CPU. LDC reg, CTRL- REG Load control: copy the control register contents to register. LDX dst, src Load extract. dst LSB RL num, dst Rotate left MSB.— LSB RR num, dst Rotate right MSB. => LSB SLA num, dst Shift left arithmetic MSBo< LSB <0 SRA num, dst Shift right arithmetic MSB. => LSB SLL num, dst Shift left logical MSB_< LSB |<-0 SRL num, dst Shift right logical o—! MSB —> LSB RLD dst Rotate left digit 9 Areg das RRD dst Rotate right digit _— Areg Tas JR cc, PC +d Jump relative (8-bit displacement) if cc then PC—PC +d. JRL cc, PC +dd Jump relative long (16-bit displacement) if cc then PC<-PC + dd. JP cc, dst Jump if cc then PC BCD VYapey//OWN/H/PREY//M/ KPH) Upper | Lower | Upper | Lower Long word |MSB LSB Notel : To access the parts indicated by HZ, the instruction code is one byte longer than when accessing the other parts. (2) Memory Data Format 1 bit Address n|7|6|5|4{3]2[1]0| Byte Address n| MSB LSB Word Address n Lower — LSB n+l Long word Address n Lower LSB n+too ne2p n+ 3!}MSB-~ Upper Note2 : There areno restrictions on the location of word or long word data in memory. They can be located from even or odd numbered address. Note3 : When the PUSH instruction is used to save data to the stack area, the stack pointer is decremented, then the data is saved. Example: PUSH HL; XSP<-XSP-—2 (XSP) . (A CLK DG ee ee ee ee _ op RAV XK |: | ee a A0~23 ) a es 3 : 2) AD0to 15 read a ee = RD a om a ee ee S| ADO to 15 (Aotois KX —S————C‘iE™—é . (A CLK DG ee ee ee _ Qn RAV XK |: | QS ca a AO to 23 KR | : ft tit fT ts 3 : 2) AD0to 15 read a ee = RD a om a ee ee S| ADO to 15 = Po Write HW, WR ete Ep w| DOto 15 a Read w RD s a ee «| DOto15 a. Write SL mn —p_ ee WAIT Ss ee ee ee Figure 7 (3) 1WAIT +n Read/Write Cycle (n = 0) CPU900-40 === page 41 === TOSHIBA TLCS-900 CPU 400 ns (at 20 MHz) T1 TW TW T2 50ns “ 4,4.6,4. CLK > Ce ee Cee ee Cee ee Cee = SS RAV ) Ea A SE A0 to 23 ) EA ee 5 |) ADO to 15 a Read = RD om a S| ADO to 15 Ss ma Write sR, wa pee a | w| DOto 15 a Read w RD % Sa o| DOto15 2. Write S| me TTT TTT Ee war fT NY 7 Figure 7 (4) 1WAIT +n Read/Write Cycle (n = 1) CPU900-41 === page 42 === TOSHIBA TLCS-900 CPU 400 ns (at 20 MHz) T1 TW TW T2 50ns “ 4,4.6,4. CLK > Ce ee Cee ee Cee ee Cee = SS RAV ) Ea A SE AO to 23 ) EA ee 5 |) ADO to 15 a Read = RD om a 3| ADOto 15 Ss ma Write sR, wa pee a | w| DOto 15 a Read o RD % Sa o| DOto15 2 Write Emme TTT TTT a ee ee eee eee WAIT a a ee ee Figure 7(5) 2WAIT Read/Write Cycle CPU900-42 === page 43 === TOSHIBA TLCS-900 CPU (at 20 MHz) <———. 100 ns ——> ~ 50ns > X1 ak ~|[.~ XL] ee ee mT Adto23 — indeterminate _| =} faa] iF) 3) = HWR, WR 2 DO to 15 o ‘ananassae . (Fe) WAIT Figure 7 (6) 1 State Dummy Cycle CPU900-43 === page 44 === TOSHIBA TLCS-900 CPU X1 CLK aD Ce DC ee Ce ee Cee Oa A0 to 23 | a a ee) ee ee ee ee CSO to 2 rr a ee re ee ee) RW ) es Ee ee ee wn a ADO~15 ae 2 x o Read * | ot a S| ADOto 15 HWR, WR w| DO to 15 (_Din_) =] a Read v RD «| DOto15 a Write "n nt ne 0 See ee Falling edge interrupt fi Rising edge interrupt \ Level interrupt —__| Final cycle of instruction Interrupt response sequence — ---- Note : This timing chart isa theoretical example. In practice, due to the operation of the bus interface unit in the CPU, external bus and internal interrupt receive timings do not correspond one to one. Figure 7 (7) Interrupt Receive Timing CPU900-44 === page 45 === so 2 Ay pa oc s | | I 1 \ | I | | ! I l l I . . . . 4 . . . . 1 | 3 I I I \ * ~~ — prot 4 ls pororoot oO _ ¥ | 1 g ! I 1 I U ‘= | | I ae) 1 I I I ron p . . . . 1 oO . . . . rat =) 1 | i v I \ I | S = an an ; - : : : : = 5 | | z I 1 I 1 c it oid 3 i i i ot § = 5 oe aan ~ : : : : xe) Z prot eA | 2 pororor 8 Pp co) 5 ll a e foorot 2 Loe tt dt Bad & er a ee 11 1 | I a I ot 4 I Se) eo. to I a : . . ' o | 1 I 7 I I I I a Ee as a 2 sist og! le I 5 f olg ls gy! a = a2 erie = 2 o12 21 D ‘a ele el le I = lé Ic € i 1 & sic) 5115 i ~ i is tf 31 E 7 A nee Qa. «a I ' 1Q .2 @O. zc low Ait) £1 1s 4 I re oit £1 sto oO: oO: c* “¢ I . "Cc 12 c: = wv | po bad eae a 1 oF 1S Sl 2 ew . . . : . . I . . . Ne. Sc rab) ] NT w+ mM fon) st st =o vy ola a! lo I I la, Ig al @G@ a ~~" ~~. _ . a Piet — a ce ak sR SR BRR Bee RR HEED T 11 11 i fl i i | | Egn i i | I roto ; 25 @ . Le . I I - . | f3s30 5 I | | I i Zz3D . a . . . . a a . . == i — v vo o> 3 a 3 3 aa € < ft ® OD R as ° i a 22 Ly $ TD I 3 £E ' | oy . . 2 2 1 | ‘ 1 oO t 1 2 ine] ve) w re) - nxn 2 x $b 85 @ EY2 bP ef EE By g2 U o fo) ow] O faa Operation : dst mem, E]m[t Tam mm ro,0,0,0,0,0[z 0 O © x LD = (#16), (mem) |1|m|0|z|m,)m,m,m| O OX LDE WS mem), (416) [TT], Yom mm ro,0,0,1,0,1[<|o| Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Executionexample: LD IX, DE When the DE register = 4567H, execution sets the IX register to 4567H. 4 5 6 7] DE register Loads 4 5 6 7] ixXregister CPU900-96 === page 49 === TOSHIBA TLCS-900 PUSH $s sre < Push > Operation: (—XSP)# [00,0 1,0] @[t O 0 x PUSH (mem Pe Yom 0 [= [om Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange CPU900-133 === page 50 === TOSHIBA TLCS-900 Execution example: PUSH HL When the stack pointer XSP = 0100H and the HL register = 1234H, execution changes address 0OOFEH to 34H, address OOFFH to 12H, and sets the stack pointer XSP to OOFEH. Memory HL register Address OFEH (stack pointer after execution) Address OFFH | | Address 100H (stack pointer before execution) CPU900-134 === page 51 === TOSHIBA TLCS-900 POP dst < Pop > Operation : dst<(XSP+)|In bytes :dst—(XSP), XSP<—XSP+1 In words : dst-(XSP), XSP (mem Pe Yo] a io [0 0,0, 0,1] 20) Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange (Note) Executing POP F changes all flags. CPU900-129 === page 52 === TOSHIBA TLCS-900 Execution example: POP IX When the stack pointer XSP = 0100H, the contents of address 100H = 56H, and the contents of address 101H = 78H, execution sets the IX register to 7856H and the stack pointer XSP to 0102H. Memory IX register [ | 56 _| Address 100H (stack pointer before execution) Address 101H | | Address 102H (stack pointer after execution) CPU900-130 === page 53 === TOSHIBA TLCS-900 LDA dst, sre < Load Address > Operation : dst Operation : dst Operation : dst [(XDE+), (KHL+)]}1,0,0[2z[0,0,1,1) O © x LDI (XIX+),(XIY+) [1,0,0[z|0,1,0,1| * Coding in square brackets [ ] can be omitted. Flags : S Z H V N C |-|-|o]*]o]-| S = Nochange Z = Nochange H = Cleared to zero. V = Oisset when the BC register value is 0 after execution, otherwise 1. N = Cleared to zero. C = Nochange Executionexample: LDI (XIX+), (XIY+) When the XIX register = 00123456H, the XIY register = 00335577H, and the BC register =0700H, execution loads the contents of address 335577H to 123456H and sets the XIX register to 00123457H, the XIY register to 00335578H, and the BC register to O6FFH. CPU900-104 === page 56 === TOSHIBA TLCS-900 LDIR dst, sre < Load Increment Repeat > Operation: dst< sre, BC [(XDE+),(XHL+)]}1,0,0|z[0,0,1,1) O © x LDIR (XIX+),(XIY+) [|1,0,0|z|0,1,0,1| * Coding in square brackets [ ] can be omitted. Note : Interrupt requests are sampled every time 1 item of data is loaded. Flags : S Z H V N C S = Nochange Z = Nochange H = Cleared to zero. V = Cleared to zero. N = Cleared to zero. C = Nochange Execution example: LDIR (XIX+), (XIY+) When the XIX register = 00123456H, the XIY register = 00335577H, and the BC register = 0003H, execution results as follows: Loads the contents of address 335577H to 123456H. Loads the contents of address 335578H to 123457H. Loads the contents of address 335579H to 123458H. Sets the XIX register to 00123459H. Sets the XIY register to 0033557AH. Sets the BC register to 0O00H. CPU900-105 === page 57 === TOSHIBA TLCS-900 LDD dst, sre < Load Decrement > Operation : dst (DE-), (KHL), 0,0]2]0,0,1;1) LDD &IX-),1Y-) [Fo 0]2 [0,701 * Coding in square brackets [ ] can be omitted. Flags : S Z H V N C |-[-]o}*]o] -| S = Nochange Z = Nochange H = Cleared to 0. V = Oissetifthe BC register value is 0 after execution, otherwise 1. N = Cleared to zero. C = Nochange Executionexample: LDD (XIX-—),(XIY-—) When the XIX register = 00123456H, the XIY register = 00335577H, and the BC register = 0700H, execution loads the contents at address 335577 to address 123456H and sets the XIX register to 123455H, the XIY register to 00335576H, and the BC register to O6FFH. CPU900-101 === page 58 === TOSHIBA TLCS-900 LDDR dst, src < Load Decrement Repeat > Operation : dst< src, BC [(XDE-), (XHL-—)]}1,0,0[z[0,0,1,1) O © x LDDR (XIX-),(XIY-) |1,0,0[z]0,1,0,1| * Coding in square brackets [ ] can be omitted. Note : Interrupt requests are sampled every time 1 item of data is loaded. Flags : S Z H V N C S = Nochange Z = Nochange H = Cleared to zero. V = Cleared to zero. N = Cleared to zero. C = Nochange Execution example: LDDR (XIX-—),(XIY—) When the XIX register = 00123456H, the XIY register = 00335577H, and the BC register = 0003H, the results of the execution are as follows: Loads the contents of address 335577H to 123456H. Loads the contents of address 335576H to 123455H. Loads the contents of address 335575H to 123454H. Sets the XIX register to 00123453H. Sets the XIY register to 00335574H. Sets the BC register to 0000H. CPU900-102 === page 59 === TOSHIBA TLCS-900 CPI srcel, srce2 < Compare Increment > Operation : srcl-src2, BC Operation : srcl-src2, BC <— BC-—1, repeat until srcl =sre2 or BC=0 Description : Compares the contents of srcl with those of src2. Then decrements the contents of the BC register by 1. Repeats until srcl = src2 or BC = 0. srcl must be the A or WA register. src2 must be in post-increment register indirect addressing mode. Details : Size Mnemonic Code __Byte _Word _Longword O OQ x CPIR [A/WA,(R+)] [1,0,0]z]o] ,R, | Note: Omitting operands in square brackets[ |] specifies A, XHL+). Flags : S Z H V N C pete fe fe fa] -| S = MSB value of the result of srcl-src2 is set. Z = 1lissetif the result of srcl-src2 is 0, otherwise 0. H = 1lissetifa borrow from bit 3 to bit 4 occurs as a result of srcl-src2, otherwise 0. V = Oissetifthe BC register value is 0 after execution, otherwise 1. N = lisset. C = Nochange Execution example: CPIR A,(XIX+) Under the following conditions, execution reads memory addresses 123456H, 123457H, and 123458H. The instruction ends with condition srcl = src2, sets the XIX register to 00123459H and the BC register to 01FDH. Conditions: A register = 33H XIX register = 00123456 HBC register = 0200H Memory address 123456H = 11H Memory address 123457H = 22H Memory address 123458H = 33H CPU900-74 === page 61 === TOSHIBA TLCS-900 CPD srcl, src2 < Compare Decrement > Operation : srcl—sre2, BC Operation : srcl—src2, BC < BC-—1, Repeat until srcl =src2 or BC=0 Description : Compares the contents of srcl with those of src2. Then decrements the contents of the BC register by 1. Repeats until srcl = src2 or BC = 0. srcl must be the A or WA register. src2 must be in post-decrement register indirect addressing mode. Details : Size Mnemonic Code Byte Word Long word 0 O x crpr anwar) [o,0[e JT 8, Note: Omitting operands in square brackets [] specifies A,.XHL-—). Flags : S Z H V N C p+ *[*]*]a] -| S = MSB value of the result of srcl - src2 is set. Z = 1lissetifthe result of srel - src2 is 0, otherwise 0. H = 1 is set if a borrow from bit 3 to bit 4 occurs as a result of srel - sre2, otherwise 0. V = Oissetifthe BC register value is 0 after execution, otherwise 1. N = 1Lisset. C = Nochange Execution example: CPIR A,(XIX—) Under the following conditions, execution reads the contents of memory addresses 123456H, 123455H, and 123454H. The instruction ends with condition BC = 0 and sets the XIX register to 00123453H and the BC register to 0000H. Conditions: A register = 55H XIX register = 00123456H BC register = 0003H Memory address 123456H = 11H Memory address 123455H = 22H Memory address 123454H = 33H CPU900-72 === page 63 === TOSHIBA TLCS-900 ADD dst, sre < Add > Operation : dst (mem,# — [7]mpo] = [mmm m| CPU900-57 === page 64 === TOSHIBA TLCS-900 Flags : S Z H V N C S = MSB value of the result is set. Z = 1issetifthe result is 0, otherwise 0. H = 1 is set if a carry from bit 3 to bit 4 occurs as a result of the operation, otherwise 0. If the operand is 32-bit, an undefined value is set. V = 1issetifan overflow occurs as a result of the operation, otherwise 0. N = Cleared to zero. C = 1issetifacarry occurs from the MSB, otherwise 0. Execution example: ADD HL,IX When the HL register = 2000H and the IX register = 3456H, execution sets the HL register to 5456H. OP, 3456 IX register CPU900-58 === page 65 === TOSHIBA TLCS-900 ADC dst, sre < Add with Carry > Operation : dst (mem,# — [T]mpo]# [mmm m| CPU900-55 === page 66 === TOSHIBA TLCS-900 Flags: S Z H V N C S = MSB value of the result is set. Z = 1issetifthe result is 0, otherwise 0. H = 1 is set if a carry from bit 3 to bit 4 occurs as a result of the operation; otherwise, 0. If the operand is 32-bit, an undefined value is set. V = 1issetifan overflow occurs as a result of the operation; otherwise, 0. N = Cleared to zero. C = 1issetifacarry occurs from the MSB, otherwise 0. Execution example: ADC HL,IX When the HL register = 2000H, the IX register = 3456H, and the carry flag = 1, execution sets the HL register to 5457H. 2000 HL register | 3456 IX register | Ca rry flag 5457 HL register CPU900-56 === page 67 === TOSHIBA TLCS-900 SUB dst, sre < Subtract > Operation : dst (mem,# — [T]m]o]#[mm,mm| CPU900-156 === page 68 === TOSHIBA TLCS-900 Flags : S Z H V N C Pete tet [1]: | S = MSB value of the result is set. Z = 1isset when the result is 0, otherwise 0. H = 1 is set when a borrow from bit 3 to bit 4 occurs as a result, otherwise 0. When the operand is 32 bits, an undefined value is set. V = 1isset when an overflow occurs as a result, otherwise 0. N = 1Lisset. C = 1isset when a borrow from MSB occurs as a result, otherwise 0. Execution example: SUB HL,IX When the HL register = 7654H and the IX register = 5000H, execution sets the HL register to 2654H. 7654 HL register O-—[ sooo | IX register CPU900-157 === page 69 === TOSHIBA TLCS-900 SBC dst, sre < Subtract with Carry > Operation : dst tmem),# = [m0] [mymmym CPU900-146 === page 70 === TOSHIBA TLCS-900 Flags : S Z H V N C Pete tet [1]: | S = MSB value of the result is set. Z = 1isset when the result is 0, otherwise 0. H = 1 is set when a borrow from bit 3 to bit 4 occurs as a result, otherwise 0. When the operand is 32 bits, an undefined value is set. V = 1isset when an overflow occurs as a result, otherwise 0. N = 1Lisset. C = 1isset when a borrow from the MSB occurs as a result, otherwise 0. Execution example: SBC HL,IX When the HL register is 7654H, the IX register = 5000H, and the carry flag = 1, execution sets the HL register to 2653H. 7654 HL register O-—[ sooo | IX register S 1 | Carry flag 2653 HL register CPU900-147 === page 71 === TOSHIBA TLCS-900 CP srel, sre2 < Compare > Operation : srcel—src2 Description : Compares the contents of srcl with those of src2 and indicates the results in flag register F. Details : Size Mnemonic Code Byte Word Long word 0 0 OO ww Rk Greece ee ttt yo] Re, | 0 0 x oC aE of] yr, 0 0 OO © 4 ToPepla | 0 oO O ©& R(mem) [9 Jom] 2 [om mm] ytytyt,o[ |B, O O O cp (mem), R ja fm} 2 |mjmjmm| Exveseves ya 0 0 x — cp (mem,# — []m]o]# [mmm m| Note: #3 in operands indicates from 0 to 7. CPU900-69 === page 72 === TOSHIBA TLCS-900 Flags : S Z H V N C Pe dete t* [rt] | S = MSB value of the result is set. Z = 1lissetifthe result is 0, otherwise 0. H = 1 is set if a borrow from bit 3 to bit 4 occurs as a result of the operation, otherwise 0. If the operand is 32 bits, an undefined value is set. V = 1issetifan overflow occurs as a result of the operation, otherwise 0. N = 1Lisset. C = 1 is set if a borrow occurs from the MSB bit as a result of the operation, otherwise 0. Execution example: CP HL,IX When the HL register = 1234H and the IX register = 1234H, execution sets the Z and N flags to 1 and clears the S, H, V, and C flags to zero. 1234 HL register ] 1234 IX register 0000 (Not loaded) CPU900-70 === page 73 === TOSHIBA TLCS-900 INC num, dst < Increment > Operation : dst #3,(mem) [im] 02 |= = = =| Note: #3 in operands indicates from 1 to 8 and object codes correspond from 1 to 7,0. Flags : S Z H V N C S = MSB value of the result is set. Z = 1issetifthe result is 0, otherwise 0. H = 1 is set if a carry occurs from bit 3 to bit 4 as a result of the operation, otherwise 0. V = 1issetifan overflow occurs as a result of the operation, otherwise 0. N = Cleared to zero. C = Nochange Note: With the INC #3,r instruction, if the operand is a word or a long word, no flags change. Execution exampl : INC 5,WA When the WA register = 1234H, execution sets the WA register to 1239H. CPU900-91 === page 74 === TOSHIBA TLCS-900 DEC num, dst < Decrement > Operation : dst #3,(mem) [im] 02 |= = = =| Note: #3 in operands indicates from 1 to 8; object codes correspond from 1 to 7,0. Flags : S Z H V N C pete fe fe fa] -| S = MSB value of the result is set. Z = 1issetifthe result is 0, otherwise 0. H = 1 is set if a borrow from bit 3 to bit 4 occurs as a result of the operation, otherwise 0. V = 1issetifan overflow occurs as a result of the operation, otherwise 0. N = lisset. C = Nochange Note: With the DEC #3, r instruction, if the operand is a word or a long word, no flags change. Executionexample: DEC 4,HL When the HL register = 5678H, execution sets the HL register to 5674H. CPU900-78 === page 75 === TOSHIBA TLCS-900 NEG dst < Negate > Operation : dst Ececi ce ere Flags : S Z H V N C pete fete file | S = MSB value of the result is set. Z = 1isset when the result is 0, otherwise 0. H = 1isset when a borrow from bit 3 to bit 4 occurs as a result, otherwise 0. V = 1isset when an overflow occurs as a result, otherwise 0. N = 1Lisset. C = 1isset when a borrow from the MSB occurs as a result, otherwise 0. Execution example: NEG IX When the IX register = 0002H, execution sets the IX register to FFFEH. 0000 (Fixed) CS) 0002 IX register IX register CPU900-122 === page 76 === TOSHIBA TLCS-900 EXTZ dst < Extend Zero> Operation : dst <0 Description : Clears the upper half of dst to zero. Used for making the operand sizes the same when they are different. Details : Size Mnemonic Code Byte Word Long word x O OO BRM ¢ Toil Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Executionexample: EXTZ HL When the HL register = 6789H, execution sets the HL register to 0089H. EXTZ XIX When the XIX register = 12345678H, execution sets the XIX register to 00005678H. CPU900-89 === page 77 === TOSHIBA TLCS-900 EXTS dst < Extend Sign > Operation : dst Description : Transfers (copies) the signed bit (bit 7 when the operand size is a word, bit 15 when a long word) of the lower half of dst to all bits of the upper half of dst. Details : Size Mnemonic Code Byte Word Long word x O OO BXPS ERCUerea ei ere Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Executionexample: EXTS HL When the HL register = 6789H, execution sets the HL register to FF89H. g ‘ fofififofol1l1[1{1fojofo]1f{ojo]1| HL register (before execution) 15 8 7 0 Ftfaftaftafaf{rafafrafrfojofo]{1fojo1| HL register (after execution) CPU900-88 === page 78 === TOSHIBA TLCS-900 DAA dst < Decimal Adjust Accumulator > Operation : dst Operation : if dst =1 thendst Operation : dst Xsrc (unsigned) Description : Multiplies unsigned the contents of lower half of dst by those of src and loads the result to dst. Details : Size Mnemonic Code Byte Word Long word OO x MUL RRr Ercec eae ere foy1,0, 0,0] \R, 0 OO x MUL me Ere ere O 0 x MUL RR mem) Tmo @ [mmm a] foy1,0,0,0] \R, Note : When the operation is in bytes, dst (word) < dst (byte) X src (byte). When the operation is in words, dst (long word) < dst (word) X sre (word). Match coding of the operand dst with the size of the result. Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: MUL XIX,IY When the IX register = 1234H and the IY register = 89ABH, execution multiplies unsigned the contents of the IX register by those of the IY register and sets the XIX register to O9C9FCBCH. CPU900-117 === page 82 === TOSHIBA TLCS-900 Note : “RR” for the MUL RR,r and MUL RR,(mem) instructions is as listed below: Operation size in bytes Operation size in words (16 bits < 8 bits x 8 bits) (32 bits — 16 bits x 16 bits) ae eee | [a eee a] WA 001 XWA 000 BC 011 XBC 001 DE 101 XDE 010 HL 111 XHL 011 IX XIX 100 IY Specifica- XIY 101 tion not IZ possible! XIZ 110 SP xSP 111 *1 When the CPU is in minimum mode, XWA, XBC, XDE, or XHL cannot be used. “rr” for the MUL rr,# instruction is as listed below. Operation size in pytes Operation size in words (16 bits < 8 bits x 8 bits) (32 bits < 16 bits x 16 bits) [eed WA 001 XWA 000 BC 011 XBC 001 DE 101 XDE 010 IX C7H : FOH XIX 100 IY C7H : F4H XIY 101 IZ C7H : F8H XIZ 110 sP C7H : FCH xSP 114 Istbyte 2nd byte *3 When the CPU is in minimum mode, *2 Any other word registers can be ., WA, XBC, XDE, or XHL cannot be used. specified in the same extension 4 Any other long word registers can be coding as those for IX to SP. specified in the extension coding. CPU900-118 === page 83 === TOSHIBA TLCS-900 MULS dst, sre < Multiply Signed > Operation : dst Xsrc (signed) Description : Multiplies signed the contents of the lower half of dst by those of sre and loads the result to dst. Details : Size Mnemonic Code Byte Word Long word OO x MUL RRr ErceC eae ere foyt,0, 0,1) \Ry 0 O x MULS me Ere ere O 0 x MULS RR mem) Fm] 0 # [mmm a] foto, 0,1] \Ry Note : When the operation is in bytes, dst(word) < dst (byte) X src (byte). When the operation is in words, dst (long word) < dst (word) X sre (word). Match coding of the operand dst with the size of the result. Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: MULS XIX,IY When the IX register = 1234H and the IY register = 89ABH, execution multiplies signed the contents of the IX register by those of the IY register and sets the XIX register to F795FCBCH. CPU900-120 === page 84 === TOSHIBA TLCS-900 Note: “RR” for the MULS RR,r and MULS RR,(mem) instructions is as listed below: Operation size in bytes Operation size in words (16 bits<-8 bits x 8 bits) (32 bitse-16 bits x 16 bits) eee [eee WA 001 XWA 000 BC 011 XBC 001 DE 101 XDE 010 HL 111 XHL 011 IX XIX 100 lY Specifica- XIY 101 tion not IZ possible! XIZ 110 SP XSP 111 *1 When the CPU is in minimum mode, XWA, XBC, XDE, or XHL cannot be used. “rr” for the MULS rr,# instruction is as listed below. Operation size in bytes Operation size in words (16 bits<8 bits x 8 bits) (32 bits<-16 bits x 16 bits) [eed WA 001 XWA 000 BC 011 XBC 001 DE 101 XDE 010 IX C7H : FOH XIX 100 IY C7H : F4H XIY 101 IZ C7H : F8H XIZ 110 sP C7H : FCH xSP 114 istbyte 2nd byte *3 When the CPU is in minimum mode, XWA, *2 Any other word registers can be #4 ABC, ree ie XHL cannot be used. b specified in the same extension ny 4 si Sha oxte regis edi can be coding as those for IX to SP. specinied in the extension coding. CPU900-121 === page 85 === TOSHIBA TLCS-900 DIV dst, sre < Divide > Operation : dst < remainder (unsigned) Description : Divides unsigned the contents of dst by those of src and transfers the quotient to the lower half of dst, the remainder to the upper half of dst. Details : Size Mnemonic Code Byte Word Long word 0 O x DV RR ErerCie camer oytyoyt,0] Ry 0 OO ™. DV me mpl | O 0 x DIV RRimem) — ]mp oT # Jom m | fo,1,0,1,0] {Ry | *For RR, see the following page. Notes : When the operation is in bytes, dst (lower byte) < dst (word) +src (byte), dst (upper byte) < remainder. When the operation is in words, dst (lower word) < dst (long word) + sre (word), dst (upper word) < remainder. Match coding of the operand dst with the size of the dividend. Flags : S Z H V N C |-|-[-[v]-|-| S = Nochange Z = Nochange H = Nochange V = 1isset when divided by 0 or the quotient exceeds the numerals which can be expressed in bits of dst for load; otherwise, 0 is set. N = Nochange C = Nochange CPU900-81 === page 86 === TOSHIBA TLCS-900 Execution example: DIV XIX,IY When the XIX register = 12345678H and the IY register = 89ABH, execution results in a quotient of 21DAH and a remainder of OFDAH, and sets the XIX register to OFDA21DAH. Note: : “RR” ofthe DIV RR,r and DIV RR,(mem) instruction is as listed below. Operation size in bytes Operation size in words (8 bits — 16 bits = 8 bits) (16 bits < 32 bits + 16 bits) ae [eae] [ae [eee] WA 001 XWA 000 BC 011 XBC 001 DE 101 XDE 010 IX XIX 100 IY Specifica- XlY 101 tion not IZ J possible! xIZ 110 SP XSP 111 *1 When the CPU is in minimum mode, XWA, XBC, XDE, and XHL cannot be used. “rr” of the DIV rr,# instruction is as listed below. Operation size in bytes Operation size in words (8 bits — 16 bits = 8 bits) (16 bits — 32 bits + 16 bits) pe | code“ | WA 001 XWA 000 BC 011 XBC 001 DE 101 XDE 010 IX C7H : FOH XIX 100 IY C7H : F4H XlY 101 IZ C7H : F8H XIZ 110 SP C7H : FCH XSP 111 istbyte 2nd byte *3 When the CPU is in minimum mode, XWA, *2 Any other word registers can be specified ,, BC, XDE, and XHL cannot be used. in the same extension coding as IX to SP. 4 Any other long word registers can be specified in the extension coding. CPU900-82 === page 87 === TOSHIBA TLCS-900 DIVS dst, sre < Divide Signed > Operation : dst < remainder (signed) Description : Divides signed the contents of dst by those of src and transfers the quotient to the lower half of dst, the remainder to the upper half of dst. Details : Size Mnemonic Code Byte Word Long word 0 O x DIS RRr ErerCie eer oto. t] Re 0 OO ™ DVS me mpl | O 0 x DVS RRimem) — [7]m] oe] mm | fo y1,0, 1,1] {Ry | * For RR, see the following page. Notes : When the operation is in bytes, dst (lower byte) < dst (word) +src (byte), dst (upper byte) <— remainder. When the operation is in words,dst (lower word) < dst (long word) + sre (word), dst (upper word) < remainder. Match coding of the operand dst with the size of the dividend. The sign of the remainder is the same as that of the dividend. Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = 1 is set when divided by 0, or the quotient exceeds the value which can be expressed in bits of the dst used for loading, otherwise 0. N = Nochange C = Nochange CPU900-83 === page 88 === TOSHIBA TLCS-900 Execution example: DIVS XIX,IY When the XIX register = 12345678H and the IY register = 89ABH, execution results in the quotient as 16EEH and the remainder as D89EH, and sets the XIX register to 1JGEED89EH. Note: “RR” of the DIVS RR,r and DIVS RR,(mem) instruction is as listed below. Operation size in bytes Operation size in words (8 bits — 16 bits = 8 bits) (16 bits — 32 bits + 16 bits) [eee Tae [eae a WA 001 XWA 000 BC 011 XBC 001 DE 101 XDE 010 HL 111 XHL 011 lY | spect XIY 101 tion not IZ J possible! xIZ 110 SP XSP 111 *1 When the CPU is in minimum mode, XWA, XBC, XDE, or XHL cannot be used. “rr” of the DIVS rr,# instruction is as listed below. Operation size in bytes Operation size in words (8 bits — 16 bits = 8 bits) (16 bits — 32 bits + 16 bits) WA 001 XWA 000 BC 011 XBC 001 DE 101 XDE 010 HL 111 XHL 011 IY C7H : F4H XIY 101 IZ C7H : F8H XIZ 110 SP C7H : FCH xSP 114 Istbyte 2nd byte *3> When the CPU is in minimum mode, XWA, *2 Any other word registers can be specified *4 Any ‘other eg word ines be used. be in the same extension coding as those for specified in the extension coding. CPU900-84 === page 89 === TOSHIBA TLCS-900 MULA dst < Multiply and Add > Operation : dst Operation : if (dst mod num) = (num—1) then dst Operation : if (dst mod num) = (num—2) then dst Operation : if (dst mod num) = (num—4) then dst Operation : if (dst mod num) =0 then dst Operation : if (dst mod num) =0 then dst Operation : if (dst mod num)=0 then dst Operation : dst (mem),# 7] m]0]# [mmm ml CPU900-59 === page 97 === TOSHIBA TLCS-900 Flags : S Z H V N C p= [t+[1}+]o[o| S = MSB value of the result is set. Z = 1lissetifthe result is 0, otherwise 0. H = 1lisset. V = 1lissetifa parity of the result is even, 0 if odd. If the operand is 32 bits, an undefined value is set. N = Cleared to zero. C = Cleared to zero. Execution example: AND HL,IX When the HL register = 7350H and the IX register = 3456H, execution sets the HL register to 3050H. 0111 0011 0101 0000 < HLregister (before execution) AND) 0011 0100 0101 0110 < IX register (before execution) 0011 0000 0101 0000 < HLregister (after execution) CPU900-60 === page 98 === TOSHIBA TLCS-900 OR dst, sre < LogicalOR > Operation : dst mem), = A] m0» [nym mm CPU900-125 === page 99 === TOSHIBA TLCS-900 Flags : S Z H V N C S = MSB value of the result is set. Z = 1isset when the result is 0, otherwise 0. H = Oisset. V = 1 is set when the parity (number of 1s) of the result is even, 0 when odd. When the operand is 32-bit, an undefined value is set. N = Cleared to 0. C = Cleared to 0. Execution example: OR HL,IX When the HL register = 7350H and the IX register is 3456H, execution sets the HL register to 7756H. 0111 0011 0101 0000 < HLregister (before execution) OR) 0011 0100 0101 0110 < IX register (before execution) 0111 0111 0101 0110 < MHLregister (after execution) CPU900-126 === page 100 === TOSHIBA TLCS-900 XOR dst, sre < ExclusiveOR > Operation : dst (mem), # it [m[o|2 |= mmm CPU900-162 === page 101 === TOSHIBA TLCS-900 Flags : S Z H V N C S = MSB value of the result is set. Z = 1isset when the result is 0, otherwise 0. H = Reset to 0. V = 1isset when the parity (number of 1s) of dst is even as a result, otherwise 0. If the operand is 32 bits, an undefined value is set. N = Cleared to 0. C = Cleared to 0. Execution example: XOR HL,IX When the HL register = 7350H and the IX register = 3456H, execution sets the HL register to 4706H. 0111 0011 0101 0000 < HLregister (before execution) XOR) 0011 0100 0101 0110 < I[X register (before execution) 0100 0111 0000 0110 < HLregister (after execution) CPU900-163 === page 102 === TOSHIBA TLCS-900 CPL dst < Complement > Operation : dst Operation : CY Description : Loads the contents of bit num of src to the carry flag. Details : Size Mnemonic Code Byte Word Long word OO x Ler Hae EREWtd En Ee O 0 x LWDeF As Reece ere Ox x LDR #8, ¢emem) mn] 1 am OX xX DOR Ame) mn] am Notes : When bit num is specified by the A register, the value of the lower 4 bits of the A register is used as bit num. When the operand is a byte and the value of the lower A bits of bit num is from 8 to 15, the value of the carry flag is undefined. Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Contents of bit num of src is set. Execution example: LDCF 6,(100H) When the contents of memoryad address 100 = 01000000B (binary), execution sets the carry flag to 1. () A t fo}1{ojolojololo| Address 100 [1] Carry flag CPU900-100 === page 104 === TOSHIBA TLCS-900 STCF num, dst < Store Carry Flag > Operation : dst Operation : CY Description : Ands the contents of the carry flag and bit num of src, and transfers the result to the carry flag. Details : Size Mnemonic Code Byte Word Long word O 0 x ANDCR #4, ExEetd SEs ea O 0 x ANDOF = Ax Ere ere O x x ANDCF _ #3, (mem) fi ]m|1,1|m)m,m)m| OX xX ANDOF = A,(mem) [mn] Yam Notes : When bit num is specified by the A register, the value of the lower 4 bits of the A register is used as bit num. When the operand is a byte and the value of the lower A bits of bit num is from 8 to 15, the result is undefined. Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = The value obtained by anding the contents of the carry flag and the bit num of src is set. Execution example: ANDCF6,(100H) When the contents of memory address 100 = 01000000B (binary) and the carry flag = 1, execution sets the carry flag to 1. 76543210 [0] 1]0]0]0]0]0]0] Address 100 @ND Carry flag (before execution) Carry flag (after execution) CPU900-61 === page 106 === TOSHIBA TLCS-900 ORCF num, src < ORCarry Flag > Operation : CY Description : Ors the contents of the carry flag with those of bit num of sre and loads the result to the carry flag. Details : Size Mnemonic Code Byte Word Long word O OO x oRCr 4s TET | O 0 x ORF As Ere ere O x x oRCF #8,(mem) mf im Ox x ORCF Aime) nT Yam Note : When bit num is specified by the A register, the value of the lower 4 bits of the A register is used as bit num. When the operand is a byte and the value of the lower bits of bit num is from 8 to 15, the result is undefined. flag : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = The result of or-ing the contents of the carry flag with those of bit num of src is set. Execution example: ORCF 6, (100H) When the contents of memory at address 100H = 01000000B (binary) and the carry flag= 0, execution sets the carry flag to 1. 76543210 101 {0/0 ]0 {0 Jo jo | Address 100 (or)<[0] Carry flag (before execution) Carry flag (after execution) CPU900-127 === page 107 === TOSHIBA TLCS-900 XORCF num, src < Exclusive OR Carry Flag > Operation : CY Description : Exclusive ors the contents of the carry flag and bit num of src, and loads the result to the carry flag. Details : Size Mnemonic Code Byte Word Long word O 0 x XORCF #4 Fert caer O 0 x XORCF Ay Ere ere O x x XORCF #3, (mem) fi {m|1,1|m)m,m,m| Ox xX KORCP —A(mem) [En] [mm Note : When bit num is specified by the A register, the value of the lower 4 bits of the A register is used. When the operand is a byte and the value of the lower 4 bits of bit num is from 8 to 15, the result is undefined. Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = The value obtained by exclusive or-ing the contents of the carry flag with those of bit num of src is set. Execution example: XORCF 6, (100H) When the contents of memory at address 100H = 01000000B (binary) and the carry flag = 1, execution sets the carry flag to 0. 76543210 (0]1]0]0]0]0]0]0] Address 1004 oR) Carry flag (before execution) 10] Carry flag (after execution) CPU900-164 === page 108 === TOSHIBA TLCS-900 RCF < Reset Carry Flag > Operation : CY<0 Description : Resets the carry flag to 0. Details : Mnemonic Code RCF Flags : S Z H V N C S = Nochange Z = Nochange H = Reset to0. V = Reset to0. N = Nochange C = Reset to 0. CPU900-135 === page 109 === TOSHIBA TLCS-900 SCF < Set Carry Flag > Operation : CY<1 Description : Sets the carry flag to 1. Details : Mnemonic Code SCF Flags : S Z H V N C -[-]o}-]o[2| S = Nochange Z = Nochange H = Reset to0. V = Nochange N = Reset to 0. C = Settol. CPU900-149 === page 110 === TOSHIBA TLCS-900 < Complement Carry Flag > Operation : CY < inverted value of CY Description : Inverts the contents of the carry flag. Details : Mnemonic Code cor Flags : S Z H V N C |-[-|x[-]o] + | S = Nochange Z = Nochange H = Anundefined value is set. V = Nochange N = Reset to 0. C = Inverted value of itself is set. Execution example: When the carry flag = 0, executing CCF sets the carry flag to 1; executing CCF again sets the carry flag to 0. 0 Carry flag (before execution) Carry flag (before execution) Inverted Inverted Carry flag (after execution) 0 | Carry flag (after execution) CPU900-67 === page 111 === TOSHIBA TLCS-900 ZCF < Zero flag to Carry Flag > Operation : CY Operation : Zflag Description : Transfers the inverted value of the bit num of src to the Z flag. Details : Size Mnemonic Code Byte Word Long word OO x Br Hae fr cere Ox x BP #8,¢mem) Fm] 1 frm m | Flags : S Z H V N C xi =| ri xo} -| S = Anundefined value is set. Z = The inverted value of sre is set. H = lisset. V = Anundefined value is set. N = Reset to 0. C = Nochange Execution example: BIT 5,(100H) When the contents of memory address 100 = 00100000B (binary), execution sets the Z flag to 0. 76543210 [0 [0/1/00 ]0 {0 Jo | Address 100 Inverted 0 | Z flag CPU900-62 === page 113 === TOSHIBA TLCS-900 RES num, dst < Reset > Operation : dst < 0 Description : Resets bit num of dst to 0. Details : Size Mnemonic Code Byte Word Long word O 0 x RBS #4: TEE | O x x RBS #8,(memn) Fm] 1 Jom m mm Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: RES _ 5, (100H) When the contents of memory at address 100H = 00100111B (binary), execution sets the contents to 00000111B (binary). 76543210 JO F Jo]O]1]1]1] Address 100 be CPU900-136 === page 114 === TOSHIBA TLCS-900 SET num, dst < Set > Operation : dst<1 Description : Sets bit num of dst to 1. Details : Size Mnemonic Code Byte Word Long word O OO x ser #4: TEE | Ox x SBP #8,¢emem) En] 1 Yam Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: SET 5, (100H) When the contents of memory at address 100H = 00000000B (binary), execution sets the contents of memory at address 100H to 00100000B (binary). 7 6 5 4 3210 fo]0f J0]0]0]0]0] Address 100H Loads CPU900-150 === page 115 === TOSHIBA TLCS-900 CHG num, dst < Change > Operation : dst < Inverted value of dst Description : Inverts the value of bit num of dst. Details : Size Mnemonic Code Byte Word Long word 0 O x CHa #4: TEE | O x x CHG #8, (mera) Fm 1 Jom mmm Flags : § Z H VN C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: CHG 5,(100H) When the contents of memory address 100 = 00100111B (binary), execution sets the contents to 00000111B (binary). 7_ 6 4,3 2 1 0 fojo}ifofo{1}1] 1] Address 100 (before execution) Inverted foj}ofofojoj1]1]1| Address 100 (after execution) CPU900-68 === page 116 === TOSHIBA TLCS-900 TSET num, dst < Test and Set > Operation : Z flag < inverted value of dst dst <1 Description : Loads the inverted value of the bit num of dst to the Z flag. Then the bit num of dst is set to “1”. Details : Size Mnemonic Code byte word long word __ OO x TSBP #4 ExEN EES ee O x x TSET —— #3,(mem) yoytjo.t] #3 Flags : § Z H V N C | x[«[1}|x]ol-| S = Anundefined value is set. Z = The inverted value of the src is set. H = Settol V = Anundefined value is set. N = Setto0 C = Nochange Execution example: When the contents of memory at address 100H=00100000B (binary), TSET 3, (100H) execution sets the Z flag to 1, the contents of memory at address 100H =00101000B (binary). i) dl 0 fofof;1jojolol{olo. address 100H (before execution) Inverted 1 | Z flag fofof{ifo}1jol{o|{o) address 100H (after execution) CPU900-160 === page 117 === TOSHIBA TLCS-900 BS1B_ dst, sre < Bit Search 1 Backward > Operation : dst Operation : dst Operation : None. Description : Does nothing but moves execution to the next instruction. The object code of this instruction is 00H. Details : Mnemonic Code NoP Flags : § Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange CPU900-123 === page 120 === TOSHIBA TLCS-900 Operation : SYSMbit <0 Description : Resets the SYSM bit in status register to 0 and changes the CPU to normal mode. Details : Mnemonic Code NORMAL Flags : § Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Note : Basically, only the software interrupt (SWI) instruction changes the mode from normal to system by software. The following change the mode: (1) SWI (2) Privilege violation interrupt (3) Tlegal instruction interrupt (4) Hardware interrupt (5) Reset The SWI instruction is used to change the mode to system in the middle of program execution, as shown below. SWI n SET 7,(XSP+1) | At address 8000H+nX10H | RET (n = Oto 7) CPU900-124 === page 121 === TOSHIBA TLCS-900 Operation : Maxbit<1 Description : Sets the MAX bit in status register to 1. Changes the CPU operation mode to maximum. Details : Mnemonic Code MAX Flags : § Z H V_N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Note : Basically, there is no instruction for changing from maximum to minimum mode. However, if it is absolutely necessary, execute either of the following ways but it is in system mode only. (1) PUSH SR RES 3, (XSP+1) POP SR CPU900-109 === page 122 === TOSHIBA TLCS-900 KI num This is privileged instruction in 900_CPU. Operation : IFF <2:0> in the status register to num. After execution, the CPU interrupt receive level becomes num. Details : Mnemonic Code BI #83] Note: A value from 0 to 7 can be specified as the operand value. If the operand is omitted, the default value is “O” (EI 0). Flags : § Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange CPU900-86 === page 123 === TOSHIBA TLCS-900 < Disable Interrupt > This is privileged instruction in 900_CPU. Operation : IFF<2:0> <7 Description : Sets the contents of the interrupt enable flag (IFF) <2:0> in status register to 7. After execution, only non-maskable interrupts (interrupt level 7) can be received. Details : Mnemonic Code DI Flags : § Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange CPU900-80 === page 124 === TOSHIBA TLCS-900 PUSH SR This is privileged instruction in 900. Operation : (—XSP) ‘This is privileged instruction in 900. Operation : SR<(XSP+) Description : Loads the contents of the address specified by the stack pointer XSP to status register. Then increments the contents of the stack pointer XSP by 2. Details : Size Mnemonic Code Byte Word Long word xO. x POP &R Flags : S Z H V N C = [+ fe ls [es |] | S = Z=- H = vy — ? Contents of the memory address specified by the stack pointer XSP are set. N =| C= Note : The timing for executing this instruction is delayed by several states than that for fetching the instruction. This is because an instruction queue (4 bytes) and pipeline processing method is used. Note, when changing from the system area to the normal area using this instruction, that the access area of the instruction code immediately after this instruction is used as the access area before execution of this instruction. The figure below is an example. POP SR Instruction 1 System area Instruction 2 Normal area CPU900-131 === page 126 === TOSHIBA TLCS-900 SWI num < Software Interrupt > Operation : [Thecase of 900] 1) Temp This is privileged instruction in 900_CPU. Operation : CPU halt Description : Halts the instruction execution. To resume, an interrupt must de received. Details : Mnemonic Code Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange CPU900-90 === page 129 === TOSHIBA TLCS-900 LDC dst, sre < Load Control Register > This is privileged instruction in 900_CPU. Operation : dst Operation : dst Operation : (—XSP) a 23CH: LEE «xSP yy OES) Willa 27CH: |__» | <-XlZ 280H: LZ Operation : XSP Operation : RFP<2:0> in status register. Since RFP2 is fixed to 0 in maximum mode, when the num value is from 4 to 7, RFP is set to from 0 to 3. Details : Mnemonic Code LDF #83 Note : In minimum mode, the operand value can be specified from 0 to 7; in maximum mode, from 0 to 3. Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange CPU900-103 === page 135 === TOSHIBA TLCS-900 INCF < Increment Register File Pointer > Operation : RFP<2:0>+1 Description : Increments the contents of RFP<2:0> in the status register by 1. In maximum mode, RFP2 is fixed to 0. Details : Mnemonic Code INCE Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: INCF When the contents of RFP<2:0> = 2, execution sets the contents of RFP <2:0> to 3. CPU900-92 === page 136 === TOSHIBA TLCS-900 DECF < Decrement Register File Pointer > Operation : RFP<2:0>-1 Description : Decrements the contents of register file pointer RFP <2:0> in the status register by 1. In maximum mode, RFP2 is fixed to 0. Details : Mnemonic Code Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: DECF When the contents of RFP<2:0> = 2, execution sets the contents of RFP <2:0> to 1. CPU900-79 === page 137 === TOSHIBA TLCS-900 SCC condition, dst < Set Condition Code > Operation : Ifccis true, then dst <1 else dst —0. Description : Loads 1 to dst when the operand condition is true; when false, 0 is loaded to dst. Details : Size Mnemonic Code Byte Word Long word OO x SG eas hla | Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: SCC OV,HL When the contents of the V flag = 1, execution sets the HL register to 0001H. CPU900-148 === page 138 === TOSHIBA TLCS-900 RLC num, dst < Rotate Left without Carry > Operation : {CY, dst< left rotate value of dst} Repeat num Description : Loads the contents of the MSB of dst to the carry flag and rotates left the contents of dst. Repeats the number of times specified in num. Description figure : dst MSB < LSB Details : Size Mnemonic Code Byte Word Long word 0 0 CO RO He Talal | 0 0 OO Mo A Eee cred ere O Ox REO (mem Pe Yom 0 Po [am Note : When the number of rotates is specified by the A register, the value of the lower 4 bits of the A register is used. Specifying 0 rotates 16 times. When dst is memory, rotating is performed only once. Flags : S Z H V N C *|* lol lo] s | S = MSB value of dst after rotate is set. Z = 1isset when the contents of dst after rotate is 0, otherwise, 0. H = Reset to0. V = 1 is set when the parity (number of 1s) of dst is even after rotate. If the operand is 32 bits, an undefined value is set. N = Reset to 0. C = MSB value of dst before the last rotate is set. Execution example: RLC 4,HL When the HL register = 1230H, execution sets the HL register to 2301H and the carry flag to 1. CPU900-141 === page 139 === TOSHIBA TLCS-900 RRC num, dst < Rotate Right without Carry > Operation : {CY, dst (mem Pe Yom 0 Pe [om Note : When the number of rotates num is specified by the A register, the value of the lower 4 bits of the A register is used as the number of rotates. Specifying 0 rotates 16 times. When dst is memory, rotating is only once. Flags : S Z H V N C *|*lol«*|o |. | S = MSB value of dst after rotate is set. Z = 1isset when the contents of dst after rotate is 0, otherwise 0. H = Reset to0. V = 1is set when the parity (number of 1s) of dst is even after rotate, otherwise 0. If the operand is 32 bits, an undefined value is set. N = Reset to 0. C = MSB value of dst before the last rotate is set. Execution example: RLC 4,HL When the HL register = 1230H, execution sets the HL register to 0123H and the carry flag to 0. CPU900-144 === page 140 === TOSHIBA TLCS-900 RL num, dst < Rotate Left > Operation : {CY &dst (mem Pe Yom] O = [ma Note: When the number of rotates is specified by the A register, the value of the lower 4 bits of the A register is used. Specifying 0 rotates 16 times. When dst is memory, rotating is performed only once. Flags : S Z H V N C *|* lol lo] s | S = MSB value of dst after rotate is set. Z = 1isset when the contents of dst after rotate is 0, otherwise 0. H = Reset to0. V = 1is set when the parity (number of 1s) of dst is even after rotate, otherwise 0. If the operand is 32 bits, an undefined value is set. N = Reset to 0. C = The value after rotate is set. Executionexample: RL 4,HL When the HL register = 6230H and the carry flag = 1, execution sets the HL register to 230BH and the carry flag to 0. CPU900-140 === page 141 === TOSHIBA TLCS-900 RR num, dst < Rotate Right > Operation : {CY &dst (mem) iT [=[o[2[=,m mm Note : When the number of rotates is specified by the A register, the value of the lower 4 bits of the A register is used. Specifying 0 rotates 16 times. When dst is memory, rotating is performed only once. Flags : S Z H V N C *|* lol lo] s | S = MSB value of dst after rotate is set. Z = 1isset when the contents of dst after rotate is 0, otherwise 0. H = Reset to0. V = 1 is set when the parity (number of 1s) of dst is even after the rotate, otherwise 0. If the operand is 32 bits, an undefined value is set. N = Reset to 0. C = The value after rotate is set. Executionexample: RR 4,HL When the HL register = 6230H and the carry flag = 1, execution sets the HL register to 1623H and the carry flag to 0. CPU900-143 === page 142 === TOSHIBA TLCS-900 SLA num, dst < Shift Left Arithmetic > Operation : {CY , dst < left shift value of dst, dst <0} Repeat num Description : Loads the contents of the MSB of dst to the carry flag, shifts left the contents of dst, and loads 0 to the LSB of dst. Repeats the number of times specified in num. dst Description chart: MSB < LSB |x— (mem Prom 0 Po [om] Note : When the number of shifts, num, is specified by the A register, the value of the lower 4 bits of the A register is used. Specifying 0 shifts 16 times. When dst is memory, shifting is performed only once. Flags : S Z H V N C *|* lol lo] s | S = MSB value of dst after shift is set. Z = 1isset when the contents of dst after shift is 0, otherwise 0. H = Reset to0. V = 1isset when the parity (number of 1s) of dst is even after shifting, otherwise 0. If the operand is 32 bits, an undefined value is set. N = Reset to 0. C = MSB value of dst before the last shift is set. Executionexample: SLA 4,HL When the HL register = 1234H, execution sets the HL register to 2340H and the carry flag to 1. CPU900-151 === page 143 === TOSHIBA TLCS-900 SRA num, dst < Shift Right Arithmetic > Operation : {CY <— dst, dst < right shift value of dst, dst is fixed} Repeat num Description : Loads the contents of the LSB of dst to the carry flag and shifts right the contents of dst (MSB is fixed). Repeats the number of times specified in num. Description chart: dst riMisel > LSB Details : Size Mnemonic Code Byte Word Long word O 0 0 SRA #4e Ered crea ere 0 O O SRA Ay hat fl O 0 x SRA (mem) Peon oP [im] Note : When the number of shifts, num, is specified by the A register, the value of the lower 4 bits of the A register is used. Specifying 0 shifts 16 times. When dst is memory, shifting is performed only once. Flags : S Z H V N C *|*lol«*|o |. | S = MSB value of dst after shift is set. Z = 1isset when the contents of dst after shift is 0, otherwise 0. H = Reset to 0. V = 1isset when the parity (number of 1s) of dst is even after shift, otherwise 0. If the operand is 32 bits, an undefined value is set. N = Reset to 0. C = LSB value of dst before the last shift is set. Executionexample: SRA 4,HL When the HL register = 8230H, execution sets the HL register to F823H and the carry flag to 0. CPU900-153 === page 144 === TOSHIBA TLCS-900 SLL num, dst < Shift Left Logical > Operation : {CY <—dst, dst < left shift value of dst, dst < 0} Repeat num Description : Loads the contents of the MSB of dst to the carry flag, shifts left the contents of dst, and loads 0 to the MSB of dst. Repeats the number of times specified in num. dst Description chart: MSB_ <_ LSB “0” Details : Size Mnemonic Code Byte Word Long word 0 0 CO SL Hae Tol hl | 0 0 OO Ssh A Tab h] | O 0 xX SLL (mem Pe Yom] Oe [mm Note : When the number of shifts, num, is specified by the A register, the value of the lower 4 bits of the A register is used. Specifying 0 shifts 16 times. When dst is memory, shifting is performed only once. Flags : S Z H V N C *|*lol«*|o |. | S = MSB value of dst after shift is set. Z = 1isset when the contents of dst after shift is 0, otherwise 0. H = Reset to0. V = 1isset when the parity (number of 1s) of dst is even after shifting, otherwise 0. If the operand is 32 bits, an undefined value is set. N = Reset to 0. C = MSB value of dst before the last shift is set. Executionexample: SLL 4,HL When the HL register = 1234H, execution sets the HL register to 2340H and the carry flag to 1. CPU900-152 === page 145 === TOSHIBA TLCS-900 SRL num, dst < Shift Right Logical > Operation : {CY , dst < right shift value of dst, dst <0} Repeat num Description : Loads the contents of the LSB of dst to the carry flag, shifts right the contents of dst, and loads 0 to the MSB of dst. Repeats the number of times specified in num. dst Description chart: <0” Details : Size Mnemonic Code Byte Word Long word 0 0 OC SRL Hae Tol hl | 0 0 O sm As Ecce cere O Ox — SRL (mem Pe Yom 0 Po [om Note : When the number of shifts, num, is specified by the A register, the value of the lower 4 bits of the A register is used. Specifying 0 shifts 16 times. When dst is memory, shifting is performed only once. Flags : S Z H V N C S = MSB value of dst after shift is set. Z = 1isset when the contents of dst after shift is 0, otherwise 0. H = Reset to0. V = 1isset when the parity (number of 1s) of dst is even after shift, otherwise 0. If the operand is 32 bits, an undefined value is set. N = Reset to 0. C = LSB value of dst before the last shift is set. Executionexample: SRL 4,HL When the HL register = 1238H, execution sets the HL register to 0123H and the carry flag to 1. CPU900-154 === page 146 === TOSHIBA TLCS-900 RLD dstl, dst2 < Rotate Left Digit > Operation : dstl<3:0>,dst2<7:4>, dst2 <3:0> Description : Rotates left the lower 4 bits of dstl and the contents of dst2 in units of 4 bits. dstl dst2 Details : Size Mnemonic Code Byte Word Long word O & x RED Alimem) [mo 0mm ma] Flags : S Z H V N C S = MSB value ofthe A register after rotate is set. Z = 1is set when the contents of the A register after the rotate are 0, otherwise 0. H = Reset to 0. V = 1 is set when the parity (number of 1s) of the A register is even after the rotate, otherwise 0. N = Reset to 0. C = Nochange Execution example: RLD A, (100H) When the A register = 12H and the contents of memory at address 100H = 34H, execution sets the A register to 13H and the contents of memory at address 100H to 42H. CPU900-142 === page 147 === TOSHIBA TLCS-900 RRD dstl, dst2 < Rotate Right Digit > Operation : dstl<3:0>, dst2<7:4>, dst2 <3:0 > Description : Rotates right the lower 4 bits of dstl and the contents of dst2 in units of 4 bits. Description figure : dst1 dst2 Details : Size Mnemonic Code Byte Word Long word OX xX RD A(mem) [Jn], 0 [an mam Flags : S Z H V N C S = MSB value ofthe A register after rotate is set. Z = 1isset when the contents of the A register after rotate is 0, otherwise 0. H = Reset to 0. V = 1isset when the parity (number of 1s) of the A register is even after rotate, otherwise 0. N = Reset to 0. C = Nochange Execution example: RRD A, (100H) When the A register = 12H and the contents of memory at address 100H = 34H, execution sets the A register to 14H and the contents of memory at address 100H to 23H. CPU900-145 === page 148 === TOSHIBA TLCS-900 JP condition, dst < Jump > Operation : Ifccistrue, then PC < dst. Description : Ifthe operand condition is true, jumps to the program address specified by dst. Details : Mnemonic Code ep HG yp JP [coJJmem FIDierenevescyes Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Executionexample: JP 2000H Execution jumps unconditionally to address 2000H. CPU900-93 === page 149 === TOSHIBA TLCS-900 JR condition, dst < Jump Relative > Operation : Ifccis true, then PC < dst. Description : If the operand condition is true, makes a relative jump to the program address specified by dst. Details : Mnemonic Code FR fee) $4+2+d8 IRL [ee] $+3+d16 Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Executionexample: JR 2078H When this instruction is executed at memory address 2000H, execution relative jumps unconditionally to address 2078H. The object code of the instruction is 68H : 76H. Memory | 6 8 | Address 2000H (Op code) Address 2001H (displacement) | Ss«|s« Address 2078H -—~_ CPU900-94 === page 150 === TOSHIBA TLCS-900 CALL condition, dst < Call subroutine > Operation : Inminimum mode, ifcc is true, then XSP <— XSP—2,(XSP) < 16-bit PC, PC < dst. In maximum mode, if cc is true, then XSP — XSP—4,(XSP) — 32-bit PC, PC < dst. Description : Ifthe operand condition is true, saves the contents of the program counter to the stack area and jumps to the program address specified by dst. Details : Mnemonic Code CALL #16 CALL #24 CALL feeJmem [1] m]1 1 [m,mymm| Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: CALL 9000H When the stack pointer XSP is 100H in minimum mode, executing this instruction at memory address 8000H writes the return address 8003H (word data) to memory address OFEH, sets the stack pointer XSP to OFEH, and jumps to address 9000H. CPU900-65 === page 151 === TOSHIBA TLCS-900 CALR dst < Call Relative > Operation : In minimum mode, XSP <— XSP—2,(XSP) < 16-bit PC,PC < dst. In maximum mode, XSP — XSP—4,(XSP) < 32-bit PC,PC < dst. Description : Saves the contents of the program counter to the stack area and makes a relative jump to the program address specified by dst. Details : Mnemonic Code CALR $4+3+d16 Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange CPU900-66 === page 152 === TOSHIBA TLCS-900 DJNZ dstl, dst2 < Decrement and Jump if Non Zero > Operation : dstl Operation : Inminimummode: [Ifccistrue, then the 16-bit PC —(XSP), XSP <— XSP + 2. In maximum mode: Ifccis true, then the 32-bit PC <— (XSP), XSP <— XSP + 4. Description : Pops the return address from the stack area to the program counter when the operand condition is true. Details : Mnemonic Code RED RET oe Flags : S Z H V N C S = Nochange Z = Nochange H = Nochange V = Nochange N = Nochange C = Nochange Execution example: RET When the stack pointer XSP = OFEH and the contents of memory at address OFEH = 9000H (word data) in minimum mode, execution sets the stack pointer XSP to 100H and jumps (returns) to address 9000H. CPU900-137 === page 154 === TOSHIBA TLCS-900 RETD num < Return and Deallocate > Operation : Inminimum mode : 16-bit PC —(XSP), XSP ‘This is privileged instruction in 900. Operation : Inminimummode: 2-byte Temp <(XSP), 16-bit PC —(XSP+2), SR When the operand size is a word, W must be specified. L ] Operands enclosed in square brackets can be omitted. # 8/16/32-bit immediate data. #3 3-bit immediate data : Oto7or1to8... for abbreviated codes. #4 4-bit immediate data : Oto 150r1to 16 d8 8-bit displacement : - 80H to + 7FH d16 16-bit displacement : —8000H to + 7FFFH cc Condition code CY Carry flag Z Zero flag (#8) Direct addressing: (QOH) to (OFFH) ... 256-byte area (#16) 64K-byte area addressing: (Q000H) to (OFFFFH) (-r32) Pre-decrement addressing (r32+) Post-increment addressing $ Start address of instruction CPU900-48 === page 157 === TOSHIBA TLCS-900 | Explanations of symbols in object codes ; ere | word [one 72 Operand size specify code het at : Pele [on [a a ee " } Register specify code [code | Byte | Word | tonewor | r ee Pon [aA] ac | xc Poo |» | oe | we | pon fc fw | om re ee ce Po fe [om | ere a Note: In addition to the above, all registers can be specified by “r” using extension codes. In this case, the number of execution states increases by 1. The format is shown below. First op code YY Sets the lower 4 bits to 0111. inserts ne register code specitied j it t t irst The code value in "r" must be: Multiple of 2, if accessed as a word register. Multiple of 4 ,if accessed as a long word. For registers specified by 8 bits, see Register Maps. CPU900-49 === page 158 === TOSHIBA TLCS-900 Memory addressing mode specify code (XWA) = <7:0>= Indicates the data bit range. (XHL) = (XIX) = (XIY) = (XIZ) = (recess) = (XHL+d8) = (XTX+d8) = (XIY+d8) = (xsPed8) = (we) (#24) " (r324ri6) = (324) = t t zz= Code used to specify the value of r32: 32-bit register increments or decrements. r1i6: Signed 16-bit register 00: +1 r8: Signed 8-bit register 10: a 11: (Notdefined) r32’ = Upper 6 bits of register code CPU900-50 === page 159 === TOSHIBA TLCS-900 cc Condition codes symbol Conditional expression 0000 Fjalways False - 1000 (none)|always True - 0110 Z| Zero Z=1 1110 NZ|Not Zero Z=0 0111 C| Carry C=1 1111 NC |Not Carry C=0 1101 | PL or P|PLus S=0 0101 | MI or M|MInus S=1 1110 NE |Not Equal Z=0 0110 EQ | EQual Z=1 0100 OV | OVerf low P/V=1 1100 NOV|No OVerflow P/V=0 0100 PE|}Parity is Even P/V=1 1100 PO|Parity is Odd P/V=0 1001 GE|Greater than or Equal (signed)| (S xor P/V) =0 0001 LT|Less Than (signed) (S xor P/V) =1 1010 GT|Greater Than (signed) [Z or (S xor P/V) ]J=0 0010 LE|Less than or Equal (signed) [Z or (S xor P/V) ]=1 1111 UGE |Unsigned Greater than or Equal] C=0 0111 ULT|Unsigned Less Than C=1 1011 UGT|Unsigned Greater Than (C or Z) =0 0011 ULE|Unsigned Less than or Equal (C or Z) =1 | Flag changes 0 Reset to “0”. 1 Setto "1". - No change. * “0" or “1" depending on the result of the calculation. X Indeterminate value. P Parity result is set. V Overflow result is set. CPU900-51 === page 160 === TOSHIBA TLCS-900 | Register map “r” (minimum mode) +3 +2 +1 +0 00H a a, RWO (RWA:0) RAO O4H [\ tt RBO (RBC'0) RCO oH [YO D0 (RDE 10) REO | Banko OCH | \ TC CY RHO (RHL!0) RLO OH | \ Tt CO RW1 (RWAi1) RA1 14H [| \ lt C(t RB1 (RBC11) RC1 Bank 1 1H [ \ tC RD (RDE'1) REL 1H [| Yt RH1 (RHL'1) RL1 20H | OY RW2 (RWA!'2) RAZ 24H fo ON RB2__(RBC{2) RC2 Bank 2 28H | Ot RD2_(RDE:2) RE2 2cH [Yt RH2_(RHLi2) RL2 30H [| ON RW3__(RWA'3) RA3 34H [CU i___RB3_(RBC 3) _RC3 Bank 3 38H [CN RDB (RDE'3) RES 3cH | tC (tC RH3__(RHL13) RL3 40H [ON RW4 (RWA:4) RA4 44H TZN RB4_ (RBC :4) RC4 Bank 4 4sH | Ct RD4_(RDE'4) RE4 AH | SOON l RH4_(RHL'4) RL4 BOH TC RW5 (RWA'5) RAS B4H | CN RB5 (RBC15) RC5 Bank 5 58H [ft CNRS (RDET5) =RES BCH | ft CN RH5 (RHL'5) RL5 6OoH | Of lt RW6 (RWA!'G) RAG 64H | ft RB6__(RBC!6) RC6 Bank 6 6sH | fC RD6 (RDE‘6) REG 6CH | ft t—“‘*;‘“;tCSNCtTTCCRHG (RHL16) RLG 70H a RW7 (RWA'17) RAZ 74H [ft NN RB7_ (RBC!7) RC7 78H ie Bank7 7H FP rr rt—“‘(CSCSCN RH7__(RHL!7) RL7 DOH Pomme W(WiA’) A’ D4H fo B’ (B:C’) C’ Previ k D8H OT H D’ DIE’ E’ I revious ban DCH ba H’ (H'L’) L’ EOH [ot —“ WA) A E44 po CB BIC) CCS, Current bank E8H Jo D (DIE E ECH [oe H(HIL L FOH OIXH (O11X) OIXL IXH (1X) IXL F4H F8H OIZH (O'IZ) OIZL IZH (I'Z) IZL FCH OSPH (O'SP) OSPL SPH (S'P) SPL @) : Word register name (16 bits) < > : Long word register name (32 bits) CPU900-52 === page 161 === TOSHIBA TLCS-900 a Register map “r“ (maximum mode) +3 +2 +1 +0 00H 04H et BankO 08H OCH 10H 14H Bank 1 18H 1CH 20H 24H Bank 2 28H 2CH 30H 34H a Sea ate eg Bank 3 38H 3CH AOH P| a a 48H po ACH PN BOW PN eT 64H po Ne a A SCH Po ee 6OH Po a 64H fo NT 68H PO es ONT SCH ON TOR Poe 0 ne 78H Poe TCH eS DOH D4H a a ee Previous bank D8H DCH EOH E4H Current bank E8H ECH FOH F4H F8H FCH () : Word register name (16 bits) < > : Long word register name (32 bits) CPU900-53 === page 162 === TOSHIBA TLCS-900 a Control register map “cr” +3 +2 +1 +0 00H ! 1 04H \eMa 08H register OCH | ) 10H y \ DMA 14H 1 1 or 18H esta 1CH ) 20H ‘_DMAMO DMA !CO Yom A 24H H DMAM1 H DMA | C1 28H '__DMAM2___| DMA {C2 eeeeaounter 2CH 1 DMAN3 1 DMA'C3 ) 3CH NSP Normal stack 3CH pointer () : Word register name (16 bits) < > : Long word register name (32 bits) CPU900-54 === page 163 === TOSHIBA TLCS-900 Appendix B Instruction Lists | Explanation of symbols used in this document 1. Size B The operand size is in bytes (8 bits) W The operand size is in word (16 bits) L The operand size is in long word (32 bits) 2. Mnemonic R Eight general-purpose registers including 8/16/32-bit current bank registers. 8 bitregister: W, A, B, C, D, E, H, L 16 bitregister: WA, BC, DE, HL, IX, IY, IZ, SP 32 bitregister: XWA, XBC, XDE, XHL, XIX, XIY, XIZ, XSP r 8/16/32-bit general-purpose registers cr All 8/16/32-bit CPU control registers DMASO to 3, DMADO to 3, DMACO to 3, DMAMO to 3, XNSP A A register (8 bits) F Flag registers (8 bits) F’ Inverse flag registers (8 bits) SR Status registers (16 bits) PC Program Counter (in minimum mode, 16 bits; in maximum mode, 32 bits) (mem) 8/16/32-bit memory data mem Effective address value (#8) ,# 08+z :#8:# (#8) ¢ # at# 866. 6. - BW- |LD = (mem) ,# BOtnem = :00+Z:# (mem) <« # 2+M# |6. 6. - BW- |LD (#16),(mem) |80+zz+mem:19:#16 (#16) © (mem) 4AM «68. 8. - BW- |LD (mem),(#16) |BO+mem :14+z:#16 |(mem) « (#16) 44M 8. 8. - B-- |PUSH F 18 (-XSP) « F 1 3. -. - B-- |PUSH A 14 (-XSP) < A 1 BS. 7. 7 PUSH | ~-WL |PUSH R 18+zz+R (-XSP) « R 1 -. 3.5 BWL |PUSH r C8+zztr 304 (-XSP) « # 09+z :# (-XSP) « # it# (4. 6. - BW- |PUSH (mem) 80+zz+mem: 04 (-XSP) < (mem) 2+M 7.7. - B-- |POP F 19 F < (XSP+) 1 Al n-. B-- |POP A 15 A © (XSP+) 1 A, -. - -WL |POP R 38+zz+R R « (XSP+) 1 -. 4.6 BWL |POP r C8+zzt+r 305 r © (XSP+) 2 6. 6. 8 BW- |POP (mem) BOt+mem :04+z (mem) « (XSP+) 24M OG. 6. - LDAR | -wi |LDAR R,$+4+d16 F3:13:d16:20+zz+R |R « PC+d16 ------|5 [-.at.41 (2) Exchange B-- |EX F,F’ 16 Fo F’ 1 2.7. 7 EX BW- |EX R,r C8+zz+r <:B8&+R Rer 2 5. 6. - BW- |EX (mem) ,R 80+zz+mem: 30+R (mem) <= R 2+M =O6. 6. - [MIRR | -w- |MIRR D8tr 16 rer|------|2. |. 4. =| CPU900-168 === page 166 === TOSHIBA TLCS-900 M@ Instruction Lists of 900 (2/10) (3) Load Increment/Decrement & Compare Increment/Decrement Size LDI 83+zz :10 |(XDE+) « (XHL+) |-o@0- |2 10.10. - [ (XDE+) , (XHL+) ] BC « BC-1 LDI 85+zz = :10 = |(XIX+) © (XIY+) |+-0@0- |2 10.10. - (XIX+) , (XIY+) BC» =6©« BC-1 LDIR 83+zz :11 repeat 2 10.10. - [ (XDE+) , (XHL+) ] (XDE+) © (XHL+) ( end ) BC « BC-1 14.14. - until BC=0 (repeat) LDIR 85+2z 211 repeat 2 10.10. - (XIX+) , (XIY+) (XIX+) © (XIY+) ( end ) BC « BC-1 14.14. - until BC=0 (repeat) LDxx LDD 83+zz :12 =| (XDE-) « (XHL-) [|-0@0- |2 10.10. - [(XDE-), (XHL-) ] BC + BC-1 LDD 85+zz :12 |(XIX-) « (XIY-) |-0@0- [2 10.10. - (XIX-), (XIY-) BC + BC-1 LDDR 83+zz 213 repeat 2 10.10. - [ (XDE-) , (XHL-) ] (XDE-) «© (XHL-) ( end ) BC « BC-1 14.14. - until BC=0 (repeat) LDDR 85+zz 213 repeat 2 10.10. - (XIX-), (XIY-) (XIX-) © (XIY-) ( end ) BC « BC-1 14.14. - until BC=0 (repeat) CPI [A/WA,(R+)] |80+zz+R :14 |A/WA - (R+) rO*O1-|2 8. 8. - BC << BC-1 CPIR [A/WA,(R+)] 80+zz+R :15 repeat KAQ*D1i-|2 10.10. - A/WA - (Rt) ( end ) BC ¢« BC-1 14.14. - until A/WA=(R) (repeat) or BC=0 CPxx CPD = [[A/WA,(R-)] |80+zz+R :16 |A/WA - (R-) H@*O1-|2 8. 8. - BC + BC-1 CPDR [A/WA, (R-) ] 80+zz+R :17 repeat KOQ*D1-|2 10.10. - A/WA - (R-) ( end ) BC + BC-1 14.14. - until A/WA=(R) (repeat) or BC=0 Note1: © ; IfBC = 0 after execution, the P/V flag is set to 0, otherwise 1. @; IfA/WA = (R), the Z flag is set to 1, otherwise, 0 is set. Note 2: When the operand is omitted in the CPI, CPIR, CPD, or CPDR instruction, A,(XHL +/—) is used as the default value. CPU900-169 === page 167 === TOSHIBA TLCS-900 H Instruction Lists of 900 (3/10) (4) Arithmetic Operations BWL |ADD R,r C8+zztr = :80+R JR «Retr eR OX 12 4.4. 7 BWL |ADD r,# C8+zztr =:C8:# |r ort+i# eee VO* |2+# 4.4.7 BWL |ADD R,(mem) /80+zz+mem:80+R |R ¢ R + (mem) |***VO* |2+M 4.4.6 BWL |ADD (mem),R |80+zz+mem:88+R |(mem) <« (mem) + R /***VO0* |2+M 6. 6.10 BW- |ADD (mem),# |80+zz+mem:38:# |(mem) « (mem) + # [F**VO* |2+M# | 7. 8. - BWL |ADC R,r C8+zztr = :90+R |R © R+r + CY F**VO* 2 4.4.7 BWL |ADC ri# C8+zzt+r :C9:# Jr er + # + CY ***V0* [2+4 4.4.7 ADC BWL |ADC R,(mem) |80+zz+mem:90+R |R © R+(mem)+CY fF**V0* |2+M 4. 4. 6 BWL |ADC (mem),R |80+zzt+mem:98+R |(mem) «(mem)+R+CY /***V0* |2+M 6. 6.10 BW- |ADC (mem),# |80+zz+mem:39:# |(mem) «(mem)+#+CY /F**VO* |2+M# | 7. 8. - BWL |SUB R,r C8+zz+r :A0+R |R “R-.r eee IX 12 4.4.7 BWL |SUB r,# C8+zz+r = :CA:# |r er-# eR TE 2+# 4.4.7 SUB BWL |SUB R,(mem) |80+zz+mem:A0+R |R ¢ R - (mem) »***V1* |24+M 4. 4.6 BWL |SUB (mem),R |80+zz+mem:A8+R |(mem) < (mem) - R »F**V1* |24+M 6. 6.10 BW- |SUB (mem),# |80+zz+mem:3A:# |(mem) « (mem) - # [F**V1i* |2+M# | 7. 8. - BWL |SBC R,r C8+zz+r =8:BO+R |R © R- rp - CY P**V1* 12 4.4.7 BWL |SBC r,# C8+zz+r =:CB:# |r er - # - CY H**V1* 2+# 4.4.7 SBC BWL |SBC R,(mem) /|80+zz+mem:BO+R |R «R-(mem) - CY/***V1* |2+M 4.4.6 BWL |SBC (mem),R |80+zz+mem:B8+R |(mem) <« (mem) - R- CY***V1* |2+M 6. 6.10 BW- |SBC (mem),# |80+zz+mem:3B:# |(mem) «(mem)- #-CY|/F**V1* |2+M# | 7. 8. - BWL |CP R,r C8+zz+r = :FOtR [R- &r eee TF 12 4.4.7 BW- |CP r,#3 C8+zzt+r =:D8+#3 |r - #3 ee eV Te 12 4. 4, - BWL |CP r,# C8+zzt+r :CF:# |r - # REVI (2+ 4.4.7 cP BWL |CP R,(mem) |80+zz+mem:FO+R |R - (mem) eR TE |O+M 4.4.6 BWL |CP (mem),R |80+zz+mem:F8+R |{mem) - R eee |2+M 6. 6. 6 BW- |CP (mem),# |80+zz+mem:3F:# |(mem) - # eeEVIe 24+MH | 6. 6. - INC B-- |INC #3,9r C8+r 2:60+#3 |r «r+ #3 ee RYO- 12 4. -. - -WL | INC #3497 C8+zztr =:60+#3 |r « #3,(mem) |80+zz+mem:60+#3 |(mem) « (mem) + #3 [F**VO- |2+M 6. 6. - B-- |DEC #39 C8+r :68+#3 |r « r - #3 ee eV I 12 4.-.- DEC -WL |DEC #347 C8+zztr =3:68+#3 |r « #3,(mem) |80+zz+mem:68+#3 |(mem) <« (mem) - #3 /***V1- |2+M 6. 6. - penta [we Jez r |oereatr saz [mig P EXTS | -WL |EXTS r C8&t+zztr «313 r © r DAA r C8+r :10 Decimal adjustment after 2 addition or subtraction. -WL |PAA r C8+zz+r =:314 if r<0>=1 then 2 INC r Note 1: With the INC/DEC instruction, when the code value of #3 =0, functions as + 8/—8. Note 2: When the ADD R, r (word type) instruction is used in the TLCS-90, the S, Z, and V flags do not change. In the TLCS-900, these flags change. CPU900-170 === page 168 === TOSHIBA TLCS-900 H Instruction Lists of 900 (4/10) BW- |MUL RR,r C8+zz+r = =:40+R RR « RxXr 2 18.26. - MUL BW- {MUL rri# C8+zz+r = :08:# rr « rx# 2+# 118.26. - BW- |MUL RR, (mem) |80+zz+mem: 40+R RR «© RX(mem) 2+M = f18.26. - BW- |MULS RR,r C8+zz+r =: 48+R RR « RXr_— ;signed 2 18.26. - MULS | BW- |MULS rr.# C8+zz+r =:09:# re« rxX# ;signed 2+# |18.26. - BW- |MULS RR, (mem) |80+zz+mem: 48+R RR «RX (mem) ;signed 2+M = =18.26. - BW- |DIV RR,r C8+zztr :50+R R « RRtr ---V-- |2 22.30. - DIV BW- |DIV rr,# C8+zz+r «=: OA:# re rre# nV (24+ 22.30. - BW- |DIV RR, (mem) |80+zz+mem: 50+R R « RR+(mem) ---V-- |24M = 22.30. - BW- |DIVS RR,r C8+zzt+r :58+R R « RR=r ;Signed|---V-- |2 24.32. - DIVS | BW- |DIVS rri# C8+zz+r :0B:# r¢ rrt# ;signed|---V-- |2+# 24.32. - BW- |DIVS RR, (mem) |80+zz+mem:58+R R «© RR=(mem);signed|---V-- |2+M |24.32. - MULA rr D8+r 219 Multiply and add signed |**-V-- /2 -.31. - MULA ree pr+(XDE) x(XHL) 32bit 32bit 16bit 16bit XHL « XHL-2 MINC1 #,r D8+r :38:#-1 |Modulo increment;+1 (#=2**n) if (r mod #)=(#-1) (1<=n<=15) then rer-(#-1) else rert+i MINC2 #,r D8+r :39:#-2 |Modulo increment; +2 (#=2**n) if (r mod #)=(#-2) MINC (2<=n<=15) then rer-(#-2) else rer+2 MINC4 #,r D8+r :3A:#-4 |Modulo increment;+4 (#=2**n) if (r mod #)=(#-4) (3<=n<=15) then rer-(#-4) else rer+4 MDEC1 8 #,r D8+r :3C:#-1 |Modulo decrement; ~-1 -. 7. - (#=2**n) if (r mod #)=0 (1<=n<=15) then rer+(#-1) else rer-1i MDEC2 §#,r D8+r :3D:#-2 |Modulo decrement; -2 4 -.7.- (#=2**n) if (r mod #)=0 MDEC (2<=n<=15) then rer+(#-2) else rer-2 MDEC4 §#,r D8+r :3E:#-4 |Modulo decrement; -4 -.7.- (#=2**n) if (r mod #)=0 (3<=n<=15) then rer+(#-4) else rer-4 Note: Operand RR of the MUL, MULS, DIV, and DIVS instructions indicates that a register twice the size of the operation is specified. When the operation is in bytes (8 bits x 8 bits, 16/8 bits), word register (16 bits) is specified; when the operation is in words (16 bits x 16 bits, 32/16 bits), long word register (32 bits) is specified. CPU900-171 === page 169 === TOSHIBA TLCS-900 H Instruction Lists of 900 (5/10) (5) Logical operations BWL |AND R,r C8+zzt+r :CO+R |R « R and r **®1P00|2 4. 4. 7 BWL |AND ri# C8t+zztr 3 :CC:# |r «+ r and # **1P00 |2+# 4.4.7 BWL | AND R,(mem) /|80+zz+mem:CO+R |R « R and (mem) **1P00/2+M 4.4.6 BWL |AND (mem),R |80+zz+mem:C8+R |(mem) « (mem) and R |**1P00|2+M 6. 6. 10 BW- |AND (mem),# |80+zz+mem:3C:# |(mem) « (mem) and # |**1PO00/2+M# | 7. 8. - BWL |OR R,r C8+zztr =:E0+R |R« Rorre **0P00/2 4.4.7 BWL |OR r,# C8t+zztr = :CE:# |r «ror # **0P00|2+# 4.4.7 BWL |OR R,(mem) /|80+zz+mem:E0+R |R <« R or (mem) **QP00/2+M 4. 4.6 BWL |OR (mem),R |80+zz+mem:E8+R |(mem) « (mem) or R_ |**0P00/2+M 6. 6. 10 BW- |OR (mem),# |80+zz+mem:3E:# |(mem) « (mem) or # |**0P00|2+M# 7. 8. - BWL |XOR R,r C8+zz+r = :DO+R JR « R xor er **QP00/2 4.4.7 BWL |XOR ri# C8+zz+r =:CD:# |r « r xor # **QP00 |2+# 4.4.7 XOR BWL |XOR R,(mem) |80+zz+mem:DO0+R |R « R xor (mem) **QP00|2+M 4. 4.6 BWL |XOR (mem),R |80+zztmem:D8+R |(mem) « (mem) xor R |**0P00/2+M 6. 6. 10 BW- |XOR (mem),# |80+zz+mem:3D:# |({mem) « (mem) xor # |**OPOO/2+M¥ | 7, 8. - CPU900-172 === page 170 === TOSHIBA TLCS-900 m Instruction Lists of 900 (6/10) (6) Bit operations BW- |LDCF #4,r C8+zzt+r :23:#4 |CY « r<#4> 3 4.4.- LDCF BW- |LDCF A ,r C8+zztr :2B CY « r 2 4.4.- B-- |LDCF #3,(mem)|BOtmen :98+#3 |CY < (mem)<#3> 2+M 8.-.- B-- |LDCF A ,{mem)/BO+men :2B CY « (mem) 2+M 8.-.- BW- |STCF #4,r C8+zztr :24:#4 | r<#4> « CY 3 4.4.- STCF BW- |STCF A ,r C8+zztr :2C r « CY 2 4.4.- B-- |STCF #3,({mem)|BO+mem :A0+#3 |(mem)<#3> < CY 2+M 8.-.- B-- |STCF A ,{mem)|BO+mem :2C (mem) < CY 2+M 8.-.- BW- |ANDCF #4,r C8+zzt+r :20:#4 |CY « CY and r<#4> 3 4.4.- ANDCF BW- |ANDCF A ,r C8+zztr :28 cY « CY and r 2 4.4.- B-- |ANDCF #3,(mem)|BO+mem :80+#3 |CY « CY and (mem)<#3> 2+M 8.-.- B-- |ANDCF A ,(mem)|}BOt+mem :28 CY « CY and (mem) 2+M 8.-.- BW- |ORCF #4,r C8+zztr :21:#4 |CY « CY or r<#4> 3 4.4.- ORCE BW- |ORCF A ,r C8+zzt+r 329 CY « CY or r 2 4.4.- B-- |ORCF #3,(mem)|BOt+mem :88+#3 |CY « CY or (mem)<#3> 2+M 8.-.- B-- |ORCF A ,(mem)|}BOtmem :29 CY « CY or (mem) 2+M 8.-.- BW- |XORCF #4,r C8+zztr :22:#4 |CY « CY xor r<#4> 3 4.4.- XORCF BW- |XORCF A ,r C8+zztr :2A CY « CY xor r 2 4.4.- B-- |XORCF #3,(mem)|BO+mem :90+#3 |CY « CY xor (mem)<#3> 2+M 8.-.- B-- |XORCF A ,(mem)|BO+mem :2A CY « CY xor (mem) 2+M 8.-.- RCF RCF 10 CY « 0 --0-00 |1 2 SCF SCF 11 CY «1 --0-01 |1 2 CCF CCF 12 CY « not CY --X-0* |i 2 ZCF ZCF 13 CY « not Z flag --X-0* | 2 BIT BW- |BIT #4,7r C8+zztr :33:#4 |Z « not r<#4> X*1X0- [3 4.4.- B-- |BIT #3,(mem)|BO+mem :C8+#3 |Z <« not (mem)<#3> X*1X0- |2+M 8.-.- RES BW- |RES #4,r C8+zzt+r :30:#4 | r<#4> «0 3 4.4.- B-- |RES #3,(mem)|BO+mem :BO+#3 |(mem)<#3> < 0 2+M 8.-.- SET BW- |SET #4,7r C8+zz+r :31:#4 | r<#4> «1 3 4.4.- B-- |SET #3,(mem) |BO+mem :B8+#3 |(mem)<#3> ¢ 1 2+M 8.-.- CHG BW- |CHG #4,r C8+zzt+r :32:#4 | r<#4> © not r<#4> 3 4.4.- B-- |CHG #3,(mem)|BO+mem :CO+#3 |(mem)<#3><«not (mem)<#3> 2+M 8.-.- BW- |TSET #4,r C8+zztr 3:34:44 |Zenot r<#4> : r<#4>e1 X*1X0- 3 6.6.- TSET | B-- |TSET #3.(mem)|BOt+mem :A8+#3 |Z < not (mem)<#3> X*1X0- OM 10.-.- (mem)<#3> «+ 1 a BS1 BS1F A,r D8+r 20E A «1 search r;Forward |---@-- (2 BS1B) ss A,r D8+r :0F A © 1 search r;Backward|---@-- |2 Note: ©; Ois set when the bit searched for is found, otherwise 1 is set and an undefined value is set in the A register. CPU900-173 === page 171 === TOSHIBA TLCS-900 H Instruction Lists of 900 (7/10) (7) Special operations and CPU control jnop | --- [nop fn operation = [mmm==-ft | 6h lrt~t~CrC;s—;sC;s=t«Ct«CS«eés«C«za«Ctdzsaey..CiwséC(i‘‘r‘CYS;SC‘ (‘(CO(’SCC;C;CCisCC;”OCN ri“ ( LULU lc UU!!! LhLLULCmrti<“—=i*~—~—~—CS CCU LCL EI EI [#3] 06 243 Sets interrupt enable flag. 2 5 IFFe#3 DI DI 06 :07 Disables interrupt. 2 5 SWI [#3] F8+#3 Software interrupt 1 16 SWI PUSH PC&SR JP 8000H+10H x #3 LDC BWL |LDC cr,r C8+zzt+r :2E:cr jer «nr [pevieged) 3 8.8.8 BWL |LDC r,cr C8+zztr :2F:cr |r © cr [prvieged) 3 8.8.8 }LDx | B-- [LDX — (#8),# | F7:00:48:00:#:00|(#8) « # ------[6jo.-.- | -~-L |LINK r,di6 E8+r :0C:di6 |PUSH r -.-.10 LINK LD r,XSP ADD XSP,d16 UNLK --L |UNLK r E8+r :0D LD XSP,r 2 POP r LDF LDF #3 17 :#3 Sets register bank. 2 2 RFP < #3 (0 at reset) INCF INCF 0c Switches register banks. 1 2 RFP< RFP + 1 DECF DECF Switches register banks. 1 2 RFP¢ RFP - 1 SCC SCC —ceyr C8+zztr :70+cc =|if cc then r<« 1 2 else r« 0 Note 1: When operand #8 coding in the EI instruction is omitted, 0 is used as the default value. Note 2: When operand #8 coding in the SWI instruction is omitted, 7 is used as the default value. Note 8: The value in the state column for the SWI instruction represents the number of states when the CPU is in minimum mode. In maximum mode, add + 2. CPU900-174 === page 172 === TOSHIBA TLCS-900 Hm esiInstruction Lists of 900 (8/10) (8) Rotate and shift BWL |RLC #4,r C8+zztr = :£8:#4 **QP0* 3 6.6.8+2n RLC BWL |RLC A,r C8+zz+r =: F8 MSB (mem) 80+zz+mem: 78 **OPQ*/2+M = 18.8.- BWL |RRC #4,r C8+zztr = :E9:#4 **OP0* 3 6.6.8+2n RRC BWL |RRC A,r C8+zzt+r =: F9 Lo MSB—->0 | **0PO0* [2 6.6.8+2n BW- |RRC (mem) 80+zzt+mem: 79 **QPO*l2+M 18.8.- BWL |RL #4,r C8+zztr :EA:#4 **0P0* 3 6.6.8+2n RL BWL |RL A,r C8+zztr :FA **¥QOPO* I2 6.6.8+2n BW- |RL (mem) 80+zz+mem: 7A **OP0*|/2+M = |8.8.- BWL |RR #4,r C8+zz+r 0s EB: #4 ¥*QPO* |Z 6.6.8+2n BWL |RR A,r C8+zz+r =: FB ¥*QPO0* |2 6.6.8+2n BW- |RR = (mem) 80+zz+mem: 7B **QPO* (24M |8.8.- BWL |SLA #4,r C8+zztr =:EC: #4 **OP0* 13 6.6.8+2n sta | BWL ISLA = A,r C8+zz+r FC Ley ]<{MSB<-0]< 0 = | ++opo*|z 6.6.8+2n BW- |SLA (mem) 80+zz+mem: 7C **QPO* (24M |8.8.- BWL |SRA #4,r C8+zz+r =: ED: #4 ¥*QPO* IB 6.6.8+2n , MSB->0 sRA | BWL [SRA A,r C8+zz+r: FD *spo*l2 (6.6. 8+2n BW- |SRACW> (mem) 80+zz+mem: 7D **QPO*/2+M |8.8.- BWL |SLL #4,r C8+zztr = :EE:#4 **0P0* 3 6.6.8+2n SLL | BWL |SLL A,r C8+zz+r : FE Ley |<[MSB (mem) 80+zz+mem: 7E **QPO*/2+M |8.8.- BWL |SRL #4,r C8+zzt+r = 3EF:#4 **OQP0*|3 6.6.8+2n SRL | BWL |SRL A,r C8+zzt+r |: FF 0 >[MSB>0 **0P0* [2 6.6.8+2n BW- |SRL (mem) 80+zz+mem: 7F **OPO*/2+M |8.8.- RLD [A, ](mem)|80+mem :06 Areg mem ) 24M = f12.-.- RLD RRD CA, ](mem) |80+mem :07 Areat mem **QPQ-|2+M 12.-.- Note 1: When #4/A is used to specify the number of shifts, the values of lower 4bits (0 to 15) is used. Code 0 means 16 shifts. Note 2: When the following instructions are used in the TLCS-90, the S, Z and V flags do not change. RLCA, RRCA, RLA, RRA, SLAA, SRAA, SLLA, and SRLA In the TLCS-900, these flags change. CPU900-175 === page 173 === TOSHIBA TLCS-900 H Instruction Lists of 900 (9/10) (9) Jump, call and return JP #16 1A :#16 |PC « #16 3 7 JP #24 1B :#24 |PC <« #24 4 7 JP JR [cc, ]$+2+d8 |60+cc :d8 if cc then PC « PC+d8 2 8/4 (T/F) JRL [cc, ]$+3+d16)70+cc :di6 if cc then PC « PC+d16 3 8/4 (T/F) JP [cc, ]Jmem BO+mem :DO+cc/if cc then PC « mem 2+M 9/6 (T/F) CALL #16 1c :#16 |PUSH PC : JP #16 3 12 CALL #24 1D :#24 |PUSH PC : JP #24 4 12 CALL CALR $+3+d16 1E :di6 |PUSH PC : JR $+3+d16 3 12 CALL [cc, ]mem BOt+mem :E0+cc)if cc then 2+M 12/6 (T/F) PUSH PC ;: JP mem DINZ DJNZ C8+zztr :1C:d8lrer-1 3 11 (r#0) [r, ]$+3/4+d8 if r#0 then JR $+3+d8 7 (r=0) RET 0E POP PC 1 9 RET RET cc BO :FO+cclif cc then POP PC 2 12/6 (T/F) RETD di6 OF :d16 |RET : ADD XSP,d16 3 9 RETI 07 POP SR8PC ipiivieged! 1 ite Note 1: The value in the state column for the CALL, CALR, RET, RETD, and RETI instructions represents the number of states when the CPU is in minimum mode. In maximum mode, add + 2. Note 2: (T/F) represents the number of states at true/false. CPU900-176 === page 174 === TOSHIBA TLCS-900 Hm eiInstruction Lists of 900 (10/10) (10) Addressing mode R +0 r +1 (R) +0 (R +d8) +2 (#8) +2 (#16) +2 (#24) +3 (r) +5 (r+d16) +5 (r + r8) +8 (r+1r16) +8 (-r) +3 (r+) +3 (11) Interrupt General-purpose PUSH PC 17 (MAX mode) interrupt processing PUSH SR 15 (MIN mode) IFF < accepted level +1 SYSM <— 1 JP 8000H + vector /0 to MEM (DMADn —) < (DMASn) DMA | MEM to I/O (DMADn) < (DMASn -) 1/0 to VO (DMADn) < (DMASn) (Note) For details of interrupt processing, refer to Chapter4 “3.3 Interrupts”. CPU900-177 === page 175 === TOSHIBA TLCS-900 Appendix C Instruction Code Maps (1/4) 1-byte op code instructions Halo | + [2}3s}ais{el7{sio}alsei clo} ele a dd 1 RCF SCF CCF ZCF |PUSH POP EX LDF |}PUSH POP JP JP CALL CALL | CALR A A F, F’ n F F nn nnn nn nnn |PC+dd Se ee ee JR cc,PC+d F LT LE ULE PE/OV M/MI Z ie (T) GE GT UGT PO/NOV P/PL NZ Nc 7 JRL = cc,PC+dd F LT LE ULE PE/OV M/MI Z Cc (T) GE GT UGT PO/NOV P/PL NZ Nc scr.B scr. B (XWA (XBC (XDE (XHL (XIX (XIY (XIZ (XSP (XWA) (XBC) (XDE) (XHL) (XIX) (XIY) (X1Z)_ (xSP) [V0 d) +d) +d) +d) Td) Sd) +d) td) scr. W scr. W (XWA (XBC (XDE (XHL (XIX (XIY (XIZ (XSP (XWA) (XBC) (XDE) (XHL) (XIX) (XIY) (XIZ) (XSP) +d) +d) +d) +d) +d) +d) +d) +d) A ser. L ser. L (XWA (XBC (XDE (XHL (XIX (XIY (XIZ (XSP (XWA) (XBC) (XDE) (XHL) (XIX) (XIY) (XIZ) (XSP) +d) +d) +d) +d) +d) +d) +d) +d) dst dst (XWA (XBC (XDE (XHL (XIX (XlY (XIZ (XSP (XWA) (XBC) (XDE) (XHL) (XIX) (XIY) (XIZ) (XSP) +d) +d) +d) +d) +d) +d) +d) +d) Cc scr. B reg. B reg.B (n) (nn) (nnn) ;(mem) )(- xrr) | (xrr +) r Ww A B ie D E H L scr. W reg. W reg. W (n) (nn) (nnn) ;(mem))(—- xrr))(xrr +) rr WA Bc DE HL Ix IY IZ SP ser. Lb reg. L reg.L (n) (nn) (nnn) (mem) |(— xrr) )(xrr +) xrr |XWA XBC- XDE XHL XIX XIY XIZ XSP F dst LDX sWwl n (n) (nn) (nnn) ;(mem) /(- xrr)) (xrr +) (n),n 0 1 2 3 4 5 6 7 Note 1: Codes in shaded parts are privileged instructions. Note 2: Codes in blank parts are undefined instructions (i.e., illegal instructions). CPU900-178 === page 176 === TOSHIBA TLCS-900 Appendix C Instruction Code Maps (2/4) Ist byte: reg Hef oo fa f2}3it4{>s;te{7}s{ofa}telc {ole e | LD | PUSH CPL | NEG | MUL MULS DIV DIVS | LINKL JUNLKL] BS1F BS1B BW | BW BW Ww rt r r r rede or, or, # or, # r,dd r A,r A,r ; |DAAB EXTZ | EXTS | PAA MIRR MULA \J\ 7 DINZ We | WL | WL w w BW r r r r r r / / rd > |ANDCF ORCF XORCF LDCF STCF ANDCF ORCF XORCF LDCF STCF pe toc BW BW — 3 | RES SET CHG BIT TSET MINC1 MINC2 MINC4 \/S MDEC1 MDEC2 MDEC4 \ 7 BW #,r #,r #,r #,r #,r #,r Ww aN #,r WwW VAN ee a INC #3,r DEC #3,r 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 7 scc ce, r BWI F LT LE ULE PE/OV M/MI Z Cc (Tt) GE GT UGT PO/NOV P/PL NZ ~~ NC a en ee ce A SUB RF LD or, #3 0 1 2 3 4 5 6 7 ee c AND R,r ADD ADC SUB SBC AND xXOR OR CP t,# # rf rf r,# t,# r,# r,# XOR Rr cP or, #3 BW 0 1 2 3 4 5 6 7 OR Rr RLC RRC RL RR SLA SRA SLL SRL #,1¢ #,r #,r #,¢ #,7 #,¢ #,r #,r F cP OR, r RLC RRC RL RR SLA SRA SLL SRL A,r A,r A,r A,r A,r A,r A,r A,r r : Register specified by the 1st byte code. (Any CPU registers can be specified.) R : Register specified by the 2nd byte code. (Only eight current registers can be specified.) B : Operand size is a byte. W : Operand size is a word. L : Operand size is a long word. Note : Dummy instructions are assigned to codes 1AH, 1BH, 3BH, and 3FH. Do not use them. CPU900-179 === page 177 === TOSHIBA TLCS-900 Appendix C Instruction Code Maps (3/4) 1st byte: src (mem) Halo | 1} 2t3{a}si{ej{7]}s}]o fa}tsjc{o {ee PUSH RLD RLDB BW (mem) A, (mem) ; | LDI LDIR LDD LDDR| CPI CPIR CPD CPDR LD BW BW BW (nn), (m) ee ee 3 EX (mem),R BW| ADD ADC SUB $BC AND XOR- OR CPBW (mem) ,# ee a INC #3,(mem) BW DEC #3,(mem) BW 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 7 RLC — RRC RL RR SLA SRA SLL SRLBW (mem) a cen a SUB R, (mem) SUB (mem),R a ne ee ke ee ee B : Operand size is a byte. W : Operand size is a word. CPU900-180 === page 178 === TOSHIBA TLCS-900 Appendix C Instruction Code Maps (4/4) 1st byte: dst (mem) Hef o f+ f2;3fatsite{7{}s} ofa} s fc [ojele | LDB LD W POPB POP W (m), # (m), # (mem) (mem) 1 LDB LDW (m), (nn) (m), (nn) 2 LDA R,mem WIANDCF ORCF XORCF LDCF STCFB A, (mem) a ee a, ee ee ANDCF #3, (mem) B ORCF #3, (mem) BI 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 XORCF #3, (mem) B LDCF #3,(mem) B 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 A STCF #3, (mem) B TSET #3,(mem) Bi 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 RES #3, (mem) B SET #3,(mem) Bi 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 Cc CHG #3, (mem) B BIT #3,(mem) B 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 JP cc,mem F LT LE ULE PE/OV M/MI Z Cc (1) GE GT UGT PO/NOV P/PL NZ NC CALL cc, mem F LT LE ULE PE/OV M/MI Z c (T) GE GT UGT PO/NOV P/PL NZ NC F RET cc (1st byte code is BOH.) F LT LE ULE PE/OV M/MI Z Cc (1) GE GT UGT PO/NOV P/PL NZ NC B : Operand size is a byte. W : Operand size is a word. L : Operand size is a long word. CPU900-181 === page 179 === TOSHIBA TLCS-900 Appendix D Differences between TLCS-90 and TLCS-900 Series cPU architecture 8-bit CPU 16-bit CPU Built-in ROM/built-in RAM 8-bit data bus 16-bit data bus Built-in I/O 8-bit data bus 8-bit data bus External data bus 8-bit data bus 8-bit/16-bit data bus (can be mixed) Program space 64 KB 16MB (linear) (except devices with MMU) Data space 16MB (bank) 16MB (linear) Instruction set/instruction TLCS-90 TLCS-90 + @ mnemonic a = enhancement of 16-bit multiply / divide instructions and bit operation instruction. 32-bit load/operation instructions, C compiler instructions, register bank operation instructions, etc. Instruction code Unique to TLCS-90 Unique to TLCS-900 (object code) (Different from TLCS-90.) Addressing mode TLCS-90 TLCS-90 + a a = (—Reg), (Reg +), (Reg + disp 16), (Reg + Reg16), (nnn) General-purpose register TLCS-90 TLCS-90 + a a = Uses as 32 bits and register bank, and adds a system stack pointer. Flag sfzf fe lxfy|yfec sf zfofe fol y[s | c| | flag is extended to IFF2 to 0 of status register.X flag is deleted. Reset PC <0000H PC <8000H (SP does not change.) XSP<—100H Built-in ROM address 0000H to undefined Built-in RAM address to FFxxH 0080H to Built-in 1/O address FFxxH~FFFFH 0000H~007FH Direct addressing area (n) FFOOH~FFFFH 0000H~00FFH Interrupt Interrupt start address OOOOH + (8x V) 8000H + (10H x V) Register to be saved PC & AF PC & SR Mask register IFF IFF2~0 Mask level o~1 0~7 CPU900-182 === page 180 === TOSHIBA TLCS-900 | Instruction @ ADDR, r (word type) S/ZNV flags don’t change. S/ZNV flag changes. S/Z/IV flag changes expect add | [ 16 bit register. @ Shift of A register [ RLCA SIZ flag changes. RRCA RLA RRA SLAA SRAA SLLA SRLA_ | $/ZN flags don’t change in these instruction. I RLCA RRC A RLA RRA SLA A SRA A SLL A SRL A | S/ZIV flag changes in these instruction. CPU900-183 === page 181 === TOSHIBA TLCS-900 Note: The TLCS-900 series is essentially the same as the TLCS-90 series but with a 16-bit CPU. Built-in I/Os are completely compatible with those of the TLCS-90. However, six types of instructions used in the TLCS-90 series do not directly correspond with those used in the TLCS-900 series. Thus, when transfering programs designed for the TLCS-90 to the TLCS-900, replace them with equivalents as follows: Instructions in TLCS-90 Equivalent instructions in but not in TLCS-900 TLCS-900 EXX EX BC, BC’ EX DE, DE’ EX HL, HL’ EX AF, AF’ EX A, A’ EX F, F’ PUSH AF PUSH A PUSH F POP AF POP F POP A Some TLCS-900 series instructions, though basically the same as TLCS-90 instructions, have more functions and more specification items in their operands. They are listed below. TLCS-90 TLCS-900 INC reg INC imm3, reg INC mem INC imm3, mem DEC reg DEC imm3, reg DEC mem DEC imm3,mem RLC reg RLC imm, reg RRC reg RRC imm, reg RL reg RL imm, reg RR reg RR imm, reg SLA reg SLA = imm, reg SRA reg SRA imm, reg SLL reg SLL imm, reg SRL reg SRL imm, reg CPU900-184