FreeCalypso > hg > freecalypso-reveng
changeset 326:a4b6b4e389b9
frbl/reconst/command.c: second function reconstruction close to perfect
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 06 Mar 2020 04:04:53 +0000 |
parents | 7df08926a4e7 |
children | b5b8df53aa51 |
files | frbl/reconst/command.c |
diffstat | 1 files changed, 96 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/frbl/reconst/command.c Fri Mar 06 01:59:20 2020 +0000 +++ b/frbl/reconst/command.c Fri Mar 06 04:04:53 2020 +0000 @@ -77,6 +77,101 @@ com_build_confirmation(t_com_confirmation *confirmation, SYS_UWORD8 *confirmation_to_send) { - + SYS_WORD32 sp8; + long sp12 = COM_SUCCESS; + SYS_UWORD8 sp16; + SYS_UWORD8 *sp20; + SYS_UWORD8 sp24; + SYS_UWORD16 *sp28; + SYS_UWORD16 sp32; + sp20 = confirmation_to_send++; + *confirmation_to_send++ = COM_COMMAND_WORD(confirmation); + sp16 = 1; + *confirmation_to_send++ = COM_RESULT(confirmation); + sp16++; + switch (COM_COMMAND_WORD(confirmation)) { + case COM_GET_MONITOR_ID: /* 0x202 */ + if (COM_RESULT(confirmation)) + break; + *confirmation_to_send++ = COM_MONITOR_ID(confirmation); + *confirmation_to_send++ = + COM_MONITOR_VERSION_FIRST_NBR(confirmation); + *confirmation_to_send++ = + COM_MONITOR_VERSION_SECOND_NBR(confirmation); + sp16 += 3; + break; + case COM_GET_FLASH_ID: /* 0x23c */ + if (COM_RESULT(confirmation)) + break; + *confirmation_to_send++ = COM_FLASH_ID(confirmation); + sp16++; + break; + case COM_GET_CHIP_ID: /* 0x25a */ + if (COM_RESULT(confirmation)) + break; + *confirmation_to_send++ = COM_CHIP_ID(confirmation); + sp16++; + break; + case COM_GET_BOARD_ID: /* 0x266 */ + if (COM_RESULT(confirmation)) + break; + *confirmation_to_send++ = COM_BOARD_ID(confirmation); + sp16++; + break; + case COM_ERASE_FLASH: + break; + case COM_WRITE_DATA: /* 0x272 */ + if (COM_RESULT(confirmation)) + break; + sp32 = COM_FILE_CHECKSUM(confirmation); + *confirmation_to_send++ = (sp32 & 0xFF00) >> 8; + *confirmation_to_send++ = sp32 & 0xFF; + sp32 = COM_FLASH_CHECKSUM(confirmation); + *confirmation_to_send++ = (sp32 & 0xFF00) >> 8; + *confirmation_to_send++ = sp32 & 0xFF; + sp16 += 4; + break; + case COM_START_APPLICATION: /* 0x2dc */ + if (COM_RESULT(confirmation)) + break; + *confirmation_to_send++ = COM_STARTING_STATE(confirmation); + sp16++; + break; + case COM_READ_PARAMETERS: /* 0x2e8 */ + if (COM_RESULT(confirmation)) + break; + sp16++; + sp24 = COM_NUMBER_OF_PARAMS_READ(confirmation); + *confirmation_to_send++ = sp24; + if (sp24 > COM_MAX_NUMBER_OF_16BITS_DATA) { + sp12 = COM_PARAMETER_ERROR; + break; + } + sp28 = COM_READ_PARAMS_LIST_ADDRESS(confirmation); + for (sp8 = 0; sp8 < sp24; sp8++) { + *confirmation_to_send++ = (*sp28 & 0xFF00) >> 8; + *confirmation_to_send++ = *sp28++ & 0xFF; + sp16 += 2; + } + case COM_WRITE_PARAMETERS: + break; + case COM_LOAD_APPLICATION: /* 0x374 */ + if (COM_RESULT(confirmation)) + break; + sp32 = COM_FILE_RAM_CHECKSUM(confirmation); + *confirmation_to_send++ = (sp32 & 0xFF00) >> 8; + *confirmation_to_send++ = sp32 & 0xFF; + sp32 = COM_RAM_CHECKSUM(confirmation); + *confirmation_to_send++ = (sp32 & 0xFF00) >> 8; + *confirmation_to_send++ = sp32 & 0xFF; + sp16 += 4; + break; + case COM_SEND_RUN_ADDRESS: + break; + default: + sp12 = COM_COMMAND_UNKNOWN; + } + *sp20 = sp16; + return sp12; }