Skip to content

Commit 01f0ec9

Browse files
committed
PCE: Removed a few unused variables
1 parent 7740b07 commit 01f0ec9

File tree

12 files changed

+73
-141
lines changed

12 files changed

+73
-141
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Retro-Go is composed of a launcher and several emulators.
88
- Sega Master System
99
- Sega Game Gear
1010
- Colecovision
11-
- PC Engine (Soon!)
11+
- PC Engine
1212

1313
### Compared to other similar projects for the ODROID-GO, Retro-Go brings:
1414
- In-game menu

huexpress-go/components/huexpress/engine/debug.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/* */
1313
/****************************************************************************/
1414

15+
#include <stdlib.h>
1516
#include "h6280.h"
1617
#include "debug.h"
1718

huexpress-go/components/huexpress/engine/gfx.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ Loop6502()
229229
&& ((IO_VDC_06_RCR.W & 0x3FF) <= 0x146)) {
230230
uint16 temp_rcr = (uint16) ((IO_VDC_06_RCR.W & 0x3FF) - 0x40);
231231

232-
if (scanline
232+
if (Scanline
233233
== (temp_rcr + IO_VDC_0C_VPR.B.l + IO_VDC_0C_VPR.B.h) % 263) {
234-
// printf("\n---------------------\nRASTER HIT (%d)\n----------------------\n", scanline);
234+
// printf("\n---------------------\nRASTER HIT (%d)\n----------------------\n", Scanline);
235235
io.vdc_status |= VDC_RasHit;
236236
return_value = INT_IRQ;
237237
}
@@ -244,14 +244,13 @@ Loop6502()
244244

245245
// Rendering of tiles / sprites
246246

247-
if (scanline < 14) {
247+
if (Scanline < 14) {
248248
gfx_need_redraw = 0;
249-
} else if (scanline < 14 + 242) {
250-
if (scanline == 14) {
249+
} else if (Scanline < 14 + 242) {
250+
if (Scanline == 14) {
251251
last_display_counter = 0;
252252
display_counter = 0;
253253
ScrollYDiff = 0;
254-
oldScrollYDiff = 0;
255254

256255
// Signal that we've left the VBlank area
257256
io.vdc_status &= ~VDC_InVBlank;
@@ -260,18 +259,18 @@ Loop6502()
260259
io.vdc_status);
261260
}
262261

263-
if (scanline == io.vdc_min_display) {
262+
if (Scanline == io.vdc_min_display) {
264263
gfx_need_redraw = 0;
265264

266265
save_gfx_context(0);
267266

268267
TRACE("GFX: FORCED SAVE OF GFX CONTEXT\n");
269268
}
270269

271-
if ((scanline >= io.vdc_min_display)
272-
&& (scanline <= io.vdc_max_display)) {
270+
if ((Scanline >= io.vdc_min_display)
271+
&& (Scanline <= io.vdc_max_display)) {
273272
if (gfx_need_redraw) {
274-
// && scanline > io.vdc_min_display)
273+
// && Scanline > io.vdc_min_display)
275274
// We got render things before being on the second line
276275

277276
render_lines(last_display_counter, display_counter);
@@ -280,8 +279,8 @@ Loop6502()
280279
}
281280
display_counter++;
282281
}
283-
} else if (scanline < 14 + 242 + 4) {
284-
if (scanline == 14 + 242) {
282+
} else if (Scanline < 14 + 242 + 4) {
283+
if (Scanline == 14 + 242) {
285284
save_gfx_context(0);
286285

287286
render_lines(last_display_counter, display_counter);
@@ -346,10 +345,10 @@ Loop6502()
346345

347346
// Incrementing the scanline
348347

349-
scanline++;
348+
Scanline++;
350349

351-
if (scanline >= 263)
352-
scanline = 0;
350+
if (Scanline >= 263)
351+
Scanline = 0;
353352

354353
if ((return_value != INT_IRQ) && io.vdc_pendvsync) {
355354
io.vdc_status |= VDC_InVBlank;

huexpress-go/components/huexpress/engine/h6280.c

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ DRAM_ATTR const uchar flnz_list[256] = {
3838

3939
#define OP_CALL_THROUGH_LOOKUP (*optable_runtime[opcode].func_exe)();
4040

41+
#define cycles Cycles
42+
4143
// pointer to the beginning of the Zero Page area
4244
#define zp_base (RAM)
4345

@@ -75,8 +77,6 @@ push_16bit(uint16 addr)
7577
*(sp_base + reg_s--) = (uchar) (addr & 0xFF);
7678
}
7779

78-
static uint32 cycles = 0;
79-
8080
#include "h6280_opcodes.h"
8181
#include "h6280_opcodes_define.h"
8282

@@ -127,8 +127,6 @@ exe_go(void)
127127
uchar temp, temp1, temp2;
128128
uint16 addr, from, to, len, alternate;
129129

130-
cycles = 0;
131-
cyclecount = 0;
132130
PCERunning = 1;
133131

134132
while (true) // PCERunning
@@ -430,7 +428,7 @@ exe_go(void)
430428

431429
for (uchar i = 0; i < 8; i++) {
432430
if (temp & (1 << i)) {
433-
reg_a = mmr[i];
431+
reg_a = MMR[i];
434432
}
435433
}
436434
reg_p &= ~FL_T;
@@ -665,13 +663,6 @@ exe_go(void)
665663
_OPCODE_rmb_(0x80)
666664
break;
667665
case 0x78: // {sei, AM_IMPL, "SEI"}
668-
#ifdef DUMP_ON_SEI
669-
int i;
670-
Log("MMR[7]\n");
671-
for (i = 0xE000; i < 0xE100; i++) {
672-
Log("%02X ", get_8bit_addr(i));
673-
}
674-
#endif
675666
reg_p = (reg_p | FL_I) & ~FL_T;
676667
reg_pc++;
677668
cycles += 2;
@@ -1154,9 +1145,9 @@ exe_go(void)
11541145

11551146
// HSYNC stuff - count cycles:
11561147
/*if (cycles > 455) */ {
1157-
cyclecount += cycles;
1148+
TotalCycles += cycles;
11581149
// cycles -= 455;
1159-
// scanline++;
1150+
// Scanline++;
11601151

11611152
// Log("Calling periodic handler\n");
11621153

@@ -1173,12 +1164,12 @@ exe_go(void)
11731164
if (I)
11741165
Int6502(I); /* Interrupt if needed */
11751166

1176-
if ((uint) (cyclecount - cyclecountold) > (uint) TimerPeriod * 2)
1177-
cyclecountold = cyclecount;
1167+
if (TotalCycles - PrevTotalCycles > TimerPeriod * 2)
1168+
PrevTotalCycles = TotalCycles;
11781169

11791170
} /*else*/ {
1180-
if (cyclecount - cyclecountold >= TimerPeriod) {
1181-
cyclecountold += TimerPeriod;
1171+
if (TotalCycles - PrevTotalCycles >= TimerPeriod) {
1172+
PrevTotalCycles += TimerPeriod;
11821173
if ((I = TimerInt()))
11831174
Int6502(I);
11841175
}
@@ -1203,7 +1194,7 @@ dump_cpu_registers()
12031194
Log("S = 0x%02x\n", reg_s);
12041195

12051196
for (i = 0; i < 8; i++) {
1206-
Log("MMR[%d] = 0x%02x\n", i, mmr[i]);
1197+
Log("MMR[%d] = 0x%02x\n", i, MMR[i]);
12071198
}
12081199

12091200
// TODO: Add zero page dump

huexpress-go/components/huexpress/engine/h6280_opcodes.h

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,11 +2879,6 @@ tai(void)
28792879
len = get_16bit_addr(reg_pc + 5);
28802880
alternate = 0;
28812881

2882-
#if ENABLE_TRACING_CD && defined(INLINED_ACCESSORS)
2883-
fprintf(stderr, "Transfert from bank 0x%02x to bank 0x%02x\n",
2884-
mmr[from >> 13], mmr[to >> 13]);
2885-
#endif
2886-
28872882
cycles += (6 * len) + 17;
28882883
while (len-- != 0) {
28892884
put_8bit_addr(to++, get_8bit_addr(from + alternate));
@@ -2951,11 +2946,6 @@ tdd(void)
29512946
to = get_16bit_addr(reg_pc + 3);
29522947
len = get_16bit_addr(reg_pc + 5);
29532948

2954-
#if ENABLE_TRACING_CD && defined(INLINED_ACCESSORS)
2955-
fprintf(stderr, "Transfert from bank 0x%02x to bank 0x%02x\n",
2956-
mmr[from >> 13], mmr[to >> 13]);
2957-
#endif
2958-
29592949
cycles += (6 * len) + 17;
29602950
while (len-- != 0) {
29612951
put_8bit_addr(to--, get_8bit_addr(from--));
@@ -2975,11 +2965,6 @@ tia(void)
29752965
len = get_16bit_addr(reg_pc + 5);
29762966
alternate = 0;
29772967

2978-
#if ENABLE_TRACING_CD && defined(INLINED_ACCESSORS)
2979-
fprintf(stderr, "Transfert from bank 0x%02x to bank 0x%02x\n",
2980-
mmr[from >> 13], mmr[to >> 13]);
2981-
#endif
2982-
29832968
cycles += (6 * len) + 17;
29842969
while (len-- != 0) {
29852970
put_8bit_addr(to + alternate, get_8bit_addr(from++));
@@ -2999,11 +2984,6 @@ tii(void)
29992984
to = get_16bit_addr(reg_pc + 3);
30002985
len = get_16bit_addr(reg_pc + 5);
30012986

3002-
#if ENABLE_TRACING_CD && defined(INLINED_ACCESSORS)
3003-
fprintf(stderr, "Transfert from bank 0x%02x to bank 0x%02x\n",
3004-
mmr[from >> 13], mmr[to >> 13]);
3005-
#endif
3006-
30072987
cycles += (6 * len) + 17;
30082988
while (len-- != 0) {
30092989
put_8bit_addr(to++, get_8bit_addr(from++));
@@ -3022,11 +3002,6 @@ tin(void)
30223002
to = get_16bit_addr(reg_pc + 3);
30233003
len = get_16bit_addr(reg_pc + 5);
30243004

3025-
#if ENABLE_TRACING_CD && defined(INLINED_ACCESSORS)
3026-
fprintf(stderr, "Transfert from bank 0x%02x to bank 0x%02x\n",
3027-
mmr[from >> 13], mmr[to >> 13]);
3028-
#endif
3029-
30303005
cycles += (6 * len) + 17;
30313006
while (len-- != 0) {
30323007
put_8bit_addr(to, get_8bit_addr(from++));
@@ -3053,7 +3028,7 @@ tma(void)
30533028

30543029
for (i = 0; i < 8; i++) {
30553030
if (bitfld & (1 << i)) {
3056-
reg_a = mmr[i];
3031+
reg_a = MMR[i];
30573032
}
30583033
}
30593034
reg_p &= ~FL_T;

huexpress-go/components/huexpress/engine/hard_pce.c

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,8 @@ IO_write(uint16 A, uchar V)
409409

410410
save_gfx_context(0);
411411

412-
if (!PCE.scroll) {
413-
oldScrollX = ScrollX;
414-
oldScrollY = ScrollY;
415-
oldScrollYDiff = ScrollYDiff;
416-
}
417412
IO_VDC_08_BYR.B.l = V;
418-
PCE.scroll = 1;
419-
ScrollYDiff = scanline - 1;
413+
ScrollYDiff = Scanline - 1;
420414
ScrollYDiff -= IO_VDC_0C_VPR.B.h + IO_VDC_0C_VPR.B.l;
421415

422416
#if ENABLE_TRACING_DEEP_GFX
@@ -432,13 +426,7 @@ IO_write(uint16 A, uchar V)
432426

433427
save_gfx_context(0);
434428

435-
if (!PCE.scroll) {
436-
oldScrollX = ScrollX;
437-
oldScrollY = ScrollY;
438-
oldScrollYDiff = ScrollYDiff;
439-
}
440429
IO_VDC_07_BXR.B.l = V;
441-
PCE.scroll = 1;
442430
return;
443431

444432
case CR:
@@ -586,15 +574,8 @@ IO_write(uint16 A, uchar V)
586574
*/
587575

588576
save_gfx_context(0);
589-
590-
if (!PCE.scroll) {
591-
oldScrollX = ScrollX;
592-
oldScrollY = ScrollY;
593-
oldScrollYDiff = ScrollYDiff;
594-
}
595577
IO_VDC_08_BYR.B.h = V & 1;
596-
PCE.scroll = 1;
597-
ScrollYDiff = scanline - 1;
578+
ScrollYDiff = Scanline - 1;
598579
ScrollYDiff -= IO_VDC_0C_VPR.B.h + IO_VDC_0C_VPR.B.l;
599580
#if ENABLE_TRACING_GFX
600581
if (ScrollYDiff < 0)
@@ -621,14 +602,7 @@ IO_write(uint16 A, uchar V)
621602

622603
save_gfx_context(0);
623604

624-
if (!PCE.scroll) {
625-
oldScrollX = ScrollX;
626-
oldScrollY = ScrollY;
627-
oldScrollYDiff = ScrollYDiff;
628-
}
629-
630605
IO_VDC_07_BXR.B.h = V & 3;
631-
PCE.scroll = 1;
632606
return;
633607
}
634608
IO_VDC_active.B.h = V;
@@ -733,16 +707,13 @@ IO_write(uint16 A, uchar V)
733707
io.psg_da_data[io.psg_ch][io.psg_da_index[io.psg_ch]] = V;
734708
io.psg_da_index[io.psg_ch] =
735709
(io.psg_da_index[io.psg_ch] + 1) & 0x3FF;
736-
if (io.psg_da_count[io.psg_ch]++ >
737-
(PSG_DIRECT_ACCESS_BUFSIZE - 1)) {
738-
if (!io.psg_channel_disabled[io.psg_ch])
739-
MESSAGE_INFO
740-
("Audio being put into the direct access buffer faster than it's being played.\n");
710+
if (io.psg_da_count[io.psg_ch]++ > (PSG_DIRECT_ACCESS_BUFSIZE - 1)) {
711+
MESSAGE_INFO("Audio being put into the direct "
712+
"access buffer faster than it's being played.\n");
741713
io.psg_da_count[io.psg_ch] = 0;
742714
}
743715
} else {
744-
io.wave[io.psg_ch][io.PSG[io.psg_ch][PSG_DATA_INDEX_REG]] =
745-
V;
716+
io.wave[io.psg_ch][io.PSG[io.psg_ch][PSG_DATA_INDEX_REG]] = V;
746717
io.PSG[io.psg_ch][PSG_DATA_INDEX_REG] =
747718
(io.PSG[io.psg_ch][PSG_DATA_INDEX_REG] + 1) & 0x1F;
748719
}
@@ -837,9 +808,9 @@ TimerInt()
837808
IRAM_ATTR void
838809
bank_set(uchar P, uchar V)
839810
{
840-
MESSAGE_DEBUG("Bank switching (mmr[%d] = %d)\n", P, V);
811+
MESSAGE_DEBUG("Bank switching (MMR[%d] = %d)\n", P, V);
841812

842-
mmr[P] = V;
813+
MMR[P] = V;
843814
if (ROMMapR[V] == IOAREA) {
844815
PageR[P] = IOAREA;
845816
PageW[P] = IOAREA;
@@ -900,7 +871,7 @@ dump_pce_cpu_environment()
900871
Log("S = 0x%02x\n", reg_s);
901872

902873
for (i = 0; i < 8; i++) {
903-
Log("MMR[%d] = 0x%02x\n", i, mmr[i]);
874+
Log("MMR[%d] = 0x%02x\n", i, MMR[i]);
904875
}
905876

906877
opcode_long_position = reg_pc & 0xE000;

0 commit comments

Comments
 (0)