Silence some codacy errors.

This commit is contained in:
Godzil 2018-01-31 18:32:22 +00:00
parent 7e1afab7e3
commit e837f43f86
4 changed files with 22 additions and 16 deletions

View File

@ -150,9 +150,9 @@
unsigned short tmp = 0; unsigned char v = read; \ unsigned short tmp = 0; unsigned char v = read; \
tmp = cpu->reg_A + v + (cpu->reg_P & Q6502_C_FLAG); \ tmp = cpu->reg_A + v + (cpu->reg_P & Q6502_C_FLAG); \
cpu->reg_P = (cpu->reg_P & ~(Q6502_C_FLAG | Q6502_N_FLAG | Q6502_Z_FLAG | Q6502_V_FLAG)) | \ cpu->reg_P = (cpu->reg_P & ~(Q6502_C_FLAG | Q6502_N_FLAG | Q6502_Z_FLAG | Q6502_V_FLAG)) | \
(tmp & 0x80) | ((tmp&0xFF)?0:Q6502_Z_FLAG) | \ (tmp & Q6502_N_FLAG) | ((tmp&0xFF)?0:Q6502_Z_FLAG) | \
((tmp & 0xFF00)?Q6502_C_FLAG:0) | \ ((tmp & 0xFF00)?Q6502_C_FLAG:0) | \
( (( ~(cpu->reg_A^v)&(cpu->reg_A^tmp) ))&0x80?Q6502_V_FLAG:0 ); \ ( (( ~(cpu->reg_A^v)&(cpu->reg_A^tmp) )&0x80)?Q6502_V_FLAG:0 ); \
cpu->reg_A = tmp & 0xFF; \ cpu->reg_A = tmp & 0xFF; \
} while(0) } while(0)

View File

@ -61,12 +61,11 @@ void time_stamp_line(void)
void log_real(int level, char *user, char *fmt, ...) void log_real(int level, char *user, char *fmt, ...)
{ {
int i;
va_list va;
/* The LOG_PANIC must always be displayed */ /* The LOG_PANIC must always be displayed */
if ((level <= MAX_DEBUG_LEVEL) || (level <= LOG_PANIC)) if ((level <= MAX_DEBUG_LEVEL) || (level <= LOG_PANIC))
{ {
va_list va;
switch(level) switch(level)
{ {
case LOG_PANIC: printf(BRED FWHITE); break; case LOG_PANIC: printf(BRED FWHITE); break;
@ -84,6 +83,7 @@ void log_real(int level, char *user, char *fmt, ...)
if (user != NULL) if (user != NULL)
{ {
int i;
i = strlen(user); i = strlen(user);
if (i < 12) if (i < 12)
{ {

View File

@ -377,19 +377,10 @@ _AAA BCDD DDDE EEEE
int ppu_hblank(uint16_t scanline) int ppu_hblank(uint16_t scanline)
{ {
uint32_t i, j; uint32_t j;
uint8_t pixelColor = 0;
uint8_t BgColor = 0;
uint8_t SpriteColor = 0;
/* Sprite to display on current scanline */ /* Sprite to display on current scanline */
spriteData scanSprites[8]; spriteData scanSprites[8];
uint16_t addr;
uint8_t value;
uint16_t tmp_HHT = 0;
uint16_t tmp_VVTFV = 0;
uint8_t spriteCount = 0;
ppu_scanlineSpriteOverflow = 0; ppu_scanlineSpriteOverflow = 0;
if ( scanline == 0 ) if ( scanline == 0 )
@ -400,6 +391,9 @@ int ppu_hblank(uint16_t scanline)
if ( scanline < 240 ) if ( scanline < 240 )
{ {
int i;
uint8_t spriteCount = 0;
/* Search for sprites on current scanline */ /* Search for sprites on current scanline */
for (i = 0 ; i < 8 ; i++) for (i = 0 ; i < 8 ; i++)
{ {
@ -434,6 +428,12 @@ int ppu_hblank(uint16_t scanline)
/* For each PPU pixel of this scanline */ /* For each PPU pixel of this scanline */
for ( i = 0 ; i < 256 ; i++ ) for ( i = 0 ; i < 256 ; i++ )
{ {
uint16_t addr;
uint8_t value;
uint8_t pixelColor = 0;
uint8_t BgColor = 0;
/* Set the current pixel color to the bg color */ /* Set the current pixel color to the bg color */
pixelColor = ppu_bgColor; pixelColor = ppu_bgColor;
BgColor = 0; BgColor = 0;
@ -475,6 +475,8 @@ int ppu_hblank(uint16_t scanline)
if ( ( ( i + PPU_Reg_FH ) % 8 ) == 7 ) if ( ( ( i + PPU_Reg_FH ) % 8 ) == 7 )
{ {
uint16_t tmp_HHT = 0;
tmp_HHT = ( ( PPU_Reg_Counter >> 5 ) & 0x0020 ) | tmp_HHT = ( ( PPU_Reg_Counter >> 5 ) & 0x0020 ) |
( PPU_Reg_Counter & 0x001F ); ( PPU_Reg_Counter & 0x001F );
tmp_HHT = ( tmp_HHT + 1 ) & 0x003F; tmp_HHT = ( tmp_HHT + 1 ) & 0x003F;
@ -511,6 +513,8 @@ int ppu_hblank(uint16_t scanline)
if ( ( spriteRelX >= 0 ) && ( spriteRelX < 8 ) ) if ( ( spriteRelX >= 0 ) && ( spriteRelX < 8 ) )
{ {
uint8_t SpriteColor = 0;
/* Get sprite tile address */ /* Get sprite tile address */
if ( ppu_spriteSize == 8 ) if ( ppu_spriteSize == 8 )
{ {
@ -615,6 +619,7 @@ int ppu_hblank(uint16_t scanline)
if ( ppu_backgroundVisibility == 1 ) if ( ppu_backgroundVisibility == 1 )
{ {
uint16_t tmp_VVTFV = 0;
tmp_VVTFV = ( ( PPU_Reg_Counter >> 3 ) & 0x0100 ) | /* V */ tmp_VVTFV = ( ( PPU_Reg_Counter >> 3 ) & 0x0100 ) | /* V */
( ( PPU_Reg_Counter >> 2 ) & 0x00F8 ) | /* VT */ ( ( PPU_Reg_Counter >> 2 ) & 0x00F8 ) | /* VT */

View File

@ -152,7 +152,6 @@ byte ppu_readMemory(byte page, byte addr)
void ppu_writeMemory(byte page, byte addr, byte value) void ppu_writeMemory(byte page, byte addr, byte value)
{ {
byte *ptr;
if (page == 0x3F) if (page == 0x3F)
{ {
/* Here we will cheat with the palette miroring, since we didn't write /* Here we will cheat with the palette miroring, since we didn't write
@ -168,6 +167,8 @@ void ppu_writeMemory(byte page, byte addr, byte value)
} }
else else
{ {
byte *ptr;
ptr = ppu_memoryPages[page & 0x3F]; ptr = ppu_memoryPages[page & 0x3F];
ptr[addr] = value; ptr[addr] = value;
} }