mirror of
https://github.com/mist-devel/mist-board.git
synced 2026-01-27 12:21:44 +00:00
Added option to switch palette between FCEUX (very common) and Unsaturated-V6 (very close to NTSC).
This commit is contained in:
@@ -158,13 +158,12 @@ parameter CONF_STR = {
|
||||
"O2,Scanlines,OFF,ON;",
|
||||
"O3,Invert mirroring,OFF,ON;",
|
||||
"O4,Hide overscan,OFF,ON;",
|
||||
"T5,Start;",
|
||||
"T6,Select;",
|
||||
"T7,Reset;",
|
||||
"O5,Palette,FCEUX,Unsaturated-V6;",
|
||||
"T6,Reset;",
|
||||
"V,v0.8;"
|
||||
};
|
||||
|
||||
parameter CONF_STR_LEN = 8+25+20+27+24+9+10+9+7;
|
||||
parameter CONF_STR_LEN = 8+25+20+27+24+32+9+7;
|
||||
wire [7:0] status;
|
||||
|
||||
wire arm_reset = status[0];
|
||||
@@ -172,13 +171,17 @@ wire smoothing_osd = status[1];
|
||||
wire scanlines_osd = status[2];
|
||||
wire mirroring_osd = status[3];
|
||||
wire overscan_osd = status[4];
|
||||
wire start_osd = status[5];
|
||||
wire select_osd = status[6];
|
||||
wire reset_osd = status[7];
|
||||
wire palette2_osd = status[5];
|
||||
wire reset_osd = status[6];
|
||||
|
||||
// no longer used
|
||||
wire start_osd = 0;
|
||||
wire select_osd = 0;
|
||||
|
||||
wire scandoubler_disable;
|
||||
wire ps2_kbd_clk, ps2_kbd_data;
|
||||
|
||||
|
||||
user_io #(.STRLEN(CONF_STR_LEN)) user_io(
|
||||
.conf_str(CONF_STR),
|
||||
// the spi interface
|
||||
@@ -431,7 +434,8 @@ video video (
|
||||
.smoothing(!smoothing_osd),
|
||||
.scanlines(scanlines_osd),
|
||||
.overscan(overscan_osd),
|
||||
|
||||
.palette(palette2_osd),
|
||||
|
||||
.VGA_HS(VGA_HS),
|
||||
.VGA_VS(VGA_VS),
|
||||
.VGA_R(VGA_R),
|
||||
|
||||
64
cores/nes/src/nes_palette_fceux.txt
Normal file
64
cores/nes/src/nes_palette_fceux.txt
Normal file
@@ -0,0 +1,64 @@
|
||||
39ce
|
||||
4464
|
||||
5400
|
||||
4c08
|
||||
3811
|
||||
0815
|
||||
0014
|
||||
002f
|
||||
00a8
|
||||
0100
|
||||
0140
|
||||
08e0
|
||||
2ce3
|
||||
0000
|
||||
0000
|
||||
0000
|
||||
5ef7
|
||||
75c0
|
||||
74e4
|
||||
7810
|
||||
5c17
|
||||
2c1c
|
||||
00bb
|
||||
0539
|
||||
01d1
|
||||
0240
|
||||
02a0
|
||||
1e40
|
||||
4600
|
||||
0000
|
||||
0000
|
||||
0000
|
||||
7fff
|
||||
7ee7
|
||||
7e4b
|
||||
7e28
|
||||
7dfe
|
||||
59df
|
||||
31df
|
||||
1e7f
|
||||
1efe
|
||||
0b50
|
||||
2769
|
||||
4feb
|
||||
6fa0
|
||||
3def
|
||||
0000
|
||||
0000
|
||||
7fff
|
||||
7f95
|
||||
7f58
|
||||
7f3a
|
||||
7f1f
|
||||
6f1f
|
||||
5aff
|
||||
577f
|
||||
539f
|
||||
53fc
|
||||
5fd5
|
||||
67f6
|
||||
7bf3
|
||||
6318
|
||||
0000
|
||||
0000
|
||||
64
cores/nes/src/nes_palette_unsaturatedv6.txt
Normal file
64
cores/nes/src/nes_palette_unsaturatedv6.txt
Normal file
@@ -0,0 +1,64 @@
|
||||
35ad
|
||||
4060
|
||||
4823
|
||||
4027
|
||||
302b
|
||||
140b
|
||||
004a
|
||||
0068
|
||||
00c6
|
||||
0121
|
||||
0120
|
||||
0d00
|
||||
2ce0
|
||||
0000
|
||||
0000
|
||||
0000
|
||||
5ad6
|
||||
6943
|
||||
74c9
|
||||
748e
|
||||
5873
|
||||
3074
|
||||
0cb4
|
||||
0130
|
||||
01ac
|
||||
0205
|
||||
0220
|
||||
2200
|
||||
49e0
|
||||
0000
|
||||
0000
|
||||
0000
|
||||
7fff
|
||||
7eac
|
||||
7e32
|
||||
7dd7
|
||||
7ddc
|
||||
65be
|
||||
361e
|
||||
167b
|
||||
02f7
|
||||
0350
|
||||
1f6b
|
||||
3f49
|
||||
6729
|
||||
294a
|
||||
0000
|
||||
0000
|
||||
7fff
|
||||
7f98
|
||||
7f5a
|
||||
7f3c
|
||||
7f3f
|
||||
7b3f
|
||||
635f
|
||||
577e
|
||||
4fbd
|
||||
4fda
|
||||
5bd7
|
||||
67d6
|
||||
77d6
|
||||
5ef7
|
||||
0000
|
||||
0000
|
||||
@@ -10,6 +10,7 @@ module video(
|
||||
input smoothing,
|
||||
input scanlines,
|
||||
input overscan,
|
||||
input palette,
|
||||
|
||||
input sck,
|
||||
input ss,
|
||||
@@ -49,10 +50,20 @@ osd #(10'd0, 10'd0, 3'd4) osd (
|
||||
);
|
||||
|
||||
// NES Palette -> RGB555 conversion
|
||||
reg [15:0] pallut[0:63];
|
||||
initial $readmemh("nes_palette.txt", pallut);
|
||||
wire [14:0] pixel = pallut[color][14:0];
|
||||
reg [15:0] pal_lut[0:63];
|
||||
initial $readmemh("nes_palette_original.txt", pal_lut); // MiST legacy
|
||||
|
||||
// NTSC UnsaturatedV6 palette
|
||||
//see: http://www.firebrandx.com/nespalette.html
|
||||
reg [15:0] pal_unsat_lut[0:63];
|
||||
initial $readmemh("nes_palette_unsaturatedv6.txt", pal_unsat_lut);
|
||||
|
||||
// FCEUX palette
|
||||
reg [15:0] pal_fcelut[0:63];
|
||||
initial $readmemh("nes_palette_fceux.txt", pal_fcelut);
|
||||
|
||||
wire [14:0] pixel = palette ? pal_unsat_lut[color][14:0] : pal_fcelut[color][14:0];
|
||||
|
||||
// Horizontal and vertical counters
|
||||
reg [9:0] h, v;
|
||||
wire hpicture = (h < 512); // 512 lines of picture
|
||||
@@ -86,9 +97,9 @@ wire darker = !mode && v[0] && scanlines;
|
||||
// display overlay to hide overscan area
|
||||
// based on Mario3, DoubleDragon2, Shadow of the Ninja
|
||||
wire ol = overscan && ( (h > 512-16) ||
|
||||
(h < 18) ||
|
||||
(v < 8) ||
|
||||
( v > (mode? 240-10 : 480-20) )
|
||||
(h < 20) ||
|
||||
(v < (mode ? 6 : 12)) ||
|
||||
(v > (mode ? 240-10 : 480-20))
|
||||
);
|
||||
|
||||
wire [4:0] vga_r = ol ? {4'b0, pixel_v[4:4]} : (darker ? {1'b0, pixel_v[4:1]} : pixel_v[4:0]);
|
||||
|
||||
Reference in New Issue
Block a user