This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
notes:asm:intel8085 [2011/05/01 04:41] – [8085 Subdirectory is created!] 4-30 bewanyk | notes:asm:intel8085 [2011/05/01 04:53] (current) – [Register Functions] 4-30 bewanyk | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======= Intel 8085 ======== | ||
+ | The processor of the GODS! You WISH you were as sexy and amazing as the awe inspiring squishyness that is posessed by those contributing to this processor project! | ||
+ | ======ToDo====== | ||
+ | * Continue working on the other instructions.(Data Transfer Group is completed except for the edit to SHLD and LHLD, Math and Logic have instruction placeholders coded and committed.) | ||
+ | * Build read function to feed interpreter. | ||
+ | * Branch Group needs to be started. | ||
+ | * Stack group needs to be started. | ||
+ | * LHLD and SHLD need an incrimentation of the 2nd byte in the address at the notated location. | ||
+ | * Is ALL the Logic Group included in the ALU or just part? | ||
+ | * Add a SP (Stack Pointer) and PC (Program Counter) registers in the register class for useage with the registers. | ||
+ | |||
+ | =======Who is doing what======== | ||
+ | *Jr018429 | ||
+ | *justion | ||
+ | *bewanyk - Working on instructions within the register class (placeholders in place for logic and math). Cleaning and | ||
+ | *rthatch2 | ||
+ | | ||
+ | |||
+ | ====8085 Subdirectory is created!==== | ||
+ | ===Registers=== | ||
+ | Register is started. | ||
+ | Currently .set and .clear functions roughed out (may want to refine them to take individual bit entries and save with tick). | ||
+ | Beginnind work on the hex code commands for data transfer activities. | ||
+ | |||
+ | * SP and CP registers need to be added. | ||
+ | |||
+ | ===Interpreter (to tie things together)=== | ||
+ | TERP class (for the Interpreter)is going to get the commands and convert them to their appropriate hex code. | ||
+ | Public functions will be: | ||
+ | * read function which will accept the assembly file name and then turn everything over to the private side for execution. | ||
+ | |||
+ | Private will include: | ||
+ | * A hex decoder, in a set of switch statements which sends commends to the register. | ||
+ | * I'm toying with the idea of just accepting the name of the assembly file and putting the actual 'read from file' function here. | ||
+ | |||
+ | ===Arithmetic Logic Unit=== | ||
+ | |||
+ | I've been looking at stuff, and I'm not sure whether we should keep a translator and an interpreter, | ||
+ | |||
+ | The memory is accessible from the register class (I've got it included at the moment. | ||
+ | ======Register Class====== | ||
+ | Right now the Register class contains 7 registers of 8-1bit latches each. they can be utilized individually or in pairs. | ||
+ | The g8sr class is included so all bits are stored as boolean values. | ||
+ | |||
+ | The basic functions are held private. | ||
+ | |||
+ | The class will accept HEX commands (prefaced with an ' | ||
+ | Register designations within the class are alphabetical. | ||
+ | |||
+ | Flags HAVE been implemented in the Register class, but they are currently in an array. | ||
+ | |||
+ | The MOV r1, r2 opcodes are coded and only need a .h updated for them. | ||
+ | |||
+ | The general functions for Logical Ops to rotate right and left, and rotate through carry right and left are coded. | ||
+ | |||
+ | Everything I'm looking at for the Register class will require the passing of either a G8SR object or a character. | ||
+ | =====Memory===== | ||
+ | The 256kB of memory for the 8085 is being represented by a 2 dimensional array of G8SR class objects. | ||
+ | |||
+ | The MEM class has get, put, private address resolution and memory dump functionality at the moment. | ||
+ | =====Instructions===== | ||
+ | Instructions come in one, two, and three byte instructions. | ||
+ | | Byte | | | ||
+ | || One Byte Instruction || | ||
+ | | One | Op Code | | ||
+ | || Two byte instruction || | ||
+ | | One | Op Code | | ||
+ | | Two | Data or Address | | ||
+ | || Three byte instructions || | ||
+ | | One | Op Code | | ||
+ | | Two |Data or | | ||
+ | | Three | Address | | ||
+ | ==Data Transfer Group== | ||
+ | Condition flags are not affected by this group. | ||
+ | | Instruction | Effect | | ||
+ | | MOV r1, r2 | The content of register r2 is moved to register r1 | | ||
+ | | MOV r, M | The content of memory location, whos address is stored in registers H and L, is moved to register r | | ||
+ | | MOV M, r | The content of the register r is moved to memory loaction stored in registers H and L | | ||
+ | | MVI r, data | The content of byte 2 of the instruction is moved to register r. | | ||
+ | | MVI M, data | The content of byte 2 of the instruction is moved to the memory location whose address is stored in H and L | | ||
+ | | LXI rp, data 16 | Byte 3 of the instruction is moved to the high order register of the register pair, byte 2 is moved to the low order register. | | ||
+ | | LDA addr | content of the memory location, whose address is in byte 3 and 3 of the instruction is loaded into the accumulator | | ||
+ | | STA addr | Content of the accumulator is moved to the memory location indicated in bytes 2 and 3. | | ||
+ | | LHLD addr | The content of the memory location at the address in bytes 2 and 3 is loaded into register L. The content of the next memory loaction is loaded into register H. | | ||
+ | | SHLD addr | The content of register L is loaded into the memory location indicated in bytes 2 and 3. The content of register H is loaded into the next memory location. | | ||
+ | | LDAX rp | the content of the memory location whose address is in the register pair is moved to register A. | | ||
+ | | STAX rp | The content of register A is moved to the memory address loaction stored in the register pair. | | ||
+ | | XCHG | The contents of rp H-L are exchanged with the contents of register pair D-L. | | ||
+ | ==Arithmetic Group== | ||
+ | |Instruction| Action | Flags | | ||
+ | | ADD r | The content of register r is added to the accumulator and the result is placed in the accumulator | Z,S,P,C,AC | | ||
+ | | ADD M | The content of memory at address located in H-L is added to the accumulator and result is placed in the accumulator. | Z,S,P,C,AC | | ||
+ | | ADI data | The content of byte 2 is added to the accumulator and result is placed in the accumulator. | Z,S,P,C,AC | | ||
+ | | ADC r | The content of register r and the carry flag is added to the accumulator and the result is stored in the accumulator. | Z,S,P,C,AC | | ||
+ | | ADC M | The content of the memory at location stored in H-L and the carry flag is added to the accumulator and the result is stored in the accumulator. | Z,S,P,C,AC | | ||
+ | | ACI data | The content of the second byte and the carry flag are added to the accumulator and the result is stored in the accumulator. | Z,S,P,C,AC | | ||
+ | | SUB r | The content of register r is subtracted from the accumulator and the result is stored in the accumulator. | Z,S,P,C,AC | | ||
+ | | SUB M | The content of memory location stored in H-L is subtracted from the accumulator and the result is stored in the accumulator. | Z,S,P,C,AC | | ||
+ | | SUI data | The content of the second byte is subtracted from the accumulator and the result is stored in the accumulator. | Z,S,P,C,AC | | ||
+ | | SBB r | The content of the register r and the carry flag are subtracted from the accumulator, | ||
+ | | SBB M | The content of the memory location stored in H-L and the carry flag are subtracted from the accumulator and the result is stored in the accumulator. | Z,S,P,C,AC | | ||
+ | | SBI data | The content of the second byte and the carry flag are subtracted from the accumulator and the result is stored in the accumulator. | Z,S,P,C,AC | | ||
+ | | INR r | The content of register r is incremented by 1. | Z,S,P,AC | | ||
+ | | INR M | The content of memory at location stored in H-L is incremented by 1. | Z,S,P,AC | | ||
+ | | DCR r | The content of the register r is decrimented by 1. | Z,S,P,AC | | ||
+ | | DCR M | The content of memory location stored in H-L is decrimented by 1. | Z,S,P,AC | | ||
+ | | INX rp | The content of register pair rp is incremented by 1. | | | ||
+ | | DCX rp | The content of register pair rp is decrimented by 1. | | | ||
+ | | DAD rp | The content of register pair rp is added to the register pair H-L. If there is a carry, C is set otherwise C is reset. | C | | ||
+ | | DAA | The 8-bit number in the accumulator is adjusted to form two four bit Binary-Coded-Decimal digits. | Z,S,P,C,AC | | ||
+ | ==Logical Group== | ||
+ | | ANA r | content of register r is logically ANDed with the accumulator. The result is placed in the accumulator. | Z,S,P,C,AC | | ||
+ | | ANA M | content of memory location whose address is stored in H-L is logically ANDed with accumulator. The result is placed in the accumulator. | Z,S,P,C,AC | | ||
+ | | ANI data | content of byte 2 is logically ANDed with the accumulator and the result is stored in the Accumulator. | | ||
+ | | XRA r | the content of the register r is XORed with the content of the accumulator and the result is stored in the accumulator. | | ||
+ | | XRA M | The content of the memory location whose address is stored in H-L is XORed with the accumulator and the result is stored in the accumulator. | | ||
+ | | XRI data | The content of the second byte is XORed with A and the result is stored in A. | | ||
+ | | ORA r | The content of the register r is inclusive ORed with A and the result is stored in A. | | ||
+ | | ORA M | The content of the memory location whose address is stored in H-L is ORed with A and the result is stored in A. | | ||
+ | | ORI data | The content of the second byte of the instruction is ORed with A and the result is stored in A. | | ||
+ | | CMP r | The content of the register r is subtracted from A. A remains unchanged. | ||
+ | | CMP M | The content of the memory location whose address is stored in H-L is subtracted from A. A remains unchanged. | ||
+ | | CPI data | The content of the second byte of the instruction is subtracted from the accumulator. | ||
+ | | RLC | The content of the accumulator is rotated left one position. (done needs refine for HEX) | | ||
+ | | RRC | The content of the accumulator is rotated right one position. (done needs refine for HEX)| | ||
+ | | RAL | Rotate left through carry. (done)| | ||
+ | | RAR | Rotate right through carry. (done)| | ||
+ | | CMA | The accumulator is complimented (0s become 1s and 1s become 0s) | | ||
+ | | CMC | The carry flag is complimented. | | ||
+ | | STC | The carry flag is set to 1. | | ||
+ | ==Branch Group== | ||
+ | | JMP addr | | | ||
+ | | Jcondition addr | | | ||
+ | | CALL addr | | | ||
+ | | Ccondition addr | | | ||
+ | | RET | | | ||
+ | | Rcondition | | | ||
+ | | RST n | | | ||
+ | | PCHL | | | ||
+ | ==Stack I/O and Machine Command Group== | ||
+ | | PUSH rp | | | ||
+ | | PUSH PSW | | | ||
+ | | POP rp | | | ||
+ | | POP PSW | | | ||
+ | | XTHL | | | ||
+ | | SPHL | | | ||
+ | | IN port | | | ||
+ | | OUT port | | | ||
+ | | EI | | | ||
+ | | DI | | | ||
+ | | HLT | | | ||
+ | | NOP | | | ||
+ | | RIM | | | ||
+ | | SIM | | | ||
+ | =====Individual Commands===== | ||
+ | | Data Transfer Group ||| | ||
+ | | Command | ||
+ | | MOV A, B | 01111000 | ||
+ | | MOV A, C | 01111001 | ||
+ | | MOV A, D | 01111010 | ||
+ | | MOV A, E | 01111011 | ||
+ | | MOV A, H | 01111100 | ||
+ | | MOV A, L | 01111101 | ||
+ | | MOV B, A | 01000111 | ||
+ | | MOV B, C | 01000001 | ||
+ | | MOV B, D | 01000010 | ||
+ | | MOV B, E | 01000011 | ||
+ | | MOV B, H | 01000100 | ||
+ | | MOV B, L | 01000101 | ||
+ | | MOV C, A | 01001111 | ||
+ | | MOV C, B | 01001000 | ||
+ | | MOV C, D | 01001010 | ||
+ | | MOV C, E | 01001011 | ||
+ | | MOV C, H | 01001100 | ||
+ | | MOV C, L | 01001101 | ||
+ | | MOV D, A | 01010111 | ||
+ | | MOV D, B | 01010000 | ||
+ | | MOV D, C | 01010001 | ||
+ | | MOV D, E | 01010011 | ||
+ | | MOV D, H | 01010100 | ||
+ | | MOV D, L | 01010101 | ||
+ | | MOV E, A | 01011111 | ||
+ | | MOV E, B | 01011000 | ||
+ | | MOV E, C | 01011001 | ||
+ | | MOV E, D | 01011010 | ||
+ | | MOV E, H | 01011100 | ||
+ | | MOV E, L | 01011101 | ||
+ | | MOV H, A | 01100111 | ||
+ | | MOV H, B | 01100000 | ||
+ | | MOV H, C | 01100001 | ||
+ | | MOV H, D | 01100010 | ||
+ | | MOV H, E | 01100011 | ||
+ | | MOV H, L | 01100101 | ||
+ | | MOV L, A | 01101111 | ||
+ | | MOV L, B | 01101000 | ||
+ | | MOV L, C | 01101001 | ||
+ | | MOV L, D | 01101010 | ||
+ | | MOV L, E | 01101011 | ||
+ | | MOV L, H | 01101100 | ||
+ | | MOV A, M | 01111110 | ||
+ | | MOV B, M | 01000110 | ||
+ | | MOV C, M | 01001110 | ||
+ | | MOV D, M | 01010110 | ||
+ | | MOV E, M | 01011110 | ||
+ | | MOV M, A | 01110111 | ||
+ | | MOV M, B | 01110000 | ||
+ | | MOV M, C | 01110001 | ||
+ | | MOV M, D | 01110010 | ||
+ | | MOV M, E | 01110011 | ||
+ | | MVI A, data | 00111110 | ||
+ | | MVI B, data | 00000110 | ||
+ | | MVI C, data | 00001110 | ||
+ | | MVI D, data | 00010110 | ||
+ | | MVI E, data | 00011110 | ||
+ | | MVI H, data | 00100110 | ||
+ | | MVI L, data | 00101110 | ||
+ | | MVI M, data | 00110110 | ||
+ | | LXI B-C, data 16 | 00000001 | ||
+ | | LXI D-E, data 16 | 00010001 | ||
+ | | LXI H-L, data 16 | 00100001 | ||
+ | | LXI SP, data 16 | 00110001 | ||
+ | | LDA addr | 00111010 | ||
+ | | STA addr | 00110010 | ||
+ | | LHLD addr | 00101010 | ||
+ | | SHLD addr | 00100010 | ||
+ | | LDAX B-C | 00001010 | ||
+ | | LDAX D-E | 00011010 | ||
+ | | LDAX H-L | 00101010 | ||
+ | | LDAX SP | 00111010 | ||
+ | | STAX B-C | 00000010 | ||
+ | | STAX D-E | 00010010 | ||
+ | | STAX H-L | 00100010 | ||
+ | | XCHG | 11101011 | ||
+ | | Arithmetic Group ||| | ||
+ | | ADD B | 10000000 | ||
+ | | ADD C | 10000001 | ||
+ | | ADD D | 10000010 | ||
+ | | ADD E | 10000011 | ||
+ | | ADD H | 10000100 | ||
+ | | ADD L | 10000101 | ||
+ | | ADD M | 10000110 | ||
+ | | ADI data | 11000110 | ||
+ | | ADC B | 10001000 | ||
+ | | ADC C | 10001001 | ||
+ | | ADC D | 10001010 | ||
+ | | ADC E | 10001011 | ||
+ | | ADC H | 10001100 | ||
+ | | ADC L | 10001101 | ||
+ | | ADC M | 10001110 | ||
+ | | ACI data | 11001110 | ||
+ | | SUB B | 10010000 | ||
+ | | SUB C | 10010001 | ||
+ | | SUB D | 10010010 | ||
+ | | SUB E | 10010011 | ||
+ | | SUB H | 10010100 | ||
+ | | SUB L | 10010101 | ||
+ | | SUB M | 10010110 | ||
+ | | SUI data | 11010110 | ||
+ | | SBB B | 10011000 | ||
+ | | SBB C | 10011001 | ||
+ | | SBB D | 10011010 | ||
+ | | SBB E | 10011011 | ||
+ | | SBB H | 10011100 | ||
+ | | SBB L | 10011101 | ||
+ | | SBB M | 10011110 | ||
+ | | SBI data | 11011110 | ||
+ | | INR A | 00111100 | ||
+ | | INR B | 00000100 | ||
+ | | INR C | 00001100 | ||
+ | | INR D | 00010100 | ||
+ | | INR E | 00011100 | ||
+ | | INR H | 00100100 | ||
+ | | INR L | 00101100 | ||
+ | | INR M | 00110100 | ||
+ | | DCR A | 00111101 | ||
+ | | DCR B | 00000101 | ||
+ | | DCR C | 00001101 | ||
+ | | DCR D | 00010101 | ||
+ | | DCR E | 00011101 | ||
+ | | DCR H | 00100101 | ||
+ | | DCR L | 00101101 | ||
+ | | DCR M | 00110101 | ||
+ | | INX B-C | 00000011 | ||
+ | | INX D-E | 00010011 | ||
+ | | INX H-L | 00100011 | ||
+ | | INX SP | 00110011 | ||
+ | | DCX B-C | 00001011 | ||
+ | | DCX D-E | 00011011 | ||
+ | | DCX H-L | 00101011 | ||
+ | | DCX SP | 00111011 | ||
+ | | DAD B-C | 00001001 | ||
+ | | DAD D-E | 00011001 | ||
+ | | DAA | 00100111 | ||
+ | | Logical Group ||| | ||
+ | | ANA B | 10100000 | ||
+ | | ANA C | 10100001 | ||
+ | | ANA D | 10100010 | ||
+ | | ANA E | 10100011 | ||
+ | | ANA H | 10100100 | ||
+ | | ANA L | 10100101 | ||
+ | | ANA M | 10100110 | ||
+ | | ANI data | 11100110 | ||
+ | | XRA B | 10101000 | ||
+ | | XRA C | 10101001 | ||
+ | | XRA D | 10101010 | ||
+ | | XRA E | 10101011 | ||
+ | | XRA H | 10101100 | ||
+ | | XRA L | 10101101 | ||
+ | | XRA M | 10101110 | ||
+ | | XRI data | 11101110 | ||
+ | | ORA B | 10110000 | ||
+ | | ORA C | 10110001 | ||
+ | | ORA D | 10110010 | ||
+ | | ORA E | 10110011 | ||
+ | | ORA H | 10110100 | ||
+ | | ORA L | 10110101 | ||
+ | | ORA M | 10110110 | ||
+ | | ORI data | 11110110 | ||
+ | | CMP B | 10111000 | ||
+ | | CMP C | 10111001 | ||
+ | | CMP D | 10111010 | ||
+ | | CMP E | 10111011 | ||
+ | | CMP H | 10111100 | ||
+ | | CMP L | 10111101 | ||
+ | | CMP M | 10111110 | ||
+ | | CPI data | 11111110 | ||
+ | | RLC | 00000111 | ||
+ | | RRC | 00001111 | ||
+ | | RAL | 00010111 | ||
+ | | RAR | 00011111 | ||
+ | | CMA | 00101111 | ||
+ | | CMC | 00111111 | ||
+ | | STC | 00110111 | ||
+ | | Branch Group ||| | ||
+ | | JMP addr | 11000011 | ||
+ | | JNZ addr | 11000010 | ||
+ | | JZ addr | 11001010 | ||
+ | | JNC addr | 11010010 | ||
+ | | JC addr | 11011010 | ||
+ | | JPO addr | 11100010 | ||
+ | | JPE addr | 11101010 | ||
+ | | JP addr | 11110010 | ||
+ | | JM addr | 11111010 | ||
+ | | CALL addr | 11001101 | ||
+ | | CNZ addr | 11000100 | ||
+ | | CZ addr | 11001100 | ||
+ | | CNC addr | 11010100 | ||
+ | | CC addr | 11011100 | ||
+ | | CPO addr | 11100100 | ||
+ | | CPE addr | 11101100 | ||
+ | | CP addr | 11110100 | ||
+ | | CM addr | 11111100 | ||
+ | | RET | 11001001 | ||
+ | | RNZ | 11000000 | ||
+ | | RZ | 11001000 | ||
+ | | RNC | 11010000 | ||
+ | | RC | 11011000 | ||
+ | | RPO | 11100000 | ||
+ | | RPE | 11101000 | ||
+ | | RP | 11110000 | ||
+ | | RM | 11111000 | ||
+ | | RST n | 11nnn111 | ||
+ | | PCHL | 11101001 | ||
+ | =====Register Functions===== | ||
+ | regConv(char): | ||
+ | |||
+ | clear(): Clears all registers. | ||
+ | |||
+ | clear(char): | ||
+ | |||
+ | clear(char, char): Clears two registers (usefull for zeroing a register pair.) | ||
+ | |||
+ | set(char, G8SR):puts a 8bit value in the designated register. | ||
+ | |||
+ | set(char, G8SR, char, G8SR): useful for loading a register pair as it puts an 8bit value in designated registers. | ||
+ | |||
+ | get(char): returns a G8SR object from the indicated register. | ||
+ | |||
+ | shift(char, bool): Shifts indicated register to the right, inserting the supplied bit to the left and returning the ejected bit. | ||
+ | |||
+ | rotate(char, | ||
+ | |||
+ | And: | ||
+ | a function that ands the accumulator with another register and returns the result to the accumulator. |