c= MITSUBISHI SEMICONDUCTORS Cl> ITI ::a ui I 3l: ' l> z c= l> I'"" SERIES 740 USER'S MANUAL • MITSUBISHI 6'ELECTRIC FOREWORD This software manual is for users of the MELPS 740 series. Register structure, addressing mode and instructions are introduced in each section. The enhanced instruction set with enhanced data and memory operations enable efficient programming. Please refer to the "USER'S MANUAL" appropriate for the hardware device or the development support tools used. CONTENTS ©©lNlu~lNlu~ 1. OVERVIEW .....................................•.............................................................. 1 2. CENTRAL PROCESSING UNIT .................................................................. 2 2.1 Accumulator(A) ..................................................................................... 2 2.2 Index Register X(X), Index Register Y(Y) ........................................ 2 2.3 Stack Pointer(S) ................................................................................... 3 2.4 Program Counter(PC) .......................................................................... 4 2.5 Processor Status Register(PS) ........................................................... 4 3. INSTRUCTIONS .............................................................................................6 3.1 Addressing Mode ................................................................................. 6 3.2 System of Instruction ........................................................................ 26 3.3 Instructions ......................................................................................... 30 4. NOTES FOR PROGRAMING .................................................................. 104 APPENDIX 1. INSTRUCTION CYCLES IN EACH ADDRESSING MODE ............... 106 APPENDIX 2. MELPS 740 MACHINE LANGUAGE INSTRUCTION TABLE ........... 172 APPENDIX 3. INSTRUCTION HEXADECIMAL CODE TABLE ................ 178 APPENDIX 4. ASCII CODE TABLE ........................................................... 179 ADC ............. 31 CLV ............. 52 MUL ............. 73 STX ............. 94 AND ............. 32 CMP ............ 53 NOP ............. 74 STY ............. 95 ASL .............. 33 COM ............ 54 ORA ............. 75 TAX ............. 96 BBC ............. 34 CPX ............. 55 PHA ............. 76 TAY ............. 97 BBS ............. 35 CPY ............. 56 PHP ............. 77 TST .............. 98 BCC ............. 36 DEC ............. 57 PLA .............. 78 TSX ............. 99 BCS ............. 37 DEX ............. 58 PLP .............. 79 TXA ........... 100 BEQ ............. 38 DEY ............. 59 ROL ............. 80 TXS ........... 101 BIT ............... 39 DIV .............. 60 ROR ............ 81 TYA ........... 102 BMI ............. .40 EOR ............. 61 RRF ............. 82 WIT ............ 103 BNE ............. 41 FST .............. 62 RTl ............... 83 BPL. ............. 42 INC .............. 63 RTS ............. 84 BRA ............. 43 INX .............. 64 SBC ............. 85 BRK ............. 44 INY .............. 65 SEB ............. 86 BVC ............. 45 JMP ............. 66 SEC ............. 87 BVS ............. 46 JSR .............. 67 SED ............. 88 CLB ............. 47 LDA ............. 68 SEl ............... 89 CLC ............ .48 LDM ............. 69 SET ............. 90 CLO ............. 49 LDX ............. 70 SLW ............. 91 CLI ............... 50 LDY ............. 71 STA ............. 92 CLT .............. 51 LSR ............. 72 STP ............. 93 OVERVIEW 1.0VERVIEW The software of MELPS 740 series CMOS microcomputers includes the complex bit process- ing functions of the 4-bit series along with byte calculations and manipulations. The software has been designed to make use of the distinctive hardware features. The distinctive features of the MELPS 740 series are described below. 1) An efficient instruction set and many addressing modes allow the effective use of ROM. 2) The same bit management, test, and branch instructions can be performed on the accu- mulator, memory, or 1/0 area. 3) Multiple interrupts with separate interrupt vectors allow servicing of different non-periodic events. 4) Byte processing and table referencing can be easily performed using the index address- ing mode. 5) Decimal mode needs no software correction for proper decimal operation. 6) The accumulator does not need to be used in operations using memory or 1/0, or memory and 1/0. 1 CENTRAL PROCESSING UNIT Accumulator (A) Index register X (X), index register Y (Y) 2. CENTRAL PROCESSING UNIT Six main registers are built into the CPU of the MELPS 740. The program counter (PC) is a 16-bit register but the accumulator (A), index register X (X), index register Y (Y), stack pointer (S) and processor status register (PS) are 8-bit registers. ,... Except for the I flag, the contents of these registers are indeterminate after a hardware reset. Therefore, initialization is required with some programs. z Q I A I Accumulator(A) 7 0 I x I Index Register X(X) z Q I y I Index Register Y(Y) z Q I s I Stack Pointer(S) z Qz Q I Program Counter(PC) I PCH I PCL i Processor _o_ [NlvJTlelolilztcJ Status Register(PS) Carry Flag Zero Flag Interrupt Disable Flag Decimal Mode Flag Break Flag X Modified Operation Mode Flag Overflow Flag Negative Flag Fig.2.1.1 Register Conf1grat1on 2.1 Accumulator (A) The accumulator is the central register of the microcomputer and is an 8-bit register. This general-purpose register is used the most frequently for arithmetic operations, data trans- fer, temporary memory, conditional judgments, etc. 2.2 Index Register X (X), Index Register Y (Y) The MELPS 740 has an index register X and an index register Y, both of which are 8-bit registers. In addressing modes which use these index registers, the register contents are added to the specified address and this becomes the actual address. These modes are extremely effective for referencing subroutine and memory tables. The index registers also have increment, decrement, compare, and data transfer functions and can therefore be used as simple accumulators. 2 CENTRAL PROCESSING UNIT Stack pointer (S) 2.3 Stack Pointer (S) The stack pointer is an 8-bit register used for generating interrupts and calling subroutines. When an interrupt is received, the following procedure is performed automatically in the indi- cated sequence. (1) The contents of the higher 8 bits of the program counter (PCH) are saved to a zero page address using the stack pointer contents for the lower 8 address bits. (2) The stack pointer contents are decremented by 1. (3) The contents of the lower 8 bits of the program counter (PCL) are saved to a zero page address using the stack pointer contents for the lower 8 address bits. (4) The stack pointer contents are decremented by 1. (5) The contents of the processor status register (PS) are saved to a zero page address using the stack pointer contents for the lower 8 address bits. (6) The stack pointer contents are decremented by 1. The process status register is not saved when calling subroutines (items (5) and (6) above are not executed). The processor status register is saved by executing the PHP instruction in software. To prevent data loss when generating interrupts and calling subroutines, it is necessary to save other registers as well. This is done by executing the proper instruction in software while in the service routine or subroutine. For example, the PHA instruction is executed to save the contents of the accumulator. Exe- cuting the PHA instruction saves the accumulator contents to a zero page address using the stack pointer contents as the lower 8 address bits. The RTI instruction is executed to return from an interrupt routine. When the RTI instruction is executed, the following procedure is performed automatically in se- quence. (1) The stack pointer contents are incremented by 1. (2) The contents of the zero page addressing the stack pointer contents as the lower 8 address bits is returned to the process status register(PS). (3) The stack pointer contents are incremented by 1. (4) The contents of the zero page address using the stack pointer as the lower 8 address bits is returned to the lower 8 bits of the program counter(PCL). (5) The stack pointer contents are incremented by 1. (6) The contents of the zero page address using the stack pointer as the lower 8 address bits is returned to the higher 8 bits of the program counter. Steps (1) and (2) are not performed when returning from a subroutine using the RTS instruc- tion. The processor status register should be restored before returning from a subroutine by using the PLP instruction. The accumulator should be restored before returning from a subrou- tine or an interrupt servicing routine by using the PLA instruction. The PLA and PLP instructions increment the stack pointer by 1 and return to the contents of the zero page address stored in the stack pointer to the accumulator or processor status register, respectively. i& Saving data in the stack area gradually fills the RAM area with saved data; therefore caution must exercised concerning the depth of interrupt levels and subroutine nesting. 3 CENTRAL PROCESSING UNIT Program counter (PC) Processor status register (PS) 2.4 Program Counter (PC) The program counter is a 16-bit counter consisting of PCH and PCL, which are each 8-bit. The program counter indicates the address of the next program instruction. The MELPS 740 uses stored programs system; to start a new operation it is necessary to transfer the instruction and relevant data from memory to the CPU. Normally the program counter is used to indicate the next memory address. After each instruction is executed, the next instruction required is read. This cycle is repeated until the program is finished. a ' The control of the program counter of the MELPS 740 is almost fully automatic. However, caution must be exercised to avoid differences between program flow and program counter contents when using the stack pointer or directly altering the contents of the program counter. 2.5 Processor Status Register (PS) The processor status register is an 8-bit register consisting of 5 flags which indicate the status of arithmetic operations and 3 flags which determine operation. Each of these flags is described below. Refer to Appendix 3 "MACHINE LANGUAGE IN- STRUCTION TABLE" or Chapter 3 "INSTRUCTIONS" concerning the factors which change these flags. [ Carry flag C ]-------------------------------------------------------Bit 0 This flag stores any carry or borrow from the ALU after an arithmetic operation and is also changed by the Shift or Rotate instruction. This flag is set by the SEC instruction and is cleared by the CLC instruction. [ Zero flag Z ] --------------------------------------------------------Bit 1 This flag is set when the result of an arithmetic operation or data transfer is "O" and is cleared by any other result. Interrupt disable flag I ] -----------------------------------------Bit 2 This flag disables interrupts when it is set to "1." This flag immediately becomes "1" when an interrupt is received. This flag is set by the SEI instruction and is cleared by the CLI instruction. Decimal mode flag D 1------------------------------------------ Bit 3 This flag determines whether additions are performed in binary or decimal notation. Additions are performed in binary notation when this flag is set to "O" and as. a 2-digit, 1-word decimal numeral when set to "1." Decimal notation correction is performed automatically at this time. This flag is set by the SEO instruction and is cleared by the CLO instruction. Only the ADC and SBC instructions are used for decimal arithmetic operations. [ Break flag B ] ------------------------------------------------------Bit 4 This flag determines whether an interrupt was generated with the BRK instruction. When a BRK instruction interrupt occurs, the flag B is set to "1"; for all other interrupts the flag is set to "O" and saved to the stack. 7 4 0 Bit r-- : s S+l I11t= s flag PS (processor status register) S+2 PC L (low-order of program counter) S+3 PC H (high-order ol program counter) - Fig.2.5.2 Stack Contents After Execution of the BAK Instruction 4 CENTRAL PROCESSING UNIT Processor.status register (PS) X modified operation mode flag T 1------------------------ Bit 5 This flag determines whether arithmetic operations are performed via the accumulator or directly in memory. When the flag is set to "O'', arithmetic operations are performed between the accumulator and memory. When "1 ", arithmetic operations are performed directly in memory. This flag is set by the SET instruction and is cleared by the CLT instruction. (1) When the T flag = O A r A * M2 * : indicates an arithmetic operation A : accumulator contents M2: contents of the memory specified by the addressing of the arithmetic operation (2) When the T flag = 1 M1 r M1 * M2 * : indicates arithmetic operation M1: memory contents specified directly by index register X M2: contents of the memory specified by the addressing of the arithmetic operation [ Overflow flag V ] --------------------------------------------------Bit 6 This flag is set to "1" when an overflow occurs as a result of a signed arithmetic operation. An overflow occurs when the result of an addition or subtraction exceeds +127 (7F16) or l-128 (8016)1. The CL V instruction clears the overflow flag. There is no set instruction. The overflow flag is also set during the BIT instruction when bit 6 of the value being tested is 1. a- Overflows do not occur when the result of an addition or subtraction is equal to or smaller than the above numerical values, or for additions involving values with different signs. Negative flag N ] ------------------------------------------------Bit 7 This flag is set to match the sign bit (bit 7) of the result of a data or arithmetic operation. This flag can be used to determine whether the results of arithmetic operations are positive or negative, and also to perform a simple bit test. 5 INSTRUCTIONS Addressing mode 3. INSTRUCTIONS 3.1 Addressing Mode The series MELPS 740 has 17 addressing modes and a powerful memory access capability. When extracting data required for arithmetic and logic operations from memory or when storing the results of such operations in memory, a memory address must be specified. The speci- fication of the memory address is called addressing. The data required for addressing and the registers involved are described below. The series MELPS 740 instructions can be classified into three kinds, by the number of bytes required in program memory for the instruction: 1- byte, 2-byte and 3-byte instructions. In each case, the first byte is known as the "operation code" which forms the basis of the instruction. The second or third byte is called the "operand" which affects the addressing. The contents of index registers X and Y can also effect the ad- dressing. 1-byte instruction 2-byte instruction 3-byte instruction Index register l>>: · x :·:·>>I ......... ......... i-=-=-= y -:-:-:-:1 Fig.3.1.1 Byte Structure of Instructions Although there are many addressing modes, there is always a particular memory location specified. What differs is whether the operand, or the index register contents, or a combina- tion of both should be used to specify the memory or jump destination. Based on these 3 types of instructions, the range of variation is increased and operation is enhanced by com- binations of the bit operation instructions, jump instruction, and arithmetic instructions. Actual addressing modes are now described by type. 6 INSTRUCTIONS Immediate Addressing mode Addressing mode : Immediate Function : Specifies the operand as an operation data. Instructions: ADC, AND, CMP, CPX, CPY, EOR, LOA, LOX, LOY, ORA, SBC Example : Mnemonic Machine code ADC .ll$A5 691& A51& T This symbol(#) indicates the Immediate addressing mode. Memory Op code(691s) (A) ... (A)+ (C) +I As1s I+- 2e~~~fi~H~~~~~] 7 INSTRUCTIONS Accumulator Addressing mode Addressing mode : Accumulator Function : Specifies the accumulator contents as an operation data. Instructions : ASL, DEC, INC, LSR, ROL, ROR Example : Mnemonic Machine code ROLA 2A1& LE]. -, Carry flag bi-t 7,......- - - - , - ,--......__,..., Accumulator 1. ____. b--.it 0..... 8 INSTRUCTIONS Zero Page Addressing mode Addressing mode : Zero page Function : Specifies the Zero page memory location appointed by the operand as an operation data (0016 - FF16). Instructions : ADC, AND, ASL, BIT, CMP, COM, CPX, CPY, DEC, EOR, INC, LOA, LDM, LOX, LOY, LSR, ORA, ROL, ROR, RRF, SBC, STA, STX, STY, TST Example : Mnemonic Machine code ADC $02 6516 0216 Memory Zero page designation Op code(6516) •.... C?per~~~.1 (9?1 s) ... • 1 - - - - - - - - ' 9 INSTRUCTIONS Zero page X Addressing mode Addressing mode : Zero page X Function : Specifies the contents of the memory address in zero page consisting of the added value of operand and index register, as an operation data. Instructions: ADC, AND, ASL, CMP, DEC, DIV, EOR, INC, LOA, LOY, LSR, MUL, ORA, ROL, ROR, SBC, STA, STY Example : Mnemonic Machine code ADC $1E,X 7516 1 E1s Memory Zero page X designation Op code(751 s) E616 Index register X 10 INSTRUCTIONS Zero page Y Addressing mode Addressing mode : Zero page Y Function :Specifies the contents of the memory address in zero page consisting of the added value of operand and index register, as an operation data. Instructions : LOX, STX Example :·Mnemonic Machine code LOX $02,Y 861& 0216 Memory Zero page Y designation Op code(B61s) · Operanana2;~r E616 Index register Y 11 INSTRUCTIONS Absolute Addressing mode Addressing mode : Absolute Function : Specifies the memory content appointed by operand I and II as an operation data. Instructions: ADC, AND, ASL, BIT, CMP, CPX, CPY, DEC, EOR, INC, JMP,JSR, LOA, LOX, LOY, LSR,ORA, ROL, ROR,SBC, STA, STX, STY Example : Mnemonic Machine code ADC $AD12 6016 1216 AD16 Memo_ry Op code(6D1s) ••••····a?~~~~ci 1(1216)··•·• } ···•c5?eranci1I(AD1.6)•••••• ~ ~I Absolute designation (A).._ (A)+ (C) +I XX1s l-4- ~-D-a-ta-(-X -1-s)- i AD1210 J 12 INSTRUCTIONS Absolute X Addressing mode Addressing mode : Absolute X Function : Specifies the memory content appointed by the added value of operand I, II and register X as an operation data. Instructions: ADC, AND, ASL, CMP, DEC, EOR, INC, LOA, LOY, LSR, ORA, ROL, ROR, SBC, STA Example : Mnemonic Machine code ADC $AD12,X 7016 1216 AD16 Memory Index register X EE16 Absolute X designation (A)..._ (A)+ (C) +I XX1s I._ 1---D-a-ta-(-XX-1-s)_ _. AEOO" _J 13 INSTRUCTIONS Absolute Y Addressing mode Addressing mode : Absolute Y Function : Specifies the memory content appointed by the added value of operand I, II, and register Y as data. Instructions: ADC, AND, CMP, EOR, LDA, LDX, ORA, SBC, STA Example : Mnemonics Machine code ADC $AD12,Y 7916 1216 AD16 Memory Index register Y EE1s Absolute Y designation (A)._ (A)+ (C) +I XX1s I..- 1---D-a-ta-(X_X_1-s)--1 AEOO 10 _J 14 INSTRUCTIONS Implied Addressing mode Addressing mode : Implied Function : Operates on a given register or the accumulator, but the address is always inherent in the instruction. Instructions: BRK, CLC, CLO, CLI, CLT, CLV, DEX, DEY, INX, INY, NOP, PHA, PHP, PLA, PLP, RTI, RTS, SEC, SEO, SEI, SET, STP, TAX, TAY, TSX, TXA, TXS, TVA, WIT Example : Mnemonic Machine code CLC 1816 Processor status register bit 7 bit 0 I I I I ? Carry flag 15 INSTRUCTIONS Relative Addressing mode Addressing mode : Relative Function : Jumps to the address specified by the addition of the program counter and the operand. Instructions : BCC, BCS, BEQ, BMI, BNE, BPL, BRA, BVC, BVS Example : Mnemonic Machine code BCC *-12 901& F21c; Loecimal When the carry flag is clear, When the carry flag is set, jumps to address * -12. goes to address * +2. Memory Memory Address to be executed next Op code(901s) Op code(901s) * roperand11(141~f Indirect designation ~ * ~·~~~~illllllllle&.. Data l(FF15) 140016 Data 11(1E1s) Jump Address to be executed next 1EFF16 Note: This addressing mode can not appointed end address (XXFF1s) as indirect address. 19 INSTRUCTIONS Zero pege Indirect Addressing mode Addressing mode : Zero page Indirect Absolute Function : Jumps to the zero page address specified by the operand and uses that data and the next byte as the next address. Instructions: JMP, JSR Example : Mnemonic Machine code JMP ($05) 8216 0516 Memory Zero page indirect designation Absolute designation *~ Jump Address to be .~ executed next 1EFF16 ---~ 20 INSTRUCTIONS Special page Addressing mode Addressing mode : Special page Function : Jumps to the special page address specified by the operand as address 2 of the lower 8-bits. Instructions : JSR Example : Mnemonic Machine code JSR _l$FFEO 2216 E016 LThis symbol indicates the Special page mode. Memory Op code(221 s) * ~ Special page ~....................................................~FF0016 Ju~:esig,ation FFE01s~ 21 INSTRUCTIONS Zero page Bit Addressing mode Addressing mode : Zero page Bit Function : Selects the specified bit located at the zero page address specified by the operand. The bit position is appointed by the upper 3-bits of the OP CODE. Instructions : CLB, SEB Example : Mnemonic Machine code CLB 5,$04 BF1s 0416 Memory Bit Zero page designation designation 1 1 1 Op code(BF 1s) J 416 22 INSTRUCTIONS Accumulator Bit Addressing mode Addressing mode : Accumulator Bit Function : Selects a specific bit of the accumulator designated by the upper 3-bits of OP CODE. Instruction: CLB, SEB Example : Mnemonic Machine code CLB 5,A 8816 Accumulator bit 5 Memory Bit designation 1 o 1 1 1 O 1 1 Opcode(BB16) J Accumulator bit 5 23 INSTRUCTIONS Accumulator Bit Relatidve. Ac dressing mode Addressing mode : Accumulator Bit Relative Function :The upper 3-bits of the OP CODE, designate the bit of the accumulator is to be tested. The branch condition is met if the bit is set (BBS) or cleared (BBC). If a branch is valid, the following OPERAND is added to the program counter to generate the next address. Instructions : BBC, BBS Example : Mnemonic Machine code BBC 5,A,*-12 B31s F21s When the bit 5 of accumulator When the bit 5 of accumulator is clear. is set. Accumulator Accumulator bit 5 bit 5 Memory Memory .......... ___ ....."1 Address to be executed next * -12 Bit Bit designation designation _t_ Op code(B316) __t_Op code(B31 s) 1 ;p;;~d~(;2~;r'. · )mp 1 0 111 0 0 1 1 * *+2 1· · · · · ()pe·~ 6~· ·1(f=~·1· ~·)· · · · · Address to be executed next 24 INSTRUCTIONS Zero page Bit Relative Addressing mode Addressing mode : Zero page Bit Relative Function : Appoints the bit at zero page specified by operand I, and jumps to the address where the added value of the program counter and operand II indicates accord- ing to the state of this bit. Instructions : BBC, BBS Example : Mnemonic Machine language BBC 5,$04,*-12 B716 0416 F116 When the bit 5 at address 0416 When the bit 5 at address 0416 is clear, jumps to address *-12. is set, goes to address *+3. Memory Memory Address to be executed next Zero page Zero page ~ designation designation Bit Bit designation designation Op code(B716) Op code(B? 1s) Jump 10110111* 10110111 * --..... operand 1(041s) Operand 1(0416) Operand 11(F11s) Operand ll(F116) Address to be executed next 25 INSTRUCTIONS System of instruction 3.2 System of Instructions The series MELPS 740 has 73 kinds of instructions. The detailed explanation is discussed in Section 3. Note) There are some kind of types that can not use a specific instructions. 3.2.1 Data transfer instructions These instructions transfer the data between registers, register and memory and memories. The followings are data transfer instructions. Instructions Contents' LDA Load memory into accumulator or memory where index X indicates LDM Load immediate value to memory Load LDX Load memory into index X LDY Load memory into index Y STA Store accumulator in memory Store STX Store index X in memory STY Store index Yin memory TAX Transfer accumulator to index X TXA Transfer index X to accumulator TAY Transfer accumulator to index Y Transfer TVA Transfer index Y to accumulator TSX Transfer stack pointer to index X TXS Transfer index X to sack pointer PHA Push accumulator on stack Stack PHP Push processor status on stack Operation PLA Pull accumulator from stack PLP Pull processor status from stack 26 INSTRUCTIONS System of instruction 3.2.2 Operation Instruction The operating instruction includes the operations of addition and subtraction, logic, comparison, and rotation. Multiplication and division instruction can use in the special page addressing mode(and so M37450). The operating instructions are as follows. Instructions Contents ADC Add memory and C flag to accumulator or memory where index X indicates SBC Substruction memory and C flag from accumulator or memory where index X indicates INC Increment memory or accumulator by 1 Addition & DEC Decrement memory or accumulator by 1 Subtraction INX Increment index X by 1 DEX Decrement index X by 1 INY Increment index Y by 1 DEY Decrement index Y by 1 MUL Multiplies accumulator by memory where index X indicates Multiplication DIV Divids word data that constituted memory where index X & indicated to higher byte and memory where in next address Division to lower byte by accumulator AND "AND" memory with accumulator ORA "OR" memory with accumulator Logic EOR "Exclusive-OR" memory with accumulator Operation COM Memory one's complement BIT Test bits in memory with accumulator TST Test memory content (=0) CMP Compare memory and accumulator or memory where Compari- index X indicates son CPX Compare memory and index X CPY Compare memory and index Y ASL Shift left one bit (memory or accumulator) LSR Shift right one bit (memory or accumulator) Shift & ROL Rotate one bit left with carry (memory or accumulator) Rotate ROR Rotate one bit right with carry (memory or accumulator) RRF Rotate four bits right (memory) 27 INSTRUCTIONS System of Instruction 3.2.3 Bit managing Instructions The bit managing instructions clear (0) or set (1) designated bits in accumulator or memory. Instructions Contents Bit CLB Clear (0) designated bit in accumulator or memory Managing SEB Set (1) designated bit in accumulator or memory 3.2.4 Flag setting Instructions The flag setting instructions clear (0) or set (1) C, D, I, T and V flags. Instructions Contents CLC Cleare flag C flag : Carry flag SEC Set C flag CLO Clear D flag D flag : Decimal mode flag SEO Set D flag· Flag Setting cu Clear I flag I flag: Interrupt disable flag SEI Set I flag CLT ClearT flag T flag : Index X mode flag SET Set T flag CLV ClearV flag V flag : Overflow flag 3.2.5 Jump, Branch and Return Instructions The jump, branch and return instructions as following are used to change program flow. Instructions Contents JMP Jump to new location Jump BRA Jump to new location JSR Jump to new location saving return address BBC Branch on designated bit in accumulator or memory clear BBS Branch on designated bit in accumulator or memory set BCC Branch on C flag clear BCS Branch on C flag set BNE Branch on Z flag clear Branch BEQ Branch on Z flag set BPL Branch on N flag clear BMI Branch on N flag set BVC Branch on V flag clear BVS Branch on V flag set RTI Returh from interrupt Return ATS Return from subroutine 28 INSTRUCTIONS System of Instruction 3.2.6 Interrupt Instruction (Break Instruction) This instruction interrupts software Instruction Content Interrupt BRK Force break 3.2.7 Special Instructions Special instructions control operation speed Instructions Content FST High speed operation mode (Note 1) SLW Low speed operation mode (Note 1) Special WIT Wait CPU mode (Note 1) STP Stop CPU mode (Note 2) .. (Note 1) This instruction IS only provided for M50740A-XXXSP/FP, M50740ASP, M50741- XXXSP/FP, M50752-XXXSP, M50757-XXXSP and M50758-XXXSP. (Note 2) This instruction is not provided for M50752-XXXSP, M50757-XXXSP and M50758- XXXSP. 3.2.8 Other Instruction Instruction Content Other NOP No operation 29 INSTRUCTIONS System of Instruction ,3.3 Instructions This section has presented discussion of the series MELPS 740 instructions by arranging mne- monics of instructions alphabetically and dividing each instruction in one page basically. Head of each page is a mnemonic. Operation, explanation and changes of status flags are written for each instruction. In addition, statement format, machine code, byte number, and list of cycle number on each addressing mode are discussed. The followings are symbols used in this manual. S_ymbol Means Symbol Means A Accumulator hh Address upper byte data in AiBit i of accumulator 0-255 PC Program counter II Address lower byte data in PCLLower byte of program 0-255 counter zz Zero page address data in PCH Upper byte of program 0-255 counter nn Data in 0-255 p Processor status register i Data in 0-7 s Stack pointer Contents of the program x Index register X * counter y Index register Y Li Tab or space M Memory # Immediate mode Mi Bit i of memory \ Special page mode c Carry flag $ Hexadecimal symbol z Zero flag + Addition I Interrupt disable flag Subtraction D Decimal operation mode flag x Multiplication B Software interrupt (Break) flag I Division T Index X register mode flag /\ Logical AND v Overflow flag v Logical OR N Negative flag v Logical exclusive OR REL Relative address () Contents of register or flag BAD RS Break address f- Direction of data transfer 30 ADC ADD WITH CARRY ADC Operation : When (T) = 0, (A) f- (A) + (M) + (C) (T) = 1, (M(X)) f- (M(X)) + (M) + (C) Function : When T flag is zero (T=0), this instruction adds the value of Memory, Carry flag, and register A, and stores the results in the register A and C flag. When T flag is 1 (T=1 ), this adds the value of M(X), M and C, and stores the results in the M(X) and C. In this case, no A content is changed except the status flag. M(X), means the content of a memory which is appointed by the index register x. Status flag N : N is when bit 7 is 1 after the operation; otherwise it is 0. V: V is when code bit or bit 7 is changed caused by the operation results that exceed + 127 or 1-1281; otherwise it is 0. T: No change B: No change I: No change D: No change Z : Z is 1 when the operation result is O; otherwise it is 0. C : C is 1 when the result of a binary addition exceeds 255 or when the result of a decimal addition exceeds 99; other- wise it is 0. Addressll!Q_ mode Statement Machine codes Byte number ~le number Immediate L\ADCL\#$nn 6916, nn16 2 2 Zero page L\ADCL\$zz 6516, ZZ16 2 3 Zero page X L\ADCL\$zz,X 7516, ZZ16 2 4 Absolute L\ADCL\$hhll 6016, 1116, hh16 3 4 Absolute X L\ADCL\$hhll,X 7016, 1116, hh16 3 5 Absolute Y L\ADCL\$h hll, Y 7916, 1116, hh16 3 5 (Indirect X) L\ADCL\($zz,X) 6116, ZZ16 2 6 (Indirect Y) L\ADCL\($zz),Y 7116, ZZ16 2 6 (Note 1) Add 3 to cycle number when T flag is 1. (Note 2) When the ADC instruction is used in decimal operation mode the following rule must be applied if a SEC, CLC, SEO or CLO instruc- tions are used immediately afterwards: one dummy instruction (e.g. NOP) must be inserted between the ADC and clear/set carry (or clear/ set decimal mode) instruction. 31 AND LOGICAL AND AND Operation : When (T) = 0, (A) f- (A) A (M) (T) = 1, (M(X)) f- (M(X)) A (M) Function : When T flag is zero, this instruction transfers the content of A and M to the ALU which performs a bit-by-bit AND operation and stores the result back in the A. When T flag is 1, this transfers M(X) and M to the ALU which performs a bit-by-bit AND operation and stores the results back in the M(X). Content of A will not change except status flag. The M(X) means a memory appointed by the X. Status flag N: N is 1 when bit 7 is 1 after the operation; otherwise it is 0. V: No change T: No change B: No change I: No change D: No change z: Z is 1 when the operation result is O; otherwise it is O. C: No change Addressing_mode Statement Machine codes ~tenumber ~le number Immediate MNDA#$nn 2916, nn16 2 2 Zero page AANDA$zz 2516, ZZ16 2 3 Zero page X AANDA$zz,X 3516, ZZ16 2 4 Absolute AANDA$hhll 2016, 1116, hh16 3 4 Absolute X AANDA$hhll,X 3016, 1116, hh16 3 5 Absolute Y MNDA$hhll,Y 3916, 1116, hh16 3 5 (Indirect X) AANDA($zz,X) 2116, ZZ16 2 6 (Indirect Y) MNDA($zz),Y 3116, ZZ16 2 6 (Note) When T flag is 1, add 3 to a cycle time. 32 ASL ARITHMETIC SHIFT LEFT ASL Operation : 0 ~ l. _b_1. . . .l_....___.___.__..____._____._l_bo__,l ~ O Function : This instruction shifts the content of A or M by one bit to the left, with bit O always being set to O and the bit 7 of the A or the M always being contained in the C. Status flag N : N is 1 when the bit 7 is 1 after the execution; otherwise it is 0. V: No change T: No change B: No change I: No change D: No change z: Z is 1 when the result of the operation is O; otherwise it is 0. C : C is 1 when the bit 7 of the A or the M before this opera- tion is 1 ; otherwise it is 0. Address!~ mode Statement Machine codes l!}'!e number CJ'._cle number Accumulator ~ASL.AA OA16 1 2 Zero page ~ASLA$zz 0616, ZZ16 2 5 Zero page X ~ASLA$zz,X 1616, ZZ16 2 6 Absolute ~ASLA$hhll OE16, 1116, hh16 3 6 Absolute X ~ASLA$hhll,X 1E16, 1116, hh16 3 7 33 BBC BRANCH ON BIT CLEAR BBC Operation : When (Mi) = 0, (PC) ~ (PC) + n + REL (Mi) = 1, (PC) ~ (PC) + n n: If addressing mode is Zero page, n=3. And if addressing mode is Accumulator, n=2. Function : This instruction tests the appointed bit i of the M and takes a conditional branch if the bit is 0. If the bit is 1, next instruction is executed. The addressing mode is relative. Status flag : No change Address!~ mode Statement Machine codes B~enumber C_ycle number Accumulator bit ABBCAi,A,$hhll (20•i+ 13)16, rr16 2 4 Relative Zero page bit (20•i+ 17)16, ABBCAi,$zz,$hhll 3 5 Relative ZZ1~rr16 (Note1) rr16=$hhll-(*+n). The m6 is a value in a range of -128 - +127. (Note 2) Add 2 to cycle number for a branch execution. (Note 3) One dummy or other instruction cycle is needed after changing the content of interrupt request bit (bit 1, bit 3, bit 5, bit 7 in address OOFE16 and bit 7 in address OOFF16) to execute this instruction. 34 BBS BRANCH ON BIT SET BBS Operation : When (Mi) = 1, (PC) ~ (PC) + n + REL (Mi) = 0, (PC) ~ (PC) + n n : If addressing mode is zero page, n=3. And if addressing mode is accumulator, n=2. Function: This instruction tests the appointed bit i of the M and takes a conditional branch if the bit is 1. If the bit is 0, next instruction is executed. The addressing mode is relative. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Accumulator bit L1BBSL1i,A,$hhll (20•i+3)1 s, ms 2 4 Relative Zero page bit L1BBSL1i,$zz,$hhll (20•i+7)16, 3 5 Relative ZZ16, rr16 (Note1) ms=$hhll-(*+n). The ms is a value in a range of -128 - +127. (Note 2) Add 2 to cycle number for a branch execution. (Note 3) One dummy or other instruction cycle is needed after changing the content of interrupt request bit (bit 1, bit 3, bit 5, bit 7 in address OOFE1s and bit 7 in address OOFF1s) to execute this instruction. 35 BCC BRANCH ON CARRY CLEAR BCC Operation : When (C) = 0, (PC) ~ (PC) + 2 + REL (C) = 1, (PC) ~ (PC) + 2 Function : This instruction takes a conditional branch to the appointed ad- dress if the C is 0. If the C is 1, the next instruction is exe- cuted. The addressing mode is relative. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Relative ~BCC~$hhll 901s, ms 2 2 (Note 1) ms=$hhll-(*+2). The rr16 is a value in a range of -128 - +127. (Note 2) Add 2 to cycle number for a branch execution. 36 BCS BRANCH ON CARRY SET BCS Operation : When (C) = 1, (PC) f- (PC) + 2 + REL (C) = 0, (PC) f- (PC) + 2 Function : This instruction takes a conditional branch to the appointed ad- dress if the C is 1. If the C is 0, the address goes to the next address. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Relative .1.BCS.1.$hhll 8016, rr16 2 2 (Note 1) m 6=$hhll-(*+2). The ms is a value in a range of -128 - + 127 (Note 2) Add 2 to a cycle time for a branch execution. 37 BEQ BRANCH ON EQUAL BEQ Operation : When (Z) = 1, (PC) f- (PC) + 2 + REL (Z) = 0, (PC) f- (PC) + 2 Function : This instruction takes a conditional branch to the appointed ad- dress when the Z is 1. If the Z is 0, the next instruction is exe- cuted. The addressing mode is relative. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Relative ~BEQ~$hhll F01s,ms 2 2 (Note 1) m s=$hhll-(*+2). The ms is a value in a range of -128 - +127. (Note 2) Add 2 to cycle number for a branch execution. 38 BIT TEST BIT IN MEMORY WITH ACCUMULATOR BIT Operation : (A) " (M) Function : This instruction takes a logical AND of every bit of the A and M contents; however, no result is stored anywhere. The con- tents of the N, V and the Z flags will be changed but no change for the A and M contents. Status Oag N : N is 1 when bit 7 of M is 1 ; otherwise it is 0. V : V is 1 when bit 6 of M is 1; otherwise it is 0. T: No change B: No change I: No change D: No change Z : Z is 1 when the result of the logical AND is O; otherwise Z is o. C: No change Addressing mode Statement Machine codes Byte number Cycle number Zero page ~BIT~$zz 2416, ZZ16 2 3 Absolute ~BIT~$hhll 2C16, 1116, hh1s 3 4 39 BMI BRANCH ON RESULT MINUS BMI Operation : When (N) = 1, (PC) ~ (PC) + 2 + REL (N) = 0, (PC) ~ (PC) + 2 Function : This instruction takes a conditional branch to the appointed ad- dress when the N is 1. If the N is 0, the next instruction is executed. The addressing mode is relative. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Relative ~BMl~$hhll 3016, rr16 2 2 (Note 1) ms=$hhll-(*+2). The ms is a value in a range of -128 - + 127. (Note 2) Add 2 to cycle time for a branch execution. 40 BNE BRANCH ON NOT EQUAL BNE Operation : When (Z) = 0, (PC) +-- (PC) + 2 + REL (Z) = 1, (PC) +-- (PC) + 2 Function : This instruction takes a conditional branch to the appointed ad- dress if the Z is 0. If the Z is 1, the next instruction is exe- cuted. The addressing mode is relative. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Relative l1BNE!1$hhll 0016, rr16 2 2 (Note 1) ms=$hhll-(*+2). The ms is a value in a range of -128 - + 127. (Note 2) Add 2 to cycle number for a branch execution. 41 BPL BRANCH ON RESULT PLUS BPL Operation : When (N) = 0, (PC) ~ (PC) + 2 + REL (N) = 1, (PC) ~ (PC) + 2 Function : This instruction takes a conditional branch to the appointed ad- dress if the N is 0. If the N is 1, the next instruction is exe- cuted. The addressing mode is relative. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Relative ~BPLA$hhll 1016, ms 2 2 (Note 1) ms=$hhll-(*+2). The rr16 is a value in a range of -128 - +127. (Note 2) Add 2 to cycle number for a branch execution. 42 BRA BRANCH ALWAYS BRA Operation : (PC) ~ (PC) + 2 + REL Function : This instruction jumps to the appointed address. The objective address is expressed in relative addressing mode. Status flag : No change Addressln mode Statement Machine codes B te number c cle number Relative LiBRM$hhll 8016, rr16 2 4 (Note) ms=$hhll-(*+2). The ms is a value in a range of -128 ~ + 127. 43 BRK FORCE BREAK BRK Operation : (8) ~ 1 (PC) ~ (PC) + 2 (M(S)) ~ (PCH) (S) ~ (S) - 1 (M(S)) ~ (PCL) (S) ~ (S) - 1 (M(S)) ~ (PS) (S) ~ (S) - 1 (I) ~ 1 (PC) ~ BAD RS (Note 1) Function : When the BAK instruction is executed, the CPU pushes the current PC contents onto the stack and stores the break ad- dress data (BADRS) . The break address data is stored in the interrupt vector table into the PC. Status flag N : No change V: No change T: No change B: 1 I: No change D: 1 Z: No change C: No change Addressing mode Statement Machine codes Byte number C cle number Implied tiBRK.'1 0016 1 7 (Note 1) "BADRS" means a break address. (Note 2) Addresses vary for different microcomputers. (Note 3) The value of the PC pushed onto the stack by the execution of the BRK instruction is the BRK instruction address plus two. Therefore, the byte following the BRK will not be executed when the value of the PC is returned from the BRK routine. (Note 4) In some microcomputers, the BRK instruction uses the same vector address as INT2. 44 BVC BRANCH ON OVERFLOW CLEAR BVC Operation : When (V) = 0, (PC) f- (PC) + 2 + REL (V) = 1, (PC) f- (PC) + 2 Function : This instruction takes a branch to the appointed address if the V is 0. The addressing mode of the objective address is rela- tive. If the V is 1, the address goes to the next address. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Relative ~BVC~ hhll 501s, ms 2 2 (Note 1) ms=$hhll-(*+2). The ms is a value in a range of -128 - +127. (Note 2) Add 2 to cycle number for a branch execution. 45 BVS BRANCH ON OVERFLOW SET BVS Operation : When (V) = 1, (PC) +-- (PC) + 2 + REL (V) = 0, (PC) +-- (PC) + 2 Function: This instruction takes a branch to the appointed address if the V is 1. The addressing mode of the objective address is rela- tive. If the V is O, the PC goes to the next address. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Relative L\BVSL\$hhll 7016, rr16 2 2 (Note 1) ms=$hhll-(*+2). The ms is a value in a range of -128 - + 127. (Note 2) Add 2 to cycle number for a branch execution. 46 CLB CLEAR BIT CLB Operation : (Ai) ~ 0, or (Mi) ~ 0 Function : This instruction resets the appointed bit i of the A or the M to 0. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Accumulator bit ACLBAi,A (20·i+ 18)16 1 2 Relative Zero page bit (20·i+1 F)1s, ACLBAi,$zz 2 5 Relative ZZ1s 47 CLC CLEAR CARRY FLAG CLC Operation : (C) +-- O Function: This instruction resets the C to 0. Status flag N : No change V: No change T: No change B: No change I: No change D: No change Z: No change C:O Addressing mode Statement Machine codes Byte number Cycle number Implied £\CLC 1816 1 2 48 CLD CLEAR DECIMAL MODE CLD Operation: (D) ~ 0 Function: This instruction resets the D to 0. Status nag N: No change V: No change T: No change B: No change I: O D: No change Z: No change C: No change Addressln mode Statement Machine codes B te number C cle number Implied ~CLO 0816 1 2 49 CLI CLEAR INTERRUPT DISABLE STATUS CLI Operation: (I) ~ O Function : This instruction resets the I to 0. Status flag N : No change V: No change T: No change B: No change I: No change D:O Z: No change C: No change Addressing mode Statement Machine codes Byte number Cycle number lmpliE!d_ ~cu 5816 1 2 50 CLT CLEAR TRANSFER FLAG CLT Operation: (T) ~ 0 Function: This instruction resets the T to 0. Status flag N: No change V: No change T: 0 B: No change I: No change D: No change Z: No change C: No change Addressing mode Statement Machine codes Byte number Cycle number Implied ~CLT 1216 1 2 51 CLV CLEAR OVERFLOW FLAG CLV Operation: (V) f- O Function: This instruction resets the V to 0. Status flag N: No change V:O T: No change B: No change I: No change D: No change Z: No change C: No change Addressln mode Statement Machine codes B te number C cle number Implied ~CLV 8816 1 2 52 CMP COMPARE CMP Operation : When (T) = 0, (A) - (M) (T) = 1, (M(X)) - (M) Function : This instruction subtracts the content of M from the A contents if the T is O. No result is stored in anywhere and none of the content of A, B or V is changed at this moment. If the T is 1, the CMP subtracts the M contents from the M(X) contents. No result is stored anywhere and the V will not be changed. The M(X) means the contents of the memory where the X indicates. Status flag N : N is 1 when the bit 7 is 1 after the subtraction; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z : Z is 1 when the subtraction result is O; otherwise Z is 0. C : C is 1 when the subtraction result is equal to or greater than O; otherwise C is 0. Addressing mode Statement Machine codes Byte number Cycle number Immediate ~CMP~#$nn C916, nrn6 2 2 Zero page ~CMP~$zz C516, ZZ16 2 3 Zero page X ~CMP~$zz,X 0516, ZZ16 2 4 Absolute ~CMP~$hhll CD16, 1116, hh16 3 4 Absolute X ~CMP~$hhll,X 0016, 1116, hh16 3 5 Absolute Y ~CMP~$hhll,Y 0916, 1116, hh16 3 5 (Indirect X) ~CMP~($zz,X) C116, ZZ16 2 6 (Indirect Y) ~CMP~($zz),Y 0116, ZZ16 2 6 53 COM COMPLEMENT COM Operation : (M) +-- (M) Function: This instruction takes one's complement of the M contents and stores the result in M. Status flag N : N is 1 when the bit 7 of the M is 1 after the implement; otherwise N is O. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the execution result is O; otherwise Z is 0. C: No change Addressln mode Statement Machine codes B te number C cle number Zero page ~COM~$zz 4416, ZZ16 2 5 54 CPX COMPARE MEMORY AND INDEX REGISTER X CPX Operation : (X) - (M) Function : This instruction subtracts the content of M from the X contents; however, no result is stored anywhere and none of X, M or V content is changed at this moment. Status flag N : N is 1 when the 7 bit after the subtraction; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the subtracted result is O; otherwise Z is 0. C : C is 1 when the subtracted result is equal to or greater than O; otherwise C is O. Addressing mode Statement Machine codes Byte number Cycle number Immediate dCPXd#$nn E01s, nn16 2 2 Zero page dCPXd$zz E416, ZZ16 2 3 Absolute dCPXd$hhll EC16, 1116, hh16 3 4 55 CPY · COMPARE MEMORY AND INDEX REGISTER V CPY Operation : (Y) - (M) Function : This instruction subtracts the content of the M from the Y contents; however, no result is stored anywhere and none of the content of Y, M or V is changed in this instruction. Status flag N : N is 1 when the bit 7 is 1 after the subtraction; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z : Z is 1 when the subtracted result is O; otherwise Z is O. C : C is 1 when the subtracted result is equal to or greater than O; otherwise C is 0. Addressln;mode Statement Machine codes Byte number C_}'!:le number Immediate ACPYA#$nn C01s, nn1s 2 2 Zero page ACPYA$zz C416, ZZ16 2 3 Absolute ACPYA$hhll CC1~ll1Eh_hh1s 3 4 56 DEC DECREMENT BY ONE DEC Operation : (A) ~ (A) - 1, or (M) ~ (M) - 1 Function : This instruction subtracts 1 from the A or the M contents; however, neither of V or C is changed. Status flag N : N is 1 when the bit 7 is 1 after the addition; otherwise N is O. V: No change T: No change B: No change I: No change D: No change z: z is 1 when the added result is O; otherwise Z is O. C: No change Addressll}[ mode Statement Machine codes Byte number Cycle number Accumulator t\DECL\A 1A16 1 2 Zero page t\DECL\$zz C616, ZZ16 2 5 Zero page X t\DECL\$zz,X 0616, ZZ16 2 6 Absolute t\DECL\$hhll CE16, 1116, hh16 3 6 Absolute X t\DECL\$hhll ,X DE16, 1116, hh16 3 7 57 DEX DECREMENT INDEX REGISTER X BY ONE DEX Operation : (X) t- (X) - 1 Function : This instruction subtracts one from the current value of the X and stores the result in the X. Status flag N : N is 1 when the bit 7 after the addition is 1 ; otherwise N is O. V: No change T: No change B: No change I: No change D: No change Z : Z is 1 when the added result is O; otherwise Z is 0. C: No change Addressln mode Statement Machine codes B e number C cle number Implied ~DEX CA1s 1 2 58 DEY DECREMENT INDEX REGISTER Y BY ONE DEY Operation : (Y) ~ (Y) - 1 Function : This instruction subtracts one from the current value in the Y and stores the result into the Y; however, neither of the V or C content is changed at this moment. Status flag N: N is 1 when the bit 7 is 1 after the subtraction; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the subtracted result is O; otherwise Z is O. C: No change Addressing mode Statement Machine codes Byte number Cycle number Implied ~DEY 8816 1 2 59 DIV DIVIDE MEMORY BY ACCUMULATOR DIV Operation : (A) ~ (M(zz+X+ 1),M(zz+X)) I (A) M(S) ~ one's complement of Remainder (S) ~ (S) - 1 Function: Divides the 16-bit data in M(zz+X) (lower byte) and M(zz+X+1) (higher byte) by the accumulator contents. The quotient is stored in the accumulator and the one's complement of the remainder is pushed onto the stack. / ~ dividend lower M(zz+X) -;- I (A) ldivisior dividend upper M(zz+X+1) II (A) Iquotient Zero page one's complement M(S) of Remainder '-JI/ Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Zero page X D.DIVD.$zz,X E216,ZZ16 2 16 (Note 1) This instruction can not .detect overflow due to a divide by zero. Please check for a non-zero divisor in software. (Note 2) This instruction changes the stack pointer and the contents of the accumulator. (Note 3) This instruction is not available on the entire MELPS 740 series. 60 EOR EXCLUSIVE OR MEMORY WITH ACCUMULATOR EOR Operation : When (T) = 0, (A) f- (A) 'r/ (M) (T) = 1, (M(X)) f- (M(X)) 'rl (M) Function : This instruction transfers the contents of the M and the A to the ALU which performs an exclusive OR bit-by-bit, and stores the result into the A when the T is 0. When the T is 1, it transfers the contents of the M(X) and the M in the same way us above. The content of A will not be changed except the status flag contents. The M(X) means a memory content of the address appointed by X. Status flag N : N is 1 when the bit 7 is 1 after the operation; otherwise N is O. V: No change T: No change B: No change I: No change D: No change Z : Z is 1 when the operation result is O; otherwise Z is 0. C: No change Addressing mode Statement Machine codes Byte number Cycle number Immediate dEORLl#$nn 4916, nn16 2 2 Zero page LlEORLl$zz 4516, ZZ16 2 3 Zero page X LlEORLl$zz,X 5516, ZZ16 2 4 Absolute AEORA$hhll 4016, 1116, hh16 3 4 Absolute X AEORA$hhll,X 5016, 1116, hh16 3 5 Absolute Y AEORA$hhll,Y 5916, 1116, hh16 3 5 (Indirect X) AEORA($zz,X) 4116, ZZ16 2 6 (Indirect Y) AEORA($zz),Y 5116, ZZ16 2 6 (Note) Add 3 to cycle number when T is 1. 61 FST FAST FST Operation : Connects oscillator output to XoUTF. Interrupt Request Interrupt Disable Flag I STP R Reset Instruction TimerX IN XOUTS XOUTF Internal Clock " es et STP Instruction In case M50740A-XXXSP/FP, M50740ASP, or M50741-XXXSP/FP 1----- To Timer 1----- Internal Clock" XOUTF In case M50752-XXX P, M50757-XXX P, or M50758-XXX P Function: When CR clock generating circuit is formed, external resistance value became small. Therefore clock oscillating frequency· be- come high. Resistance value = RS • RF RS+RF Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Implied ~FST E21s 1 2 (Note 1) This instruction is not for any other models than M50740A-XXXSP/FP, M50740ASP, M50741-XXXSP/FP, M50752-XXXSP, M50757-XXXSP and M50758-XXXSP. (Note 2) The SWOSC closes at reset. 62 INC INCREMENT BY ONE INC Operation : (A) ~ (A) + 1, or (M) ~ (M) + 1 Function : This instruction adds one to the A or the M contents. Status Dag N : N is 1 when the bit 7 is 1 after the addition; otherwise N is o. V: No change T: No change B: No change I: No change D: No change Z : Z is 1 when the added result is O; otherwise Z is 0. C: No change Addressing mode Statement Machine codes Byte number Cycle number Accumulator dlNCM 3A1s 1 2 Zero page dlNCd$zz E616, ZZ16 2 5 Zero page X dlNCd$zz,X F616, ZZ16 2 6 Absolute dlNCd$hhll EE1s, 1116, hh1s 3 6 Absolute X dlNCd$hhll,X FE1s, 1116, hh1s 3 7 63 INX INCREMENT INDEX REGISTER X BY ONE INX Operation : (X) f- (X) + 1 Function : This instruction adds one to X contents. Status flag N : N is 1 when the bit 7 is 1 after the addition; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the added result is O; otherwise Z is 0. C: No change Addressing mode Statement Machine codes Byte number Cycle number Implied LilNX E81s 1 2 64 INY INCREMENT INDEX REGISTER Y BY ONE Operation : (Y) ~ (Y) + 1 Function : This instruction adds one to the Y contents. Status flag N: N is 1 when bit 7 is 1 after the addition; otherwise N is o. V: No change T: No change B: No change I: No change D: No change Z : Z is 1 when the added result is O; otherwise Z is O. C: No change Addressln mode Statement Machine codes B e number c cle number Implied .11NY C81s 1 2 65 JMP JUMP JMP Operation : When addressing mode is (a) Absolute, then (PC) f- hhll (b) Indirect Absolute, then (PCL) f- (hhll) (PCH) f- (hhll+ 1) (c) Zero page Indirect Absolute, then (PCL) f- (zz) (PCH) f- (zz+ 1) Function: This instruction jumps to the address appointed by the follow- ing three addressing modes; the absolute addressing mode, Indirect absolute addressing mode or the zero page Indirect absolute addressing mode. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Absolute ~JMP~$hhll 4C1s,ll1s,hh1s 3 3 Indirect ~JMP~($hhll) 6C1s,ll1s,hh1s 3 5 Zero page Indirect ~JMP~($zz) B216,ZZ16 2 4 66 JSR JUMP TO SUBROUTINE JSR Operation : (M(S)) +- (PCH) (S) +- (S) - 1 After the above operations, if the addressing mode is (a) Absolute, then (PC) +- hhll (b) Special page, then (PCL) +- II (PCH) +- FF16 (c) Zero page Indirect, then (PCL) +- (zz) (PCH) +- (zz+ 1) Function : This instruction jumps to the address appointed by the Abso- lute's, Special page's or Zero page lndirect's addressing mode after saving the PC contents into the stack. Status flag : No change Addressl~mode Statement Machine codes BJ'!e number C..rcle number Absolute AJSRA$hhll 2016, 1116, hh16 3 6 Special page AJSRA\$hhll (Note) 2216, 1116 2 5 Zero page Indirect AJSRA($zz) 0216, ZZ16 2 7 (Note) "\" denote special page(At DC16 of the ASCII code). hh16 must be FF16 in the special page addressing mode. However, hh16 must be 1 F16 at the M50740A-XXXSP/FP, M50741-XXXSP/FP, M50740ASP, M50752- XXXSP, M50757-XXXSP and M50758-XXXSP in the special page addressing mode. 67 LDA LOAD ACCUMULATOR WITH MEMORY LDA Operation : When (T) = 0, (A) ~ (M) (T) = 1, (M(X)) ~ (M) Function : This instruction transfers the content of M to the A when the T is 0. It transfers the M content to the (M(X)) when the T is 1. The content of A is not changed at the time except the status flag. The M(X) is the memory content of the address where the X appointed. Status flag N : N is 1 when the bit 7 is 1 after the execution; otherwise N is O. V: No change T: No change B : ·No change I: No change D: No change Z: Z is 1 when the execution result is O; otherwise Z is O. C: No change Addressll}g_ mode Statement Machine codes B~enumber C_ycle number Immediate ALDM#$nn A916, nn16 2 2 Zero page ALDM$zz A516, nn16 2 3 Zero page X ALDAA$zz,X 8516, nn16 2 4 Absolute ALDAA$hhll AD16, 1116, hh16 3 4 Absolute X ALDM$hhll,X 8016, 1116, hh16 3 5 Absolute Y ALDAA$hhll,Y 8916, 1116, hh16 3 5 (Indirect X) ALDAA($zz,X) Al16, ZZ16 2 6 (Indirect Y) ALDM($zz),Y 8116, ZZ16 2 6 (Note) Add 2 to cycle number when T is 1. 68 LDM LOAD IMMEDIATE DATA TO MEMORY LDM Operation : (M) +--- nn Function: This instruction loads the immediate value into the M. Status flag : No change Addressln mode Statement Machine codes Byte number Cycle number Zero page L\LDML\#$nn,$zz 3C1s, nms, zz1s 3 4 69 LDX LOAD INDEX REGISTER X FROM MEMORY LDX Operation : (X) ~ (M) Function : This instruction loads the M content into the X. Status flag N: N is 1 when the bit 7 is 1 after the execution; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the execution result is O; otherwise Z is O. C: No change Addressing mode Statement Machine codes Byte number Cycle number Immediate ALD~#$nn A21s, nn1s 2 2 Zero page ALD~$zz A616, ZZ16 2 3 Zero page Y ALD~$zz,Y 8616, ZZ16 2 4 Absolute .6.LD~$hhll AE1s, lhs, hh1s 3 4 Absolute Y .6.LDX.6.$hhll,Y BE1s, lhs, hh1s 3 5 70 LDY LOAD INDEX REGISTER Y FROM MEMORY LDY Operation : (Y) ~ (M) Function : This instruction loads the M content into the Y. Status flag N: N is 1 when the bit 7 is 1 after the execution; otherwise N is o. V: No change T: No change e: No change I: No change D: No change Z : Z is 1 when the execution result is O; otherwise Z is O. C: No change Address111g mode Statement Machine codes Byte number Cycle number Immediate ALDYA#$nn A016, nn16 2 2 Zero page ALDYA$zz A416, zz16 2 3 Zero page X ALDYA$zz,X 8416, ZZ16 2 4 Absolute ALDYA$hhll AC16, 1116, hh16 3 4 Absolute X ALDYA$hhll,X BC16, 1116, hh16 3 5 71 LSR LOGICAL SHIFT RIGHT LSR Operation : 0 l ~ l._b_7. . ._...___..___..__..__~__._I_bo__.I ~ [£] Function : This instruction shifts either the A or the M location one bit to the right with the bit 7 of the result always being set to O, and the bit O being stored in the C. Status flag N : O V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the execution result is O; otherwise Z is 0. C : C is 1 when the bit 0 of either the A or the M before the execution is 1; otherwise C is O. Addressing mode Statement Machine codes ~te number Cycle number Accumulator LlLSRM 4A1s 1 2 Zero page ilLSRil$zz 4616, ZZ16 2 5 Zero page X ilLSRtl$zz,X 5616, ZZ16 2 6 Absolute LlLSRLl$hhll 4E1s, 1116, hh16 3 6 Absolute X LlLSRLl$hhll,X SE1s, 1116, hh1s 3 7 72 MUL MULTIPLY ACCUMULATOR AND MEMORY MUL Operation : M(S) • (A) f- (A) x M(zz+X) (S) t - (S) - 1 Function : Multiplies accumulator with the memory specified by the zero page X addressing mode and stores the high byte of the result on the stack and the low byte in the accumulator. / ~ multiplicant M(zz+X) X l (A) lmultiplier II -----=,i Zero page product M(S) upper I (A) lower J '-J / Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Zero page X ~MULA$zz,X 6216, ZZ16 2 15 (Note 1) Be careful instruction of accumulator and stack pointer changes when this instruction execute. (Note 2) This instruction can use in special kind (and so M37450). 73 NOP NO OPERATION NOP Operation : (PC) f- (PC) + 1 Function: This instruction adds one to the program counter but does no other operation. Status flag : No change Addressln mode Statement Machine codes B number C cle number Implied ~NOP EArn 1 2 74 ORA OR MEMORY WITH ACCUMULATOR ORA Operation : When (T) = 0, (A) t- (A) v (M) (T) = 1, (M(X)) t- (M(X)) v (M) Function : This instruction transfers the A and the M contents to the ALU which performs an "OR" bit-by-bit, and stores the result in the A if flag T is 0. If the T is 1, it operates the M(X) and the M in the same way of above. The content of A is not changed at the time except the status flag. The M(X) means the memory content of the address where the X appoints. Status flag N : N is when the bit 7 is 1 after the operation; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z : Z is 1 when the execution result is O; otherwise Z is 0. C: No change Address!~ mode Statement Machine codes B~number ~clenumber Immediate L\ORM#$nn 0916, nn16 2 2 Zero page L\ORM$zz 0516, ZZ16 2 3 Zero page X L\ORM$zz,X 1516, ZZ16 2 4 Absolute L\ORM$hhll 0016, 1116, hh16 3 4 Absolute X L\ORM$hhll,X 1016, 1116, hh1s 3 5 Absolute Y L\ORM$hhll,Y 1916, 1116, hh16 3 5 (Indirect X) L\ORM($zz,X) 0116, ZZ16 2 6 (Indirect Y) L\ORM($zz),Y 1116, ZZ16 2 6 (Note) Add 3 to cycle number when T is 1. 75 PHA PUSH ACCUMULATOR ON STACK Operation: (M(S)) ~ (A) (S) ~ (S) - 1 Function : This instruction pushes the content of A to the address the stack pointer appoints, and decrements the stack pointer con- tents by one. Status nag : No change Addressing mode Statement Machine codes Byte number Cycle number Implied APHA 4816 1 3 76 PHP PUSH PROCESSOR STATUS ON STACK PHP Operation : (M(S)) t- (P) (S) t- (S) - 1 Function : This instruction pushes the contents of the processor status register to the memory of the address where the stack pointer appoints and decrements the stack pointer contents by one. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Im lied .1PHP 0816 1 3 77 PLA PULL ACCUMULATOR FROM STACK PLA Operation : (S) +-- (S) + 1 (A) +-- (M(S)) Function : This instruction adds one to the stack pointer and loads the memory content of the address where the stack pointer ap- points into the A. • Status flag N : N is 1 when the bit 7 after the execution is 1; otherwise N is O. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the execution result is O; otherwise Z is O. C: No change Addressing mode Statement Machine codes Byte number Cycle number Implied ~PLA 6816 1 4 78 PLP PULL PROCESSOR STATUS FROM STACK PLP Operation : (S) ~ (S) + 1 (P) ~ (M(S)) Function : This instruction adds one to the stack pointer and loads the memory content of the address where the stack pointer ap- points into the processor status register. Status flag : Value returns to the original one that was pushed in the stack. Addressing mode Statement Machine codes Byte number Cycle number Implied D.PLP 2816 1 4 79 ROL ROTATE ONE BIT LEFT ROL Operation: I bOk[i]J Function : This instruction shifts either the A or the M one bit left combin- ing with the C. The C content is stored in the bit O and the bit 7 is stored in the C. Status flag N : N is 1 when the bit 6 is 1 before the execution; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the execution result is O; otherwise Z is O. C: C is 1 when bit 7 is 1 befor execution; otherwise C is 0. Addressing mode Statement Machine codes Byte number Cycle number Accumulator ~ROUA 2A16 1 2 Zero page ~ROU$zz 2616, ZZ16 2 5 Zero page X ~ROU$zz,X 3616, ZZ16 2 6 Absolute ~ROU$hhll 2E16, 1116, hh16 3 6 Absolute X ~ROU$hhll,X 3E16, 1116, hh16 3 7 80 ROR ROTATE ONE BIT RIGHT ROR Operation: ~ ~~lb71 Function : This instruction shifts either the A or the M one bit right combining with the C. The C content is stored in the bit 7 and the bit O content is stored in the C. Status flag N : N is 1 when the C content before the execution is 1 ; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the execution result is O; otherwise Z is 0. C: C is 1 when bit O is 1 before execution; otherwise C is 0. Addressing mode Statement Machine codes Byte number Cycle number Accumulator ARO RM 6A1s 1 2 Zero page ARORA$zz 6616, ZZ16 2 5 Zero page X ARORA$zz,X 7616, ZZ16 2 6 Absolute ARORA$hhll 6E1s, ll1s, hh1a 3 6 Absolute X ARORA$hhll,X 7E16, 1116, hh16 3 7 81 RRF ROTATE RIGHT OF FOUR BITS RRF Operation: bO I Function : This instruction rotates 4 bits of the M content to the right (It may be called "swap nibbles"). Status flag : No change Addressln mode Statement Machine codes B te number C cle number Zero page ~RRF~$zz 8216, ZZ16 2 8 82 RTI RETURN FROM INTERRUPT RTI Operation : (S) f- (S) + 1 (P) f- (M(S)) (S) f- (S) + 1 (PCL) f- (M(S)) (S) f- (S) + 1 (PCH) f- (M(S)) Function : This instruction reload the status flag and the PC content that have been pushed to the stack when they are interrupted and sets them back to their pre-interrupt state. The M(S) means the memory content of the address where the stack pointer ap- points. Status flag : Value returns to the original one that was pushed in the stack. Addressing mode Statement Machine codes Byte number Cycle number Implied ~RTI 4016 1 6 83 RTS RETURN FROM SUBROUTINE RTS Operation : (S) f- (S) + 1 (PCL) t- (M(S)) (S) t- (S) + 1 (PCH) t- (M(S)) (PC) t- (PC) + 1 Function : This instruction reloads the content of the PC which has been pushed to the stack when the subroutine is called and incre- ments the PC by one. The PC points the next instruction at this time. The M(S) means the memory content of the address where the stack pointer appoints. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Implied L'iRTS 6016 1 6 84 SBC SUBTRACT WITH CARRY SBC Operation : When (T) = 0, (A) ~ (A) - (M) - (C) (T) = 1, (M(X)) ~ (M(X)) - (M) - (C) Function : This instruction subtracts the value of the M and the comple- ment of C flag from the value of the A, and stores the results into the A and the C if the T is O. If the T is 1, the instruction subtracts the value of the M(X) and the complement of C from the value of the M(X), and stores the results into the M(X) and the C. The content of A is not changed except the status flag. The M(X) is the memory content of the address where the X appoints. Status flag N : N is when the bit 7 is 1 after the execution; otherwise N is o V : V is 1 when the operation result exceeds +127 or -128; otherwise V is 0. T: No change B: No change I: No change D: No change Z : Z is 1 when the operation result is O; otherwise Z is O. C : C is 1 when the operation result is equal to O or greater than O; otherwise C is O and shows the borrow is gener- ated. Addressing_ mode Statement Machine codes ~enumber C_ycle number Immediate L\SBCL\#$nn E91s, nn16 2 2 Zero page L\SBCL\$zz E516, ZZ16 2 3 Zero page X L\SBCL\$zz,X F516, ZZ16 2 4 Absolute L\SBCL\$hhll ED1s, 1116, hh1s 3 4 Absolute X L\SBCL\$hhll,X FD1s, 1116, hh1s 3 5 Absolute Y L\SBCL\$hhll,Y F91s, 1116, hh1s 3 5 (Indirect X) L\SBCL\($zz,X) E116, ZZ16 2 6 (Indirect Y) L\SBCL\($zz), Y F116, ZZ16 2 6 (Note 1) Add 3 to cycle number when T is 1. (Note 2) When the SBC instruction is used in decimal operation mode the following rule must be applied if a SEC, CLC, SED or GLD instruc- tions are used immediately afterwards: one dummy instruction (e.g. NOP) must be inserted between the ADC and clear/set carry (or clear/set decimal mode) instruction. 85 SEB SET BIT SEB Operation : (Ai) ~ 1, or (Mi) ~ 1 Function : This instruction sets the appointed bit i of the A or the M to 1. Status Oag : No change Address!~ mode Statement Machine codes B_I_te number ~cle number Accumulator bit ASEBAi,A (20•i+B)1s 1 2 Zero page bit ASEBAi,$zz (20•i+F)16, ZZ16 2 5 86 SEC SET CARRY FLAG SEC Operation: (C) t- 1 Function : This instruction sets the C to 1. Status flag N : No change V: No change T: No change B: No change I: No change D: No change Z: No change c: 1 Statement Machine code B te number C cle number !1SEC 3816 1 2 87 SED SET DECIMAL MODE SED Operation: (D) ~ 1 Function: This instruction set the D to 1. Status flag N: No change V: No change T: No change B: No change I: No change D: 1 Z: No change C: No change Addressln mode Statement Machine codes B te number C cle number Implied L\SED F816 1 2 88 SEI SET INTERRUPT DISABLE FLAG SEI Operation : (I) +-- 1 Function : This instruction sets the I to 1. Status flag N : No change V: No change T: No change B: No change I: 1 D: No change Z: No change C: No change Addressln mode Statement Machine codes B te number C cle number Implied ~SEI 7816 1 2 89 SET SET TRANSFER FLAG SET Operation: (T) f- 1 Function : This instruction sets the T to 1. Status flag N : No change V: No change T: 1 B: No change I: No change D: No change z: No change C: No change Statement Machine codes cle number L\SET 3216 2 90 SLW SLOW SLW Operation : Releases the connection between the oscillator output and pin XOUTF pin. Interrupt Request Interrupt Disable Flag I STP R Reset Instruction TimerX XIN XOUTS tw= XOUTF Internal Clock o Rs Reset STP Instruction In case M50740A-XXXSP/FP, M50740ASP, or M50741-XXXSP/FP 1----- To Timer 1 - - - - Internal Clock o In case M50752-XXXSP, M50757-XXXSP, or M50758-XXXSP Function : When CR clock generating circuit is formed, executing the SLW instruction is lowered the oscillation than FST instruction exe- cuting, because of the external resistance value is only Rs. Status flag : No change Addressing mode Statement Machine number Byte number Cycle number Implied ~SLW C216 1 2 (Note 1) This instruction is not for any other models than M50740A-XXXSP/FP, M507 40ASP, M507 41-XXXSP/FP, M50752-XXXSP, M50757-XXXSP and M50758-XXXSP. (Note 2) The SWosc closes at reset. 91 STA STORE ACCUMULATOR IN MEMORY STA Operation : (M) ~ (A) Function : This instruction stores the A content into the M. The contents of A is not changed at the time. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Zero page ASTM$zz 8516, ZZ16 2 4 Zero page X ASTAA$zz,X 9516, ZZ16 2 5 Absolute ASTAA$hhll 8016, 1116, hh16 3 5 Absolute X ASTM$hhll,X 9016, 1116, hh16 3 6 Absolute Y ASTAA$hhll,Y 9916, 1116, hh16 3 6 (Indirect X ) ASTM($zz,X) 8116, ZZ16 2 7 (Indirect Y) ASTM($zz),Y 9116, ZZ16 2 7 92 STP STOP STP Operation: CPU +-- Stand-by state (Oscillation stopped) Interrupt Request Tlmlna 11 Interrupt (Internal CTock) Disenable Flag I Reset WIT Instruction Reset STP Instruction Function : This instruction resets the oscillation control F/F and the oscil- lation stops. To wake up from this mode, reset or interrupt input is needed. CPU starts its function after the timer X over flows (comes to the terminal count). All registers or internal memory contents except Timer X will not change during this mode. (Of course needs Voo). atus flag : No change Addressing mode Statement Machine codes Byte number Cycle number Implied ~STP 4216 1 2 (Note 1) This instruction is not provided for M50752-XXXSP, M50757-XXXSP, and M50758-XXXSP. (Note 2) This circuit diagram a little differ by any other models. For more detail, see the "MITSUBISHI SEMICONDUCTORS SINGLE-CHIP MICROCOMPUTERS DATA BOOK". 93 STX STORE INDEX REGISTER X IN MEMORY STX Operation: (M) f- (X) Function: This instruction stores the X content into the M; X is not changed. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Zero page ~ST~$zz 8616, ZZ16 2 4 Zero page Y ~ST~$zz,Y 9616, ZZ16 2 5 Absolute ~STX~$hhll 8E16, 1116, hh16 3 5 94 STY STORE INDEX REGISTER V IN MEMORY STY Operation: (M) f- (Y) Function: This instruction stores the Y content into the M; Y is not changed. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Zero page LlSTYLl$zz 8416, ZZ16 2 4 Zero page X LlSTYLl$zz,X 9416, ZZ16 2 5 Absolute LlSTYLl$hhll BC16, 1116, hh16 3 5 95 TAX TRANSFER ACCUMULATOR TO INDEX REGISTER X TAX Operation : (X) ~ (A) Function : This instruction transfers the A content to the X; The contents of A are not changed. Status flag N : N is 1 when the bit 7 is 1 after the transfer; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z : Z is 1 when the result after the transfer is O; otherwise Z is O. C: No change Addressln mode Statement Machine codes B e number C cle number Implied L\TAX AA1s 1 2 96 TAY TRANSFER ACCUMULATOR TO INDEX REGISTER Y TAY Operation : (Y) f- (A) Function : This instruction transfers the A content to the Y; The content of A are not changed. Status flag N : N is 1 when the bit 7 is 1 after the transfer; otherwise N is O. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the result of the transfer is O; otherwise Z is 0. C: No change Statement Machine codes B te number C cle number A.TAY A81s 1 2 97 TST TEST FOR NEGATIVE OR ZERO TST Operation : (M) = O ? Function : This instruction tests whether or not the M contents are zero and modifies the N and Z. Status flag N : N is when the bit 7 of M is 1; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z : Z is 1 when the M content is O; otherwise Z is 0. C: No change Addressing mode Statement Machine codes Byte number Cycle number Zero page !1TST!1$zz 6416, ZZ16 2 3 98 TSX TRANSFER STACK POINTER TO INDEX REGISTER X TSX Operation : (X) +-- (S) Function : This instruction transfers the S contents to X. Status Oag N : N is 1 when the bit 7 is 1 after the execution otherwise N v: is o. T: No change B: No change I: No change D: No change Z: No change C: Z is 1 when the execution result is O; otherwise Z is O. No change Addressing mode Statement Machine codes Byte number Cycle number Implied ~TSX BArn 1 2 99 TXA TRANSFER INDEX REGISTER X TO ACCUMULATOR TXA Operation : (A) ~ (X) Function : This instruction transfers the X contents to A. Status flag N : N is 1 when the bit 7 after the execution is 1 ; otherwise N is 0. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the execution result is O; otherwise Z is O. C: No change Addressing mode Statement Machine codes Byte number ·Cycle number Implied f). TXA 8A1s 1 2 100 TXS TRANSFER INDEX REGISTER X TO STACK POINTER TXS Operation: (S) ~ (X) Function : This instruction transfers the X contents to S. Status flag : No change Addressln mode Statement Machine codes B te number C cle number Implied ~TXS 9A1s 1 2 101 TYA TRANSFER INDEX REGISTER Y TO ACCUMULATOR TYA Operation : (A) ~ (Y) Function : This instruction transfers the Y contents to A. Status flag : N : N is 1 when the bit 7 after the execution is 1 ; otherwise N is o. V: No change T: No change B: No change I: No change D: No change Z: Z is 1 when the execution result is O; otherwise Z is O. C: No change Addressing mode Statement Machine codes Byte number Cycle number Implied ATYA 9816 1 2 102 WIT WAIT WIT Operation : CPU ~ Wait state Interrupt Request TiminQ 111 Interrupt (Internal CTock) Disenable Flag I Reset W.IT Instruction R SJP lnstruct1on Function : This ins.truction resets the internal clock control F/F and internal clock source is stopped after this instruction. To wake up from this wait mode, reset or interrupt inputs are needed. Oscillation will not stop during this wait mode. Status flag : No change Addressing mode Statement Machine codes Byte number Cycle number Implied ~WIT C21s 1 2 (Note 1) This instruction is not provided for M50740A-XXXSP/FP, M50740ASP, M50741-XXXSP/FP, M50752-XXXSP, M50757-XXXSP and M50758-XXXSP. (Note 2)This circuit diagram a little differ by any other models. For more detail, see the "MITSUBISHI SEMICONDUCTORS SINGLE-CHIP MICROCOM- PUTERS". 103 Notes for Programing 4.Notes for Programing 4.1 Note about Processor Status Register 4.1.1 Initialize the processor status register Reset The contents of processor status register(PS) is indeterminate after reset except the I flag. Therefore the flags that influence on execution of program, are required to initialize. Flags Initializing I Especially initialize the T flag, and D flag are I ~rogram influenced on operation directory. Main Fig.4.1 Flag in PS Initialization 4.1.2 How to refer to the processor statµs register (1 )Execute a PHP instruction to save the of processor status register(PS) into stack(S+1). (2) Read from the contents of stack(S+ 1). s (3)To restore the previous PS from stack, S+1 1 - -Saved PS -------1 execute a PLP instruction. However, a NOP instruction is needed after execute the PLP instruction. Fig.4.2 Stack Memory afterthe Executionof "PHP" PLP Instruction NOP Instruction Fig.4.3 Example program N0.1 4.2 Notes for Interrupt Function (1 )More than one instruction cycle is needed to execute the BBC or BBS instruction after switching the value interrupt request bit. Switch the Interrupt Request Bit NOP Instruction BBC, or BBS Instruction Fig.4.4 Example program N0.2 104 Notes for Programing (2)Even though the BBC and BBS instructions are executed just after the interrupt request bits are modified (by the program),those instructions are only valid for the contents IExchange of request flag I before the modification. I BBC or BBC on the request flag I Fig.4.5 Example program N0.3 (3)Checking the condition of B flag in the interrupt routine can be used to discriminate between the BRK interrupt and the lowest priority (S)-3 7 ' interrupt. 4 0 (S)-2 J1J = Bflag PS (S)-1 PCL (S) PCH ' Fig.4.6 Example program N0.4 4.3 Note for Decimal Operation (1)1n decimal operation mode(at D flag="1"), Set D Flag to '1" more than one instruction cycle is needed before SEC, CLC, or CLO instruction after the ADC or SBC instruction. ADC or SBC Instruction (2)The N (Negative),V(Overflow),and Z(Zero) flags are ignored during decimal mode. NOP 1nf'ruction ISEC, CLC, or CLD Instruction I Flg.4.7 Example program N0.5 4. 4 ,Note for Stop Mode The time X gate flag (bit 5 at OOFF16) must be closed before a stop instruction so that the processor can be waked up later (CLB 5 $FF before STP). 4.5 Notes for JMP instruction Don't designate the last address of each page(XXFF16) as the indirect address when using JMP instruction in the indirect addressing mode. 105 APPENDIX 1 Instruction Cycles in each Addressing Mode APPENDIX 1. Instruction cycles in each addressing mode Internal clock 121, which has a frequency one fourth of the f(XIN) (oscillating frequency), controls the system timing of series MELPS 740. The SYNC signal is output in every instruction fetch cycle. In this period, value of PC(program counter) is also output. Op code is fetched during the next half-period of 121. Instruction decoder of CPU decodes this op code and determines the following procedure. Instruction timings of all addressing modes are described on the next pages. In these figures, 121, SYNC, R/W(RD, WR), ADDR(ADDRH, ADDRL), and DATA are internal signals of the single-chip microcomputer. Therefore, these signals can be investigated only in the microprocessor mode. • If some .kind of the single-chip microcomputer that outputs the address signals separately (M50734SP is a case in point), the each signal timing are shown in the dashed line box as ADDRH and ADDRL And in this case, the data signal timing(DATA) is shown with ADDRL(ADDRUDATA). • If some kind of the single-chip microcomputer that outputs the .read and write signals sepa- rately (M37450 is a case in point), the each signal timing are shown in the dashed line box as RD and WR. 106 IMPLIED Instructions : CLC CLD CLI CLT CLV DEX DEY INX INY NOP SEC SED SEI SET TAX TAY TSX TXA TXS TVA Byte length : 1 Cycle number : 2 Timing SYNC R/W ADDR [ __P_c__ I_.____Pc_+_1____) DATA OP ..\f Invalid _ _cod_e_.,,.._,./:,,",.'_ _ _ _, ADD RH ADDRL /DATA 107 IMPLIED Instruction : BRK Byte length :1 Cycle number :7 Timing SYNC R/W ADDR DATA OP Invalid PCH PCL PS ADL ADH code • ' - - - - ' • •"----E• . .___..J.• •'----'• •'-----J••+......-~ ---------------------------------------------------------------------------------------------------., ADD RH i{ PCH I PCH I 01 lu FF ' \ PCH ) ..! .. ADDRL •. /DATA ; _ ~--- -·~ • •• • • -·~ ---~--- -·~ • • • • •• -• -·~-- -·~ • • • •• • -·~ --·~- -·~- -·~ ••• •• • •• w •• • • -·~- ••• • ~ --·~ --~ ••a: .. ••• ~j • • • • • • w• Note 1 : Some kind of types are "01" or content of SPS flag. Note 2 : Some kind of types differ the address. 108 IMPLIED Instructions : STP WIT Byte length :1 Timing SYNC R/W ADDR DATA • c~~e I. . ._____i_nv_a_lid-----~ ~ ~ ~~~~ -..1J iji__ ADD RH rr-~~~y-------------------:;~-mmmmmm•'.:'.~'.~:-----------------i I '------------------ ___________________:C_l:'____________ ::_: ::_:: ----------~,j!J_I ADDRL /DATA Return from standby state is excuted by ex- ternal interrupt. Return from wait state is excuted by internal or external interrupt. 109 IMPLIED Instruction : RTI Byte length :1 Cycle number :6 Timing llJ SYNC R/W ---------------------------------------------------------------------------------------------------, ~~j!I ~~i~}ViJ~!{~~tJr !' ·.....·....·.·.. : ·:·:·;:;.;.;:;.;:;:;:;:;:;:;:;:;:;~;~;:;:~:; ;~ ~; ;:;:i: :>: ·:·: . ! '' ' . . . . . . . . . . .1 --- I ·----.. ·---· --------------------------------------------------------------------------------------------------~ ,.,.,.,.----.. .. PCL ' ii S,00 S+1,00 S+2,00 S+3,00 Note Note Note Note PCH Invalid ADDRH [ PCH I PCH I . . ______ 0_1_ _ _ _ _ _ I PCH ) ADDRL /DATA ., ·------------------------------------------------------·--------·---------------------------------- ' Note : Some kind of types are "01" or content of SPS flag. 110 IMPLIED Instruction : RTS Byte length :1 Cycle number :6 Timing " SYNC R/W ;--------------------------------------------------------------------------------------------------, RD WR ADDR S,00 S+1,00 S+2,00 PCL PCL+1 ,.___,,._,,.v,,~--..--1••~-=No~te~ '1-...i:N~o~te;i._.,,_...N~ot~et.......1 __P_C~H__,. •"'--'-P~C~H.__,. DATA OP Invalid Invalid code ADDRH ADDRL /DATA Note : Some kind of types are "01" or SPS flag. 111 IMPLIED Instructions :PHA PHP Byte length :1 Cycle number :3 Timing SYNC R/W ADDR DATA ADD RH ADDRL /DATA Note : Some kind of types are "01" or content of SPS flag. 112 IMPLIED Instructions : PLA PLP Byte length :1 Cycle number :4 Timing I•••••• ••1••••1••••1•1•1•1•1l••i••••••••1·•• ••••••••••I •••1•1••••••••1•1•••••••••1•••1•••• ••••••••••••••••••••••••••I•••••••• •••••1••••••1•1•••••1 1•1•i•••••1•1•••1••1••1•1••••1 •••••1•1•••••••••••11••••• •1•1•1•1·••1••1•1• 111••••••••••••••••••••1••1•1•1•••••••••1•••••••••••••••1••• SYNC R/W !·-----· ,-------------------------------------------------- ... ---------------------- ... ----------------------- . .:: . .~ ~1111~11~~~~11~11~11~11~11~11~11~11~;1 t ___________ . _ __________________ -------------------------------------------------------------------- ADDR [ DATA OP Invalid DATA code ADD RH r·r-----~~~----x-----~~~-----~-----~~------l·-----~~------i~~~~~i~~~~~~~~;~~- ... ADDRL . .. •. /DATA . 11... ............................................................................................................................................................................................................................................. ___________________ .. Note : Some kind of types are "01" or content of SPS flag. 113 IMMEDIATE Instructions : ADCMl$nn (T=0) ANDMl$nn (T=0) CMPM$nn (T=O) CPXMl$nn CPYM$nn EOR..1#$nn (T=0) LDAM$nn (T:O) LD~#$nn LDYA#$nn ORAM$nn (T:0) SBCM$nn (T:O) Byte length :2 Cycle number :2 Timing SYNC R/W ADDR DATA -----:""-----------------------------...................................................................................-..................., .•• ADD RH l •• . l • ADDRL .• •• • /DATA .•• ..................... _..................................................................................................................................................................................... J 114 ACCUMULATOR Instructions :AS~A DECti.A INCti.A LSRti.A ROLti.A RORti.A Byte length :1 Cycle number :2 Timing SYNC R/W -----------------------------------------------------------------------, RD · ..l l!i i i Jil I :; 1111 !i I llllll 11 llil llJ!!i!Jf i ,. : l '' .. '' '' .. i.. ........................................................................................................................................... .. . '' '' ADDR PC+ 1 DATA Invalid ..11----------------------------------------------------------------------. ''' ADD RH . ... '. '' '' ADDRL . .. ' ' '.. /DATA . ' . ............................................................................................................. .............................................................................. \.. .._ ' ' 115 ACCUMULATOR BIT RELATIVE Instructions : BBCAl,A,$hhll BBSAl,A,$hhll Byte length :2 (1) With no branch Cycle number :4 Timing ,, SYNC R/W ADDR PC+ 1 DATA Invalid ,---------------------------..................................................................................................................................................................................................................... : • ADD RH : PCH : ' :'' ADDRL •• /DATA .' ' •• ~--------------------------------------------. ..................................................................................................................................................................... 116 ACCUMULATOR BIT RELATIVE Instructions : BBCAl,A,$hhll BBSAl,A,$hhll Byte length :2 (2) With branch Cycle number :6 Timing SYNC R/W ADDR (PC+2)L±R ·•·•·•· · (PC+2) PC PC+ 1 PC+2 H ±RR DATA OP Invalid ±RR Invalid Invalid code ,--------------------------------------------------------------------------------------------------i ADD RH :( PCH I PCH I (PC+2)H I l. (PC+2)H IPC+2)H±RR l ADDRL /DATA . IB!ll · I i 2 ~--------------------------------------------------------------------------------------------------! 11111 RR: Offset value *1: (PC+1)L *2: (PC+2)L±RR 117 ACCUMULATOR BIT Instructions : CLBdl,A SEBdl,A Byte length :1 Cycle number :2 Timing " I t:llllllllllllllillllllllllllllill 1llllli-lillllilll Ill 1111:1: lil1 l l il··:11:1111·:::1111p:. 111111lil lil lil il11lll!lillililllllllllll!llllllllllll. SYNC l!ill\!li!i!_lilJli!l!l!IJll!llJ!llJ!j\!i!i!li))illllililliiJ!li!\JJJ\lilj\J.jJllill·!::!Jli!l.!Jil!J!iJ\llil!Jii!!Jlj il::!jj:::::: j!jij j i!jJIJi!Jl Hl l il!lJ::1:1:1·:,·1JJlj)j\ R/W ADDR DATA OP code _____ ---- Invalid ··:::;:;:: :::::::::::::::::::::::::::::::::::::::::::::::::{~ :: ·.· -::i :;::~:~:i:j:i:j:i:i:i:i:i:=:~:i:i:it=]j~~t::~?}:~:i!~ ,/}.,,""'. ADD RH ADDRL /DATA 118 BIT RELATIVE Instructions : BBC~l,$zz,$hhll BBS~l,$zz,$hhll Byte length :3 (1) With no branch Cycle number :5 Timing SYNC R/W ADDR { Pc I Pc+ 1 I ADL,oo I, ,____ P_c_+_2_ _ __,~ < DATA OP ADL DATA Invalid code ADD RH ir--~~=mf ·-~::··i·m~~-----l--m m--~=- . .mm_____ 1 ... .. ADDRL . .. /DATA . : :· I t I ;_~·-----..--~~-----------------------------------------------------------------------------~~---..---~-j 119 BIT RELATIVE Instructions : BBCAl,$zz,$hhll BBSAl,$zz,$hhll Byte length :3 (2) With branch Cycle number :7 Timing SYNC R/W ---------------------------------------------------------------------------------------------------., ' i.l.l :IJi !!l l!:i l :':l l!f~·i=l 'lf!l l!:!l lifl!~!: lllill:i=il i ''' ''' ''' ;_~~------------------------------------~~~-~-~~~--------~~-_ . . _____________________________________ _!' ADDR PC+2 DATA -... ----... ------------------............. -......... -...... --.. ---................................ -.. -............... -----------.. ------........ ---------. ADD RH ,....__.-. - - - · ,.._ _ _ _. .,:\. PCH T'(PC + 2)H \'(PC+ 3)H T (PC+3) ·: .,;;:;.. .,:;::.. &. ±RR -:! I! ': ADDRL /DATA .__...,.......;..;;;;.J:.__...,.....;.;;;;...,;,..._...,.... _________ ;.. _________________________________________ ... ______________________________________________ .,.! __.::;:11Bllll· 2 J,111111.:.i.I i ' RR : Offset address *1 : (PC+3)L *2 : (PC+3)L±RR 120 ZERO PAGE BIT Instructions :CLBAl,$zz SEBAl,$zz Byte length :2 Cycle number :5 Timing SYNC R/W ::··~ ..;·~:J:·=~·:.:: : ~;:;~:·~:· :::~::},:~;'.\:::~. =:::-:·='.~l;i:~\.: ·::·::=:~·::'.:l;·t~:~i;:;;· . . .:/~://·J; .~ ,---------------------------------------------------------------------------------------------------~ !' ' '' '''' .... ' ''' '' ··: ... !' _______________________ ._ ............................................................................................................................................................................................................................................i ADDR DATA OP code ADL ,------------------------------------------------------------------------------ ' ... -------------------~ . ADD RH j' PCH I PCH ~ 00 t4lli·llil,lilll:llf.lll1l·l· ti:=111 !. '' '' . ADDRL /DATA l : ADL ::·::!:1111111 ADL I ~:~1:1:1:.1 :1:1:1 1 1 :;1 1:1:1.1: 1·1 1.1 1 !. '..............................................................................................................................................................__________________________ ... ___________________ .. 121 ZERO PAGE Instructions : ADCA$zz (T:0) ANDA$zz (T:O) BITA$ZZ CMP!1$ZZ {T:O) CPXA$zz CPYA$zz EORA$zz (T:O) LDM$zz (T:0) LDXA$ZZ LDYA$ZZ ORA!1$ZZ (T:0) SBCA$zz {T:0) TSTA$zz Byte length :2 Cycle number :3 Timing SYNC R/W ...... ---. ---... ---... -. ---.. --. -.... -...... ----....... -.... -.......... -........... -........ -.............................. -........... -- -.... .. ADDR ADL,00 .,._____A.\,." . - - - - ' '~"'111iii"'111iii""' DATA ADL ADD RH ADDRL /DATA 122 ZERO PAGE Instructions : ASLA$zz COM~$zz DEC~$zz INC~$zz LSR~$zz ROL~$zz ROR~$zz Byte length :2 Cycle number :5 Timing SYNC R/W ,---------------------------------------------------------------------------------------------------... I I I I I I I I I I '' .. I I 'I '' ..' WR '' ''' . .. ' ' '"'-----------. . ---------------------------------. . ------------------------------. .---------------------1 I I ADDR { Pc I PC+1 I . .•____A_D_L_,o_o_____,J!!lil!liiljij!i!!!.-iiil DATA OP code ADL DATA Invalid NEW DATA t------------------------------------. . ----------------------------------------. .--------------------.,, ADD RH !{ PCH I PCH ~ 00 ,41 li!li!I ! I ' ' . I ADDRL /DATA ::11111ADL1~;fJ:1.1111:1:1: .i .i:'------------------------------------------ --------------------------------------------------------- .... 123 ZERO PAGE Instruction :RRF~zz Byte length :2 Cycle number :8 Timing SYNC R/W r·------------------------------ -----------·----------. --. ---- --------. --------------------------. i••·············- .. !.. . . . . . . . . .. . ~--------------------------------------------------------------------------------------------------- ADDR ~PC+1~~~~~~~~-A_D_L_.o_o~~~~~~~-'~ DATA ADD RH ADDRL /DATA 124 ZERO PAGE Instruction : LD~#$nn,$zz Byte length :3 Cycle number :4 Timing " SYNC R/W ----------------------------------------------------------------------------- ...-------------------- ...: ~ '' .. '' '' ... '' '' ... '' ' .: . :'' . ' ~--------------------------------------------------------------------------------------------------· DATA OP code DATA ADL DATA ADD RH rc·--~~-~---1---~~-~---x----~~-~---~-----~~m--~~i~~!--~~~iil~~i!~~il~il~~~~~i-· '' ' ADDRL '''' /DATA '' . ' .:. t ....................................................................................................................................... --------------------------------. . -------------------- 125 ZERO PAGE Instructions :STM$zz STXL\$zz STYA$zz Byte length :2 Cycle number :4 Timing SYNC R/W ".. -. ----- .. -----. -. ----- -- ---. -. ---. ---- .. ---. --...... -. -. -. -........ -........ -..... -............................. --...... --.. ADDR ADL,00 DATA Invalid ADD RH 00 ADDRL /DATA 126 ZEROPAGEX Instruction : MULl$zz,X (Note) Byte length :2 Cycle number :15 Timing SYNC R/W ADDR 8 Pc+ 1 . .X_______ A_D_L_+_x_.o_o______~X s.sPs I_ DATA Invalid Note: This instruction can be used special types (M37450 is a case in point). 127 ZEROPAGEX Instruction : DIV6$zz,X (Note) Byte length :2 Cycle number :16 Timing SYNC R/W ADDR a PC+ 1 ~------A_D_L_+_x_+_1_.o_o_ _ _ _ __,X. S,SPS I DATA Invalid Note: This instruction can be used special types (M37450 is a case in point). 128 ZEROPAGEX Instructions : ASLI.$zz,X DEC~$zz,X INC~$zz,X LSR~$zz,X ROLI.$zz,X ROru$zz,X Byte length :2 Cycle number :6 Timing " SYNC R/W .-------------------------------------------------------------------------------------------------- . ' ADDR [ PC I PC+ 1 I (P~0~1 )LI .·. ____ A_D_L_+_x_.o_o_ _ _ _• DATA NEW ADL DATA Invalid DATA ADDRH { PCH I PCH ~....._ _ _ _ _ _ _o_o_ _ _ _ _ _ _• f ADDRL /DATA 129 ZEROPAGEX ZEROPAGEY Instructions : ADCA$zz,X (T=O) ANDA$zz,X (T:0) CMP~zz.x (T:O) EORA$zz,X (T:0) LDA8$zz,X (T:0) LDX8$zz,Y LDYA$zz,X ORA8$zz,X (T:0) SBCA$zz,X (T=0) Byte length :2 Cycle number :4 Timing " SYNC R/W --------------------------------------------------------------------------------------------------- ' ................... I j lil lul l 111••1•:1:11111·11:11:111•111 • \ill 1•111•111•1•11111•:1:: ••••••••••••••••11•1•1:::11•1•:1•1••• I I 11•111111 1111 !!!!!• \\I \l.f\•11111\l!l!liill•l•I ADDR !------ :' ' ~-------------------------------------------------------------------------------------------------- DATA OP code ADL Invalid DATA ADD RH t.•. _P_c_H_ _,I. .• _P_c_H_ _,~._____o_o_____,~l!I·•·· ADDRL /DATA 130 ZEROPAGEX ZEROPAGEY Instructions : STM$zz,X STXL\$zz,Y STYL\$zz,X Byte length :2 Cycle number :5 Timing R/W -----------------------------··----------·---·-----------·--------------------------------------- ... ADDA DATA Invalid Invalid ...... -...... -"' . -............ -. --.... -------. -...... -.... --....... -.......... --.... --.... -.... --.... --... --------.... -.......................... --.......... -. ADD RH 00 ADDRL /DATA 131 ABSOLUTE Instructions : ADCd$hhll (T=O) AN0d$hhll (T:0) BIB$hhll CMPd$hhll (T:O) CPXd$hhll CPYd$hhll E0Rd$hhll (T:0) L0Ad$hhll (T:O) LDXd$hhll L0Yd$hhll ORAd$hhll (T:O) SBCd$hhll (T:O) Byte length :3 Cycle number :4 Timing SYNC R/W DATA OP code ADL ADH DATA ADD RH ..r[----~~:---~f---~~:---1----~~~----i---::~---1111·.~:i-1111111:1·:~~-~-~.~~:~:~-~~~~i--l. . ADDRL ! ' '' ' ::,:. j /DATA . ~ :. . ·:::::::;::::::::::·:·:= ·: ··::::::::::::::::::::::: :. ·::::::::::;:::::::;:::::::: : ~-------------------------------------------------------------------------------------------------~ 132 ABSOLUTE Instructions : ASLl.$hhll DECt.$hhll INCt.$hhll LSRt.$hhll R0Lt.$hhll RORt.$hhll Byte length :3 Cycle number :6 Timing SYNC R/W ~--------------------------------------------------------------------------------------------------- ADDR PC I PC+ 1 I I\. •____ PC+ 2 A_D_L._A_D_H_ _ _ _ • DATA • OPcodeI ADL I I.. 'VIA ADH DATA .I,,,,. Invalid:., NEW " DATA A ADD RH r --------------------- ---------- ------------------ ------------------------ ------ --- ----------------- \ PCH I·.,,. ,\. PCH I PCH I\..•_____ A_D_H_ _ _ _ _• j ADDRL /DATA DATA ADL l,,,,,,,;,,;;.J•i...-..1,_J~-~--- !llADLI~f+v~ il -------------------------------------------------------------------------------------------------- .. 133 ABSOLUTE Instruction :JMP~$hhll Byte length :3 Cycle number :3 Timing SYNC R/W ADDR '...·'..·.·''"·. · __P_c_.JA 9' PCL. PCH '\•·•·••·:··· '9 PC+ 1 9A"""_P_c_+_2_/A I?············.·•.•.•.•.•.·.•.·.•.·.·. . .·. . •.••.•...·..·.•.•.'··.•..·..•..·..•..·. •.•.·.·.•.·.N·~··.·..·.•· ••••••••••••. DATA OP code PCL PCH ADD RH r-,----~~~m-jm--~~:-mxm--~-~~m-1--m~:~-m-j~•!i11i•!i-~.~~~~-~!ij--· : '' ·"----- ' ADDRL '''' /DATA '' '~------------- ............................................................................................................................................................................................................................................................ ... 134 ABSOLUTE Instruction :JSR8$hhll Byte length :3 Cycle number :6 Timing SYNC R/W ' . .--------------------------------------------------------------------------------------------------, ' .' ' '' . ' ' '' ''' '., • • • • • - - • • • • • • - - - • • • • • - - - - • - - - - - • • • • · - • - • • • • • - - - - - • • • • • • - - - - - - - • - • - - - - • • • - • • • • • • • - • • • - • - - • - • - - - - - - . I' ' ADDR PC S,00 (Note) DATA ADDRL /DATA Note : Some kind of types are "01" or content of SPS flag. 135 ABSOLUTE Instructions :STM$hhll STX.i$hhll STY.i$hhll Byte length :3 Cycle number :5 Timing SYNC R/W t : ;.................................................. --- --. --.............. ---- ........................................ -.......................... --. -.... --........ -. -.......... J ADDR ,\_.__- - PC- ·1·.·,:,:·'.:,.·•.:,',·., .,·. . PC+ 1 I'..'.·.:.':·'· · '.,·'· ,·,·.. PC+ 2 .1·,.'','.':·:.'.: , '.,',·......_ _ _A_D_H ~ AOL_ _ _ . '.':·••.' \tz.' •.~ l fffff?:?:::::::::::::,,,:,,,.,.,., .·•.:·••.• .::::: DATA OP code AOL ADH Invalid DATA ADD RH ADDRL /DATA 136 ABSOLUTEX ABSOLUTEY Instructions : ADC6$hhll,X or V (T=O) AND6$hhll,X or v (T=0) CMP6$hhll,X or v (T:O) EOR6$hhll,X or V (T=0) LDA6$hhll,X or V (T=0) LD~$hhll,V LDV6$hhll,X ORA6$hhll,X or v (T=0) SBC6$hhll,X or V (T=0) Byte length :3 Cycle number :5 Timing SYNC R/W ADDR PC+ 1 PC+2 DATA OP code ADL ADH Invalid DATA ADD RH ADDRL /DATA C:Carry of ADL+X or y 137 ABSOLUTEX Instructions : AS~$hhll,X DEC~hhll,X INCt.$hhll,X LSRt.$hhll,X ROL~hhll,X ROR~hhll,X Byte length :3 Cycle number :7 Timing SYNC RD DATA NEW DATA .,:~ ADD RH --~~~A_D_H_+C~~~--lili: ADDRL /DATA C:Carry of ADL+X 138 ABSOLUTEX ABSOLUTEY Instruction : STAt.$hhll,X or Y Byte length :3 Cycle number :6 Timing SYNC R/W ADDR ?:4DL+X(or yj? ADL+X(or Y) PC PC+ 1 PC + 2 ADH ADH+C DATA . O P code I I I I I ADL ADH Invalid Invalid DATA J ADDRH t PCH % % I x_·__ PCH PCH ADH A_D_H_+_c_ _ • ADDRL /DATA C:Carry of ADL+X or y 139 INDIRECT Instructions : JMPL\($hhll) Byte length :3 Cycle number :5 Timing SYNC R/W RD ADDR , =_·_=· i=·=·=·=·· )..,._,_P_c_ _,_.:::;: I.,,,,,,,.. PC+ 1,;;·:, I..,,,,,,, BBAAHL __=,:.,: PC + 2,,;.:;,,_,..____ . . I_'_=. =,=., ,_=,·.. BBAAL+H1 x· _=_,_,,_~=,_,:=,·.,._,: .· .. AOLl AOH;i DATA ____ ---- ... BAH },.,,.... AOL ADD RH ADDRL /DATA BA: Basic address 140 ZERO PAGE INDIRECT Instruction :JMP~($zz) Byte length :2 Cycle number :4 Timing " SYNC R/W ADDR DATA OP code BAL ADL ADH ADD RH ADDRL /DATA BA: Basic address 141 ZERO PAGE INDIRECT Instruction : JSR.1($zz) Byte length :2 Cycle number :7 Timing SYNC R/W ADDA S,OO(Note) DATA ADDRH ( PCH I f>CH ____ ---~--o_o--~ % 0_1 ADH ) ADD AL /DATA BA : Basic address Note : Some kind of types are "01" or content of SPS flag. 142 INDIRECTX Instructions : ADCL\($zz,X) (T:O) ANDL\($zz,X) (T:0) CMPL\($zz,X) (T:O) EORL\($zz,X) (T:0) LDM($zz,X) (T:0) ORAL\($zz,X) (T:0) SBCL\($zz,X) (T:O) Byte length :2 Cycle number :6 Timing SYNC R/W ADDR PC ADL .OP I I I I I ADH DATA code BAL Invalid ADL ADH DATA I i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ·1 ADDRH [ PCH PCH ~......_ _ _ _ _o_o_ _ _ _..... ADH • : ADDRL /DATA BA : Basic address 143 INDIRECTX Instruction : STM($zz,X) Byte length :2 Cycle number :7 Timing SYNC ADDR DATA ADD RH ADDRL /DATA BA : Basic address 144 INDIRECTY Instructions : ADCL\($zz),Y (T:0) ANDL\($zz),Y (T:O) CMPL\($zz),Y (T:O) EORL\($zz),Y (T:O) LDM($zz),Y (T:O) ORAL\($zz),Y (T:O) SBCL\($zz),Y (T:O) Byte length :2 Cycle number :6 Timing SYNC R/W ADDR PC+ 1 BAL,00 BAL+1 00 DATA BAL AOL ADH Invalid DATA ADDRH [ PCH I PCH ~..___ _o_o_ _...1Jx ADH I ADH+C JI jjj j :1 ADDRL /DATA BA: Basic address c : Carry of ADL+y 145 INDIRECTY Instruction : STM($zz),Y Byte length :2 Cycle number :7 Timing SYNC R/W :- ---------------- -----.. ----------.. ------- .. ----- ---- .. ------ --------- .. --- ----.. ---------- -.... -- -------: : I : ' I ' I ' I ' I ' I ' I ' I ' I ' I ' : : : I : ' L--------------------------------------------------------------------------------------------------• I ' ··:::::· ··:::::- ADDR BAL+1 ADL+Y \. ADL+Y PC ..: PC+ 1 •. BAL,00 00 ADH ADH+C DATA BAL ADL ADH Invalid Invalid DATA ADD RH rr:~--f~~~I---------~~-------7~::-x------~~~:------.-~- . I I ADDRL /DATA l.. •••!!il~lll~~LIDArAJilllii•l••l•iili.liii• 1 .. - - - - - - - - - - - .. - - - - - - - - - - - - - .. - - - - - - - - - - - - - - - - - .... - - .. - - - - - - - - - .. - - - - - - - - - .. - - - - - .. - - - ...... - - - - - - .... - - .... - - - - - BA: Basic address c : Carry of ADL+y 146 RELATIVE Instructions : BCCd$hhll BCSd$hhll BEQd$hhll BMld$hhll BNEd$hhll BPl.l1$hhll BVCd$hhll BVSd$hhll Byte length :2 (1 )With no branch Cycle number :2 Timing " SYNC R/W DATA OP code Invalid ADD RH ADDRL /DATA 147 RELATIVE Instructions : BCC~$hhll BCS~$hhll BEQ~$hhll BMl~$hhll BNE~$hhll BP~$hhll BVC~$hhll BVS~$hhll Byte length :2 (2)Wlth branch Cycle number :4 Timing " I•• i II 11111111•111111••·11•111 1•11•1•1•11111111•111• 11111111111111111111111•111111 1111•11111•1111111••111 Ill 1•1111111•111•1•1•111•111•11111 I .•:. llllll lll•l••111•••lllllll•1•1•11 1•1111•111 SYNC R/W ,-------------------------------------------------------------------------------------------------"""' '' '' '' ' ' :' ''~ ''' ' ''' '' '' '' ' '' ''' '' ' '"--------------------------------------------------------- ' ... ----------------------------------------~' (PC+2)L ,,,;;,· (PC+2)L±R ADDR PC PC+ 1 PC+1 H PC+2 H DATA OP code ±RR Invalid Invalid ·-------------------------------------- .................................................................................................................................................................................., ADD RH ' ~ t PCH I PCH I (PC+1)H I (PC+2)H I(PC+2)H±R~ ! ' . '' '' ADDRL /DATA j :(P;;~) ::::;•1111111(P;;il•·11••·•• 1 ! 11...----------------------------------:---------------------------------------------------------------' ' = ' RR : Offset value 148 RELATIVE Instruction : BRM$hhll Byte length :2 Cycle number :4 Timing SYNC R/W ADDR PC+ 1 DATA OP code ±RR Invalid ADD RH ADDRL /DATA RR : Offset value 149 SPECIAL PAGE Instruction : JSR&\$hhll Byte length :2 Cycle number :5 Timing " SYNC R/W :--------------------------------------------------------------------------------------------------1 ... '' .••. '' '' .•. • ... ' .. . . '' ' ""'---------------------------------------------------------------------------------------- ---------- ... ADDR [ ·...._P_c__I,. .•_P_c_+_1..,I.·.__s_._oo_(_N_ot_e_)__I ~~~t~~ XBAL,FF j DATA OP code ADD RH ADDRL /DATA BA : Basic address Note : Some kind of types are "01" or content of SPS flag. 150 IMMEDIATE Instructions : ADC.6.#$nn (T:1) AND.6.#$nn (T:1) EOR.6.#$nn (T =1) ORA.6.#$nn (T:1) SBC.6.#$nn (T:1) Byte length :2 Cycle number :5 Timing SYNC R/W ;----------------------------------------.......................................................................................................................... ____________ _ RD WR ADDR DATA DATA DATA Invalid NEW OP code 2 DATA i--------------------------------------------------------------------------------------------------. ADDRH lt PCH % PCH ~......_ _ _oo_ _--J'.~iil·lili·i,iililllilil·liil ADDRL .. : ;: /DATA : ~:. 151 IMMEDIATE Instruction :CMPM$nn (T:1) Byte length :2 Cycle number :3 Timing SYNC R/W ADDR _%__Pc_+1_%...__x.o_o_J · . .· :··.:·I [...__P_c DATA DATA DATA OP code 1 2 ADD RH ADDRL /DATA 152 IMMEDIATE Instruction : LDAM$nn (T:1) Byte length :2 Cycle number :4 Timing SYNC R/W ADDR t__ _%_.P_c _Pc_+1_I_ _ _x_.o_o_ _ Jlllll··ll::11lll DATA OP code DATA Invalid DATA ·----------------------------------------- ' . ... ------------------------------------ ... -------------------.., ADD RH lt : PCH I PCH ~ 00 .4·:·1·:::1:,1111 ! : ADDRL :l . PCL ~ ' I ::· : /DATA l. .~--------------------------------------------------------------------------------------- . . ________! 153 ZERO PAGE Instructions : ADC.<\$zz (T=1) AND.<\$zz (T=1) EOR.<\$zz (T:1) ORA,\Szz (T:1) SBC,\$zz (T=1) Byte length :2 Cycle number :6 Timing " SYNC R/W .--------------------------------------------------------------------------------------------------. ..... '' ''' .. ' ''' . ''' .. . . .....'.' '.]i!ji:i.!.i i :i·!i!:il l !i!l! li li!i! li·i!l .l l!l! l lil!i~mnt+trn ..!--------------------------------------------------------------------------------------------------..J !!l !l l:l il i·:j:ii\ll i: 1 ADDR ··==fr ·::~::: ·::f· ··~r ·:::>~= ·::: DATA AOL DATA DATA NEW Invalid ;k, .:;:;:;., 1 . ~i 2 .:l. .=~~:::. DATA ADD RH ADDRL /DATA 154 ZERO PAGE Instruction : CMP.1$ZZ (T:1) Byte length :2 Cycle number :4 Timing Ill lllii1ll:J-.:1111111111111l·illlilllllll,liii:l.llll·lt111:11111:1111·1·11:111111111111·1:111111:1:111·111:111:111111111:111·11::11111111:·1:1.111111111:11,1111111-1:11,11:11.1111111.1.11111:1111111111:111111111:111111111111111111111111111:1111111111111:111:1:!Hilililill·11·111 SYNC R/W DATA DATA DATA OP code ADL 1 2 ~--------- ............................................................................................................................................................................................................................................. . . ADD RH j '' t PCH I PCH ~ 00 ,411,Jlll~l{lllll::lt.;ilil '' :·· ADDRL ' ' .· ' /DATA '' <. ' ~----------------------------------------- .............................................................................................................................................................. 155 ZERO PAGE Instruction : LDM$zz (T=1) Byte length :2 Cycle number :5 Timing SYNC ADDR PC I PC+ 1 I ADL,OO I,..• ___ x_.o_o__---.JJlll.ltii!l~I &/:>? DATA OP code ADL DATA Invalid DATA . .. -----... --------------------------------------------------------------------------------------------'"' ADD RH !t PCH I PCH ~ 00 ,4111:1::11:111111111:1.111:111: j .' ' ' ' ADDRL /DATA j •. ;:!illll x IoArAJ!!l l!l liM!!lj! lj j '~---------------------------------------------------------------------------------------------------·' 156 ZEROPAGEX Instructions : ADC!1$zz,X (T =1) AND!1$zz,X (T:1) EOR!1$zz,X (T:1) ORA!1$zz,X (T=1) SBC!1$zz,X (T=1) Byte length :2 Cycle number :7 Timing SYNC R/W ,--------------------------------------------------------------------------------------------------; ''' '' ' '' ADDR DATA.···.· DATA DATA NEW ADL 2 Invalid 1 DATA ADDRH { PCH I PCH ~.......__ _ _ _ _o_o_ _ _ __,~········ · · · · · · · · · · · ·~ ADDRL /DATA 157 ZEROPAGEX Instruction : CMP~$zz,X (T=1) Byte length :2 Cycle number :5 Timing SYNC R/W ---------------------------------------------------------------------------------------------------\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ DATA DATA DATA AOL Invalid 1 2 ADD RH ADDRL /DATA 158 ZEROPAGEX Instruction : LDA~$zz,X (T:1) Byte length :2 Cycle number :6 Timing SYNC R/W t- - - - - -- - - - - - - - - - -- - - - - - - - - - - - - - - - - - - -- - - - - - - - - -- - - - - - - -- - - -- - - - - - - - - - - -- -- - - - --- --- - - - - - - - - - - - - - - ., '' ' '' ''' '' '' ' '' '' '' '' '' '' '' '' '' ''' ' ' '~ ---------- - - - -- ------- ------------ ----------- ---- ------------ ----- ------------- -- ------- --------- -~' ADDR { PC DATA AOL Invalid DATA Invalid DATA ADD RH i-f-~~~---~(-~~~---~------------------------~-~------------------------~~~-~~~~~~~~f1 '' '' '' '' ADDRL /DATA ' j 1~11 x XoATAI I }: t..- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --------1' 159 ABSOLUTE Instruction : ADCL'l$hhll (T=1) ANDL'l$hhll (T:1) EORL'l$hhll (T:1) ORAL'l$hhll (T =1) SBCL'l$hhll (T =1) Byte length :3 Cycle number :7 Timing SYNC R/W ---------------------------------------------------------------------------------------------------, RD ' WR --------------------------------------------------------------------------------------------------· ADDR DATA DATA DATA NEW AOL ADH Invalid 2 DATA ADDRH { PCH I PCH I PCH I ADH ~.___ _ _ _o_o_____,~ ! ~· · ADDRL /DATA • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - u - - - - - - - - - - - - - - - - - :::11 x t~;li I :) - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - 160 ABSOLUTE Instruction : CMPL'1$hhll (T:1) Byte length :3 Cycle number :5 Timing SYNC R/W ADDR r___ P_c__.I...._P_c_+_1...,I,,_-_P_c_+_2.....I .•. -~g--~__,% _x_,_oo__,J .. i DATA DATA OP code ADL ADH 1 ADDRL PCL /DATA 161 ABSOLUTE Instruction : LDM$hhll (T:1) Byte length :3 Cycle number :6 Timing SYNC R/W DATA ADD RH AOL ~ PCH········· PCH········ PCH L>. ADH />...____o_o___AN.: ADH lt i ,,,,,,,,, ' --------------------------------------------------------------------------------------------------- ' 1··::::;:: ' I::::;:;·· \fl '/: : : ;: : : ~{:}}){\{ : ' DATA Invalid DATA __ ' ADDRL /DATA .-. . . . ._. ."___, ..__. . . .___.. . . . . . . . . '"'". . . . . . . . . ._.... . _. . II x IDATAI 11~ i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -·- - - - .1 162 ABSOLUTEX ABSOLUTEY Instructions : ADCL'.$hhll,X or y (T:1) ANDL'.$hhll,X or y (T:1) EORL'.$hhll,X or y (T=1) ORAL'.$hhll,X or y (T:1) SBCL'.$hhll,X or Y (T=1) Byte length :3 Cycle number :8 Timing SYNC R/W ;- ------ - ---- -- --- --- -- -- -- --- ------------- ---- --- - ------- -- ---- ---- -- ---- -------- ------------ ---- --~ ' ' '' :' ' ' ;__ ---- ------ --- ------------ -------- -- ---- ---------------------- --------- ---------- -- - -- ----------- -~ ADDR PC X,00 DATA ---------------------------------------------------------------------------------------------------., -::: ' ADD RH ADH •. ADH+C. 00 ADDRL /DATA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1 C : Carry of ADL+X or Y 163 ABSOLUTEX ABSOLUTEY Instruction : CMP6$hhll,X or y (T:1) Byte length :3 Cycle number :6 Timing SYNC R/W ---------------------------------------------------------------------------------------------------! ' :' '' ' _I_ _1_1_ _I_I_I_I_I_I1_1_ _I_I_I_I_I_I_Il__I_I_I_I_I_I_I_II__I_I_I_I_I_I_I_Il__I_I_I_I_I_I_I1_1_ _I_I_Il_J ADDR PC DATA DATA DATA 1 2 ADD RH ADDRL /DATA C : Carry of ADL+X or Y 164 ABSOLUTEX ABSOLUTEY Instruction : LDAt.$hhll,X or y (T=1) Byte length :3 Cycle number :7 Timing SYNC R/W ADDR X,00 DATA OP code{ ADL Invalid DATA Invalid DATA ADD RH .....___o_o- - - • ADDRL /DATA C : Carry of ADL+X or Y 165 INDIRECTX Instructions : ADCL'i($zz,X) (T=1) ANDL'i($zz,X) (T:1) EORL'i($zz,X) (T:1) ORAL'i($zz,X) (T:1) SBCL'i($zz,X) (T:1) Byte length :2 Cycle number :9 Timing SYNC R/W ADDR X,00 NEW DATA DATA ADD RH 00 00 ADDRL /DATA BA : Basic address 166 INDIRECTX Instruction :CMPt..($zz,X) (T=1) Byte length :2 Cycle number :7 Timing SYNC R/W ADDR DATA DATA DATA BAL Invalid AOL ADH 1 2 ADD RH 1r~~~ '.:f~~~ i--- ---------~~-- - --------1~~~s:---~;----i11111-- . ADDRL i I I /DATA : ____ --------- -- ---- ---- -- -- -- ----- ---- --------------- --------- ---------------------------- ----- - -~ _: BA : Basic address 167 [1fa 1L] INDIRECTX Instructions : LDAil($zz,X) (T:1) Byte length :2 Cycle number :8 Timing SYNC R/W ADDR X,00 DATA DATA ADD RH 00 00 ADDRL /DATA BA : Basic address 168 INDIRECTY Instructions : ADC~($zz),Y (T:1) AND~($zz),Y (T:1) EOR~($zz),Y (T:1) ORA~($zz),Y (T:1) SBC~($zz),Y (T:1) Byte length :2 Cycle number :9 Timing SYNC R/W ADDR X,00 NEW DATA DATA ADD RH 00 ADDRL /DATA BA : Basic address c : Carry of ADL+y 169 INDIRECTY Instruction : CMP~($zz),Y (T:1) By1e length :2 Cycle number :7 Timing SYNC R/W BAL BAL+1 .,. ADL+Y '' ADL+Y ADDR PC PC+ 1 X,00 00 00 ADH ) ADH+C DATA •••••.•••••••••••.•• OPcode? BAL DATA DATA \j ADL ADH Invalid 1 2 ADDRL /DATA BA : Basic address c: Carry of ADL+Y 170 INDIRECTY Instructions : LDA~($zz),Y (T:1) Byte length :2 Cycle number :8 Timing SYNC R/W ADDR X,00 DATA --------------------------------------------------------------------------------------------------- : ::· ADDRL /DATA BA : Basic address c : Carry of AOL+ y 171 APPENDIX2 MELPS 740 Machine Language Instruction Table ~ FLAG INSTRUCTION CODE BYTE "' SYMBOL FUNCTION HsX tlUMBER N::s!:T B::[l:l.Q: 01Do::lli04D302 Dt Dl ~1~~ NOT~ LOA #$nn (A) .... nn oxxxxxox 1 0 1 0<92,.1 0 0 1 A9 2 2 2 LOA $zz (A) .... (M) where M=(zz) oxxxxxox 1010<82>0101 A5 2 3 2 LOA $zz,X (A) .... (M) where M=(ZZ+(XJ) oxxxxxox 1 0 1 1<82>0 1 0 1 85 2 4 2 LOA $hhll (AJ .... (M) where M=(hhll) oxxxxxox 1 0 1 ~82>1 1 0 1 AD 3 4 2 <83> LOA $hhll,X (A) .... (M) where M=(hhll+(X)) oxxxxxox 1 0 1 1<82:>1 1 0 1 BD 3 5 2 <83:> LOA $hhll,Y (A).._ (M) where M=(hhll+(YJ) oxxxxxox 1 o 1 \.e2>1 o o 1 89 3 5 2 <83> LOA ($zz,X) (A) .... (M) where M=((zz+(X)+ 1)(zz+(X))) oxxxxxox 1 o 1 0< 82>0 oo1 A1 2 6 2 LOA ($zz),Y (A) +- (M) where M=((zz+ 1)(zz)+(Y)) oxxxxxox 1011..:82>0001 81 2 6 2 LOX #$nn (X) .... nn oxxxxxox 1 o 1 oo o 1 o A2 2 2 'O LOX $zz (X) .._ (M) where M=(zz) oxxxxxox 1 0 1 0<82>0 1 1 0 A6 2 3 ....0" LOX $zz,Y (X) .... (M) where M=(Zz+(Y)) oxxxxxox 1 0 1 1<82>0 1 1 0 86 2 4 LOX $hhll (X) .... (M) where M=(hhll) oxxxxxox 1 0 1 0<82:>1 1 I 0 AE 3 4 <03> LDX $hhll,Y (X) .... (M) where M=(hhll+(Y)) oxxxxxox 1 0 1 1<82,.1 1 1 0 BE 3 5 <83:> LDY #$nn (Y)-+- nn oxxxxxox 1 0 1 0<82>0 0 0 0 AO 2 2 LOY $zz (Y)-+- (M) where M=(zz) oxxxxxox 1 0 1 0<82>0 1 0 0 A4 2 3 LOY $zz,X (Y)-+- (M) where M=(ZZ+(X)J oxxxxxox 1 0 1 1<82>0 1 0 0 B4 2 4 LOY $hhll (Y) .... (M) where M=(hhll) oxxxxxox 1 0 1 0<82,.1 1 0 0 AC 3 4 <83> LOY $hhll,X (Y) .... (M) where M=(hhll+(X)) oxxxxxox 1 0 1 1<82>1 1 0 0 BC 3 5 <83> ~ LDM #$nn,$z (M)-4- nn where M=(zz) xxxxxxxx 0 0 1 1<82:>1 1 0 0 3C 3 4 ~c <83:> f STA $zz (M).._ (A) where M=(zz) xxxxxxxx 1 0 0 0<82>0 1 0 1 85 2 4 I- STA $zz,X (M)-4- (AJ where M=(ZZ+(X)) xxxxxxxx 1001<82>0101 95 2 5 . !'! Q STA $hhll (M)-4- (A) where M=(hhll) xxxxxxxx t 0 0 0<82>1 1 0 1 <83> SD 3 5 STA $hhll,X (M)-4- (A) where M=(hhll+(X)) xxxxxxxx 1 0 0 1<82>1 1 0 1 90 3 6 <83> STA $hhll,Y (M)-4- (A) where M=(hhll+(Y)) xxxxxxxx 1 0 0 1<82>1 0 0 1 99 3 6 <83:> ~ STA ($zz,X) (M)<0- (A) where M=((zz+(XJ+ 1)(zz+(X))) xxxxxxxx 1 0 0 0<82>0 0 0 1 81 2 7 .s STA ($zz),Y (/) (M) +- (A) where M=((zz+ 1)(zzJ+(Y)) xxxxxxxx 1 0 0 1<82:>0 0 0 1 91 2 7 STX $zz (M) .._ (X) where M=(zz) xxxxxxxx 1 0 0 0<82>0 1 1 0 86 2 4 STX $zz,Y (MJ .._ (X) where M=(zz+(Y)) xxxxxxxx 1 0 0 1<82>0 1 1 0 96 2 5 STX $hhll (M) +- (X) where M=(hhll) xxxxxxxx 1 0 0 0<82>1 1 1 0 SE 3 5 <83> STY $zz (MJ .._ (YJ where M=(zzJ xxxxxxxx 1 0 0 0<82>0 1 0 0 84 2 4 STY $zz,X (MJ .._ (Y) where M=(zz+(X)) xxxxxxxx 1 0 0 1<82>0 1 0 0 94 2 5 STY $hhll (M) .._ (Y) where M=(hhllJ xxxxxxxx 1 0 0 0<82>1 1 0 0 SC 3 6 <83> .... (A) i '&; c f TAX TXA TAY TYA (X) (A) - (X) (Y) .... (A) (AJ .... (Y) oxxxxxox 1 0 1 0 oxxxxxox 1 0 0 0 oxxxxxox 1 0 1 0 oxxxxxox 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 AA SA AS 98 1 1 1 1 2 2 2 2 (X) .... (S) I- TSX oxxxxxox 1 0 1 1 1 0 1 0 BA 1 2 TXS (SJ .... (X) xxxxxxxx 1 0 0 1 1 0 1 0 9A 1 2 c PHA (M(SJ) .._ (A) , (SJ ..._ (S) - 1 xxxxxxxx 0 1 0 0 1 0 0 0 48 1 3 .x.!! PHP (M(S)) .._ (PS) , (SJ .._ (S) - 1 xxxxxxxx 0 0 0 0 1 0 0 0 08 1 3 :ff Ci):. PLA (S) .... (S) + 1 , (AJ .._ (M(S)) oxxxxxox 0 1 1 0 1 0 0 0 68 1 4 0 PLP (S) .._ (S) + 1, (PS)-4- (M(S)) Pr~~fa~~atus 0 0 1 0 1 0 0 0 28 1 4 172 MELPS 740 Machine Language Instruction Table ~ SYMBOL FLAG INSTRUCTION CODE BYTE ~YCLE FUNCTION lliYT-6...lll.Z.Q_ ~~D> Hl::X ~MBER UMBER NOTE "' ADC #$nn (A)+- (A)+m+(C) ooxxxxoo 0 1 1 0<82>1 0 0 1 69 2 2 1 ADC $zz (A)+- (A) + (M) + (C) where M=(zz) ooxxxxoo 0 1 1 0<82>0 1 0 1 65 2 3 1 ADC $zz,X (A)+- (A) + (M) + (C) where M=(zz+(X)) ooxxxxoo 0 1 1 ~82>0 1 0 1 75 2 4 1 ADC $hhll (A)+- (A) + (M) + (C) where M=(hhll) ooxxxxoo 0 1 t 0<82>1 1 0 1 6D 3 4 1 <83> ADC $hhll,X (A)+- (A)+ (M) + (C) where M=(hhll+(X)) ooxxxxoo 0111<82;101 7D 3 5 1 <83> ADC $hhll,Y (A)+- (A) + (M) + (C) where M=(hhll+(Y)) ooxxxxoo 0 1 1 1<82>1 0 0 1 79 3 5 1 <83> ADC ($zz,X) (A)+- (A)+ (M) + (C) ooxxxxoo 0 1 1 0<82>0 0 0 1 61 2 6 1 where M=((zz+(X)+ 1)(zz+(X))) ADC ($zz),Y (A)+- (A) + (M~+ ~C) ooxxxxoo 0 1 1 1<82>0 0 0 1 71 2 6 1 where = (zz+ 1)(zz)+(Y)) SBC #$nn (A)+- (A)-nn-(C) ooxxxxoo 1 1 1 0<82>1 0 0 1 E9 2 2 1 SBC $zz (A)+- (A)-(M)- (C) where M=(zz) ooxxxxoo 1 1 1 0<82>0 1 0 1 ES 2 3 1 SBC $zz,X (A)+- (A) - (M) - \Cl where M=(zz+(X)) ooxxxxoo 1 1 1 1<82>0 1 0 1 FS 2 4 1 SBC $hhll (A)+- (A) - (M) - \Cl where M=(hhll) ooxxxxoo 1 1 1 0<82>1 1 0 1 ED 3 4 1 -" <83> SBC $hhll,X (A)+- (A)-(~-(C) ooxxxxoo 1 1 1 1<82} 1 0 1 FD 3 5 1 where =(hhll+(X)) <83> 2 'iii ..Q SBC $hhll,Y (A)+- (A)-(~-(C) ooxxxxoo 1 1 1 1<82} 0 0 1 F9 3 5 1 where =(hhll+(Y)) <83> c: ..,"c: SBC ($zz,X) If) (A)+- (A)-(M)-(C) where M=((zz+(X)+1)(zz+(X))) ooxxxxoo 1 1 1 0<82>0 0 0 1 E1 2 6 1 0 ..,.., SBC ($zz),Y m ;; (A)+- (A)- (M) -{CJ ooxxxxoo .. ~ Cl. <( INC A where M=((zz+ 1)(zz)+(Y)) (A)+- (A)+1 1 1 1 ~82>0 0 0 1 oxxxxxox 0 0 1 1 1 0 1 0 F1 3A 2 1 6 2 1 0 INC $zz (M) +- (M) + 1 where M=(zz) oxxxxxox 1110<82>0110 E6 2 5 INC $zz,X (M) +- (M) + 1 where M=(zz+(X)) oxxxxxox 1111<82>0110 F6 2 6 INC $hhll (M) +- (M) + 1 where M=(hhll) oxxxxxox 1 1 1 0<82>1 1 1 0 EE 3 6 <83> INC $hhll,X (M)+- (M) + 1 where M=(hhll+(X)) oxxxxxox 1 1 1 1<82>1 1 1 0 FE 3 7 <83> DEC A (A)+- (A)-1 oxxxxxox 0 0 0 1 1 0 1 0 1A 1 2 DEC $zz (M) +- (M) - 1 where M=(zz) oxxxxxox 1 1 0 0<82>0 1 1 0 C6 2 5 DEC $zz,X (M) +- (M) - 1 where M=(ZZ+(X)) oxxxxxox 1 1 0 1<82>0 1 1 0 D6 2 6 DEC $hhll (M) +- (M) -1 where M=(hhll) oxxxxxox 1 1 0 0<82>1 1 1 0 CE 3 6 <83> DEC $hhll,X (M) +- (M)-1 where M=(hhll+(X)) oxxxxxox 1101<82;110 DE 3 7 <83> INX (X) - (X) + 1 oxxxxxox 1 1 1 0 1 0 0 0 ES 1 2 DEX (X) ... (X)-1 oxxxxxox 1 1 0 0 1 0 1 0 CA 1 2 INY (Y)+ (Y) + 1 oxxxxxox 1 1 0 0 1 0 0 0 cs 1 2 DEY (Y) - (Y)-1 oxxxxxox 1 0 0 0 1 0 0 0 88 1 2 {ll MUL $zz,X M(S), (A) +- (A)x M(zz+X) :;?.: xxxxxxxx 0 1 1 0 0 0 1 0 62 2 15 8 - 0 ~ >. DIV $zz,X (S) +- (S)-1 (At +- (M(zz+X+1), M(zz+X)HA) M S) +- One's complement of remainder xxxxxxxx 1 1 1 0 0 0 1 0 E2 2 16 8 ~ (S) +- (S)-1 173 MELPS 740 Machine Language Instruction Table ~ FLAG INSTRUCTION CODE BYTE hlYCLE on SYMBOL FUNCTION NVTBD I K nz.n._os D4 03 02 01 DJ HE ~MBER UMBER NOT~ AND #$nn (A)+- (A)A m oxxxxxox o o 1 0< 82>1 o o 1 29 2 2 1 AND $zz (A)._ (A)A (M) where M=(Z2) oxxxxxox 0 0 1 O0 1 0 1 25 2 3 1 AND $zz,X (A)+- (A)A (M) where M=(zz+(X)) oxxxxxox 0011<82>0101 35 2 4 1 AND $hhll (A)+- (A)A (M) where M=(hhll) oxxxxxox 0010<82}101 2D 3 4 1 AND $hhll,X (A)+- (A)A (M) where M=(hhll+(X)) oxxxxxox 00111101 3D 3 5 1 <93> AND $hhll,Y (A)+- (A)A (M) where M=(hhll+(Y)) oxxxxxox 0011<82>1001 39 3 5 1 <83> AND ($zz,X) (A) .... (A) A (M) oxxxxxox 0 0 1 O0 0 0 1 21 2 6 1 where M=((zz+(X)+1)(zz+(X))) AND ($zz),Y {A)._. (A)A (M) where M=((zz+ 1)(zz)+(Y)) oxxxxxox 0011<82>0001 31 2 6 1 ORA #$nn (A)+- (A) v m oxxxxxox 0 0 0 0<82:>1 0 0 1 09 2 2 1 ORA $zz (A) +- (A) v (M) where M=(Z2) oxxxxxox 0 0 0 0<82>0 1 0 1 05 2 3 1 ORA $zz,X (A)+- (A)v (M) where M=(zz+(X)) oxxxxxox 0 0 0 1<82>0 1 0 1 15 2 4 1 ORA $hhll (A)+- (A)v (M) where M=(hhll) oxxxxxox 0 0 0 0<82>~ 1 0 1 OD 3 4 1 <83> c ORA $hhll,X (A)+-. (A)v (M) where M=(hhll+(X)) oxxxxxox 0001<82>1101 10 3 5 1 .!! <83> c .!! iii :;; .. i! ORA $hhll,Y 0. 0 (A)+- (A)v (M) where M=(hhll+(Y)) oxxxxxox 0 0 0 1<82>1 0 0 1 <83> 19 3 5 1 0. ORA ($zz,X) (A)+- (A) v (M) oxxxxxox 0 0 0 0<02:>0 0 0 1 01 2 6 1 0 " ·;;, where M=((zz+(X)+1)(zz+(X))) oxxxxxox 0001<02>0001 .... ORA ($zz),Y 0 (A)+- (A)v (M) where M=((zz+ 1)(zz)+(Y)) 11 2 6 1 EOR #$nn (A)+- (A) V nn oxxxxxox 0 1 0 0<82>1 0 0 1 49 2 2 1 EOR $ZZ (A) +- (A)V (M) where M=(Z2) oxxxxxox 0 1 0 0<82>0 1 0 1 45 2 3 1 EOR $zz,X (A)+- (A)V (M) where M=(zz+(X)) oxxxxxox 0 1 0 1<82>0 1 0 1 55 2 4 1 EOR $hhll (A)+- (A)V (M) where M=(hhll) oxxxxxox 0 1 0 0<82:>1 1 0 1 4D 3 4 1 <83> EOR $hhll,X (A) +- (A) V (M) where M=(hhll+(X)) O)(XXXXOX 0 1 0 1<82>1 1 0 1 5D 3 5 1 <83> EOR $hhll,Y (A) .._ (A) V (M) where M=(hhll+(Y)) oxxxxxox 0101<82}001 59 3 5 1 <83> EOR ($zz,X) (A) +- (A) V (M) oxxxxxox 0 1 0 0<82>0 0 0 1 41 2 6 1 where M=({zz+(X)+1)(zz+(X))) EOR ($zz),Y (A) +- (A) V (M) where M=((zz+ 1)(zz)+(Y)) oxxxxxox 0 1 0 1,.,,0 0 0 1 51 2 6 1 COM $zz (M) +- (M) where M=(zz) oxxxxxox 0 1 0 0<82:>0 1 0 0 44 2 5 BIT $zz (A)" (M) where M=(zz) M,M~xxxox 0 0 1 0<82>0 1 0 0 24 2 3 BIT $hhll (A)" (M) where M=(hhll) M,M~xxxox 0 0 1 0<82>1 1 0 0 2C 3 4 <83> TST $zz (M)=O? where M=(ZZ) oxxxxxox 0 1 1 0<82>0 1 0 0 64 2 3 174 MELPS 740 Machine Language Instruction Table ~ FLAG INSTRUCTION CODE BYTE ~YCLE on SYMBOL FUNCTION LN_Vlll..Jl...LZ.Q. ~!l4D~ ~ ~MBER UMBER NOT~ CMP #$nn (A)-nn oxxxxxoo 1100<82>1001 C9 2 2 3 CMP $zz (A)-(M) where M=(zz) oxxxxxoo 1100<82>0101 C5 2 3 3 CMP $zz,X (A)-(M) where M=(zz+(X)) oxxxxxoo 1 1 o 1.ce2>o t o 1 D5 2 4 3 CMP $hhll (A)-(M) where M=(hhll) oxxxxxoo 1 1 0 0<82>1 1 0 1 CD 3 4 3 <83> CMP Shhll,X (A)-(M) where M=(hhll+(X)) oxxxxxoo 1101<82,.1101 DD 3 5 3 -~ <83> c c oxxxxxoo 1101<82>1001 a CMP $hhll,Y (A)-(M) s where M=(hhll+(Y)) <83:> D9 3 5 3 i... CMP ($zz,X) (A)-(M) ~E where M=((zz+(X)+ 1)(zz+(X))) oxxxxxoo 1 1 0 0<82>0 0 0 1 C1 2 6 3 E CMP ($zz),Y (A)-(lvl) 0 where M=((zz+ 1)(zz)+(Y)) oxxxxxoo 1101<82>0001 D1 2 6 3 0 (.) 0 CPX #$nn (X)-nn oxxxxxoo 1 1 1 0< 82>0 o o o EO 2 2 CPX $zz (X)-(M) where M=(zz) oxxxxxoo 1 1 1 oo 1 o o E4 2 3 CPX $hhll (X)-(M) where M=(hhll) oxxxxxoo 1 1 1 o1 1 o o EC 3 4 <83> CPY #$nn (Y)-nn oxxxxxoo 1 1 o 0<112>0 o o o co 2 2 CPY $zz (Y)-(M) where M=(zz) oxxxxxoo 1 1 0 0<82>0 1 0 0 C4 2 3 l CPY $hhll (Y)-(M)J where M=(hhll) oxxxxxoo 1 1 0 0<82} 1 0 0 cc 3 4 <83> ASL A LeftShift~O oxxxxxoo 0 0 0 0 1 0 1 0 OA 1 2 ~-~~ ASL $zz oxxxxxoo 0 0 0 0<82>0 1 1 0 06 2 5 ASL $zz,X Left Shift where M=(ZZ+(X)) oxxxxxoo 0001<82>0110 16 2 6 ASL $hhll ~o where M=(hhll) oxxxxxoo 0 0 0 0<82>1 1 1 0 OE 3 6 c c83> 0 ::::: ASL $hhll,X where M=(hhll+(X)) oxxxxxoo 1E 3 7 I! 0001<82>1110 ... ... <83> oxxxxxoo 0 1 0 0 1 0 1 0 r 0 LSR A RightShiftO~ 4A 1 2 ~-~~ LSR $zz oxxxxxoo o 1 o 0< 82>0 1 1 0 46 2 5 LSR $zz,X Right Shift where M=(zz+(X)) oxxxxxoo 0 1 0 1<82>0 1 1 0 56 2 6 LSR $hhll ~ where M=(hhll) oxxxxxoo 0 1 0 oc82>1 1 1 0 4E 3 6 c83> = :c LSR $hhll,X where M=(hhll+(X)) oxxxxxoo 010~ 82}1 1 0 c83> SE 3 7 ,,c ROLA UI Left Shiftrf\1As A1Ao~ oxxxxxoo 0 0 1 0 1 0 1 0 2A 1 2 • oxxxxxoo 0 0 1 0<82>0 1 1 0 i~~· where M=(zz) 26 ! ROL $zz 2 5 B 0 ROL $zz,X ~ where M=(zz+(X)) oxxxxxoo 0 0 t t< 82>o 1 1 0 36 2 6 a: ijM1Ms ROL $hhll Mi Mo where M=(hhll) oxxxxxoo 0 0 1 0<82>1 1 1 0 2E 3 6 c83> ROL $hhll,X where M=(hhll+(X)) oxxxxxoo O o 1 tcB:C.1 1 1 0 3E 3 7 c83> RORA Right Shift~1As A1hib oxxxxxoo 0 1 1 0 1 0 1 0 6A 1 2 ROR $zz where M=(zz) oxxxxxoo 0 1 1 OcBbO 1 1 0 66 2 5 ROR $zz,X where M=(zz+(X)) oxxxxxoo 0 1 1 1<82>-o 1 1 0 76 2 6 ROR $hhll )d!!hs:.::.' M1M oti where M=(hhll) oxxxxxoo 0 1 1 0<82>-1 1 1 0 <83> 6E 3 6 ROR $hhll,X where M=(hhll+(X)) oxxxxxoo 0 1 1 1<82>-1 1 1 0 7E 3 7 <83> RRF $zz ri!l/ ¥•IM3 16Moi where M=(ZZ) xxxxxxxx 1 o o o<..,o o 1 o 82 2 8 CLB i,A (Ai) + 0 where i=O - 7 xxxxxxxx i i i 1 1 0 1 1 (2i+1)•10+8 1 2 -·· _&c CLB i,$zz miiiE SEB i,A :E SEB i,$zz (Mi)+ (M~ + o where i=O - 7, M=(zz) (Ai) ..... 1 where i=O - 7 1 where i=O - 7, M=(zz) XXXXXXXX I I I 1 ,.,,1 1 1 1 (21+1)•10+F xxxxxxxx i i i 0 1 0 1 1 xxxxxxxx I I I 0~111 2i•10+8 2i•10+F 2 1 2 5 2 5 175 MELPS 740 Machine Language Instruction Table ~ SYMBOL FLAG ll'!§IRUCIION CODE BYTE ~YCLE an FUNCTION ~i0l'D6~SD4~:l.!l!1lj I)) Htll UMB~ UMBER NOT~ CLC (CJ- 0 xxxxxxx 0 0 0 0 1 1 0 0 0 18 1 2 SEC (CJ- 1 XXXXXXX I 0 0 1 1 1 0 0 0 38 1 2 m CLO (DJ- 0 xxxxoxxx 1 1 0 1 1 0 0 0 D8 1 2 -- c SEO (DJ- 1 XXXXIXXX 1 1 1 1 1 0 0 0 F8 1 2 ~ Ill CLI (I) 0 xxxxxoxx 0 1 0 1 1 0 0 0 58 1 2 . m ii: SEI CLT (I) 1 xxxxxixx 0 1 1 1 xxoxxxxx 0 0 0 1 1 0 0 0 0 0 1 0 78 12 1 1 2 2 (T) - 0 SET (T) - 1 )()(!)()()()()( 0 0 1 1 0 0 1 0 32 1 2 CLV M- o xoxxxxxx 1 0 1 1 1 0 0 0 B8 1 2 BRA $hhll (PC) - (PC) + 2 + Rel xxxxxxxx 1000<82>0000 80 2 4 JMP $hhll (PC)-hhll xxxxxxxx 0100<8:!>1100 4C 3 3 c83> JMP ($hhll) (PCL)-(hhll), (PCft-(hhll+1) xxxxxxxx 0 1 1 oc0:!>1 1 0 0 SC 3 5 <83> Q. E JMP ($zz) (PCL)-(zz), (PCH)+(zz+1) xxxxxxxx 1 o 1 1< 82:l' O· 1 o B2 2 4 ..,:I JSR $hhll (M(S))-(PCft, (S)-(S)-1, (M(S))-(PCL), )()()()()()()()( 0010<8:!>1100 20 3 6 (S)-(S}---1 , and (PC) - hhll <83> JSR ($zz) (M(S))-(PCij, (S)-(S)-1, (M(S))+(PCL), )()()()()()()()( 0000<82:llo10 02 2 7 (S) -(S)-1, (PCL) - (zz), and (PCH) + (zz+ 1) JSR \$hhll (M(S))-(PCij, (S)-(S)-1, (M(S))+ (PCL), )()()()()()()()( 0010<82,!1010 22 2 5 (S)-(S}---1, (PCL)-11, and(PCH)+FF BBC i,A,$hhll When(Ai)=1)•10+7 3 5 4 When(Mi}=1 (PC) - (PC)+ 3 <83> E BBS i,A,$hhll When(Ai)=1 (PC) - (PC)+ 2 +Rel Where i= 1001<82>0000 90 2 2 4 WhenC =1 PC - PC +2 c --- f m .c BCS $hhll rcl+2+Rel xxxxxxxx 1011<82:llooo BO 2 2 4 ...c When!Cl=1 rel + WhenC =O PC - PC +2 f BNE $hhll When!Z)=O tel tCl+2+ Rel xxxxxxxx 110\82:llooo DO 2 2 4 m When Z)=1 PC PC +2 BEO $hhll When(Z)=1 (PCl (PC)+2+Rel ')()()()()()()()( 1 1 1 \ 82>0 o o o FO 2 2 4 When(Z)=O (PC (PC)+2 BPL $hhll When!Nl=O !Pel - rcl+2+ Rel )()()()()()()()( 0001<82>0000 10 2 2 4 WhenN =1 PC - PC +2 BMI $hhll )()()()()()()()( 0011<~000 30 2 2 4 When!Nl=1 !Pel - iPCl+2+Rel WhenN =O PC - PC +2 BVC $hhll When(V)=O tel - tCl+2+Rel )()()()()()()()( 0101<82,!JOOO 50 2 2 4 When(V)=1 PC + PC +2 BVS $hhll When(~=1 (PCl + (PC)+ 2 +Rel xxxxxxxx 0111<82,!JOOO 70 2 2 4 When( =O (PC + (PC) + 2 RTI (S)+-(S) + 1, (PS)-(M(S)), (S)+(S) + 1, Previous status 0 1 0 0 0 0 0 0 40 1 6 E (PC L)-(M(S)), (S)+(S) + 1, and (PCH)- (M(S)) in stack • :I a: ATS (S)+-(S) + 1, (PCL)+(M(S)), (S)+-(S) + 1, (PCH)-(M(S)), and (PC) - (PC) +1 )()()()()()()()( 0 1 1 0 0 0 0 0 60 1 6 BAK ~)-1, (P~-(PC) + 2, (M(S))-(PCH), lnterrup -s-1, (~)+(PCL),S-S-1, )()()(1)(1)()( 0 0 0 0 0 0 0 0 00 1 7 (M(S(~-(P ~-s-1, (I) -1, and C)+ RS Other NOP (PC) - (PC) + 1 xxxxxxxx 1 1 1 0 1 0 1 0 EA 1 2 FST xxxxxxxx 1 1 1 0 Connec1 X OUTF pin wi1h internal oscillation circuit. 0 0 1 0 E2 1 2 5 SLW Cut XouTF pin with internal oscillation circuit. xxxxxxxx 1 1 0 0 0 0 1 0 C2 1 2 5 Special WIT Internal clock source is stopped. xxxxxxxx 1 1 0 0 0 0 1 0 C2 1 2 6 STP Oscillation is stopped. xxxxxxxx 0 1 0 0 0 0 1 0 42 1 2 7 176 MELPS 740 Machine Language Instruction Table Symbol Means Symbol Means ~ccumulater !x Bit I of accumulator Index register X \ hh II Special page mode Higher byte of address (0-255) Lower byte of address (0-255) y Index register Y zz Zero Page address (0-255) M Memory nn Data at 0-255 Mi Bit I of memory i Data at 0-7 PS Processor status register iii Data at 0-7 s Stack pointer <82> Second byte of instruction PC Program counter <83> Third byte of instruction - PCL Lower byte of program counter Rel Relative address PCH Higher byte of program counter BAD RS Break address N Negative flag Direction of data transfer v Overflow flag () Contents of register or memory T X modified operation mode flag + Add B Break flag - Substract D Decimal mode flaR v Logical OR I Interrupt disable ag A Logical AND z Zero flag v - Logical Exclusive OR c Carry flag Ne~ative # Immediate mode x Sta le flag after execution $ Hexadecimal 0 Variable flag after execution Note 1 : Listed function is when (T) = 0. When (T) = 1, (M(X)) is entered instead of (A) and the cycle number is increased by 3. Note 2: Ditto. rhe cycle number is increased by 2. Note 3: Ditto. The cycle number is increased by 1. Note 4: The cycle number is increased by 2 when a branch is occurred. Note 5: This instruction is provided for M50740A-XXXSP/FP, 50740ASP, M50741-XXXSP/FP, M50752-XXXSP, M50 757-XXXSP and M50758-XXXSP. Note 6: This instruction is not provided for M50740A-XXXSP/FP, 50740ASP, M50741-XXXSP/FP, M50752-XXXSP, M50757-XXXSP and M50758-XXXSP. Note 7: This instruction is not provided for M50752-XXXSP, M50757-XXXSP and M50758-XXXSP. Note 8: This instruction is provided for special type only (for example M37450 family). Note 9: The "CYCLE NUMBER" means the cycle number of the internal clock 0. 177 APPENDIX3 MELPS 740 Instruction Hexadecimal Code Table ~3-DO 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 xadecimal notation 0 1 2 3 4 5 6 7 8 9 A B c D E F 0000 0 BRK ORA JSR BBS IND)( ~.IND O,A - ORA ASL BBS PHP ORA ASL SEB ZP ZP O,ZP llJM A O,A - ORA ASL SEB ABS ABS O,ZP 0001 1 BPL ORA CLT BBC IND,Y O,A - ORA ASL BBC CLC ORA DEC CLB ZP,X ZP,X O,ZP jABS,Y A O,A - ORA ASL CLB ABS,X ABS,X O,ZP JSR AND JSR BBS BIT AND ROL BBS PLP AND ROL SEB BIT AND ROL SEB 0010 2 ABS IND,X SP 1,A ZP ZP ZP 1,ZP llJM A 1,A ABS ABS ABS 1,ZP AND BBC BMI IND,Y SET 1,A - AND ROL BBC SEC ABS,Y A 1,A LDM AND INC CLB AND ROL CLB 0011 3 ZP,X ZP,X 1,ZP ZP ABS,X ABS,X 1,ZP 0100 4 RTI EOR STP BBS COM EOR LSR BBS PHA EOR LSR SEB JMP EOR LSR SEB IND,X 2,A ZP ZP ZP 2,ZP llJM A 2,A ABS ABS ABS 2,ZP 0101 5 BYC EORIND,Y - BBC 2,A - EOR LSR BBC CLI EOR ZP,X ZP,X 2,ZP ABS,Y - CLB 2,A - EOR LSR CLB ABS,X ABS,X 2,ZP RTS ADC BBS TST ADC ROR BBS PLA ADC ROR SEB JMP ADC ROR SEB ~~~ 3,A ZP ZP ZP 3,ZP 0110 6 IND,)( ADC . BBC ADC ROR BBC llJM ADC A 3,A CLB IND ABS ABS 3,ZP ADC ROR CLB 3,A - 0111 7 BYS IND,Y - ZP,X ZP,X 3,ZP SEI ABS,Y - 3,A - ABS,X ABS,X 3,ZP 1000 8 BRA STA RRF BBS STY STA STX BBS DEY IND,)( ZP 4,A ZP ZP ZP TXA SEB STY STA STX SEB 4,ZP - 4,A ABS ABS ABS 4,ZP 1001 9 BCC STAIND,Y - BBC STY STA STX BBC TVA STA TXS CLB 4,A ZP,X ZP,X ZP,X 4,ZP ABS,Y 4,A - STA ABS,X - CLB 4,ZP LDY LDA LDX BBS LDY LDA LDX BBS TAY LDA TAX SEB LDY LDA LDX SEB 1010 A llJM IND,)( 1""1 5,A ZP ZP ZP 5,ZP llJM 5,A ABS ABS ABS 5,ZP 1011 B BCS LDA JMP BBC LDY LDA LDX BBC IND,Y ZP,IND 5,A ZP,X ZP,X ZP,Y 5,ZP LDA CLY jABS,Y TSX CLB LDY LDA LDX CLB 5,A ABS,X ABS,X ~BS,Y 5,ZP CPY CMP BBS CPY CMP DEC BBS CMP SEB CPY CMP DEC SEB 1100 c llJM IND,)( WIT 6,A ZP ZP ZP 6,ZP INY llJM DEX 6,A ABS ABS ABS 6,ZP 1101 D BNE CMPIND,Y - BBC 6,A - CMP DEC BBC CLD CMP ZP,X ZP,X 6,ZP ABS,Y - CLB 6,A - CMP DEC CLB ABS,X ABS,X 6,ZP CPX SBC ¥~~ BBS CPX SBC INC BBS INX SBC NOP SEB CPX SBC INC SEB 1110 E llJM IND,X "..L 7,A ZP ZP ZP 7,ZP lt.t.4 7,A ABS ABS ABS 7,ZP SBC BBC SBC INC BBC SED SBC CLB SBC INC CLB 1111 F BEQ IND,Y - 7,A - ZP,X ZP,X 7,ZP ABS,Y - 7,A - ABS,X ABS,X 7,ZP Note "'1: This instruction is provided for special type only (for example M37450 family). 17.8 APPENDIX4 ASCII Code Table HEX 0 1 2 3 4 5 6 7 0 NUL OLE SP 0 @ p ' p 1 SOH DC1 ! 1 A a a q 2 STX DC2 " 2 B R b r 3 ETX DC3 # 3 c s c s 4 EOT DC4 $ 4 D T d t 5 ENQ NAK % 5 E u e u 6 ACK SYN & 6 F v f v 7 BEL ETB I 7 G w g w 8 BS CAN ( 8 H x h x 9 HT EM ) 9 I y i y A LF SUB * J z j z 8 VT ESC + K [ k { ' c FF FS ' < L \ I I D CR GS - = M ] m } E so RS > N I\ n - F SI us I ? 0 - 0 DEL 179 CONTACT ADDRESSES FOR FURTHER INFORMATION JAPAN =cc==c-===· SOUTHWEST WEST GERMANY=::.-:==~ · Semiconductor Marketing Division Mitsubishi Electronics America, Inc. Mitsubishi Electric Europe GmbH Mitsubishi Electric Corporation 991 Knox Street Headquarters: 2-3, Marunouchi 2-chome Torrance, CA 90502 Gothear Str. 8 Chiyoda-ku, Tokyo 100, Japan Telephone: (213) 515-3993 4030 Ratingen 1, West Germany Telex: 24532 MELCO J Facsimile: (213) 217-5781 Telex: 8585070 MED D Telephone: (03) 218-3473 Telephone: (02102) 4860 (03) 218-3499 SOUTH CENTRAL Facsimile: (02102) 486-115 Facsimile: (03) 214-5570 Mitsubishi Electronics America, Inc. 1501 Luna Road, Suite 124 Munich Office: Overseas Marketing Manager Carrollton, TX 75006 ArabellastralSe 31 Kita-ltami Works Telephone: (214) 484-1919 8000 Monchen 81, West Germany 4-1, Mizuhara, ltami-shi, Facsimile: (214) 243-0207 Telex: 5214820 Hyogo-ken 664, Japan Telephone: (089) 919006-09 Telex: 526408 KMELCO J NORTHERN Facsimile: (089) 9101399 Telephone: (0727) 82-5131 Mitsubishi Electronics America, lnc. Facsimile: (0727) 72-2329 15612 Highway 7 :!1243 FRANCE~~~~· Minnetonka, MN 55345 Mitsubishi Electric Europe GmbH HONG KONG ~c=c·. ~~"·"~=~--,.-= Telephone: (612) 938-7779 55, Avenue de Colmar MITSUBISHI ELECTRIC (HK) LTD. Facsimile: (612) 938-5125 92563 Rueil Malmaison Cedex 25 Floor, Leighton Centre, Telex: 632326 77, Leighton Road. Causeway Bay. NORTH CENTRAL Telephone: 47087871 Hong Kong Mitsubishi Electronics America, Inc. Facsimile: 47513622 Telex: 60800 MELCO HX 800 N. Bierman Circle Telephone: (5) 773901-3 Mt. Prospect, IL 60056 ITALY============= Facsimile: (5) 895-3104 Telephone: (312) 298-9223 Mitsubishi Electric Europe GmbH Facsimile: (312) 298-0567 Centro Direzionale Colleoni SINGAPORE====== Palazzo Cassiopea 1 MELCO SALES SINGAPORE PTE. NORTHEAST 20041 Agrate Brianza I-Milano LTD. Mitsubishi Electronics America, Inc. Telephone: (039) 636011 230 Upper Bukit Timah Road # 03- 200 Unicorn Park Drive Facsimile: (039) 6360120 01 /15 Woburn, MA 01801 Hock Soon Industrial Complex Telephone: (617) 932-5700 SWEDEN Singapore 2158 Facsimile: (617) 938-1075 Mitsubishi Electric Europe GmbH Telex: RS 20845 MELCO Lastbilsvagen 6B Telephone: 4695255 MID-ATLANTIC 5-19149 Sollentuna, Sweden Facsimile: 4695347 Mitsubishi Electronics America, lnc. Telex: 10877 (meab S) 800 Cottontail Lane Telephone: (08) 960468 TAIWAN=========== Somerset, NJ 08873 Facsimile: (08) 966877 MELCO-TAIWAN CO., Ltd. Telephone: (201) 469-8833 U.K.~~~~~--~~~~~~~ 1st fl .. Chung-Ling Bldg, Facsimile: (201) 469-1909 363, Sec. 2, Fu-Hsing S Road, Mitsubishi Electric (U.K.) Ltd. Taipei R.0.C. SOUTH ATLANTIC Travellers Lane Telephone: (02) 735-3030 Mitsubishi Electronics America, Inc. Hatfield Facsimile: (02) 735-6771 2500 Gateway Center Blvd., Suite 300 Herts AL 10 BX B, England, U .K. Telex: 25433 CHURYO "MELCO- Morrisville. NC 27560 Telephone: (0044) 7072 76100 TAIWAN" Telephone: (404) 368-4850 Facsimile: (0044) 7072 78692 Facsimile: (404) 662-5208 U.S.A.==~~~= AUSTRALIA======~~ NORTHWEST SOUTHEAST Mitsubishi Electric Australia Pty. Ltd. Mitsubishi Electronics America, Inc. Mitsubishi Electronics America, Inc. 73-75, Epping Road, North Ryde, 1050 East Arques Avenue Town Executive Center P.O. Box 1567, Macquarie Centre, Sunnyvale, CA 94086 6100 Glades Road # 210 N.S.W.. 2113, Australia Telephone: (408) 730-5900 Boca Raton, FL 33433 Telex: MESYD AA 26614 Facsimile: (408) 730-4972 Telephone: (407) 487-7747 Telephone: (02) (888) 5777 Facsimile: (407) 487-2046 Facsimile: (02) (887) 3635 SAN DIEGO Mitsubishi Electronics America, Inc. CANADA 11545 West Bernardo Court Mitsubishi Electronics America, Inc. Suite 100 6185 Ordan Drive, Unit #110 San Diego, CA 92128 Mississauga, Ontario, Canada L5T 2E1 Telephone: (619) 592-1445 Telephone: (416) 670-8711 Facsimile: (619) 592-0242 Facsimile: (416) 670-8715 DENVER Mitsubishi Electronics America, Inc. Mitsubishi Electronics America, Inc. 300 March Road, Suite 302 4600 South Ulster Street Kanata, Ontario, Canada K2K 2E2 Metropoint Building, 7th Floor Telephone: (416) 670-8711 Denver, CO 80237 Facsimile: (416) 670-8715 Telephone: (303) 7 40-6775 Facsimile: (303) 694-0613 MITSUBISHI SEMICONDUCTORS MELPS 740 (SOFTWARE) USER'S MANUAL November. First Edition 1989 Editioned by Committee of editing of Mitsubishi Semiconductor USER'S MANUAL Published by Mitsubishi Electric Corp., Semiconductor Marketing Division This book, or parts thereof, may not be reproduced in any form without permission of Mitsubishi Electric Corporation. ©1989 MITSUBISHI ELECTRIC CORPORATION MITSUBISHI SEMICONDUCTORS SHINGLE-CHIP 8-BIT MICROCOMPUTERS SERIES 740 J..MITSUBISHI ELECTRIC CORPORATION HEAD OFFICE MITSUBISHI DENKI BLDG . MAAUNOUCHI. TOKYO 100 TELE X J24532 CABLE MELCO TOKYO These products CJ( technologies are subject to Japanese and/CJ( COCOM strategic restrictions, and diversion contrary thereto is prohibited. H-E0204 -A(ROD) Printed in Japan