Skip to content

Commit

Permalink
corrected SYS6 diagnostic and implemented SYS3 nvram setings together…
Browse files Browse the repository at this point in the history
… with APC
  • Loading branch information
bontango committed Oct 9, 2023
1 parent a68634c commit ae4800f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/lisy/lisy_api_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <wiringPi.h>

extern char debugbuf[256]; // see hw_lib.c

Expand Down Expand Up @@ -870,6 +871,10 @@ lisy_api_set_apc_game_setting(unsigned char number, unsigned char value) {
//send value
cmd_data[3] = value;

//delay for APC
delay(10);

//send cmd
if (lisy_api_write(cmd_data, 4, ls80dbg.bitv.basic) != 4) {
fprintf(stderr, "Game setting Error writing to serial %s\n", strerror(errno));
return(-1);
Expand All @@ -894,6 +899,9 @@ lisy_api_get_apc_game_setting(unsigned char number) {
//send setting number
cmd_data[2] = number;

//delay for APC
delay(10);

//send cmd
if (lisy_api_write(cmd_data, 3, ls80dbg.bitv.switches) != 3) {
printf("Error get switch status writing to serial\n");
Expand Down
14 changes: 12 additions & 2 deletions src/lisy/lisy_w.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ void
lisy_S3_cmos_setting(void) {
int i, ret;
UINT8 data[29];
UINT8 old_data[29];
unsigned char action;

//calculate decimal values out of 4bit bcd data in CMOS
Expand Down Expand Up @@ -1288,10 +1289,19 @@ printf("get setting %d: %d\n",42+i,data[i]);

//write new settings to cmos
//calculate 4bit bcd data in CMOS out of data
for(i=0; i<58; i+=2) {
//data 1..8
for(i=2; i<=16; i+=2) {
lisy_s4_CMOS[i] = data[i/2] / 10;
lisy_s4_CMOS[i+1] = data[i/2] % 10;
//printf("data %d bcd %d %d\n",data[i/2], lisy_s4_CMOS[i] , lisy_s4_CMOS[i+1] );
lisy_s4_CMOS[i] |= 0xf0;
lisy_s4_CMOS[i+1] |= 0xf0;
}
//data 12..21
for(i=24; i<=42; i+=2) {
lisy_s4_CMOS[i] = data[i/2] / 10;
lisy_s4_CMOS[i+1] = data[i/2] % 10;
//printf("data %d bcd %d %d\n",data[i/2], lisy_s4_CMOS[i] , lisy_s4_CMOS[i+1] );
//printf("data %d bcd %d %d\n",data[i/2], lisy_s4_CMOS[i] , lisy_s4_CMOS[i+1] );
lisy_s4_CMOS[i] |= 0xf0;
lisy_s4_CMOS[i+1] |= 0xf0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lisy/lisyversion.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define LISYVERSION "5.28-90-00"
#define LISYVERSION "5.28-91-00"
19 changes: 16 additions & 3 deletions src/wpc/s4.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ static void s4_irqline(int state) {
static INTERRUPT_GEN(s4_irq) {
s4_irqline(1);
#if defined(LISY_SUPPORT)
//get the switches from LISY_mini
static count = 0;
//get the switches from LISY_mini (needed in test/diag mode)
lisy_w_switch_handler();
//timing according to throttle value in games.cfg
lisy_w_throttle();
//reduced call to throttle in order not to interfere with timing
//but needed for nvram timer
if ((count++) > 500 ) {
lisy_w_throttle();
count = 0;
}
#endif
timer_set(TIME_IN_CYCLES(32,0),0,s4_irqline);
}
Expand All @@ -135,10 +140,18 @@ static READ_HANDLER(s4_dips_r) {
/************/
/* SWITCH MATRIX */
static READ_HANDLER(s4_swrow_r) {
#if defined(LISY_SUPPORT)
//get the switches from LISY_mini
lisy_w_switch_handler();
#endif
return core_getSwCol(s4locals.swCol);
}

static WRITE_HANDLER(s4_swcol_w) {
#if defined(LISY_SUPPORT)
//LISY timing adjusted with switch polling
lisy_w_throttle();
#endif
s4locals.swCol = data;
}

Expand Down
19 changes: 16 additions & 3 deletions src/wpc/s6.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,15 @@ static void s6_piaIrq(int state) {
static INTERRUPT_GEN(s6_irq) {
s6_irqline(1);
#if defined(LISY_SUPPORT)
//get the switches from LISY_mini
static count = 0;
//get the switches from LISY_mini (needed in test/diag mode)
lisy_w_switch_handler();
//timing according to throttle value in games.cfg
lisy_w_throttle();
//reduced call to throttle in order not to interfere with timing
//but needed for nvram timer
if ((count++) > 500 ) {
lisy_w_throttle();
count = 0;
}
#endif
timer_set(TIME_IN_CYCLES(32,0),0,s6_irqline);
}
Expand All @@ -142,10 +147,18 @@ static READ_HANDLER(s6_dips_r) {
/*SWITCH MATRIX */
/********************/
static READ_HANDLER(s6_swrow_r) {
#if defined(LISY_SUPPORT)
//get the switches from LISY_mini
lisy_w_switch_handler();
#endif
return core_getSwCol(s6locals.swCol);
}

static WRITE_HANDLER(s6_swcol_w) {
#if defined(LISY_SUPPORT)
//LISY timing adjusted with switch polling
lisy_w_throttle();
#endif
s6locals.swCol = data;
}

Expand Down

0 comments on commit ae4800f

Please sign in to comment.