Hyundai GMS800 Instruction Manual

Gms800 series 8-bit single-chip microcomputers

Advertisement

Quick Links

NOV. 1996
Rev. 1.0
8-BIT SINGLE-CHIP MICROCOMPUTERS
GMS800 Series
Instruction Manual

Advertisement

Table of Contents
loading

Summary of Contents for Hyundai GMS800

  • Page 1 NOV. 1996 Rev. 1.0 8-BIT SINGLE-CHIP MICROCOMPUTERS GMS800 Series Instruction Manual...
  • Page 2 Additional information of this manual may be served by HYUNDAI MicroElectonics Offices in Korea or Distributors and Representatives listed at address directory. HYUNDAI MicroElectonics reserves the right to make changes to any Information here in at any time without notice.
  • Page 3: Table Of Contents

    Table of Contents 1. ADDRESSING MODE......................1 1.1. Inherent Addressing Mode............................ 2 1.2. Immediate Addressing Mode #imm........................ 3 1.3. Direct Page Addressing Mode dp ........................4 1.4. Absolute Addressing Mode !abs ........................5 1.5. Indexed Addressing Mode ............................ 6 1.6. Indirect Addressing Mode............................. 8 1.7.
  • Page 5: Addressing Mode

    Addressing Mode 1. ADDRESSING MODE Addressing refers to the specification, within an instruction, of the location of the operand on which the instruction will operate. Because G8MC core has no 16-bit register, other than the program counter, which can be used to specify an address, it is necessary that G8MC core user understand the various addressing modes.
  • Page 6: Inherent Addressing Mode

    HYUNDAI MicroElectonics 1.1. Inherent Addressing Mode This is a mode that needs no address field at all. The operand is specified implicitly in the definition of the operation code. This mode is used to instructions which operate on registers(A,X,Y,PSW,SP). This mode has an important advantage that executes faster than any two- or three-byte instruction.
  • Page 7: Immediate Addressing Mode

    Addressing Mode 1.2. Immediate Addressing Mode #imm The operand is specified in the instruction itself. In other word, an immediate mode instruction has an operand field rather than an address field. Immediate mode instructions are useful for Initializing registers to a constant value.
  • Page 8: Direct Page Addressing Mode Dp

    HYUNDAI MicroElectonics 1.3. Direct Page Addressing Mode The address field of the instruction gives the address of the operand in memory. The 2nd byte of instruction is the offset from the start address of direct page. Direct Page(dp) is determined by G-flag.
  • Page 9: Absolute Addressing Mode !Abs

    Addressing Mode 1.4. Absolute Addressing Mode !abs The address field of the instruction gives the address of the operand in memory. 2nd byte instruction is the lower address and 3rd byte is the upper address. The disadvantage of absolute addressing mode is to require 3-byte instruction.
  • Page 10: Indexed Addressing Mode

    HYUNDAI MicroElectonics 1.5. Indexed Addressing Mode In the indexed addressing mode the contents of an index register(X,Y) is added to the address part of the instruction to obtain the effective address. The index register contains an index value. The address field of the instruction defines the beginning address of a data array in memory.
  • Page 11 Addressing Mode Y-register Indexed Addressing Mode in absolute address !abs+Y The effective address is determined by adding the address of operand and the contents of Y-register. it is specified to all space of memory. OP CODE Low Address Low Address Operand Instructions X,Memory...
  • Page 12: Indirect Addressing Mode

    HYUNDAI MicroElectonics 1.6. Indirect Addressing Mode The address field of the instruction gives the address where the effective address is stored in memory. X-register Indirect Addressing Mode in direct page ( no offset ) { X } The contents of X-register is the effective address to access in direct page(dp) .
  • Page 13 Addressing Mode dp Indirect Addressing Mode [ dp ] The effective address is the contents of memory pair((dp+1)(dp)) in direct page. OP CODE [dp] Operand Instructions Memory CALL MEMORY 0 Page Example) ( G=0 ) data1 ( 05 ) C005 3F 35 JMP [35H] data2 ( C0 )
  • Page 14 HYUNDAI MicroElectonics dp Indirected Y-register Indexed Addressing Mode [ dp ] + Y The effective address is determined by adding contents of ((dp+1)(dp)) and contents of Y-register. OP CODE [dp] Operand Instructions A,Memory MEMORY 0 Page Example) data1 ( 05 )
  • Page 15: Relative Addressing Mode

    Addressing Mode 1.7. Relative Addressing Mode In this addressing mode, the effective address is calculated current address(the contents of PC) and the contents of address part of instruction. The address part of the instruction is considered as a signed number which can be either positive or negative.
  • Page 16 HYUNDAI MicroElectonics MEMORY Example) ( A=55 F2 30 BBC A.7,30H Op code ( F2 ) Op code Operand ( 30 ) ( IF A =1,) Accumulator PC+30 NEXT +2+30 dp.bit Relative dp.bit,rel The branch operation is determined by the bit in memory specified by bit7,6,5 of op code. The branch address is obtained by adding the contents of operand to the contents of program counter.
  • Page 17 Addressing Mode 1.8. Bit Manipulation Mode Operation is performed by 1bit instruction manipulation. Accumulator Bit Operation A.bit Bit position of accumulator is determined by the upper 3 bits of operand. OP CODE operand Operand Instructions CLRA1 SETA1 MEMORY Example) ( A=00 0B C0 SETA1 A.6 Op code ( 0B )
  • Page 18: Bit Operation Mode Dp

    HYUNDAI MicroElectonics 12-bit Address Space Memory Bit Operation M.bit Operand composes the lower 8bit of 12bits address, the lower 4bits of operand indicate the upper 4bits of 12bits address, also bit position of memory is determined by upper 3 bits of operand 2, bit4 of operand indicates reversal.
  • Page 19: Etc

    Addressing Mode 1.10. Etc. U-page Addressing Mode upage The operand becomes offset address in U-page(FF00h~FFFFh). The program is jumped to the specified address in U-page. OP CODE upage MEMORY Example) 4F 35 PCALL 35H Op code ( 4F ) Operand ( 35 ) FF00 NEXT FF35...
  • Page 20 HYUNDAI MicroElectonics...
  • Page 21: Instruction Set

    Arithmetic/ Logic Operation 16-bit Operation Register / Memory Operation Bit Manipulation Branch / Jump Operation Control Operation & etc. Total Charging space of GMS800 series instruction set as bytes Size 1 Byte 2 Bytes 3 Bytes Total Percents 28 %...
  • Page 22 HYUNDAI MicroElectonics Terminology List Terminology Description A - Register X - Register Y - Register Program Status Word Carry Flag of PSW Overflow Flag of PSW Negative Flag of PSW Master Interrupt Enable Flag of PSW Zero Flag of PSW...
  • Page 23 Instruction Set ( Add with carry ) Function ( A ) + ( M ) + C or A ( A ) + #imm + C Description : Add the contents of memory or immediate data to accumulator with carry. The result is left in the accumulator.
  • Page 24 HYUNDAI MicroElectonics ( Logical AND ) Function ( A ) ( M ) or A ( A ) #imm Description : Logical AND of the accumulator and the contents of memory( or immediate data). The result is left in the accumulator.
  • Page 25 Instruction Set AND1B ( Bit logical AND - 1's complement ) Function ( C ) ~ ( M.bit ) Description : Logical AND of the carry flag and the 1's complement of specified bit of memory. The result is left in the carry flag.  Flag Mnemonic...
  • Page 26 HYUNDAI MicroElectonics ( Branch if bit clear ) Function : if (bit) = 0, then ( PC ) ( PC ) + rel Description : Branches if the specified bit of the accumulator or of the memory is “0”. ...
  • Page 27 Instruction Set ( Branch if carry flag clear ) Function : if (C) = 0, then ( PC ) ( PC ) + rel Description : Branches if carry flag is “0”  Flag Mnemonic OP Code Bytes Cycles Example 62 F03F 8B1F20 AND1 F_SLP...
  • Page 28 HYUNDAI MicroElectonics ( Branch if equal ) Function : if (Z) = 1, then ( PC ) ( PC ) + rel Description : Branches if zero flag is “1”.  Flag Mnemonic OP Code Bytes Cycles Example 115 E085 C4C0 #0C0H ;...
  • Page 29 Instruction Set ( Branch if minus ) Function : if (N) = 1, then ( PC ) ( PC ) + rel Description : Branches if negative flag(N) is “1”  Flag Mnemonic OP Code Bytes Cycles Example WORK0 108 E07C C570 109 E07E 2404 110 E080 9002 MINUS...
  • Page 30 HYUNDAI MicroElectonics ( Branch if plus ) Function : if (N) = 0, then ( PC ) ( PC ) + rel Description : Branches if negative flag is “0”  Flag Mnemonic OP Code Bytes Cycles Example ; DATA MOVE 186 F0E3 1E02 ;...
  • Page 31 Instruction Set ( Software interrupt ) “1” Function M( SP ) SP - 1 , M( SP ) SP - 1 , M( SP ) PSW, SP - 1 , M( FFDEh ) , M( FFDFh ) Description : Generates software interrupt.    Flag Mnemonic...
  • Page 32 HYUNDAI MicroElectonics ( Branch if overflow flag set ) Function : if (V) = 1, then ( PC ) ( PC ) + rel Description : Branches if overflow flag(V) are “1”.  Flag Mnemonic OP Code Bytes Cycles Example...
  • Page 33 Instruction Set CBNE ( Compare and branch if not equal ) Function : ( A ) ( M ) , if (Z) 0 , then ( PC ) ( PC ) + rel Description : Compare the accumulator and the contents of memory and then if the result is not zero, then branch to specified address.
  • Page 34 HYUNDAI MicroElectonics CLRA1 ( Clear A.bit ) Function : ( A.bit ) “ 0 ” Description : Clear the specified bit of accumulator.  Flag Mnemonic OP Code Bytes Cycles CLRA1 A.bit Example 225 E107 2BA0 CLRA1 226 E109 2F02...
  • Page 35 Instruction Set CLRG ( Clear G-flag ) Function : (G) “ 0 ” Description : Clear G-flag   Flag Mnemonic OP Code Bytes Cycles CLRG Example 262 E12D C0 SETG 263 E12E C530 ;LOAD FROM !0130H 264 E130 40 CLRG 265 E131 E505 WORK0 ;STORE TO !0005H...
  • Page 36 HYUNDAI MicroElectonics ( Compare accumulator ) Function : ( A ) ( M ) Description : Compare the accumulator with the contents of memory or immediate data. The results effects N, Z, C and the accumulator and the contents of memory are not changed.
  • Page 37 Instruction Set CMPY ( Compare Y-register ) Function : ( Y ) ( M ) Description : Compare the Y-register with the contents of memory or immediate data. The results effects N, Z, C and the Y-register and the contents of memory are unchanged.  Flag Mnemonic...
  • Page 38 HYUNDAI MicroElectonics ( 1's complement ) Function : ( M ) ~ ( M ) Description : 1’s complement of the contents of memory.  Flag Mnemonic OP Code Bytes Cycles COM dp Example 539 C251 C504 540 C253 2C04...
  • Page 39 Instruction Set ( Decimal adjust for subtraction ) Function Before After ADDED (hex) (hex) 0 ~ 9 0 ~ 9 0 ~ 8 6 ~ F FA ( = -06 ) 7 ~ F 0 ~ 9 A0 ( = -60 ) 6 ~ F 6 ~ F 9A ( = -66 )
  • Page 40 HYUNDAI MicroElectonics ( Decrement ) Function ( M ) Description : Decrement the contents of the accumulator or of the memory by 1.  Flag Mnemonic OP Code Bytes Cycles DEC A DEC dp DEC dp + X DEC !abs...
  • Page 41 Instruction Set ( Disable all interrupts ) Function “ 0 ” Description : Inhibit interrupts by clearing interrupt master flag(I)   Flag Mnemonic OP Code Bytes Cycles Example 243 C000 60 RESET: ;Disable All Interrupts 244 C001 1E 245 C003 C400 RAM_CLR: ;RAM Clear(!0000H->!00BFH) 246 C005 FB...
  • Page 42 HYUNDAI MicroElectonics ( Enable interrupts ) Function “ 1 ” Description : Enable interrupts by setting interrupt master flag   Flag Mnemonic OP Code Bytes Cycles Example 208 C063 E400F3 IMOD,#0 ;PRIORITY OF HARDWARE 209 C066 E48AF6 IENH,#8AH ;ENABLE TIMER0, TIMER2, EXT INT.0...
  • Page 43 Instruction Set EOR1 ( Bit exclusive OR ) ( C ) ⊕ ⊕ ⊕ ⊕ ( M.bit ) Function Description : Exclusive-OR of the carry flag and the specified bit of memory. The results is left in the carry flag.  Flag Mnemonic...
  • Page 44 HYUNDAI MicroElectonics ( Increment ) Function ( M ) Description : Increment the contents of accumulator, register or memory by 1.  Flag Mnemonic OP Code Bytes Cycles INC A INC dp INC dp + X INC !abs INC X...
  • Page 45 Instruction Set ( Unconditional jump ) Function : PC jump address Description : Jump to new address.  Flag Mnemonic OP Code Bytes Cycles JMP !abs JMP [!abs] JMP [dp] Example 298 C10C 3BACC2 LOOP: CALL TXDAT 299 C10F C500 STPDAT 300 C111 4409 301 C113 F004...
  • Page 46 HYUNDAI MicroElectonics ( Load carry ) Function ( M.bit ) Description : The carry flag is loaded with specified bit of memory.  Flag Mnemonic OP Code Bytes Cycles LDC M.bit * The bit4 of 3rd byte is set to "0".
  • Page 47 Instruction Set ( Load memory ) Function : ( M ) #imm Description : The memory is loaded with immediate data.  Flag Mnemonic OP Code Bytes Cycles LDM dp,#imm Example 490 C1FA E40003 TXCLR: DPL,#0 491 C1FD E40004 DPH,#0 492 C200 91C6 CLR1 CMDDAT...
  • Page 48 HYUNDAI MicroElectonics ( Load Y-register ) Function ( M ) Description : The Y-register is loaded with contents of the specified memory or of the immediate data.  Flag Mnemonic OP Code Bytes Cycles LDY #imm LDY dp LDY dp + X...
  • Page 49 Instruction Set ( Logical shift right ) Function          ”0” Description : Move the contents of the Accumulator or of the memory right by one bit position. "0" comes in on the left(bit7). Bit0 into the carry flag.  Flag Mnemonic...
  • Page 50 HYUNDAI MicroElectonics ( No operation ) Function : No operation Description : No operation for 2 cycle.  Flag Mnemonic OP Code Bytes Cycles Example 306 C119 20 STPMOD: CLRC 307 C11A 00 STOP 308 C11B FF 309 C11C FF...
  • Page 51 Instruction Set ( Logical OR ) Function ( A ) ( M ) Description : Logical OR of the accumulator and the contents of memory address or Immediate data. The result is left in the accumulator.  Flag Mnemonic OP Code Bytes Cycles OR #imm...
  • Page 52 HYUNDAI MicroElectonics OR1B ( Bit logical OR - 1's complement ) Function ( C ) ~( M.bit ) Description : Logical OR of the carry flag and 1’s complement of M.bit. The result is left in the carry flag. ...
  • Page 53 Instruction Set ( Pop from stack ) Function : SP SP + 1 , Reg. M( SP ) Description : Pop data from stack.  Flag Mnemonic OP Code Bytes Cycles POP A POP X POP Y POP PSW Example 226 F111 0E PUSH ;...
  • Page 54 HYUNDAI MicroElectonics ( Return from subroutine ) Function : SP SP + 1 , M( SP ), SP + 1 , M( SP ) Description : Return from subroutine.  Flag Mnemonic OP Code Bytes Cycles Example 503 FF02 3B10FF...
  • Page 55 Instruction Set ( Rotate left through carry ) Function           Description : Rotate the accumulator or the contents of memory to the left side by 1bit. Move the carry flag to bit0, and bit7 enter into the carry flag.  Flag Mnemonic...
  • Page 56 HYUNDAI MicroElectonics ( Subtract with carry ) Function ( A ) ( M ) ~( C ) Description : subtract the contents of memory and the complement of carry flag from accumulator. The result is left in the accumulator. ...
  • Page 57 Instruction Set SETA1 ( Set A.bit ) Function : ( A.bit ) “ 1 ” Descriptor : Set the specified bit of accumulator to “1”.  Flag Mnemonic OP Code Bytes Cycles SETA1 A.bit Example 319 E15D 0BA0 SETA1 320 E15F 2F02 KOU3 321 E161 2B00 CLRA1...
  • Page 58 HYUNDAI MicroElectonics SETG ( Set G-flag ) Function : ( G ) “ 1 ” Description : Set G-flag to “1”.  Flag Mnemonic OP Code Bytes Cycles SETG Example 236 E114 C0 SETG 237 E115 C605 WORK0+X ; MOVE FROM PAGE0 TO PAGE1...
  • Page 59 Instruction Set ( Store carry ) Function : ( M.bit ) Description : Store carry flag to the specified bit of memory.  Flag Mnemonic OP Code Bytes Cycles STC M.bit Example 345 F171 3B7AF1 CALL COLK 346 F174 EB3570 35H.3 347 F177 1B83F1 NEXTSTEP...
  • Page 60 HYUNDAI MicroElectonics ( Store X-register ) Function : ( M ) Description : Store the contents of X-register to memory.  Flag Mnemonic OP Code Bytes Cycles STX dp STX dp + Y STX !abs Example 396 F1A2 8F 397 F1A3 EC29 POINTER ;...
  • Page 61 Instruction Set STYA ( Store YA - 16bit accumulator ) Function : ( dp +1 ) ( dp ) Description : Store the contents of 16bit accumulator(YA) to memory pair  Flag Mnemonic OP Code Bytes Cycles STYA dp Example ;============================= ;...
  • Page 62 HYUNDAI MicroElectonics ( Transfer accumulator into X-register ) Function Description : Transfer the accumulator into X-Register.  Flag Mnemonic OP Code Bytes Cycles Example 441 C17A C464 #100 442 C17C A8 LOOP0: 443 C17D 70FD LOOP0 444 C17F E8 ( Transfer accumulator into Y-register ) Function Description : Transfer the accumulator to Y-register.
  • Page 63 Instruction Set TCALL ( Table call ) Function : M( SP ) SP - 1 , M( SP ) SP - 1 , ( Table Vector L ) PC ( Table Vector H ) Description : Table Call subroutine.  Flag Mnemonic OP Code...
  • Page 64 HYUNDAI MicroElectonics TSET1 ( Test and set bits with A ) : A − − − − ( abs ), Function ( abs ) ( abs ) ( A ) Description :  Flag Mnemonic OP Code Bytes Cycles TSET1 !abs...
  • Page 65 Instruction Set ( Test memory ) : (dp) − − − − 00h Function Description : Tests whether contents of memory are “0” or negative. The contents of memory is unchanged.  Flag Mnemonic OP Code Bytes Cycles Example 486 C1A4 E4FF35 35H,#0FFH 487 C1A7 4C35 ( Transfer X-register into accumulator )
  • Page 66 HYUNDAI MicroElectonics ( Transfer Y-register into accumulator ) Function Description : Transfer Y-register to the accumulator.  Flag Mnemonic OP Code Bytes Cycles Example 508 C1B2 3E64 #100 509 C1B4 BE LOOP2: 510 C1B5 70FD LOOP2 511 C1B7 BF ( Exchange accumulator with X-register) Function Description : Exchange the accumulator with the X-register.
  • Page 67 Instruction Set ( Exchange nibbles within the accumulator ) Function Description : Exchange the upper 4bit with the lower 4bit of the accumulator..  Flag Mnemonic OP Code Bytes Cycles Example 533 C1C2 C4F0 #11110000B 534 C1C4 CE ( Exchange memory with accumulator ) Function : ( M ) Description : Exchange the accumulator with the contents of memory.
  • Page 68 HYUNDAI MicroElectonics...
  • Page 69: Appendix

    Appendix 3. APPENDIX 3.1. Instruction Map 00000 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111 HIGH TCALL SET1 SETA1 PUSH STOP dp.bit A.bit,rel dp.bit,rel #imm dp+X !abs .bit TCALL CLRA1 PUSH CLRC #imm dp+X !abs .bit...
  • Page 70: Alphabetic Order Table Of Instruction

    HYUNDAI MicroElectonics 3.2. Alphabetic Order Table of Instruction BYTE CYCLE FLAG OPERATION MNEMONIC NVGBHIZC CODE ADC #imm Add with carry. ADC dp ( A ) ( M ) ADC dp + X NV--H--ZC ADC !abs ADC !abs + Y ADC [ dp + X ]...
  • Page 71 Appendix BYTE CYCLE FLAG OPERATION MNEMONIC NVGBHIZC CODE CALL !abs Subroutine call -------- CALL [dp] M( SP) ( PC ), SP SP - 1, M( SP) ( PC ), SP - 1, if !abs, PC abs ; if [dp], PC ( dp ), PC ( dp+1 ) .
  • Page 72 HYUNDAI MicroElectonics BYTE CYCLE FLAG OPERATION MNEMONIC NVGBHIZC CODE EOR #imm Exclusive OR ( A ) ⊕ ( M ) EOR dp EOR dp + X N-----Z- EOR !abs EOR !abs + Y EOR [ dp + X ] EOR [ dp ] + Y EOR { X } ( C ) ⊕...
  • Page 73 Appendix BYTE CYCLE FLAG OPERATION MNEMONIC NVGBHIZC CODE N-----Z- Multiply : -------- No operation -------- NOT1 M.bit Bit complement : ( M .bit ) ( M .bit ) OR #imm Logical OR OR dp ( A ) ( M ) OR dp + X N-----Z- OR !abs...
  • Page 74 HYUNDAI MicroElectonics BYTE CYCLE FLAG OPERATION MNEMONIC NVGBHIZC CODE -------- SET1 dp.bit Set bit : ( M.bit ) “1” -------- SETA1 A.bit Set A bit : ( A.bit ) “1” -------1 SETC Set C-flag : C “1” SETG --1----- Set G-flag : G “1”...
  • Page 75: Instruction Table By Function

    Appendix 3.3. Instruction Table by Function 1. ARITHMETIC/ LOGIC OPERATION FLAG BYTE CYCLE NVGBHIZC MNEMONIC OPERATION CODE ADC #imm Add with carry. ADC dp ( A ) ( M ) ADC dp + X NV--H-ZC ADC !abs ADC !abs + Y ADC [ dp + X ] ADC [ dp ] + Y ADC { X }...
  • Page 76 HYUNDAI MicroElectonics FLAG BYTE CYCLE NVGBHIZC MNEMONIC OPERATION CODE EOR #imm Exclusive OR ( A ) ⊕ ( M ) EOR dp EOR dp + X N-----Z- EOR !abs EOR !abs + Y EOR [ dp + X ] EOR [ dp ] + Y...
  • Page 77 Appendix 2. REGISTER / MEMORY OPERATION FLAG BYTE CYCLE NVGBHIZC MNEMONIC OPERATION CODE LDA #imm Load accumulator LDA dp ( M ) LDA dp + X LDA !abs N-----Z- LDA !abs + Y LDA [ dp + X ] LDA [ dp ] + Y LDA { X } LDA { X }+ X- register auto-increment : A...
  • Page 78 HYUNDAI MicroElectonics 3. 16-BIT OPERATION BYTE CYCLE FLAG MNEMONIC OPERATION NVGBHIZC CODE NV--H-ZC ADDW 16-Bits add without carry ( YA ) ( dp +1 ) ( dp ) CMPW Compare YA contents with memory pair contents : N-----ZC (YA) (dp+1)(dp)
  • Page 79 Appendix 5. BRANCH / JUMP OPERATION BYTE CYCLE FLAG MNEMONIC OPERATION NVGBHIZC CODE -------- BBC A.bit,rel Branch if bit clear : BBC dp.bit,rel if ( bit ) 0 , then PC ( PC ) -------- BBS A.bit,rel Branch if bit set : BBS dp.bit,rel if ( bit ) 1 , then PC...
  • Page 80 HYUNDAI MicroElectonics 6. CONTROL OPERATION & etc. BYTE CYCLE FLAG MNEMONIC OPERATION NVGBHIZC CODE ---1-0-- Software interrupt : B ”1”, M( SP) ( PC ), SP SP - 1, M( s ) ( PC ), SP SP - 1, M( SP)

Table of Contents