#ifndef SPC700_H
#define SPC700_H

#include "../types.h"

/* SPC700 opcode handlers (cpu/spc_ops.h, instantiated in cpu/c_spc700.c).
   Each takes the program counter just past the opcode byte and returns the
   updated one; cpu/c_dspproc.c builds opcjmptab out of them. */
u1* SpcOpInvalid(u1* pc);
u1* SpcOp00(u1* pc);
u1* SpcOp01(u1* pc);
u1* SpcOp02(u1* pc);
u1* SpcOp03(u1* pc);
u1* SpcOp04(u1* pc);
u1* SpcOp05(u1* pc);
u1* SpcOp06(u1* pc);
u1* SpcOp07(u1* pc);
u1* SpcOp08(u1* pc);
u1* SpcOp09(u1* pc);
u1* SpcOp0A(u1* pc);
u1* SpcOp0B(u1* pc);
u1* SpcOp0C(u1* pc);
u1* SpcOp0D(u1* pc);
u1* SpcOp0E(u1* pc);
u1* SpcOp0F(u1* pc);
u1* SpcOp10(u1* pc);
u1* SpcOp11(u1* pc);
u1* SpcOp12(u1* pc);
u1* SpcOp13(u1* pc);
u1* SpcOp14(u1* pc);
u1* SpcOp15(u1* pc);
u1* SpcOp16(u1* pc);
u1* SpcOp17(u1* pc);
u1* SpcOp18(u1* pc);
u1* SpcOp19(u1* pc);
u1* SpcOp1A(u1* pc);
u1* SpcOp1B(u1* pc);
u1* SpcOp1C(u1* pc);
u1* SpcOp1D(u1* pc);
u1* SpcOp1E(u1* pc);
u1* SpcOp1F(u1* pc);
u1* SpcOp20(u1* pc);
u1* SpcOp21(u1* pc);
u1* SpcOp22(u1* pc);
u1* SpcOp23(u1* pc);
u1* SpcOp24(u1* pc);
u1* SpcOp25(u1* pc);
u1* SpcOp26(u1* pc);
u1* SpcOp27(u1* pc);
u1* SpcOp28(u1* pc);
u1* SpcOp29(u1* pc);
u1* SpcOp2A(u1* pc);
u1* SpcOp2B(u1* pc);
u1* SpcOp2C(u1* pc);
u1* SpcOp2D(u1* pc);
u1* SpcOp2E(u1* pc);
u1* SpcOp2F(u1* pc);
u1* SpcOp30(u1* pc);
u1* SpcOp31(u1* pc);
u1* SpcOp32(u1* pc);
u1* SpcOp33(u1* pc);
u1* SpcOp34(u1* pc);
u1* SpcOp35(u1* pc);
u1* SpcOp36(u1* pc);
u1* SpcOp37(u1* pc);
u1* SpcOp38(u1* pc);
u1* SpcOp39(u1* pc);
u1* SpcOp3A(u1* pc);
u1* SpcOp3B(u1* pc);
u1* SpcOp3C(u1* pc);
u1* SpcOp3D(u1* pc);
u1* SpcOp3E(u1* pc);
u1* SpcOp3F(u1* pc);
u1* SpcOp40(u1* pc);
u1* SpcOp41(u1* pc);
u1* SpcOp42(u1* pc);
u1* SpcOp43(u1* pc);
u1* SpcOp44(u1* pc);
u1* SpcOp45(u1* pc);
u1* SpcOp46(u1* pc);
u1* SpcOp47(u1* pc);
u1* SpcOp48(u1* pc);
u1* SpcOp49(u1* pc);
u1* SpcOp4A(u1* pc);
u1* SpcOp4B(u1* pc);
u1* SpcOp4C(u1* pc);
u1* SpcOp4D(u1* pc);
u1* SpcOp4E(u1* pc);
u1* SpcOp4F(u1* pc);
u1* SpcOp50(u1* pc);
u1* SpcOp51(u1* pc);
u1* SpcOp52(u1* pc);
u1* SpcOp53(u1* pc);
u1* SpcOp54(u1* pc);
u1* SpcOp55(u1* pc);
u1* SpcOp56(u1* pc);
u1* SpcOp57(u1* pc);
u1* SpcOp58(u1* pc);
u1* SpcOp59(u1* pc);
u1* SpcOp5A(u1* pc);
u1* SpcOp5B(u1* pc);
u1* SpcOp5C(u1* pc);
u1* SpcOp5D(u1* pc);
u1* SpcOp5E(u1* pc);
u1* SpcOp5F(u1* pc);
u1* SpcOp60(u1* pc);
u1* SpcOp61(u1* pc);
u1* SpcOp62(u1* pc);
u1* SpcOp63(u1* pc);
u1* SpcOp64(u1* pc);
u1* SpcOp65(u1* pc);
u1* SpcOp66(u1* pc);
u1* SpcOp67(u1* pc);
u1* SpcOp68(u1* pc);
u1* SpcOp69(u1* pc);
u1* SpcOp6A(u1* pc);
u1* SpcOp6B(u1* pc);
u1* SpcOp6C(u1* pc);
u1* SpcOp6D(u1* pc);
u1* SpcOp6E(u1* pc);
u1* SpcOp6F(u1* pc);
u1* SpcOp70(u1* pc);
u1* SpcOp71(u1* pc);
u1* SpcOp72(u1* pc);
u1* SpcOp73(u1* pc);
u1* SpcOp74(u1* pc);
u1* SpcOp75(u1* pc);
u1* SpcOp76(u1* pc);
u1* SpcOp77(u1* pc);
u1* SpcOp78(u1* pc);
u1* SpcOp79(u1* pc);
u1* SpcOp7A(u1* pc);
u1* SpcOp7B(u1* pc);
u1* SpcOp7C(u1* pc);
u1* SpcOp7D(u1* pc);
u1* SpcOp7E(u1* pc);
u1* SpcOp7F(u1* pc);
u1* SpcOp80(u1* pc);
u1* SpcOp81(u1* pc);
u1* SpcOp82(u1* pc);
u1* SpcOp83(u1* pc);
u1* SpcOp84(u1* pc);
u1* SpcOp85(u1* pc);
u1* SpcOp86(u1* pc);
u1* SpcOp87(u1* pc);
u1* SpcOp88(u1* pc);
u1* SpcOp89(u1* pc);
u1* SpcOp8A(u1* pc);
u1* SpcOp8B(u1* pc);
u1* SpcOp8C(u1* pc);
u1* SpcOp8D(u1* pc);
u1* SpcOp8E(u1* pc);
u1* SpcOp8F(u1* pc);
u1* SpcOp90(u1* pc);
u1* SpcOp91(u1* pc);
u1* SpcOp92(u1* pc);
u1* SpcOp93(u1* pc);
u1* SpcOp94(u1* pc);
u1* SpcOp95(u1* pc);
u1* SpcOp96(u1* pc);
u1* SpcOp97(u1* pc);
u1* SpcOp98(u1* pc);
u1* SpcOp99(u1* pc);
u1* SpcOp9A(u1* pc);
u1* SpcOp9B(u1* pc);
u1* SpcOp9C(u1* pc);
u1* SpcOp9D(u1* pc);
u1* SpcOp9E(u1* pc);
u1* SpcOp9F(u1* pc);
u1* SpcOpA0(u1* pc);
u1* SpcOpA1(u1* pc);
u1* SpcOpA2(u1* pc);
u1* SpcOpA3(u1* pc);
u1* SpcOpA4(u1* pc);
u1* SpcOpA5(u1* pc);
u1* SpcOpA6(u1* pc);
u1* SpcOpA7(u1* pc);
u1* SpcOpA8(u1* pc);
u1* SpcOpA9(u1* pc);
u1* SpcOpAA(u1* pc);
u1* SpcOpAB(u1* pc);
u1* SpcOpAC(u1* pc);
u1* SpcOpAD(u1* pc);
u1* SpcOpAE(u1* pc);
u1* SpcOpAF(u1* pc);
u1* SpcOpB0(u1* pc);
u1* SpcOpB1(u1* pc);
u1* SpcOpB2(u1* pc);
u1* SpcOpB3(u1* pc);
u1* SpcOpB4(u1* pc);
u1* SpcOpB5(u1* pc);
u1* SpcOpB6(u1* pc);
u1* SpcOpB7(u1* pc);
u1* SpcOpB8(u1* pc);
u1* SpcOpB9(u1* pc);
u1* SpcOpBA(u1* pc);
u1* SpcOpBB(u1* pc);
u1* SpcOpBC(u1* pc);
u1* SpcOpBD(u1* pc);
u1* SpcOpBE(u1* pc);
u1* SpcOpBF(u1* pc);
u1* SpcOpC0(u1* pc);
u1* SpcOpC1(u1* pc);
u1* SpcOpC2(u1* pc);
u1* SpcOpC3(u1* pc);
u1* SpcOpC4(u1* pc);
u1* SpcOpC5(u1* pc);
u1* SpcOpC6(u1* pc);
u1* SpcOpC7(u1* pc);
u1* SpcOpC8(u1* pc);
u1* SpcOpC9(u1* pc);
u1* SpcOpCA(u1* pc);
u1* SpcOpCB(u1* pc);
u1* SpcOpCC(u1* pc);
u1* SpcOpCD(u1* pc);
u1* SpcOpCE(u1* pc);
u1* SpcOpCF(u1* pc);
u1* SpcOpD0(u1* pc);
u1* SpcOpD1(u1* pc);
u1* SpcOpD2(u1* pc);
u1* SpcOpD3(u1* pc);
u1* SpcOpD4(u1* pc);
u1* SpcOpD5(u1* pc);
u1* SpcOpD6(u1* pc);
u1* SpcOpD7(u1* pc);
u1* SpcOpD8(u1* pc);
u1* SpcOpD9(u1* pc);
u1* SpcOpDA(u1* pc);
u1* SpcOpDB(u1* pc);
u1* SpcOpDC(u1* pc);
u1* SpcOpDD(u1* pc);
u1* SpcOpDE(u1* pc);
u1* SpcOpDF(u1* pc);
u1* SpcOpE0(u1* pc);
u1* SpcOpE1(u1* pc);
u1* SpcOpE2(u1* pc);
u1* SpcOpE3(u1* pc);
u1* SpcOpE4(u1* pc);
u1* SpcOpE5(u1* pc);
u1* SpcOpE6(u1* pc);
u1* SpcOpE7(u1* pc);
u1* SpcOpE8(u1* pc);
u1* SpcOpE9(u1* pc);
u1* SpcOpEA(u1* pc);
u1* SpcOpEB(u1* pc);
u1* SpcOpEC(u1* pc);
u1* SpcOpED(u1* pc);
u1* SpcOpEE(u1* pc);
u1* SpcOpEF(u1* pc);
u1* SpcOpF0(u1* pc);
u1* SpcOpF1(u1* pc);
u1* SpcOpF2(u1* pc);
u1* SpcOpF3(u1* pc);
u1* SpcOpF4(u1* pc);
u1* SpcOpF5(u1* pc);
u1* SpcOpF6(u1* pc);
u1* SpcOpF7(u1* pc);
u1* SpcOpF8(u1* pc);
u1* SpcOpF9(u1* pc);
u1* SpcOpFA(u1* pc);
u1* SpcOpFB(u1* pc);
u1* SpcOpFC(u1* pc);
u1* SpcOpFD(u1* pc);
u1* SpcOpFE(u1* pc);
u1* SpcOpFF(u1* pc);

// The SPC's whole 64K address space. The declaration used to stop at the
// .fill in cpu/c_spcdata.c, leaving the 64-byte boot ROM at $FFC0 - which
// follows it in the same block, and which the handlers do index - outside it.
extern u1 SPCRAM[65536];
extern u1 spcA; // The A register (general purpose)
extern u1 spcNZ; // The processor NZ flag (little speed up hack :) )
extern u1 spcP; // The processor status byte (Removed for each flags), NZ are not always processed...
extern u1 spcX; // The X register (general purpose)
extern u1 spcY; // The Y register (general purpose)
extern u1* spcPCRam; // Program Counter (with SPCRAM added)
extern uint32_t spcPCRamSt; // the save-state slot: spcPCRam - SPCRAM
extern u1* spcRamDP; // The direct page pointer
extern uint32_t spcRamDPSt; // the save-state slot: spcRamDP - SPCRAM
extern u4 spcS; // The stack pointer (always from 100 to 1FF) (added Ram)

#endif
