OpenCores
URL https://opencores.org/ocsvn/opencores/opencores/trunk

Subversion Repositories opencores

[/] [opencores/] [trunk/] [doc/] [work_flag.txt] - Rev 6

Compare with Previous | Blame | View Log

//  update all flags from alu8   for logic operations pv <= parity else ofl
ADCsA_A      = 'h8F,//      ADC A,A      ; 8F
ADCsA_B      = 'h88,//      ADC A,B      ; 88
ADCsA_C      = 'h89,//      ADC A,C      ; 89
ADCsA_D      = 'h8A,//      ADC A,D      ; 8A
ADCsA_E      = 'h8B,//      ADC A,E      ; 8B
ADCsA_H      = 'h8C,//      ADC A,H      ; 8C
ADCsA_L      = 'h8D,//      ADC A,L      ; 8D
ADCsA_N      = 'hCE,//      ADC A,N      ; CE XX
ADDsA_A      = 'h87,//      ADD A,A      ; 87
ADDsA_B      = 'h80,//      ADD A,B      ; 80
ADDsA_C      = 'h81,//      ADD A,C      ; 81
ADDsA_D      = 'h82,//      ADD A,D      ; 82
ADDsA_E      = 'h83,//      ADD A,E      ; 83
ADDsA_H      = 'h84,//      ADD A,H      ; 84
ADDsA_L      = 'h85,//      ADD A,L      ; 85
ADDsA_N      = 'hC6,//      ADD A,N      ; C6 XX
ANDsA        = 'hA7,//      AND A        ; A7
ANDsB        = 'hA0,//      AND B        ; A0
ANDsC        = 'hA1,//      AND C        ; A1
ANDsD        = 'hA2,//      AND D        ; A2
ANDsE        = 'hA3,//      AND E        ; A3
ANDsH        = 'hA4,//      AND H        ; A4
ANDsL        = 'hA5,//      AND L        ; A5
ANDsN        = 'hE6,//      AND N        ; E6 XX
CPsA         = 'hBF,//      CP A         ; BF
CPsB         = 'hB8,//      CP B         ; B8
CPsC         = 'hB9,//      CP C         ; B9
CPsD         = 'hBA,//      CP D         ; BA
CPsE         = 'hBB,//      CP E         ; BB
CPsH         = 'hBC,//      CP H         ; BC
CPsL         = 'hBD,//      CP L         ; BD
CPsN         = 'hFE,//      CP N         ; FE XX
ORsA         = 'hB7,//      OR A         ; B7
ORsB         = 'hB0,//      OR B         ; B0
ORsC         = 'hB1,//      OR C         ; B1
ORsD         = 'hB2,//      OR D         ; B2
ORsE         = 'hB3,//      OR E         ; B3
ORsH         = 'hB4,//      OR H         ; B4
ORsL         = 'hB5,//      OR L         ; B5
ORsN         = 'hF6,//      OR N         ; F6 XX
SBCsA        = 'h9F,//      SBC A        ; 9F
SBCsA_N      = 'hDE,//      SBC A,N      ; DE XX
SBCsB        = 'h98,//      SBC B        ; 98
SBCsC        = 'h99,//      SBC C        ; 99
SBCsD        = 'h9A,//      SBC D        ; 9A
SBCsE        = 'h9B,//      SBC E        ; 9B
SBCsH        = 'h9C,//      SBC H        ; 9C
SBCsL        = 'h9D,//      SBC L        ; 9D
SUBsA        = 'h97,//      SUB A        ; 97
SUBsB        = 'h90,//      SUB B        ; 90
SUBsC        = 'h91,//      SUB C        ; 91
SUBsD        = 'h92,//      SUB D        ; 92
SUBsE        = 'h93,//      SUB E        ; 93
SUBsH        = 'h94,//      SUB H        ; 94
SUBsL        = 'h95,//      SUB L        ; 95
SUBsN        = 'hD6,//      SUB N        ; D6 XX
XORsA        = 'hAF,//      XOR A        ; AF
XORsB        = 'hA8,//      XOR B        ; A8
XORsC        = 'hA9,//      XOR C        ; A9
XORsD        = 'hAA,//      XOR D        ; AA
XORsE        = 'hAB,//      XOR E        ; AB
XORsH        = 'hAC,//      XOR H        ; AC
XORsL        = 'hAD,//      XOR L        ; AD
XORsN        = 'hEE,//      XOR N        ; EE XX

//  same as above but no cf change  oh my god why?
DECsA        = 'h3D,//      DEC A        ; 3D
DECsB        = 'h05,//      DEC B        ; 05
DECsC        = 'h0D,//      DEC C        ; 0D
DECsD        = 'h15,//      DEC D        ; 15
DECsE        = 'h1D,//      DEC E        ; 1D
DECsH        = 'h25,//      DEC H        ; 25
DECsL        = 'h2D,//      DEC L        ; 2D
INCsA        = 'h3C,//      INC A        ; 3C
INCsB        = 'h04,//      INC B        ; 04
INCsC        = 'h0C,//      INC C        ; 0C
INCsD        = 'h14,//      INC D        ; 14
INCsE        = 'h1C,//      INC E        ; 1C
INCsH        = 'h24,//      INC H        ; 24
INCsL        = 'h2C,//      INC L        ; 2C

// update h n c (f5, f3) from alu16
ADDsHL_BC    = 'h09,//      ADD HL,BC    ; 09
ADDsHL_DE    = 'h19,//      ADD HL,DE    ; 19
ADDsHL_HL    = 'h29,//      ADD HL,HL    ; 29
ADDsHL_SP    = 'h39,//      ADD HL,SP    ; 39
INCsBC       = 'h03,//      INC BC       ; 03
INCsDE       = 'h13,//      INC DE       ; 13
INCsHL       = 'h23,//      INC HL       ; 23
INCsSP       = 'h33,//      INC SP       ; 33
// update all flags from alu16
ED_SBCsHL_REG  = 6'b01__0010, // compair with {ir[7:6],ir[3:0]}
ED_ADCsHL_REG  = 6'b01__1010, // compair with {ir[7:6],ir[3:0]}


//  the shifts probably muck with all flags (some operations are 
//  guarenteed not to change certain flags )
//  crap docs say sf and zf  never change for these ops.
RLA          = 'h17,//      RLA          ; 17
RLCA         = 'h07,//      RLCA         ; 07
RRA          = 'h1F,//      RRA          ; 1F
RRCA         = 'h0F,//      RRCA         ; 0F
// sf and zf do change for theses
CB_RLC   = 5'b00_000,  // these must be compaired with ir[7:3]
CB_RRC   = 5'b00_001,  // these must be compaired with ir[7:3]
CB_RL    = 5'b00_010,  // these must be compaired with ir[7:3]
CB_RR    = 5'b00_011,  // these must be compaired with ir[7:3]
CB_SLA   = 5'b00_100,  // these must be compaired with ir[7:3]
CB_SRA   = 5'b00_101,  // these must be compaired with ir[7:3]
CB_SLL   = 5'b00_110,  // these must be compaired with ir[7:3]
CB_SRL   = 5'b00_111,  // these must be compaired with ir[7:3]

//  pretty nomal stuff here
CB_BIT   = 2'b01,    // these must be compaired with ir[7:6]
//  which alu? --  
ED_NEG         =    5'b01___100, // compair with {ir[7:6],ir[2:0]} all A<= -A                   
// rmw 8 types
INCs6HL7     = 'h34,//      INC (HL)     ; 34
DECs6HL7     = 'h35,//      DEC (HL)     ; 35

//  ED Block Move messyness
//  hf and nf <= 0   pnf<= BC==0
ED_LDI       =  'hA0//      LDI        ; ED A0   (DE++) <= (HL++) , BC-- 
ED_LDD       =  'hA8//      LDD        ; ED A8   (DE--) <= (HL--) , BC--
ED_LDIR      =  'hB0//      LDIR       ; ED B0   (DE++) <= (HL++) , BC-- Repeat til BC==0 
ED_LDDR      =  'hB8//      LDDR       ; ED B8   (DE--) <= (HL--) , BC-- Repeat til BC==0
// only c not affected - nf<=1 ? 
ED_CPI       =  'hA1//      CPI        ; ED A1    A - (HL++) , BC--
ED_CPD       =  'hA9//      CPD        ; ED A9    A - (HL--) , BC--
ED_CPIR      =  'hB1//      CPIR       ; ED B1    A - (HL++) , BC-- repeat if(|B
ED_CPDR      =  'hB9//      CPDR       ; ED B9    A - (HL--) , BC-- repeat if(|B

//  all the ed i/o muck with all flags  -- wonderful  cf?
//  use the aluoutput for the b-1 computation. 
ED_INI       =  'hA2//      INI        ; ED A2   (HL++) <- (Cio) , B--
ED_IND       =  'hAA//      IND        ; ED AA   (HL--) <- (Cio) , B--
ED_INIR      =  'hB2//      INIR       ; ED B2   (HL++) <- (Cio) , B-- repeat if(|B)
ED_INDR      =  'hBA//      INDR       ; ED BA   (HL--) <- (Cio) , B-- repeat if(|B)
ED_OUTI      =  'hA3//      OUTI       ; ED A3   (Cio)  <-(HL++) , B--
ED_OUTD      =  'hAB//      OUTD       ; ED AB   (Cio)  <-(HL--) , B--
ED_OTIR      =  'hB3//      OTIR       ; ED B3   (Cio)  <-(HL++) , B--  rpt if(|B)
ED_OTDR      =  'hBB//      OTDR       ; ED BB   (Cio)  <-(HL--) , B--  rpt if(|B)

ED_INsREG_6C7  =    5'b01___000,// compair with {ir[7:6],ir[2:0]} really (BCio)
ED_OUTs6C7_REG =    5'b01___001,// compair with {ir[7:6],ir[2:0]}



// special problems
CCF          = 'h3F,//      CCF          ; 3F  // h<=c  c<=1C N<=0  F3,F5?
CPL          = 'h2F,//      CPL          ; 2F  // H<=1  N<=1  F3,F5?
DAA          = 'h27,//      DAA          ; 27  // H<=0???  
SCF          = 'h37,//      SCF          ; 37
ED_RRD       =  'h67//      RRD        ; ED 67   nibble roates A HL
ED_RLD       =  'h6F//      RLD        ; ED 6F   nibble roates A HL
ED_LDsA_I    =  'h57//      LD A,I     ; ED 57   move I to A



//  no changes
CB_RES   = 2'b10,    // these must be compaired with ir[7:6]
CB_SET   = 2'b11,    // these must be compaired with ir[7:6]
DECsBC       = 'h0B,//      DEC BC       ; 0B
DECsDE       = 'h1B,//      DEC DE       ; 1B
DECsHL       = 'h2B,//      DEC HL       ; 2B
DECsSP       = 'h3B,//      DEC SP       ; 3B
DI           = 'hF3,//      DI           ; F3
EI           = 'hFB,//      EI           ; FB
EXX          = 'hD9,//      EXX          ; D9
EXsAF_AFp    = 'h08,//      EX AF,AF'    ; 08
EXsDE_HL     = 'hEB,//      EX DE,HL     ; EB
HALT         = 'h76,//      HALT         ; 76
LDsA_A       = 'h7F,//      LD A,A       ; 7F
LDsA_B       = 'h78,//      LD A,B       ; 78
LDsA_C       = 'h79,//      LD A,C       ; 79
LDsA_D       = 'h7A,//      LD A,D       ; 7A
LDsA_E       = 'h7B,//      LD A,E       ; 7B
LDsA_H       = 'h7C,//      LD A,H       ; 7C
LDsA_L       = 'h7D,//      LD A,L       ; 7D
LDsA_N       = 'h3E,//      LD A,N       ; 3E XX
LDsBC_nn     = 'h01,//      LD BC,NN     ; 01 XX XX
LDsB_A       = 'h47,//      LD B,A       ; 47
LDsB_B       = 'h40,//      LD B,B       ; 40
LDsB_C       = 'h41,//      LD B,C       ; 41
LDsB_D       = 'h42,//      LD B,D       ; 42
LDsB_E       = 'h43,//      LD B,E       ; 43
LDsB_H       = 'h44,//      LD B,H       ; 44
LDsB_L       = 'h45,//      LD B,L       ; 45
LDsB_N       = 'h06,//      LD B,N       ; 06 XX
LDsC_A       = 'h4F,//      LD C,A       ; 4F
LDsC_B       = 'h48,//      LD C,B       ; 48
LDsC_C       = 'h49,//      LD C,C       ; 49
LDsC_D       = 'h4A,//      LD C,D       ; 4A
LDsC_E       = 'h4B,//      LD C,E       ; 4B
LDsC_H       = 'h4C,//      LD C,H       ; 4C
LDsC_L       = 'h4D,//      LD C,L       ; 4D
LDsC_N       = 'h0E,//      LD C,N       ; 0E XX
LDsDE_NN     = 'h11,//      LD DE,NN     ; 11 XX XX
LDsD_A       = 'h57,//      LD D,A       ; 57
LDsD_B       = 'h50,//      LD D,B       ; 50
LDsD_C       = 'h51,//      LD D,C       ; 51
LDsD_D       = 'h52,//      LD D,D       ; 52
LDsD_E       = 'h53,//      LD D,E       ; 53
LDsD_H       = 'h54,//      LD D,H       ; 54
LDsD_L       = 'h55,//      LD D,L       ; 55
LDsD_N       = 'h16,//      LD D,N       ; 16 XX
LDsE_A       = 'h5F,//      LD E,A       ; 5F
LDsE_B       = 'h58,//      LD E,B       ; 58
LDsE_C       = 'h59,//      LD E,C       ; 59
LDsE_D       = 'h5A,//      LD E,D       ; 5A
LDsE_E       = 'h5B,//      LD E,E       ; 5B
LDsE_H       = 'h5C,//      LD E,H       ; 5C
LDsE_L       = 'h5D,//      LD E,L       ; 5D
LDsE_N       = 'h1E,//      LD E,N       ; 1E XX
LDsHL_NN     = 'h21,//      LD HL,NN     ; 21 XX XX
LDsH_A       = 'h67,//      LD H,A       ; 67
LDsH_B       = 'h60,//      LD H,B       ; 60
LDsH_C       = 'h61,//      LD H,C       ; 61
LDsH_D       = 'h62,//      LD H,D       ; 62
LDsH_E       = 'h63,//      LD H,E       ; 63
LDsH_H       = 'h64,//      LD H,H       ; 64
LDsH_L       = 'h65,//      LD H,L       ; 65
LDsH_N       = 'h26,//      LD H,N       ; 26 XX
LDsL_A       = 'h6F,//      LD L,A       ; 6F
LDsL_B       = 'h68,//      LD L,B       ; 68
LDsL_C       = 'h69,//      LD L,C       ; 69
LDsL_D       = 'h6A,//      LD L,D       ; 6A
LDsL_E       = 'h6B,//      LD L,E       ; 6B
LDsL_H       = 'h6C,//      LD L,H       ; 6C
LDsL_L       = 'h6D,//      LD L,L       ; 6D
LDsL_N       = 'h2E,//      LD L,N       ; 2E XX
LDsSP_HL     = 'hF9,//      LD SP,HL     ; F9
LDsSP_NN     = 'h31,//      LD SP,NN     ; 31 XX XX
NOP          = 'h00,//      NOP          ; 00
ED_IMs0      =  'h46//      IM 0       ; ED 46   set IM0
ED_LDsI_A    =  'h47//      LD I,A     ; ED 47   move a to I
ED_IMs1      =  'h56//      IM 1       ; ED 56   set IM1
ED_IMs2      =  'h5E//      IM 2       ; ED 5E   set IM2
//  load 8 types
LDsA_6BC7    = 'h0A,//      LD A,(BC)    ; 0A
LDsA_6DE7    = 'h1A,//      LD A,(DE)    ; 1A
LDsB_6HL7    = 'h46,//      LD B,(HL)    ; 46
LDsD_6HL7    = 'h56,//      LD D,(HL)    ; 56
LDsH_6HL7    = 'h66,//      LD H,(HL)    ; 66
ADDsA_6HL7   = 'h86,//      ADD A,(HL)   ; 86
SUBs6HL7     = 'h96,//      SUB (HL)     ; 96
ANDs6HL7     = 'hA6,//      AND (HL)     ; A6
ORs6HL7      = 'hB6,//      OR (HL)      ; B6
LDsC_6HL7    = 'h4E,//      LD C,(HL)    ; 4E
LDsE_6HL7    = 'h5E,//      LD E,(HL)    ; 5E
LDsL_6HL7    = 'h6E,//      LD L,(HL)    ; 6E
LDsA_6HL7    = 'h7E,//      LD A,(HL)    ; 7E
ADCsA_6HL7   = 'h8E,//      ADC A,(HL)   ; 8E
SBCs6HL7     = 'h9E,//      SBC (HL)     ; 9E
XORs6HL7     = 'hAE,//      XOR (HL)     ; AE
CPs6HL7      = 'hBE,//      CP (HL)      ; BE
LDsA_6NN7    = 'h3A,//      LD A,(NN)    ; 3A XX XX
CB_MEM &   CB_BIT   = 2'b01,    // (HL) these must be compaired with ir[7:6]
// load 16 types
LDsHL_6NN7   = 'h2A,//      LD HL,(NN)   ; 2A XX XX
POPsAF       = 'hF1,//      POP AF       ; F1   AF<- (SP++ ++)  
POPsBC       = 'hC1,//      POP BC       ; C1   BC<- (SP++ ++)  
POPsDE       = 'hD1,//      POP DE       ; D1   DE<- (SP++ ++)  
POPsHL       = 'hE1,//      POP HL       ; E1   HL<- (SP++ ++)  
ED_LDsREG_6NN7 =    6'b01__1011, // compair with {ir[7:6],ir[3:0]}  REG = BC,DE,HL,SP
// store 8 types
LDs6HL7_N    = 'h36,//      LD (HL),N    ; 36 XX
LDs6BC7_A    = 'h02,//      LD (BC),A    ; 02 
LDs6DE7_A    = 'h12,//      LD (DE),A    ; 12
LDs6HL7_A    = 'h77,//      LD (HL),A    ; 77
LDs6HL7_B    = 'h70,//      LD (HL),B    ; 70
LDs6HL7_C    = 'h71,//      LD (HL),C    ; 71
LDs6HL7_D    = 'h72,//      LD (HL),D    ; 72
LDs6HL7_E    = 'h73,//      LD (HL),E    ; 73
LDs6HL7_H    = 'h74,//      LD (HL),H    ; 74
LDs6HL7_L    = 'h75,//      LD (HL),L    ; 75
LDs6NN7_A    = 'h32,//      LD (NN),A    ; 32 XX XX
// store 16 types
PUSHsAF      = 'hF5,//      PUSH AF      ; F5   (-- --SP) <- AF
PUSHsBC      = 'hC5,//      PUSH BC      ; C5   (-- --SP) <- BC
PUSHsDE      = 'hD5,//      PUSH DE      ; D5   (-- --SP) <- DE
PUSHsHL      = 'hE5,//      PUSH HL      ; E5   (-- --SP) <- HL
LDs6NN7_HL   = 'h22,//      LD (NN),HL   ; 22 XX XX
ED_LDs6NN7_REG = 6'b01__0011,// XX XX compair with {ir[7:6],ir[3:0]} REG = BC,DE,HL,SP                    



           
// rmw 16 types
EXs6SP7_HL   = 'hE3,//      EX (SP),HL   ; E3

// Jumps    only trick here is that next inst is not valid - ignore it
JRs$t2       = 'h18,//      JR $+2       ; 18  XX
JRsC_$t2     = 'h38,//      JR C,$+2     ; 38
JRsNC_$t2    = 'h30,//      JR NC,$+2    ; 30
JRsNZ_$t2    = 'h20,//      JR NZ,$+2    ; 20
JRsZ_$t2     = 'h28,//      JR Z,$+2     ; 28
DJNZs$t2     = 'h10,//      DJNZ $+2     ; 10 XX  XX
JPs          = 'hC3,//      JP $+3       ; C3 XX  XX
JPsC         = 'hDA,//      JP C,$+3     ; DA XX  XX
JPsHL        = 'hE9,//      JP HL        ; E9     // documented as indirect IS NOT
JPsM         = 'hFA,//      JP M,$+3     ; FA XX  XX
JPsNC        = 'hD2,//      JP NC,$+3    ; D2 XX  XX
JPsNZ        = 'hC2,//      JP NZ,$+3    ; C2 XX  XX
JPsPE        = 'hEA,//      JP PE,$+3    ; EA XX  XX
JPsPO        = 'hE2,//      JP PO,$+3    ; E2 XX  XX
JPsP         = 'hF2,//      JP P,$+3     ; F2 XX  XX
JPsZ         = 'hCA,//      JP Z,$+3     ; CA XX  XX
RSTs0        = 'hC7,//      RST 0        ; C7
RSTs8H       = 'hCF,//      RST 8H       ; CF 
RSTs10H      = 'hD7,//      RST 10H      ; D7
RSTs18H      = 'hDF,//      RST 18H      ; DF
RSTs20H      = 'hE7,//      RST 20H      ; E7
RSTs28H      = 'hEF,//      RST 28H      ; EF        
RSTs30H      = 'hF7,//      RST 30H      ; F7
RSTs38H      = 'hFF,//      RST 38H      ; FF


// calls
CALLsC_NN    = 'hDC,//      CALL C,NN    ; DC XX XX  (-- --SP) <- PC, PC<-NN
CALLsM_NN    = 'hFC,//      CALL M,NN    ; FC XX XX  (-- --SP) <- PC, PC<-NN
CALLsNC_NN   = 'hD4,//      CALL NC,NN   ; D4 XX XX  (-- --SP) <- PC, PC<-NN
CALLsNN      = 'hCD,//      CALL NN      ; CD XX XX  (-- --SP) <- PC, PC<-NN
CALLsNZ_NN   = 'hC4,//      CALL NZ,NN   ; C4 XX XX  (-- --SP) <- PC, PC<-NN
CALLsPE_NN   = 'hEC,//      CALL PE,NN   ; EC XX XX  (-- --SP) <- PC, PC<-NN
CALLsPO_NN   = 'hE4,//      CALL PO,NN   ; E4 XX XX  (-- --SP) <- PC, PC<-NN
CALLsP_NN    = 'hF4,//      CALL P,NN    ; F4 XX XX  (-- --SP) <- PC, PC<-NN
CALLsZ_NN    = 'hCC,//      CALL Z,NN    ; CC XX XX  (-- --SP) <- PC, PC<-NN

//returns
RET          = 'hC9,//      RET          ; C9    PC <- (SP++ ++)
RETsC        = 'hD8,//      RET C        ; D8    PC <- (SP++ ++)
RETsM        = 'hF8,//      RET M        ; F8    PC <- (SP++ ++)
RETsNC       = 'hD0,//      RET NC       ; D0    PC <- (SP++ ++)
RETsNZ       = 'hC0,//      RET NZ       ; C0    PC <- (SP++ ++)
RETsP        = 'hF0,//      RET P        ; F0    PC <- (SP++ ++)
RETsPE       = 'hE8,//      RET PE       ; E8    PC <- (SP++ ++)
RETsPO       = 'hE0,//      RET PO       ; E0    PC <- (SP++ ++)
RETsZ        = 'hC8,//      RET Z        ; C8    PC <- (SP++ ++)
ED_RETN        =    5'b01___101; // compair with {ir[7:6],ir[2:0]} and !reti


//io input   no flag chnges for this one
INsA_6N7     = 'hDB,//      IN A,(N)     ; DB XX    A<-(Nio)//silly 

//io output
OUTs6N7_A    = 'hD3,//      OUT (N),A    ; D3 XX     A-> (Nio)






CBgrp        = 'hCB,//       CBgrp is rotates and bit munging below
EDgrp        = 'hED,//      EDgrp          ED
FDgrp        = 'hFD,//      FDgrp          FD
DDgrp        = 'hDD,//      DDgrp   

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.