修复nes颜色错误问题
This commit is contained in:
@@ -7,14 +7,14 @@ set(CMAKE_C_FLAGS "-mcpu=${CONFIG_ARCH} -O3 -g3 -mfloat-abi=${CONFIG_FLOAT_TYPE}
|
|||||||
-include ${CMAKE_SOURCE_DIR}/build/autoconf.h \
|
-include ${CMAKE_SOURCE_DIR}/build/autoconf.h \
|
||||||
" CACHE STRING "" FORCE)
|
" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "-mcpu=${CONFIG_ARCH} -O3 -g3 -mfloat-abi=${CONFIG_FLOAT_TYPE} -mthumb -mthumb-interwork -D=MKRTOS -std=c++11 \
|
set(CMAKE_CXX_FLAGS "-mcpu=${CONFIG_ARCH} -O3 -g3 -mfloat-abi=${CONFIG_FLOAT_TYPE} -mthumb -D=MKRTOS -std=c++11 \
|
||||||
-fmessage-length=0 -Xlinker --print-map -Wall -W -fno-stack-protector -g \
|
-fmessage-length=0 -Xlinker --print-map -Wall -W -fno-stack-protector -g \
|
||||||
-u=_printf_float -D__ARM_ARCH_7M__ \
|
-u=_printf_float -D__ARM_ARCH_7M__ \
|
||||||
-ffunction-sections -fdata-sections -fno-builtin -nostartfiles -nodefaultlibs -nostdlib -nostdinc -Xlinker \
|
-ffunction-sections -fdata-sections -fno-builtin -nostartfiles -nodefaultlibs -nostdlib -nostdinc -Xlinker \
|
||||||
-include ${CMAKE_SOURCE_DIR}/build/autoconf.h \
|
-include ${CMAKE_SOURCE_DIR}/build/autoconf.h \
|
||||||
" CACHE STRING "" FORCE)
|
" CACHE STRING "" FORCE)
|
||||||
|
|
||||||
set(CMAKE_ASM_FLAGS "-mcpu=${CONFIG_ARCH} -O3 -g3 -mfloat-abi=${CONFIG_FLOAT_TYPE} -mthumb -mthumb-interwork -D=MKRTOS \
|
set(CMAKE_ASM_FLAGS "-mcpu=${CONFIG_ARCH} -O3 -g3 -mfloat-abi=${CONFIG_FLOAT_TYPE} -mthumb -D=MKRTOS \
|
||||||
-u=_printf_float -std=gnu11 -ffunction-sections -fdata-sections -fno-builtin \
|
-u=_printf_float -std=gnu11 -ffunction-sections -fdata-sections -fno-builtin \
|
||||||
-nostartfiles -nodefaultlibs -nostdlib -nostdinc -Xlinker -fno-stack-protector -D__ARM_ARCH_7M__ \
|
-nostartfiles -nodefaultlibs -nostdlib -nostdinc -Xlinker -fno-stack-protector -D__ARM_ARCH_7M__ \
|
||||||
-include ${CMAKE_SOURCE_DIR}/build/autoconf.h \
|
-include ${CMAKE_SOURCE_DIR}/build/autoconf.h \
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAT32F437ZMT7 -DUSE_STDPERIPH_DRIVER -DAT_SURF_F437_V1 ")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAT32F437ZMT7 -DUSE_STDPERIPH_DRIVER -DAT_SURF_F437_V1 -DINFONES")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DAT32F437ZMT7 -DUSE_STDPERIPH_DRIVER -DAT_SURF_F437_V1 ")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DAT32F437ZMT7 -DUSE_STDPERIPH_DRIVER -DAT_SURF_F437_V1 -DINFONES")
|
||||||
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DAT32F437ZMT7 -DUSE_STDPERIPH_DRIVER -DAT_SURF_F437_V1 ")
|
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DAT32F437ZMT7 -DUSE_STDPERIPH_DRIVER -DAT_SURF_F437_V1 -DINFONES")
|
||||||
|
|
||||||
file(
|
file(
|
||||||
GLOB deps
|
GLOB deps
|
||||||
@@ -14,7 +14,6 @@ file(
|
|||||||
# ${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/NES_Simulator/PPU.c
|
# ${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/NES_Simulator/PPU.c
|
||||||
# ${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/NES_Simulator/ROM__MARIO.c
|
# ${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/NES_Simulator/ROM__MARIO.c
|
||||||
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/infoNES/*.c
|
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/infoNES/*.c
|
||||||
# ${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/infoNES/mapper/*.c
|
|
||||||
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/infoNES/ports/*.c
|
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/infoNES/ports/*.c
|
||||||
*.c
|
*.c
|
||||||
)
|
)
|
||||||
@@ -51,6 +50,7 @@ target_include_directories(
|
|||||||
${CMAKE_SOURCE_DIR}/mkrtos_bsp/AT32/AT32F435_437_Firmware_Library_V2.2.0/project/at_surf_f437_board/
|
${CMAKE_SOURCE_DIR}/mkrtos_bsp/AT32/AT32F435_437_Firmware_Library_V2.2.0/project/at_surf_f437_board/
|
||||||
${CMAKE_SOURCE_DIR}/mkrtos_bsp/AT32/AT32F435_437_Firmware_Library_V2.2.0/middlewares/i2c_application_library
|
${CMAKE_SOURCE_DIR}/mkrtos_bsp/AT32/AT32F435_437_Firmware_Library_V2.2.0/middlewares/i2c_application_library
|
||||||
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator
|
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator
|
||||||
|
|
||||||
# ${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/NES_Simulator
|
# ${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/NES_Simulator
|
||||||
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/infoNES
|
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/infoNES
|
||||||
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/mapper
|
${CMAKE_SOURCE_DIR}/mkrtos_user/server/drv/ATSURFF437/nes_simulator/mapper
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
// #define _USE_ROM_MARIO_
|
#define _USE_ROM_MARIO_
|
||||||
//#define _USE_ROM_DEMO_
|
//#define _USE_ROM_DEMO_
|
||||||
#define _USE_ROM_TANKE_
|
// #define _USE_ROM_TANKE_
|
||||||
|
|
||||||
#ifdef _USE_ROM_MARIO_
|
#ifdef _USE_ROM_MARIO_
|
||||||
char const rom_file[]={78,69,83,26,2,1,1,0,0,0,0,0,0,0,0,0,
|
char const rom_file[]={78,69,83,26,2,1,1,0,0,0,0,0,0,0,0,0,
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file
|
* @file
|
||||||
* @author
|
* @author
|
||||||
* @version
|
* @version
|
||||||
* @date
|
* @date
|
||||||
* @brief
|
* @brief
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "nes_main.h"
|
#include "nes_main.h"
|
||||||
#include "u_sleep.h"
|
#include "u_sleep.h"
|
||||||
@@ -19,140 +19,162 @@
|
|||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
/* Private functions ---------------------------------------------------------*/
|
/* Private functions ---------------------------------------------------------*/
|
||||||
uint8 Continue = TRUE;//????????
|
uint8 Continue = TRUE; //????????
|
||||||
int FrameCnt;
|
int FrameCnt;
|
||||||
|
|
||||||
/* NES ????????*/
|
/* NES ????????*/
|
||||||
void NesFrameCycle(void)
|
void NesFrameCycle(void)
|
||||||
{
|
{
|
||||||
int clocks; //CPU??????
|
int clocks; // CPU??????
|
||||||
|
|
||||||
//// ?????????????????VROM????????????0???????VROM
|
//// ?????????????????VROM????????????0???????VROM
|
||||||
// if ( NesHeader.byVRomSize == 0)
|
// if ( NesHeader.byVRomSize == 0)
|
||||||
// ????VROM?<3F><>??<3F><>?<3F><>?
|
// ????VROM?<3F><>??<3F><>?<3F><>?
|
||||||
FrameCnt = 0;
|
FrameCnt = 0;
|
||||||
while(Continue){
|
while (Continue)
|
||||||
/* scanline: 0~19 VBANK ?<3F><>???PPU???NMI????????NMI ?<3F><>?, */
|
{
|
||||||
FrameCnt++; //???????
|
/* scanline: 0~19 VBANK ?<3F><>???PPU???NMI????????NMI ?<3F><>?, */
|
||||||
// printf("\r\n??????? %d", FrameCnt);
|
FrameCnt++; //???????
|
||||||
SpriteHitFlag = FALSE;
|
// printf("\r\n??????? %d", FrameCnt);
|
||||||
for(PPU_scanline=0; PPU_scanline<20; PPU_scanline++){
|
SpriteHitFlag = FALSE;
|
||||||
|
for (PPU_scanline = 0; PPU_scanline < 20; PPU_scanline++)
|
||||||
|
{
|
||||||
exec6502(CLOCKS_PER_SCANLINE);
|
exec6502(CLOCKS_PER_SCANLINE);
|
||||||
// NesHBCycle();
|
// NesHBCycle();
|
||||||
}
|
}
|
||||||
/* scanline: 20, PPU??????????????<3F><>????????*/
|
/* scanline: 20, PPU??????????????<3F><>????????*/
|
||||||
exec6502(CLOCKS_PER_SCANLINE);
|
exec6502(CLOCKS_PER_SCANLINE);
|
||||||
// NesHBCycle(); //??????
|
// NesHBCycle(); //??????
|
||||||
PPU_scanline++; //20++
|
PPU_scanline++; // 20++
|
||||||
PPU_Reg.R2 &= ~R2_SPR0_HIT;
|
PPU_Reg.R2 &= ~R2_SPR0_HIT;
|
||||||
/* scanline: 21~261*/
|
/* scanline: 21~261*/
|
||||||
for(; PPU_scanline < SCAN_LINE_DISPALY_END_NUM; PPU_scanline++){
|
for (; PPU_scanline < SCAN_LINE_DISPALY_END_NUM; PPU_scanline++)
|
||||||
if((SpriteHitFlag == TRUE) && ((PPU_Reg.R2 & R2_SPR0_HIT) == 0)){
|
{
|
||||||
|
if ((SpriteHitFlag == TRUE) && ((PPU_Reg.R2 & R2_SPR0_HIT) == 0))
|
||||||
|
{
|
||||||
clocks = sprite[0].x * CLOCKS_PER_SCANLINE / NES_DISP_WIDTH;
|
clocks = sprite[0].x * CLOCKS_PER_SCANLINE / NES_DISP_WIDTH;
|
||||||
exec6502(clocks);
|
exec6502(clocks);
|
||||||
PPU_Reg.R2 |= R2_SPR0_HIT;
|
PPU_Reg.R2 |= R2_SPR0_HIT;
|
||||||
exec6502(CLOCKS_PER_SCANLINE - clocks);
|
exec6502(CLOCKS_PER_SCANLINE - clocks);
|
||||||
}else{
|
}
|
||||||
exec6502(CLOCKS_PER_SCANLINE);
|
else
|
||||||
|
{
|
||||||
|
exec6502(CLOCKS_PER_SCANLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(PPU_Reg.R1 & (R1_BG_VISIBLE | R1_SPR_VISIBLE)){ //????????????
|
if (PPU_Reg.R1 & (R1_BG_VISIBLE | R1_SPR_VISIBLE))
|
||||||
if(SpriteHitFlag == FALSE)
|
{ //????????????
|
||||||
NES_GetSpr0HitFlag(PPU_scanline - SCAN_LINE_DISPALY_START_NUM); //????Sprite #0 ??????
|
if (SpriteHitFlag == FALSE)
|
||||||
|
NES_GetSpr0HitFlag(PPU_scanline - SCAN_LINE_DISPALY_START_NUM); //????Sprite #0 ??????
|
||||||
|
}
|
||||||
|
if (FrameCnt & 2)
|
||||||
|
{ //?2???????
|
||||||
|
NES_RenderLine(PPU_scanline - SCAN_LINE_DISPALY_START_NUM); //?????????????
|
||||||
}
|
}
|
||||||
// if(FrameCnt & 2){ //?2???????
|
|
||||||
NES_RenderLine(PPU_scanline - SCAN_LINE_DISPALY_START_NUM); //?????????????
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
/* scanline: 262 ?????*/
|
/* scanline: 262 ?????*/
|
||||||
exec6502(CLOCKS_PER_SCANLINE);
|
exec6502(CLOCKS_PER_SCANLINE);
|
||||||
PPU_Reg.R2 |= R2_VBlank_Flag; //????VBANK ???
|
PPU_Reg.R2 |= R2_VBlank_Flag; //????VBANK ???
|
||||||
/*?????PPU VBANK?<3F><>????????VBANK*/
|
/*?????PPU VBANK?<3F><>????????VBANK*/
|
||||||
if(PPU_Reg.R0 & R0_VB_NMI_EN){
|
if (PPU_Reg.R0 & R0_VB_NMI_EN)
|
||||||
NMI_Flag = SET1; //???????<3F>k????NMI?<3F><>?
|
{
|
||||||
|
NMI_Flag = SET1; //???????<3F>k????NMI?<3F><>?
|
||||||
}
|
}
|
||||||
|
|
||||||
/*?????IRQ????????????????APU??*/
|
/*?????IRQ????????????????APU??*/
|
||||||
|
|
||||||
/* A mapper function in V-Sync ?<3F><>???<3F><>????VBANK???*/
|
/* A mapper function in V-Sync ?<3F><>???<3F><>????VBANK???*/
|
||||||
// MapperVSync();
|
// MapperVSync();
|
||||||
|
|
||||||
/*?????????JoyPad??,????JoyPad???????*/
|
/*?????????JoyPad??,????JoyPad???????*/
|
||||||
// NES_JoyPadUpdateValue(); //systick ?<3F><>????????
|
// NES_JoyPadUpdateValue(); //systick ?<3F><>????????
|
||||||
|
|
||||||
/*?????????????????????*/
|
/*?????????????????????*/
|
||||||
// if(){
|
// if(){
|
||||||
// Continue = FALSE;
|
// Continue = FALSE;
|
||||||
// }
|
// }
|
||||||
u_sleep_ms(1);
|
u_sleep_ms(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief NES_Main program.
|
* @brief NES_Main program.
|
||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
|
||||||
void nes_main(void)
|
|
||||||
{
|
|
||||||
NesHeader *neshreader = (NesHeader *) rom_file;
|
|
||||||
|
|
||||||
/* ????NES??????????0x1A????????0x1a??Ctrl+Z,????????????????????
|
|
||||||
* ???????strcncmp????3??????
|
|
||||||
*/
|
*/
|
||||||
if(strncmp(neshreader->filetype, "NES", 3) != 0){
|
void nes_main(void)
|
||||||
printf("\r\n???<3F><>???????????????, NES??????????");
|
{
|
||||||
|
NesHeader *neshreader = (NesHeader *)rom_file;
|
||||||
|
|
||||||
|
/* ????NES??????????0x1A????????0x1a??Ctrl+Z,????????????????????
|
||||||
|
* ???????strcncmp????3??????
|
||||||
|
*/
|
||||||
|
if (strncmp(neshreader->filetype, "NES", 3) != 0)
|
||||||
|
{
|
||||||
|
printf("\r\n???<3F><>???????????????, NES??????????");
|
||||||
return;
|
return;
|
||||||
}else{
|
}
|
||||||
printf("\r\n?????????<3F><>?");
|
else
|
||||||
|
{
|
||||||
|
printf("\r\n?????????<3F><>?");
|
||||||
printf("\r\n 16kB ROM ?????: %d", neshreader->romnum);
|
printf("\r\n 16kB ROM ?????: %d", neshreader->romnum);
|
||||||
printf("\r\n 8kB VROM ?????: %d", neshreader->vromnum);
|
printf("\r\n 8kB VROM ?????: %d", neshreader->vromnum);
|
||||||
if((neshreader->romfeature & 0x01) == 0){
|
if ((neshreader->romfeature & 0x01) == 0)
|
||||||
|
{
|
||||||
printf("\r\n ??????");
|
printf("\r\n ??????");
|
||||||
}else{
|
}
|
||||||
printf("\r\n ???????");
|
else
|
||||||
|
{
|
||||||
|
printf("\r\n ???????");
|
||||||
}
|
}
|
||||||
|
|
||||||
if((neshreader->romfeature & 0x02) == 0){
|
if ((neshreader->romfeature & 0x02) == 0)
|
||||||
|
{
|
||||||
printf("\r\n ?????SRAM");
|
printf("\r\n ?????SRAM");
|
||||||
}else{
|
}
|
||||||
printf("\r\n ?<3F><>???SRAM");
|
else
|
||||||
|
{
|
||||||
|
printf("\r\n ?<3F><>???SRAM");
|
||||||
}
|
}
|
||||||
|
|
||||||
if((neshreader->romfeature & 0x04) == 0){
|
if ((neshreader->romfeature & 0x04) == 0)
|
||||||
|
{
|
||||||
printf("\r\n ??512????trainer($7000-$71FF)");
|
printf("\r\n ??512????trainer($7000-$71FF)");
|
||||||
}else{
|
}
|
||||||
printf("\r\n ??512????trainer(ROM?????????)");
|
else
|
||||||
|
{
|
||||||
|
printf("\r\n ??512????trainer(ROM?????????)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if((neshreader->romfeature & 0x08) == 0){
|
if ((neshreader->romfeature & 0x08) == 0)
|
||||||
|
{
|
||||||
printf("\r\n 2???VRAM????");
|
printf("\r\n 2???VRAM????");
|
||||||
}else{
|
}
|
||||||
printf("\r\n 4???VRAM????(??????)");
|
else
|
||||||
|
{
|
||||||
|
printf("\r\n 4???VRAM????(??????)");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\r\n iNES Mapper Numbers: %d", (neshreader->rommappernum & 0xF0)|( neshreader->romfeature >> 4));
|
printf("\r\n iNES Mapper Numbers: %d", (neshreader->rommappernum & 0xF0) | (neshreader->romfeature >> 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*?????nes ?????
|
*?????nes ?????
|
||||||
*/
|
*/
|
||||||
init6502mem( 0, /*exp_rom*/
|
init6502mem(0, /*exp_rom*/
|
||||||
0, /*sram ??????????, ??????*/
|
0, /*sram ??????????, ??????*/
|
||||||
(&rom_file[0x10]), /*prg_rombank, ?<3F><>????<3F><> ??????????*/
|
(&rom_file[0x10]), /*prg_rombank, ?<3F><>????<3F><> ??????????*/
|
||||||
neshreader->romnum
|
neshreader->romnum); //?????6502?<3F><>??????
|
||||||
); //?????6502?<3F><>??????
|
|
||||||
reset6502();
|
reset6502();
|
||||||
PPU_Init((&rom_file[0x10] + (neshreader->romnum * 0x4000)), (neshreader->romfeature & 0x01)); /*PPU_?????*/
|
PPU_Init((&rom_file[0x10] + (neshreader->romnum * 0x4000)), (neshreader->romfeature & 0x01)); /*PPU_?????*/
|
||||||
NES_JoyPadInit();
|
NES_JoyPadInit();
|
||||||
/*
|
/*
|
||||||
*nes ????????????
|
*nes ????????????
|
||||||
*/
|
*/
|
||||||
NesFrameCycle();
|
NesFrameCycle();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*******************************END OF FILE***********************************/
|
/*******************************END OF FILE***********************************/
|
||||||
|
|||||||
@@ -4,9 +4,10 @@
|
|||||||
#include "InfoNES.h"
|
#include "InfoNES.h"
|
||||||
#include "InfoNES_System.h"
|
#include "InfoNES_System.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <u_types.h>
|
||||||
// #include "UserMain.h"
|
// #include "UserMain.h"
|
||||||
#include <at_surf_f437_board_lcd.h>
|
// #include <at_surf_f437_board_lcd.h>
|
||||||
|
extern void nes_lcd_color_fill(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *color);
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
/* Palette data */
|
/* Palette data */
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
@@ -150,7 +151,7 @@ void InfoNES_LoadFrame()
|
|||||||
void InfoNES_LoadLine()
|
void InfoNES_LoadLine()
|
||||||
{
|
{
|
||||||
// BSP_LCD_DrawBitmap(32, PPU_Scanline, 256, 1, WorkLine);
|
// BSP_LCD_DrawBitmap(32, PPU_Scanline, 256, 1, WorkLine);
|
||||||
lcd_color_fill(32, PPU_Scanline, 32 + 256, PPU_Scanline, WorkLine);
|
nes_lcd_color_fill(32, PPU_Scanline, 32 + 256, PPU_Scanline, WorkLine);
|
||||||
}
|
}
|
||||||
/* Get a joypad state */
|
/* Get a joypad state */
|
||||||
void InfoNES_PadState(DWORD *pdwPad1, DWORD *pdwPad2, DWORD *pdwSystem)
|
void InfoNES_PadState(DWORD *pdwPad1, DWORD *pdwPad2, DWORD *pdwSystem)
|
||||||
|
|||||||
@@ -6,12 +6,36 @@
|
|||||||
#include <u_sleep.h>
|
#include <u_sleep.h>
|
||||||
#include <u_sys.h>
|
#include <u_sys.h>
|
||||||
#include <u_thread.h>
|
#include <u_thread.h>
|
||||||
// #include <NES_Simulator/nes_main.h>
|
#ifndef INFONES
|
||||||
|
#include <NES_Simulator/nes_main.h>
|
||||||
|
#else
|
||||||
#include <InfoNES.h>
|
#include <InfoNES.h>
|
||||||
|
#endif
|
||||||
void delay_ms(int ms)
|
void delay_ms(int ms)
|
||||||
{
|
{
|
||||||
u_sleep_ms(ms);
|
u_sleep_ms(ms);
|
||||||
}
|
}
|
||||||
|
#ifdef INFONES
|
||||||
|
#define BGR565TORGB565(a) (((a) >> 11) | ((a) & (0x3f << 5)) | (a & 0x1f) << 11)
|
||||||
|
void nes_lcd_color_fill(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *color)
|
||||||
|
{
|
||||||
|
uint16_t height, width;
|
||||||
|
uint16_t i, j;
|
||||||
|
|
||||||
|
width = ex - sx + 1;
|
||||||
|
height = ey - sy + 1;
|
||||||
|
|
||||||
|
lcd_windows_set(sx, sy, ex, ey);
|
||||||
|
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < width; j++)
|
||||||
|
{
|
||||||
|
lcd_data_16bit_write(BGR565TORGB565(color[i * width + j]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
void NES_LCD_DisplayLine(int y_axes, uint16_t *Disaplyline_buffer)
|
void NES_LCD_DisplayLine(int y_axes, uint16_t *Disaplyline_buffer)
|
||||||
{
|
{
|
||||||
lcd_color_fill(0, y_axes, 256, y_axes, Disaplyline_buffer);
|
lcd_color_fill(0, y_axes, 256, y_axes, Disaplyline_buffer);
|
||||||
@@ -58,11 +82,14 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
// nes_main();
|
#ifndef INFONES
|
||||||
|
nes_main();
|
||||||
|
#else
|
||||||
if (InfoNES_Load(NULL) == 0)
|
if (InfoNES_Load(NULL) == 0)
|
||||||
{
|
{
|
||||||
FrameSkip = 2;
|
FrameSkip = 2;
|
||||||
InfoNES_Main();
|
InfoNES_Main();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user