Committing some edits made awhile ago that look legit.
Need to get things rolling again with this project!!!
This commit is contained in:
parent
4b0c340eb1
commit
d1aacecd6c
|
|
@ -44,29 +44,41 @@ uint8_t * operation_usb_call( setup_packet *spacket, uint8_t *rv, uint8_t *rlen)
|
||||||
return rptr;
|
return rptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
read_funcptr decode_rdfunc_num( uint8_t func_num ) {
|
read_funcptr decode_rdfunc_num(uint8_t dict, uint8_t func_num )
|
||||||
|
{
|
||||||
|
|
||||||
switch( func_num ) {
|
if ( dict == NES ) {
|
||||||
case NES_CPU_RD: return nes_cpu_rd;
|
switch( func_num ) {
|
||||||
case NES_PPU_RD: return nes_ppu_rd;
|
case NES_CPU_RD: return nes_cpu_rd;
|
||||||
case EMULATE_NES_CPU_RD: return emulate_nes_cpu_rd;
|
case NES_PPU_RD: return nes_ppu_rd;
|
||||||
default:
|
case EMULATE_NES_CPU_RD: return emulate_nes_cpu_rd;
|
||||||
return (void*)~SUCCESS;
|
default:
|
||||||
|
return (void*)~SUCCESS;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//dictionary not supported
|
||||||
|
return (void*)~SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
write_funcptr decode_wrfunc_num( uint8_t func_num ) {
|
write_funcptr decode_wrfunc_num(uint8_t dict, uint8_t func_num )
|
||||||
switch( func_num ) {
|
{
|
||||||
case DISCRETE_EXP0_PRGROM_WR:
|
if ( dict == NES ) {
|
||||||
return discrete_exp0_prgrom_wr;
|
switch( func_num ) {
|
||||||
case NES_CPU_WR:
|
case DISCRETE_EXP0_PRGROM_WR:
|
||||||
return nes_cpu_wr;
|
return discrete_exp0_prgrom_wr;
|
||||||
case NES_PPU_WR:
|
case NES_CPU_WR:
|
||||||
return nes_ppu_wr;
|
return nes_cpu_wr;
|
||||||
default:
|
case NES_PPU_WR:
|
||||||
return (void*)~SUCCESS;
|
return nes_ppu_wr;
|
||||||
|
default:
|
||||||
|
return (void*)~SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//dictionary not supported
|
||||||
|
return (void*)~SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -93,17 +105,19 @@ uint8_t oper_opcode_no_return( uint8_t opcode, uint8_t operMSB, uint8_t operLSB,
|
||||||
case COPY_ELEMENTS_TO_BUFF0:
|
case COPY_ELEMENTS_TO_BUFF0:
|
||||||
copy_data_to_buff0( (uint8_t *)oper_info, OPER_DATA_NUM_BYTE_ELEMENTS );
|
copy_data_to_buff0( (uint8_t *)oper_info, OPER_DATA_NUM_BYTE_ELEMENTS );
|
||||||
break;
|
break;
|
||||||
|
//operMSB contains dictionary, operLSB contains function number
|
||||||
|
//decode that into proper function pointer
|
||||||
case SET_OPER_FUNC:
|
case SET_OPER_FUNC:
|
||||||
//oper_info->oper_func = decode_opfunc_num( operLSB );
|
//oper_info->oper_func = decode_opfunc_num( operLSB );
|
||||||
break;
|
break;
|
||||||
case SET_RD_FUNC:
|
case SET_RD_FUNC:
|
||||||
oper_info->rd_func = decode_rdfunc_num( operLSB );
|
oper_info->rd_func = decode_rdfunc_num( operMSB, operLSB );
|
||||||
break;
|
break;
|
||||||
case SET_WR_MEM_FUNC:
|
case SET_WR_MEM_FUNC:
|
||||||
oper_info->wr_mem_func = decode_wrfunc_num( operLSB );
|
oper_info->wr_mem_func = decode_wrfunc_num( operMSB, operLSB );
|
||||||
break;
|
break;
|
||||||
case SET_WR_MAP_FUNC:
|
case SET_WR_MAP_FUNC:
|
||||||
oper_info->wr_map_func = decode_wrfunc_num( operLSB );
|
oper_info->wr_map_func = decode_wrfunc_num( operMSB, operLSB );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//opcode doesn't exist
|
//opcode doesn't exist
|
||||||
|
|
@ -128,8 +142,8 @@ uint8_t oper_opcode_return( uint8_t opcode, uint8_t operMSB, uint8_t operLSB, ui
|
||||||
{
|
{
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case GET_OPERATION:
|
case GET_OPERATION:
|
||||||
*rvalue = oper_info->operation;
|
*rvalue = oper_info->operation;
|
||||||
*rlength += 1;
|
*rlength += 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//opcode doesn't exist
|
//opcode doesn't exist
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
|
|
||||||
uint8_t * operation_usb_call( setup_packet *spacket, uint8_t *rv, uint8_t *rlen);
|
uint8_t * operation_usb_call( setup_packet *spacket, uint8_t *rv, uint8_t *rlen);
|
||||||
read_funcptr decode_rdfunc_num( uint8_t func_num );
|
read_funcptr decode_rdfunc_num( uint8_t dict, uint8_t func_num );
|
||||||
write_funcptr decode_wrfunc_num( uint8_t func_num );
|
write_funcptr decode_wrfunc_num( uint8_t dict, uint8_t func_num );
|
||||||
uint8_t oper_opcode_no_return( uint8_t opcode, uint8_t operMSB, uint8_t operLSB, uint8_t miscdata );
|
uint8_t oper_opcode_no_return( uint8_t opcode, uint8_t operMSB, uint8_t operLSB, uint8_t miscdata );
|
||||||
uint8_t oper_opcode_return( uint8_t opcode, uint8_t operMSB, uint8_t operLSB, uint8_t miscdata,
|
uint8_t oper_opcode_return( uint8_t opcode, uint8_t operMSB, uint8_t operLSB, uint8_t miscdata,
|
||||||
uint8_t *rvalue, uint8_t *rlength );
|
uint8_t *rvalue, uint8_t *rlength );
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* Post:oper_info elements loaded
|
* Post:oper_info elements loaded
|
||||||
* Rtn: SUCCESS if no errors
|
* Rtn: SUCCESS if no errors
|
||||||
*/
|
*/
|
||||||
int load_oper_info_elements( USBtransfer *transfer, cartridge *cart, int mem )
|
int load_oper_info_elements( USBtransfer *transfer, cartridge *cart )
|
||||||
{
|
{
|
||||||
uint8_t rv[RETURN_BUFF_SIZE];
|
uint8_t rv[RETURN_BUFF_SIZE];
|
||||||
uint8_t buff_num = 0; //buffer used to load elements according to shared_dict_operation.h
|
uint8_t buff_num = 0; //buffer used to load elements according to shared_dict_operation.h
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ enum operation_elem_nums { //Each index is numbered by it's name
|
||||||
#define COPY_ELEMENTS_TO_BUFF0 0x02
|
#define COPY_ELEMENTS_TO_BUFF0 0x02
|
||||||
|
|
||||||
|
|
||||||
|
//pass dictionary in operMSB and command/func in operLSB
|
||||||
#define SET_OPER_FUNC 0x03
|
#define SET_OPER_FUNC 0x03
|
||||||
#define SET_RD_FUNC 0x04
|
#define SET_RD_FUNC 0x04
|
||||||
#define SET_WR_MEM_FUNC 0x05
|
#define SET_WR_MEM_FUNC 0x05
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue