background image

CHAPTER 5  EXPLANATION OF INSTRUCTIONS

User’s Manual  U11047EJ3V0UM00

102

BR

Branch

Unconditional Branch

[Instruction format] 

BR target

[Operation]

PC 

 target

[Operand]

Mnemonic

Operand (target)

BR

!addr16

AX

$addr16

[Flag]

Z

AC

CY

[Description]

This is an instruction to branch unconditionally.

The word data of the target address operand (target) is transferred to PC and program branches.

[Description example]

BR AX;  The AX register contents are regarded as an address to which the program branches.

Содержание 78K/0S Series

Страница 1: ...User s Manual Common to 78K 0S Series 78K 0S Series 8 Bit Single Chip Microcontroller Instructions Printed in Japan Document No U11047EJ3V0UMJ1 3rd edition Date Published November 2000 N CP K 1996 ...

Страница 2: ...User s Manual U11047EJ3V0UM00 2 MEMO ...

Страница 3: ...aterial All test and measurement tools including work bench and floor should be grounded The operator should be grounded using wrist strap Semiconductor devices must not be touched with bare hands Similar precautions need to be taken for PW boards with semiconductor devices on it 2 HANDLING OF UNUSED INPUT PINS FOR CMOS Note No connection for CMOS device inputs can be cause of malfunction If no co...

Страница 4: ...uality reliability and safety of NEC semiconductor products customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely To minimize risks of damage to property or injury including death to persons arising from defects in NEC semiconductor products customers must incorporate sufficient safety measures in their design such as redundancy fire containment and ...

Страница 5: ...tronics Germany GmbH Duesseldorf Germany Tel 0211 65 03 02 Fax 0211 65 03 490 NEC Electronics UK Ltd Milton Keynes UK Tel 01908 691 133 Fax 01908 670 290 NEC Electronics Italiana s r l Milano Italy Tel 02 66 75 41 Fax 02 66 75 42 99 NEC Electronics Germany GmbH Benelux Office Eindhoven The Netherlands Tel 040 2445845 Fax 040 2444580 NEC Electronics France S A Velizy Villacoublay France Tel 01 30 6...

Страница 6: ...156 789167 789177 789197AY 789217AY 789407A 789417A and 789842 Subseries Deletion of the following target products µPD789407 789417 and 789806Y Subseries p 52 Modification of MOV PSW byte instruction code p 52 Modification of MOVW rp AX instruction code p 54 Modification of XOR A r instruction code p 54 Modification of CMP A r instruction code The mark shows major revised points ...

Страница 7: ...AY µPD789407A Subseries µPD789405A 789406A 789407A µPD789417A Subseries µPD789415A 789416A 789417A 78F9418A µPD789800 Subseries µPD789800 78F9801 µPD789842 Subseries Note µPD789841 789842 78F9842 Note Under development Purpose This manual is intended for users to understand the instruction functions of 78K 0S Series products Organization The contents of this manual are broadly divided into the fol...

Страница 8: ... common to 78K 0S Series Document Number Document Name English Japanese User s Manual Instructions This manual U11047J Individual documents µ µ µ µPD789014 Subseries Document Number Document Name English Japanese µPD789011 789012 Data Sheet U11095E U11095J µPD78P9014 Data Sheet U10912E U10912J µPD789014 Subseries User s Manual U11187E U11187J µ µ µ µPD789026 Subseries Document Number Document Name...

Страница 9: ...U13045E U13045J µ µ µ µPD789134 Subseries Document Number Document Name English Japanese µPD789131 789132 789134 Preliminary Product Information U13015E U13015J µPD78F9136 Preliminary Product Information U13036E U13036J µPD789134 Subseries User s Manual U13045E U13045J µ µ µ µPD789146 789156 Subseries Document Number Document Name English Japanese µPD789144 789146 789154 789156 Preliminary Product...

Страница 10: ... Japanese µPD789405A 789406A 789407A 789415A 789416A 789417A Data Sheet To be prepared U14024J µPD78F9418A Data Sheet To be prepared To be prepared µPD789407A 789417A Subseries User s Manual To be prepared U13952J µ µ µ µPD789800 Subseries Document Number Document Name English Japanese µPD789800 Data Sheet U12627E U12627J µPD78F9801 Preliminary Product Information U12626E U12626J µPD789800 Subseri...

Страница 11: ...ive addressing 29 3 1 2 Immediate addressing 30 3 1 3 Table indirect addressing 31 3 1 4 Register addressing 32 3 2 Addressing of Operand Address 33 3 2 1 Direct addressing 33 3 2 2 Short direct addressing 34 3 2 3 Special function register SFR addressing 35 3 2 4 Register addressing 36 3 2 5 Register indirect addressing 37 3 2 6 Based addressing 38 3 2 7 Stack addressing 38 CHAPTER 4 INSTRUCTION ...

Страница 12: ...crement Decrement Instructions 78 5 6 Rotate Instructions 83 5 7 Bit Manipulation Instructions 88 5 8 CALL RETURN Instructions 92 5 9 Stack Manipulation Instructions 97 5 10 Unconditional Branch Instruction 101 5 11 Conditional Branch Instructions 103 5 12 CPU Control Instructions 111 APPENDIX A INSTRUCTION INDEX MNEMONIC BY FUNCTION 117 APPENDIX B INSTRUCTION INDEX MNEMONIC IN ALPHABETICAL ORDER ...

Страница 13: ...le 0000H to 002BH µPD789026 Subseries 17 1 4 Vector Table 0000H to 0019H µPD789046 Subseries 17 1 5 Vector Table 0000H to 0015H µPD789104 789114 789124 789134 Subseries 17 1 6 Vector Table 0000H to 0019H µPD789146 789156 Subseries 18 1 7 Vector Table 0000H to 0023H µPD789167 789177 Subseries 18 1 8 Vector Table 0000H to 0027H µPD789197AY 789217AY Subseries 18 1 9 Vector Table 0000H to 0023H µPD789...

Страница 14: ...User s Manual U11047EJ3V0UM00 14 MEMO ...

Страница 15: ...es 16 Kbytes 24 Kbytes 32 Kbytes Address Space Subseries Name 0000H to 07FFH 0000H to 0FFFH 0000H to 1FFFH 0000H to 2FFFH 0000H to 3FFFH 0000H to 5FFFH 0000H to 7FFFH µPD789014 Subseries µPD789011 µPD789012 µPD78P9014 µPD789026 Subseries µPD789022 µPD789024 µPD789025 µPD789026 µPD78F9026 µPD789046 Subseries µPD789046 µPD78F9046 µPD789104 Subseries µPD789101 µPD789102 µPD789104 µPD789114 Subseries ...

Страница 16: ...s Space Subseries Name 0000H to 07FFH 0000H to 0FFFH 0000H to 1FFFH 0000H to 2FFFH 0000H to 3FFFH 0000H to 5FFFH 0000H to 7FFFH µPD789217AY Subseries µPD789216AY µPD789217AY µPD78F9217AY µPD789407A Subseries µPD789405A µPD789406A µPD789407A µPD789417A Subseries µPD789415A µPD789416A µPD789417A µPD78F9418A µPD789800 Subseries µPD789800 µPD78F9801 µPD789842 Subseries µPD789841 µPD789842 µPD78F9842 ...

Страница 17: ... µ µ µPD789026 Subseries Vector Table Address Interrupt Request Vector Table Address Interrupt Request 0000H RESET input 000CH INTSR INTCSI0 0004H INTWDT 000EH INTST 0006H INTP0 0010H INTTM0 0008H INTP1 0014H INTTM2 000AH INTP2 002AH INTKR Table 1 4 Vector Table 0000H to 0019H µ µ µ µPD789046 Subseries Vector Table Address Interrupt Request Vector Table Address Interrupt Request 0000H RESET input ...

Страница 18: ...t Request Vector Table Address Interrupt Request 0000H RESET input 0012H INTWT 0004H INTWDT 0014H INTWTI 0006H INTP0 0016H INTTM80 0008H INTP1 0018H INTTM81 000AH INTP2 001AH INTTM82 000CH INTP3 001CH INTTM90 000EH INTSR20 INTCSI20 0022H INTAD0 0010H INTST20 Table 1 8 Vector Table 0000H to 0027H µ µ µ µPD789197AY 789217AY Subseries Vector Table Address Interrupt Request Vector Table Address Interr...

Страница 19: ...NTWT Table 1 10 Vector Table 0000H to 0019H µ µ µ µPD789800 Subseries Vector Table Address Interrupt Request Vector Table Address Interrupt Request 0000H RESET input 000EH INTUSBRE 0004H INTWDT 0010H INTP0 0006H INTUSBTM 0012H INTCSI10 0008H INTUSBRT 0014H INTTM00 000AH INTUSBRD 0016H INTTM01 000CH INTUSBST 0018H INTKR00 Table 1 11 Vector Table 0000H to 0023H µ µ µ µPD789842 Subseries Vector Table...

Страница 20: ...789197AY 789217AY Subseries Electrically erasable PROM EEPROM is allocated in the address space shown in Table 1 12 Unlike ordinary RAM EEPROM retains the data it contains even when the power is turned off Also unlike EPROM the contents of EEPROM can be erased electrically without the need to expose the chip to ultraviolet light Table 1 12 Internal Data Memory Space of 78K 0S Series Products 1 2 S...

Страница 21: ...s µPD78F9156 µPD789167 µPD789166 FD00H to FEFFH Subseries µPD789167 512 bytes µPD789177 µPD789176 FD00H to FEFFH Subseries µPD789177 512 bytes µPD78F9177 µPD789197AY µPD789196AY FD00H to FEFFH F800H to F87FH Subseries µPD789197AY 512 bytes 128 bytes µPD78F9197AY µPD789217AY µPD789216AY FD00H to FEFFH F800H to F87FH Subseries µPD789217AY 512 bytes 128 bytes µPD78F9217AY µPD789407A µPD789405A FD00H ...

Страница 22: ...CE User s Manual U11047EJ3V0UM00 22 1 6 Special Function Register SFR Area Special function registers SFRs of on chip peripheral hardware are allocated to the area FF00H to FFFFH refer to the User s Manual of each product ...

Страница 23: ... data and register contents are set When the ______________ RESET signal is input the program counter is set to the value of the reset vector table which are located at addresses 0000H and 0001H Figure 2 1 Format of Program Counter 15 0 PC15 PC14 PC13 PC12 PC11 PC10 PC9 PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0 PC 2 1 2 Program status word PSW Program status word is an 8 bit register consisting of vario...

Страница 24: ...t 3 this flag is set 1 otherwise it is reset 0 4 Carry flag CY This flag records an overflow or underflow upon add subtract instruction execution It also records the shift out value upon rotate instruction execution and functions as a bit accumulator during bit operation instruction execution 2 1 3 Stack pointer SP This is a 16 bit register that holds the first address of the stack area in the mem...

Страница 25: ...DE and HL Registers can be described in terms of functional names X A C B E D L H AX BC DE and HL and absolute names R0 to R7 and RP0 to RP3 Interrupt PSW PC15 to PC8 PC15 to PC8 PC7 to PC0 Lower byte in register pair SP SP 2 SP 2 CALL CALLT instructions PUSH rp instruction SP 1 SP SP SP 2 SP 2 SP 1 SP PC7 to PC0 SP 3 SP 2 SP 1 SP SP SP 3 Upper byte in register pair RETI instruction PSW PC15 to PC...

Страница 26: ...UM00 26 Figure 2 6 General Purpose Register Configuration a Absolute name R0 15 0 7 0 16 bit processing 8 bit processing RP3 RP2 RP1 RP0 R1 R2 R3 R4 R5 R6 R7 b Functional name X 15 0 7 0 16 bit processing 8 bit processing HL DE BC AX A C B E D L H ...

Страница 27: ...ction register type The bit unit for manipulation is specified as follows 1 bit manipulation Describes a symbol reserved by the assembler for the 1 bit manipulation instruction operand sfr bit This manipulation can also be specified with an address 8 bit manipulation Describes a symbol reserved by the assembler for the 8 bit manipulation instruction operand sfr This manipulation can also be specif...

Страница 28: ...User s Manual U11047EJ3V0UM00 28 MEMO ...

Страница 29: ...dressing Function The value obtained by adding the 8 bit immediate data displacement value jdisp8 of an instruction code to the first address of the following instruction is transferred to the program counter PC and program branches The displacement value is treated as signed two s complement data 128 to 127 and bit 7 becomes a sign bit Thus relative addressing causes a branch to an address within...

Страница 30: ...to the program counter PC and program branches This function is carried out when the CALL addr16 or BR addr16 instruction is executed The CALL addr16 and BR addr16 instructions can be used to branch to any address within the memory spaces Illustration In case of CALL addr16 or BR addr16 instruction 15 0 PC 8 7 7 0 CALL or BR Low addr High addr ...

Страница 31: ...rred to the program counter PC and program branches Table indirect addressing is performed when the CALLT addr5 instruction is executed This instruction references the address stored in the memory table from 40H to 7FH and allows branching to the entire memory space Illustration 15 1 15 0 PC 7 0 Low addr High addr Memory table Effective address 1 Effective address 0 1 0 0 0 0 0 0 0 0 8 7 8 7 6 5 0...

Страница 32: ... Register addressing Function Register pair AX contents specified with an instruction word are transferred to the program counter PC and program branches This function is carried out when the BR AX instruction is executed Illustration 7 0 rp 0 7 A X 15 0 PC 8 7 ...

Страница 33: ...ecution 3 2 1 Direct addressing Function This addressing directly addresses a memory to be manipulated with immediate data in an instruction word Operand format Operand Description addr16 Label or 16 bit immediate data Description example MOV A FE00H When setting addr16 to FE00H Instruction code 0 0 1 0 1 0 0 1 OP code 0 0 0 0 0 0 0 0 00H 1 1 1 1 1 1 1 0 FEH Illustration 7 0 OP code addr16 lower M...

Страница 34: ...re register of the timer event counter are mapped and these SFRs can be manipulated with a small number of bytes and clocks When 8 bit immediate data is 20H to FFH bit 8 of an effective address is set to 0 When it is 00H to 1FH bit 8 is set to 1 See Illustration below Operand format Operand Description saddr Label or FE20H to FF1FH immediate data saddrp Label or FE20H to FF1FH immediate data even ...

Страница 35: ...d This addressing is applied to the 240 byte spaces of FF00H to FFCFH and FFE0H to FFFFH However the SFRs mapped at FF00H to FF1FH can also be accessed by means of short direct addressing Operand format Operand Description sfr Special function register name Description example MOV PM0 A When selecting PM0 for sfr Instruction code 1 1 1 0 0 1 1 1 0 0 1 0 0 0 0 0 Illustration 15 0 SFR Effective addr...

Страница 36: ... executed When an 8 bit register is specified one of the eight registers is specified with 3 bits register specification code in the instruction code Operand format Operand Description r X A C B E D L H rp AX BC DE HL r and rp can be described with absolute names R0 to R7 and RP0 to RP3 as well as functional names X A C B E D L H AX BC DE and HL Description example MOV A C When selecting the C reg...

Страница 37: ...ssed is specified with the register pair specification code in an instruction code This addressing can be carried out for the entire memory space Operand format Operand Description DE HL Description example MOV A DE When selecting register pair DE Instruction code 0 0 1 0 1 0 1 1 Illustration 15 0 8 D 7 E 0 7 7 0 A DE Memory address specified with register pair DE The contents of the specified mem...

Страница 38: ...y space Operand format Operand Description HL byte Description example MOV A HL 10H When setting byte to 10H Instruction code 0 0 1 0 1 1 0 1 0 0 0 1 0 0 0 0 3 2 7 Stack addressing Function This addressing is to indirectly address the stack area with the stack pointer SP contents This addressing method is automatically employed when the PUSH POP subroutine call or RETURN instructions is executed o...

Страница 39: ...User s Manual U11047EJ3V0UM00 39 CHAPTER 4 INSTRUCTION SET This chapter lists the instruction set of the 78K 0S Series The instructions are common to all 78K 0S Series products ...

Страница 40: ...ure to describe or For operand register description formats r and rp either functional names X A C etc or absolute names names in parentheses in the table below R0 R1 R2 etc can be described Table 4 1 Operand Representation and Description Formats Operand Description Format r rp sfr X R0 A R1 C R2 B R3 E R4 D R5 L R6 H R7 AX RP0 BC RP1 DE RP2 HL RP3 Special function register symbol saddr saddrp FE...

Страница 41: ...ord CY Carry flag AC Auxiliary carry flag Z Zero flag IE Interrupt request enable flag NMIS Non maskable interrupt servicing flag Memory contents indicated by address or register contents in parentheses XH XL Higher 8 bits and lower 8 bits of 16 bit register Logical product AND Logical sum OR Exclusive logical sum exclusive OR Inverted data addr16 16 bit immediate data or label jdisp8 Signed 8 bit...

Страница 42: ...1 4 Description of clock column The number of clock cycles during instruction execution is outlined as follows One instruction clock cycle is equal to one CPU clock cycle fCPU selected by the processor clock control register PCC The operation list is shown below ...

Страница 43: ...fr A 2 4 sfr A A addr16 3 8 A addr16 addr16 A 3 8 addr16 A PSW byte 3 6 PSW byte A PSW 2 4 A PSW PSW A 2 4 PSW A A DE 1 6 A DE DE A 1 6 DE A A HL 1 6 A HL HL A 1 6 HL A A HL byte 2 6 A HL byte HL byte A 2 6 HL byte A XCH A X 1 4 A X A r Note 2 2 6 A r A saddr 2 6 A saddr A sfr 2 6 A sfr A DE 1 8 A DE A HL 1 8 A HL A HL byte 2 8 A HL byte Notes 1 Except r A 2 Except r A X Remark One instruction clo...

Страница 44: ... A HL 1 6 A CY A HL A HL byte 2 6 A CY A HL byte ADDC A byte 2 4 A CY A byte CY saddr byte 3 6 saddr CY saddr byte CY A r 2 4 A CY A r CY A saddr 2 4 A CY A saddr CY A addr16 3 8 A CY A addr16 CY A HL 1 6 A CY A HL CY A HL byte 2 6 A CY A HL byte CY SUB A byte 2 4 A CY A byte saddr byte 3 6 saddr CY saddr byte A r 2 4 A CY A r A saddr 2 4 A CY A saddr A addr16 3 8 A CY A addr16 A HL 1 6 A CY A HL ...

Страница 45: ...r16 A HL 1 6 A A HL A HL byte 2 6 A A HL byte OR A byte 2 4 A A byte saddr byte 3 6 saddr saddr byte A r 2 4 A A r A saddr 2 4 A A saddr A addr16 3 8 A A addr16 A HL 1 6 A A HL A HL byte 2 6 A A HL byte XOR A byte 2 4 A A byte saddr byte 3 6 saddr saddr byte A r 2 4 A A r A saddr 2 4 A A saddr A addr16 3 8 A A addr16 A HL 1 6 A A HL A HL byte 2 6 A A HL byte CMP A byte 2 4 A byte saddr byte 3 6 sa...

Страница 46: ...Am 1 Am 1 ROLC A 1 1 2 CY A7 A0 CY Am 1 Am 1 SET1 saddr bit 3 6 saddr bit 1 sfr bit 3 6 sfr bit 1 A bit 2 4 A bit 1 PSW bit 3 6 PSW bit 1 HL bit 2 10 HL bit 1 CLR1 saddr bit 3 6 saddr bit 0 sfr bit 3 6 sfr bit 0 A bit 2 4 A bit 0 PSW bit 3 6 PSW bit 0 HL bit 2 10 HL bit 0 SET1 CY 1 2 CY 1 1 CLR1 CY 1 2 CY 0 0 NOT1 CY 1 2 CY _____ CY CALL addr16 3 6 SP 1 PC 3 H SP 2 PC 3 L PC addr16 SP SP 2 CALLT a...

Страница 47: ...bit addr16 4 10 PC PC 4 jdisp8 if saddr bit 1 sfr bit addr16 4 10 PC PC 4 jdisp8 if sfr bit 1 A bit addr16 3 8 PC PC 3 jdisp8 if A bit 1 PSW bit addr16 4 10 PC PC 4 jdisp8 if PSW bit 1 BF saddr bit addr16 4 10 PC PC 4 jdisp8 if saddr bit 0 sfr bit addr16 4 10 PC PC 4 jdisp8 if sfr bit 0 A bit addr16 3 8 PC PC 3 jdisp8 if A bit 0 PSW bit addr16 4 10 PC PC 4 jdisp8 if PSW bit 0 DBNZ B addr16 2 6 B B...

Страница 48: ...16 1 None A ADD ADDC SUB SUBC AND OR XOR CMP MOV Note XCH Note ADD ADDC SUB SUBC AND OR XOR CMP MOV XCH MOV XCH ADD ADDC SUB SUBC AND OR XOR CMP MOV ADD ADDC SUB SUBC AND OR XOR CMP MOV MOV XCH MOV XCH ADD ADDC SUB SUBC AND OR XOR CMP MOV XCH ADD ADDC SUB SUBC AND OR XOR CMP ROR ROL RORC ROLC r MOV MOV Note INC DEC B C DBNZ sfr MOV MOV saddr MOV ADD ADDC SUB SUBC AND OR XOR CMP MOV DBNZ INC DEC ad...

Страница 49: ... Note saddrp SP None AX ADDW SUBW CMPW MOVW XCHW MOVW MOVW rp MOVW MOVW Note INCW DECW PUSH POP saddrp MOVW SP MOVW Note Only when rp BC DE HL 3 Bit manipulation instructions SET1 CLR1 NOT1 BT BF 2nd operand 1st operand saddr None A bit BT BF SET1 CLR1 sfr bit BT BF SET1 CLR1 saddr bit BT BF SET1 CLR1 PSW bit BT BF SET1 CLR1 HL bit SET1 CLR1 CY SET1 CLR1 NOT1 ...

Страница 50: ...50 4 Call instructions branch instructions CALL CALLT BR BC BNC BZ BNZ BT BF DBNZ 2nd operand 1st operand AX addr16 addr5 addr16 Basic instructions BR CALL BR CALLT BR BC BNC BZ BNZ Compound instructions DBNZ 5 Other instructions RET RETI NOP EI DI HALT STOP ...

Страница 51: ...8 bit immediate data corresponding to byte Low High byte 16 bit immediate data corresponding to word Saddr offset 16 bit address lower 8 bit offset data corresponding to saddr Sfr offset sfr 16 bit address lower 8 bit offset data Low High addr 16 bit immediate data corresponding to addr16 jdisp Signed two s complement data 8 bits of relative address distance between the start and branch addresses ...

Страница 52: ...r High addr PSW byte 1 1 1 1 0 1 0 1 0 0 0 1 1 1 1 0 Data A PSW 0 0 1 0 0 1 0 1 0 0 0 1 1 1 1 0 PSW A 1 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 A DE 0 0 1 0 1 0 1 1 DE A 1 1 1 0 1 0 1 1 A HL 0 0 1 0 1 1 1 1 HL A 1 1 1 0 1 1 1 1 A HL byte 0 0 1 0 1 1 0 1 Data HL byte A 1 1 1 0 1 1 0 1 Data XCH A X 1 1 0 0 0 0 0 0 A r Note 2 0 0 0 0 1 0 1 0 0 0 0 0 R2 R1 R0 1 A saddr 0 0 0 0 0 1 0 1 Saddr offset A sfr 0 0 0 0...

Страница 53: ...HL byte 1 0 1 0 1 1 0 1 Data SUB A byte 1 0 0 1 0 0 1 1 Data saddr byte 1 0 0 1 0 0 0 1 Saddr offset Data A r 0 0 0 0 1 0 1 0 1 0 0 1 R2 R1 R0 1 A saddr 1 0 0 1 0 1 0 1 Saddr offset A addr16 1 0 0 1 1 0 0 1 Low addr High addr A HL 1 0 0 1 1 1 1 1 A HL byte 1 0 0 1 1 1 0 1 Data SUBC A byte 1 0 1 1 0 0 1 1 Data saddr byte 1 0 1 1 0 0 0 1 Saddr offset Data A r 0 0 0 0 1 0 1 0 1 0 1 1 R2 R1 R0 1 A sad...

Страница 54: ...dr A HL 0 1 0 0 1 1 1 1 A HL byte 0 1 0 0 1 1 0 1 Data CMP A byte 0 0 0 1 0 0 1 1 Data saddr byte 0 0 0 1 0 0 0 1 Saddr offset Data A r 0 0 0 0 1 0 1 0 0 0 0 1 R2 R1 R0 1 A saddr 0 0 0 1 0 1 0 1 Saddr offset A addr16 0 0 0 1 1 0 0 1 Low addr High addr A HL 0 0 0 1 1 1 1 1 A HL byte 0 0 0 1 1 1 0 1 Data ADDW AX word 1 1 0 1 0 0 1 0 Low byte High byte SUBW AX word 1 1 0 0 0 0 1 0 Low byte High byte ...

Страница 55: ...0 1 0 1 0 0 CLR1 CY 0 0 0 0 0 1 0 0 NOT1 CY 0 0 0 0 0 1 1 0 CALL addr16 0 0 1 0 0 0 1 0 Low addr High addr CALLT addr5 0 1 ta4 to 0 0 RET 0 0 1 0 0 0 0 0 RETI 0 0 1 0 0 1 0 0 PUSH PSW 0 0 1 0 1 1 1 0 rp 1 0 1 0 P1 P0 1 0 POP PSW 0 0 1 0 1 1 0 0 rp 1 0 1 0 P1 P0 0 0 MOVW SP AX 1 1 1 0 0 1 1 0 0 0 0 1 1 1 0 0 AX SP 1 1 0 1 0 1 1 0 0 0 0 1 1 1 0 0 BR addr16 1 0 1 1 0 0 1 0 Low addr High addr addr16 0...

Страница 56: ... 0 0 Sfr offset jdisp A bit addr16 0 0 0 0 1 0 1 0 0 B2 B1 B0 0 0 0 0 jdisp PSW bit addr16 0 0 0 0 1 0 1 0 0 B2 B1 B0 1 0 0 0 0 0 0 1 1 1 1 0 jdisp DBNZ B addr16 0 0 1 1 0 1 1 0 jdisp C addr16 0 0 1 1 0 1 0 0 jdisp saddr addr16 0 0 1 1 0 0 1 0 Saddr offset jdisp NOP 0 0 0 0 1 0 0 0 EI 0 0 0 0 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0 DI 0 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0 HALT 0 0 0 0 1 ...

Страница 57: ...es Each instruction is described in the unit of mnemonic including description of multiple operands The basic configuration of instruction descriptions is shown on the next page For the number of instruction bytes and operation codes refer to CHAPTER 4 INSTRUCTION SET All the instructions are common to 78K 0S Series products ...

Страница 58: ...ic Operand dst src Mnemonic Operand dst src MOV r byte MOV A PSW A saddr HL A saddr A A HL byte PSW byte HL C A Flag Indicates the operation of the flag that changes by instruction execution Each flag operation symbol is shown in the legend Z AC CY Legend Symbol Description Blank 0 1 R Unchanged Cleared to 0 Set to 1 Set or cleared according to the result Previously saved value is restored Descrip...

Страница 59: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 59 5 1 8 Bit Data Transfer Instructions The following instructions are 8 bit data transfer instructions MOV 60 XCH 61 ...

Страница 60: ...E A saddr A A HL A sfr HL A sfr A A HL byte A addr16 HL byte A Note Except r A Flag PSW byte and PSW A All other operand operands combinations Z AC CY Z AC CY Description The contents of the source operand src specified by the 2nd operand are transferred to the destination operand dst specified by the 1st operand No interrupts are acknowledged between the MOV PSW byte instruction or the MOV PSW A ...

Страница 61: ...ion format XCH dst src Operation dst src Operand Mnemonic Operand dst src XCH A X A r Note A saddr A sfr A DE A HL A HL byte Note Except r A X Flag Z AC CY Description The 1st and 2nd operand contents are exchanged Description example XCH A 0FEBCH The A register contents and address FEBCH contents are exchanged ...

Страница 62: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 62 5 2 16 Bit Data Transfer Instructions The following instructions are 16 bit data transfer instructions MOVW 63 XCHW 64 ...

Страница 63: ...saddrp AX AX rp Note rp AX Note Note Only when rp BC DE or HL Flag Z AC CY Description The contents of the source operand src specified by the 2nd operand are transferred to the destination operand dst specified by the 1st operand Description example MOVW AX HL The HL register contents are transferred to the AX register Caution Only an even address can be specified to saddrp An odd address cannot ...

Страница 64: ...Instruction format XCHW dst src Operation dst src Operand Mnemonic Operand dst src XCHW AX rp Note Note Only when rp BC DE or HL Flag Z AC CY Description The 1st and 2nd operand contents are exchanged Description example XCHW AX BC The memory contents of AX register are exchanged with those of the BC register ...

Страница 65: ...PTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 65 5 3 8 Bit Operation Instructions The following are 8 bit operation instructions ADD 66 ADDC 67 SUB 68 SUBC 69 AND 70 OR 71 XOR 72 CMP 73 ...

Страница 66: ...he source operand src specified with the 2nd operand and the result is stored in the CY flag and the destination operand dst If the addition result shows that dst is 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 If the addition generates a carry from bit 7 the CY flag is set 1 In all other cases the CY flag is cleared 0 If the addition generates a carry from bit 3 to bit 4 the A...

Страница 67: ...and the result is stored in the destination operand dst and the CY flag The CY flag is added to the least significant bit This instruction is mainly used to add two or more bytes If the addition result shows that dst is 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 If the addition generates a carry from bit 7 the CY flag is set 1 In all other cases the CY flag is cleared 0 If th...

Страница 68: ...and the result is stored in the destination operand dst and the CY flag The destination operand can be cleared to 0 by equalizing the source operand src and the destination operand dst If the subtraction shows that dst is 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 If the subtraction generates a borrow at bit 7 the CY flag is set 1 In all other cases the CY flag is cleared 0 I...

Страница 69: ...perand and the result is stored in the destination operand dst The CY flag is subtracted from the least significant bit This instruction is mainly used for subtraction of two or more bytes If the subtraction shows that dst is 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 If the subtraction generates a borrow at bit 7 the CY flag is set 1 In all other cases the CY flag is cleared...

Страница 70: ... byte A saddr Flag Z AC CY Description The destination operand dst specified with the 1st operand and the source operand src specified with the 2nd operand are ANDed bit wise and the result is stored in the destination operand dst If the logical product shows that all bits are 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 Description example AND 0FEBAH 11011100B The FEBAH conten...

Страница 71: ...HL byte A saddr Flag Z AC CY Description The destination operand dst specified with the 1st operand and the source operand src specified with the 2nd operand are ORed bit wise and the result is stored in the destination operand dst If the logical sum shows that all bits are 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 Description example OR A 0FE98H The A register and FE98H are...

Страница 72: ...rand dst specified with the 1st operand and the source operand src specified with the 2nd operand are XORed bit wise and the result is stored in the destination operand dst Logical negation of all bits of the destination operand dst is possible with this instruction by selecting 0FFH for the source operand src If the exclusive logical sum shows that all bits are 0 the Z flag is set 1 In all other ...

Страница 73: ...t operand The subtraction result is not stored anywhere and only the Z AC and CY flags are changed If the subtraction result is 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 If the subtraction generates a borrow at bit 7 the CY flag is set 1 In all other cases the CY flag is cleared 0 If the subtraction generates a borrow from bit 4 to bit 3 the AC flag is set 1 In all other cas...

Страница 74: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 74 5 4 16 Bit Operation Instructions The following are 16 bit operation instructions ADDW 75 SUBW 76 CMPW 77 ...

Страница 75: ...ed to the source operand src specified with the 2nd operand and the result is stored in the destination operand dst If the addition result shows that dst is 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 If the addition generates a carry from bit 15 the CY flag is set 1 In all other cases the CY flag is cleared 0 As a result of addition the AC flag becomes undefined Description e...

Страница 76: ...e result is stored in the destination operand dst and the CY flag The destination operand can be cleared to 0 by equalizing the source operand src and the destination operand dst If the subtraction shows that dst is 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 If the subtraction generates a borrow at bit 15 the CY flag is set 1 In all other cases the CY flag is cleared 0 As a r...

Страница 77: ...ith the 1st operand The subtraction result is not stored anywhere and only the Z AC and CY flags are changed If the subtraction result is 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 If the subtraction generates a borrow at bit 15 the CY flag is set 1 In all other cases the CY flag is cleared 0 As a result of subtraction the AC flag becomes undefined Description example CMPW AX...

Страница 78: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 78 5 5 Increment Decrement Instructions The following are increment decrement instructions INC 79 DEC 80 INCW 81 DECW 82 ...

Страница 79: ...remented by only one If the increment result is 0 the Z flag is set 1 In all other cases the Z flag is cleared 0 If the increment generates a carry from bit 3 to bit 4 the AC flag is set 1 In all other cases the AC flag is cleared 0 Because this instruction is frequently used for a counter for repeated operations the CY flag contents are not changed to hold the CY flag contents in multiple byte op...

Страница 80: ... other cases the Z flag is cleared 0 If the decrement generates a carry from bit 4 to bit 3 the AC flag is set 1 In all other cases the AC flag is cleared 0 Because this instruction is frequently used for a counter for repeated operations the CY flag contents are not changed to hold the CY flag contents in multiple byte operation If dst is the B or C register or saddr and it is not desired to chan...

Страница 81: ...tion dst dst 1 Operand Mnemonic Operand dst INCW rp Flag Z AC CY Description The destination operand dst contents are incremented by only one Because this instruction is frequently used for increment of a register pointer used for addressing the Z AC and CY flag contents are not changed Description example INCW HL The HL register is incremented ...

Страница 82: ...tion dst dst 1 Operand Mnemonic Operand dst DECW rp Flag Z AC CY Description The destination operand dst contents are decremented by only one Because this instruction is frequently used for decrement of a register pointer used for addressing the Z AC and CY flag contents are not changed Description example DECW DE The DE register is decremented ...

Страница 83: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 83 5 6 Rotate Instructions The following are rotate instructions ROR 84 ROL 85 RORC 86 ROLC 87 ...

Страница 84: ...dstm 1 dstm one time Operand Mnemonic Operand dst cnt ROR A 1 Flag Z AC CY Description The destination operand dst contents specified with the 1st operand are rotated to the right just once The LSB bit 0 contents are simultaneously rotated to MSB bit 7 and transferred to the CY flag CY 0 7 Description example ROR A 1 The A register contents are rotated one bit to the right ...

Страница 85: ...stm 1 dstm one time Operand Mnemonic Operand dst cnt ROL A 1 Flag Z AC CY Description The destination operand dst contents specified with the 1st operand are rotated to the left just once The MSB bit 7 contents are simultaneously rotated to LSB bit 0 and transferred to the CY flag CY 0 7 Description example ROL A 1 The A register contents are rotated to the left by one bit ...

Страница 86: ...C dst cnt Operation CY dst0 dst7 CY dstm 1 dstm one time Operand Mnemonic Operand dst cnt RORC A 1 Flag Z AC CY Description The destination operand dst contents specified with the 1st operand are rotated just once to the right including the CY flag CY 0 7 Description example RORC A 1 The A register contents are rotated to the right by one bit including the CY flag ...

Страница 87: ...C dst cnt Operation CY dst7 dst0 CY dstm 1 dstm one time Operand Mnemonic Operand dst cnt ROLC A 1 Flag Z AC CY Description The destination operand dst contents specified with the 1st operand are rotated just once to the left including the CY flag CY 0 7 Description example ROLC A 1 The A register contents are rotated to the left by one bit including the CY flag ...

Страница 88: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 88 5 7 Bit Manipulation Instructions The following are bit manipulation instructions SET1 89 CLR1 90 NOT1 91 ...

Страница 89: ...ation dst 1 Operand Mnemonic Operand dst SET1 saddr bit sfr bit A bit PSW bit HL bit CY Flag dst PSW bit dst CY In all other cases Z AC CY Z AC CY Z AC CY 1 Description The destination operand dst is set 1 When the destination operand dst is CY or PSW bit only the corresponding flag is set 1 Description example SET1 0FE55H 1 Bit 1 of FE55H is set 1 ...

Страница 90: ...ion dst 0 Operand Mnemonic Operand dst CLR1 saddr bit sfr bit A bit PSW bit HL bit CY Flag dst PSW bit dst CY In all other cases Z AC CY Z AC CY Z AC CY 0 Description The destination operand dst is cleared 0 When the destination operand dst is CY or PSW bit only the corresponding flag is cleared 0 Description example CLR1 P3 7 Bit 7 of port 3 is cleared 0 ...

Страница 91: ...3V0UM00 91 NOT1 Not Single Bit Carry Flag 1 Bit Data Logical Negation Instruction format NOT1 dst Operation dst _______ dst Operand Mnemonic Operand dst NOT1 CY Flag Z AC CY Description The CY flag is inverted Description example NOT1 CY The CY flag is inverted ...

Страница 92: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 92 5 8 CALL RETURN Instructions The following are call return instructions CALL 93 CALLT 94 RET 95 RETI 96 ...

Страница 93: ...C 3 L SP SP 2 PC target Operand Mnemonic Operand target CALL addr16 Flag Z AC CY Description This is a subroutine call with a 16 bit absolute address or a register indirect address The next instruction s start address PC 3 is saved in the stack and is branched to the address specified with the target operand target Description example CALL 3059H Subroutine call to 3059H ...

Страница 94: ...nic Operand addr5 CALLT addr5 Flag Z AC CY Description This is a subroutine call for call table reference The next instruction s start address PC 1 is saved in the stack and is branched to the address indicated with the word data of a call table the higher 8 bits of address are fixed to 00000000B and the following 5 bits are specified with addr5 Description example CALLT 40H Subroutine call to the...

Страница 95: ...Subroutine Instruction format RET Operation PCL SP PCH SP 1 SP SP 2 Operand None Flag Z AC CY Description This is a return instruction from the subroutine call made with the CALL and CALLT instructions The word data saved in the stack returns to the PC and the program returns from the subroutine ...

Страница 96: ...k returns to the PC and PSW and the program returns from the interrupt service routine None of interrupts are acknowledged between this instruction and the next instruction to be executed The NMIS flag is set to 1 by acknowledgment of a non maskable interrupt and cleared to 0 by the RETI instruction Caution When the return from non maskable interrupt servicing is performed by an instruction other ...

Страница 97: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 97 5 9 Stack Manipulation Instructions The following are stack manipulation instructions PUSH 98 POP 99 MOVW SP AX 100 MOVW AX SP 100 ...

Страница 98: ...SH src Operation When src rp When src PSW SP 1 srcH SP 1 src SP 2 srcL SP SP 1 SP SP 2 Operand Mnemonic Operand src PUSH PSW rp Flag Z AC CY Description The data of the register specified with the source operand src is saved in the stack Description example PUSH AX AX register contents are saved in the stack ...

Страница 99: ...monic Operand dst POP PSW rp Flag dst rp PSW Z AC CY Z AC CY R R R Description Data is returned from the stack to the register specified with the destination operand dst When the operand is PSW each flag is replaced with stack data No interrupts are acknowledged between the POP PSW instruction and the subsequent instruction Description example POP AX The stack data is returned to the AX register ...

Страница 100: ... src Operation dst src Operand Mnemonic Operand dst src MOVW SP AX AX SP Flag Z AC CY Description This is an instruction to manipulate the stack pointer contents The source operand src specified with the 2nd operand is stored in the destination operand dst specified with the 1st operand Description example MOVW SP AX AX register contents are stored in the stack pointer ...

Страница 101: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 101 5 10 Unconditional Branch Instruction The following is an unconditional branch instruction BR 102 ...

Страница 102: ...ion PC target Operand Mnemonic Operand target BR addr16 AX addr16 Flag Z AC CY Description This is an instruction to branch unconditionally The word data of the target address operand target is transferred to PC and program branches Description example BR AX The AX register contents are regarded as an address to which the program branches ...

Страница 103: ...ER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 103 5 11 Conditional Branch Instructions The following are conditional branch instructions BC 104 BNC 105 BZ 106 BNZ 107 BT 108 BF 109 DBNZ 110 ...

Страница 104: ...2 jdisp8 if CY 1 Operand Mnemonic Operand addr16 BC addr16 Flag Z AC CY Description When CY 1 program branches to the address specified with the operand When CY 0 no processing is carried out and the subsequent instruction is executed Description example BC 300H When CY 1 program branches to 0300H with the start of this instruction set in the range of addresses 027FH to 037EH ...

Страница 105: ...C 2 jdisp8 if CY 0 Operand Mnemonic Operand addr16 BNC addr16 Flag Z AC CY Description When CY 0 program branches to the address specified with the operand When CY 1 no processing is carried out and the subsequent instruction is executed Description example BNC 300H When CY 0 program branches to 0300H with the start of this instruction set in the range of addresses 027FH to 037EH ...

Страница 106: ... Z 1 Operand Mnemonic Operand addr16 BZ addr16 Flag Z AC CY Description When Z 1 program branches to the address specified with the operand When Z 0 no processing is carried out and the subsequent instruction is executed Description example DEC B BZ 3C5H When the B register is 0 program branches to 03C5H with the start of this instruction set in the range of addresses 0344H to 0443H ...

Страница 107: ...0 Operand Mnemonic Operand addr16 BNZ addr16 Flag Z AC CY Description When Z 0 program branches to the address specified with the operand When Z 1 no processing is carried out and the subsequent instruction is executed Description example CMP A 55H BNZ 0A39H If the A register is not 0055H program branches to 0A39H with the start of this instruction set in the range of addresses 09B8H to 0AB7H ...

Страница 108: ...it addr16 4 A bit addr16 3 PSW bit addr16 4 Flag Z AC CY Description If the 1st operand bit contents have been set 1 program branches to the address specified with the 2nd operand addr16 If the 1st operand bit contents have not been set 1 no processing is carried out and the subsequent instruction is executed Description example BT 0FE47H 3 55CH When bit 3 at address FE47H is 1 program branches to...

Страница 109: ... addr16 4 A bit addr16 3 PSW bit addr16 4 Flag Z AC CY Description If the 1st operand bit contents have been cleared 0 program branches to the address specified with the 2nd operand addr16 If the 1st operand bit contents have not been cleared 0 no processing is carried out and the subsequent instruction is executed Description example BF P2 2 1549H When bit 2 of port 2 is 0 program branches to add...

Страница 110: ...destination operand dst contents specified with the 1st operand and the subtraction result is stored in the destination operand dst If the subtraction result is not 0 program branches to the address indicated with the 2nd operand addr16 When the subtraction result is 0 no processing is carried out and the subsequent instruction is executed The flag remains unchanged Description example DBNZ B 1215...

Страница 111: ...CHAPTER 5 EXPLANATION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 111 5 12 CPU Control Instructions The following are CPU control instructions NOP 112 EI 113 DI 114 HALT 115 STOP 116 ...

Страница 112: ...ION OF INSTRUCTIONS User s Manual U11047EJ3V0UM00 112 NOP No Operation No Operation Instruction format NOP Operation no operation Operand None Flag Z AC CY Description No processing is performed and only time is consumed ...

Страница 113: ...C CY Description The maskable interrupt acknowledge enable status is set by setting the interrupt enable flag IE 1 Interrupts are acknowledged immediately after this instruction is executed If this instruction is executed vectored interrupt acknowledgment with another source can be disabled For details refer to Interrupt Functions in the User s Manual of each product ...

Страница 114: ... IE 0 Operand None Flag Z AC CY Description Maskable interrupt acknowledgment with vectored interrupt is disabled with the interrupt enable flag IE cleared 0 No interrupts are acknowledged between this instruction and the subsequent instruction For details of interrupt servicing refer to Interrupt Functions in the User s Manual of each product ...

Страница 115: ... Instruction format HALT Operation Set HALT Mode Operand None Flag Z AC CY Description This instruction is used to set the HALT mode to stop the CPU operation clock Total power consumption of the system can be reduced with intermittent operations through combination with the normal operation mode ...

Страница 116: ...Mode Set Instruction format STOP Operation Set STOP Mode Operand None Flag Z AC CY Description This instruction is used to set the STOP mode to stop the main system clock oscillator and to stop the whole system Power dissipation can be minimized to an ultra low leakage current level only ...

Страница 117: ...SUBW 76 CMPW 77 Increment decrement instructions INC 79 DEC 80 INCW 81 DECW 82 Rotate instructions ROR 84 ROL 85 RORC 86 ROLC 87 Bit manipulation instructions SET1 89 CLR1 90 NOT1 91 Call return instructions CALL 93 CALLT 94 RET 95 RETI 96 Stack manipulation instructions PUSH 98 POP 99 MOVW SP AX 100 MOVW AX SP 100 Unconditional branch instruction BR 102 Conditional branch instructions BC 104 BNC ...

Страница 118: ...User s Manual U11047EJ3V0UM00 118 MEMO ...

Страница 119: ...105 BNZ 107 BR 102 BT 108 BZ 106 C CALL 93 CALLT 94 CLR1 90 CMP 73 CMPW 77 D DBNZ 110 DEC 80 DECW 82 DI 114 E EI 113 H HALT 115 I INC 79 INCW 81 M MOV 60 MOVW 63 MOVW AX SP 100 MOVW SP AX 100 N NOP 112 NOT1 91 O OR 71 P POP 99 PUSH 98 R RET 95 RETI 96 ROL 85 ROLC 87 ROR 84 RORC 86 S SET1 89 STOP 116 SUB 68 SUBC 69 SUBW 76 X XCH 61 XCHW 64 XOR 72 ...

Страница 120: ...User s Manual U11047EJ3V0UM00 120 MEMO ...

Страница 121: ... of the table of the internal data memory space of the 78K 0S Series products CHAPTER 1 MEMORY SPACE 3rd Addition of the following target products µPD789046 789104 789114 789124 789134 789146 789156 789167 789177 789197AY 789217AY 789407A 789417A and 789842 Subseries Deletion of the following target products µPD789407 789417 and 789806Y Subseries Throughout Modification of MOV PSW byte instruction...

Страница 122: ...User s Manual U11047EJ3V0UM00 122 MEMO ...

Страница 123: ... 02 2719 5951 Address North America NEC Electronics Inc Corporate Communications Dept Fax 1 800 729 9288 1 408 588 6130 Europe NEC Electronics Europe GmbH Technical Documentation Dept Fax 49 211 6503 274 South America NEC do Brasil S A Fax 55 11 6465 6829 Asian Nations except Philippines NEC Electronics Singapore Pte Ltd Fax 65 250 3583 Japan NEC Semiconductor Technical Hotline Fax 044 435 9608 I ...

Отзывы: