MCPcopy Create free account
hub / github.com/TASEmulators/fceux / FCEUI_DatachSet

Function FCEUI_DatachSet

src/boards/bandai.cpp:395–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393// #define INTERL2OF5
394
395int FCEUI_DatachSet(uint8 *rcode) {
396 int prefix_parity_type[10][6] = {
397 { 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 0, 1, 1 }, { 0, 0, 1, 1, 0, 1 }, { 0, 0, 1, 1, 1, 0 },
398 { 0, 1, 0, 0, 1, 1 }, { 0, 1, 1, 0, 0, 1 }, { 0, 1, 1, 1, 0, 0 }, { 0, 1, 0, 1, 0, 1 },
399 { 0, 1, 0, 1, 1, 0 }, { 0, 1, 1, 0, 1, 0 }
400 };
401 int data_left_odd[10][7] = {
402 { 0, 0, 0, 1, 1, 0, 1 }, { 0, 0, 1, 1, 0, 0, 1 }, { 0, 0, 1, 0, 0, 1, 1 }, { 0, 1, 1, 1, 1, 0, 1 },
403 { 0, 1, 0, 0, 0, 1, 1 }, { 0, 1, 1, 0, 0, 0, 1 }, { 0, 1, 0, 1, 1, 1, 1 }, { 0, 1, 1, 1, 0, 1, 1 },
404 { 0, 1, 1, 0, 1, 1, 1 }, { 0, 0, 0, 1, 0, 1, 1 }
405 };
406 int data_left_even[10][7] = {
407 { 0, 1, 0, 0, 1, 1, 1 }, { 0, 1, 1, 0, 0, 1, 1 }, { 0, 0, 1, 1, 0, 1, 1 }, { 0, 1, 0, 0, 0, 0, 1 },
408 { 0, 0, 1, 1, 1, 0, 1 }, { 0, 1, 1, 1, 0, 0, 1 }, { 0, 0, 0, 0, 1, 0, 1 }, { 0, 0, 1, 0, 0, 0, 1 },
409 { 0, 0, 0, 1, 0, 0, 1 }, { 0, 0, 1, 0, 1, 1, 1 }
410 };
411 int data_right[10][7] = {
412 { 1, 1, 1, 0, 0, 1, 0 }, { 1, 1, 0, 0, 1, 1, 0 }, { 1, 1, 0, 1, 1, 0, 0 }, { 1, 0, 0, 0, 0, 1, 0 },
413 { 1, 0, 1, 1, 1, 0, 0 }, { 1, 0, 0, 1, 1, 1, 0 }, { 1, 0, 1, 0, 0, 0, 0 }, { 1, 0, 0, 0, 1, 0, 0 },
414 { 1, 0, 0, 1, 0, 0, 0 }, { 1, 1, 1, 0, 1, 0, 0 }
415 };
416 uint8 code[13 + 1];
417 uint32 tmp_p = 0;
418 uint32 csum = 0;
419 int i, j;
420 int len;
421
422 for (i = len = 0; i < 13; i++) {
423 if (!rcode[i]) break;
424 if ((code[i] = rcode[i] - '0') > 9)
425 return(0);
426 len++;
427 }
428 if (len != 13 && len != 12 && len != 8 && len != 7) return(0);
429
430#define BS(x) BarcodeData[tmp_p] = x; tmp_p++
431
432 for (j = 0; j < 32; j++) { // delay before sending a code
433 BS(0x00);
434 }
435
436#ifdef INTERL2OF5
437
438 BS(1); BS(1); BS(0); BS(0); // 1
439 BS(1); BS(1); BS(0); BS(0); // 1
440 BS(1); BS(1); BS(0); BS(0); // 1
441 BS(1); BS(1); BS(0); BS(0); // 1
442 BS(1); BS(1); BS(0); BS(0); // 1
443 BS(1); BS(0); BS(0); // 0
444 BS(1); BS(0); BS(0); // 0
445 BS(1); BS(0); BS(0); // 0
446 BS(1); BS(0); BS(0); // 0
447 BS(1); BS(0); BS(0); // 0
448 BS(1); BS(0); BS(0); // 0
449 BS(1); BS(0); BS(0); // 0
450 BS(1); BS(0); BS(0); // 0
451 BS(1); BS(0); BS(0); // 0
452 BS(1); BS(0); BS(0); // 0

Callers 3

AppWndProcFunction · 0.85
KeyboardCommandsFunction · 0.85
KeyboardCommandsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected