FreeCalypso > hg > freecalypso-reveng
view frbl/reconst/serial.c @ 382:4307b57229d3
miscprog: tone-convert written, compiles
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 10 Nov 2021 00:04:12 +0000 |
parents | ea1e950c849f |
children |
line wrap: on
line source
#include "main/sys_types.h" #include "serial.h" #include "convert.h" static const SYS_UWORD32 S0_expect[7] = {6, 0, 0, 'H', 'D', 'R', 0x1B}; static const SYS_UWORD32 S7_expect[6] = {5, 0, 0, 0, 0, 0xFA}; static const SYS_UWORD32 uart_base[2] = {0xFFFF5800, 0xFFFF5000}; static SYS_UWORD32 bss_0; static SYS_UWORD8 bss_4; static SYS_UWORD8 bss_5; static SYS_UWORD8 bss_6; static SYS_UWORD8 bss_7; static SYS_UWORD8 bss_8; static SYS_UWORD32 bss_0xc; static SYS_UWORD8 bss_0x10; static SYS_UWORD16 bss_0x12; static SYS_UWORD32 static_func_0x0(SYS_UWORD8 arg1, SYS_UWORD32 *arg2, SYS_UWORD32 *arg3, SYS_UWORD16 *arg4) { SYS_UWORD32 retval; bss_5 += arg1; if (bss_6) { bss_0x12 += arg1; *arg4 = bss_0x12; *arg2 = 0; retval = 0; } else { *arg3 += 2; bss_0x12 = arg1 << 8; retval = 1; } bss_6 = ~bss_6 & 1; bss_0x10--; if (bss_0x10 == 0) bss_0xc = 6; return retval; } static SYS_UWORD32 static_func_0x7a(SYS_UWORD8 arg1, SYS_UWORD32 *arg2) { SYS_UWORD32 retval = 1; if (!bss_7) { if (arg1 == 'S') { bss_7 = 1; } else { *arg2 = 1; retval = 0; } } else { bss_7 = 0; if (arg1 == '0') { if (bss_4) { *arg2 = 1; bss_4 = 0; retval = 0; } else { bss_0xc = 2; bss_8 = 0; } } else if (arg1 == '3') { if (!bss_4) { *arg2 = 1; retval = 0; } else { bss_0xc = 4; bss_8 = 0; } } else if (arg1 == '7') { if (!bss_4) { *arg2 = 1; retval = 0; } else { bss_0xc = 3; bss_8 = 0; } } else { *arg2 = 1; bss_4 = 0; retval = 0; } } return retval; } static SYS_UWORD32 static_func_0x126(SYS_UWORD8 arg1, SYS_UWORD32 *arg2) { SYS_UWORD32 retval = 1; if (arg1 == S0_expect[bss_8]) { bss_8++; if (bss_8 == 7) { bss_0xc = 1; bss_4 = 1; } } else { *arg2 = 1; bss_0xc = 1; retval = 0; } return retval; } static SYS_UWORD32 static_func_0x176(SYS_UWORD8 arg1, SYS_UWORD32 *arg2) { SYS_UWORD32 retval = 1; if (arg1 == S7_expect[bss_8]) { bss_8++; if (bss_8 == 6) { *arg2 = 2; bss_0xc = 1; bss_4 = 0; retval = 0; } } else { *arg2 = 1; bss_0xc = 1; bss_4 = 0; retval = 0; } return retval; } static void static_func_0x1d4(SYS_UWORD8 arg) { bss_0x10 = arg - 1; bss_5 = arg; bss_8 = 0; bss_0 = 0; bss_0xc = 5; } static SYS_UWORD32 static_func_0x200(SYS_UWORD8 arg1, SYS_UWORD32 *arg2, SYS_UWORD32 *arg3) { SYS_UWORD32 retval = 1; bss_0x10--; if (bss_0x10) { bss_5 += arg1; bss_8++; bss_0 += arg1 << ((4 - bss_8) * 8); if (bss_8 == 4) { *arg3 = bss_0 - 2; bss_0xc = 0; bss_6 = 0; bss_8 = 0; } } else { *arg2 = 1; bss_0xc = 1; bss_4 = 0; retval = 0; } return retval; } static SYS_UWORD32 static_func_0x288(SYS_UWORD8 arg1, SYS_UWORD32 *arg2) { SYS_UWORD32 retval = 1; bss_0xc = 1; if (bss_5 != (~arg1 & 0xFF)) { *arg2 = 1; bss_4 = 0; retval = 0; } return retval; }