mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-23 03:29:39 +00:00
Merge branch 'master' of github.com:sehugg/8bitworkshop
This commit is contained in:
commit
13254bebd5
3
presets/verilog/.gitignore
vendored
Normal file
3
presets/verilog/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*.asc
|
||||
*.bin
|
||||
*.blif
|
@ -5,3 +5,10 @@ check:
|
||||
|
||||
deps.dot:
|
||||
grep \`include *.v | sed "s/:/ /g" | awk '{ print "\"" $1 "\" -> " $3 ";" }'
|
||||
|
||||
%.bin: %.v
|
||||
~/yosys/yosys -p "synth_ice40 -blif $*.blif" $*.v
|
||||
arachne-pnr -d 1k -p icestick.pcf $*.blif -o $*.asc
|
||||
icepack $*.asc $*.bin
|
||||
#iceprog $*.bin
|
||||
|
9
presets/verilog/icestick.pcf
Normal file
9
presets/verilog/icestick.pcf
Normal file
@ -0,0 +1,9 @@
|
||||
# For the iCE40HX-1K iCEstick
|
||||
|
||||
set_io reset 99
|
||||
set_io hsync 98
|
||||
set_io vsync 97
|
||||
set_io rgb[0] 96
|
||||
set_io rgb[1] 95
|
||||
set_io rgb[2] 94
|
||||
set_io clk 21
|
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "sprite_bitmap.v"
|
||||
`include "sprite_renderer.v"
|
||||
@ -50,24 +50,30 @@ module racing_game_top(clk, hsync, vsync, rgb, hpaddle, vpaddle);
|
||||
if (!hpaddle) paddle_x <= vpos[7:0];
|
||||
if (!vpaddle) paddle_y <= vpos[7:0];
|
||||
end
|
||||
|
||||
|
||||
// select player or enemy access to ROM
|
||||
wire player_load = (hpos >= 256) && (hpos < 260);
|
||||
wire enemy_load = (hpos >= 260);
|
||||
// wire up car sprite ROM
|
||||
wire [3:0] car_sprite_yofs;
|
||||
wire [7:0] car_sprite_bits;
|
||||
|
||||
// multiplex between player and enemy ROM address
|
||||
wire [3:0] player_sprite_yofs;
|
||||
wire [3:0] enemy_sprite_yofs;
|
||||
wire [3:0] car_sprite_yofs = player_load ? player_sprite_yofs : enemy_sprite_yofs;
|
||||
wire [7:0] car_sprite_bits;
|
||||
car_bitmap car(
|
||||
.yofs(car_sprite_yofs),
|
||||
.bits(car_sprite_bits));
|
||||
|
||||
// signals for player sprite generator
|
||||
wire player_vstart = {1'd0,player_y} == vpos;
|
||||
wire player_hstart = {1'd0,player_x} == hpos;
|
||||
wire player_vstart = {1'b0,player_y} == vpos;
|
||||
wire player_hstart = {1'b0,player_x} == hpos;
|
||||
wire player_gfx;
|
||||
wire player_is_drawing;
|
||||
|
||||
// signals for enemy sprite generator
|
||||
wire enemy_vstart = {1'd0,enemy_y} == vpos;
|
||||
wire enemy_hstart = {1'd0,enemy_x} == hpos;
|
||||
wire enemy_vstart = {1'b0,enemy_y} == vpos;
|
||||
wire enemy_hstart = {1'b0,enemy_x} == hpos;
|
||||
wire enemy_gfx;
|
||||
wire enemy_is_drawing;
|
||||
|
||||
@ -75,9 +81,9 @@ module racing_game_top(clk, hsync, vsync, rgb, hpaddle, vpaddle);
|
||||
sprite_renderer player_renderer(
|
||||
.clk(clk),
|
||||
.vstart(player_vstart),
|
||||
.load(hpos == 256),
|
||||
.load(player_load),
|
||||
.hstart(player_hstart),
|
||||
.rom_addr(car_sprite_yofs),
|
||||
.rom_addr(player_sprite_yofs),
|
||||
.rom_bits(car_sprite_bits),
|
||||
.gfx(player_gfx),
|
||||
.in_progress(player_is_drawing));
|
||||
@ -86,9 +92,9 @@ module racing_game_top(clk, hsync, vsync, rgb, hpaddle, vpaddle);
|
||||
sprite_renderer enemy_renderer(
|
||||
.clk(clk),
|
||||
.vstart(enemy_vstart),
|
||||
.load(hpos == 258),
|
||||
.load(enemy_load),
|
||||
.hstart(enemy_hstart),
|
||||
.rom_addr(car_sprite_yofs),
|
||||
.rom_addr(enemy_sprite_yofs),
|
||||
.rom_bits(car_sprite_bits),
|
||||
.gfx(enemy_gfx),
|
||||
.in_progress(player_is_drawing));
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
|
||||
`include "hvsync_generator.v"
|
||||
`include "sprite_bitmap.v"
|
||||
`include "sprite_renderer.v"
|
||||
@ -106,22 +106,26 @@ module racing_game_cpu_top(clk, reset, hsync, vsync, hpaddle, vpaddle,
|
||||
);
|
||||
|
||||
// flags for player sprite renderer module
|
||||
wire player_vstart = {1'0,ram[PLAYER_Y]} == vpos;
|
||||
wire player_hstart = {1'0,ram[PLAYER_X]} == hpos;
|
||||
wire player_vstart = {1'b0,ram[PLAYER_Y]} == vpos;
|
||||
wire player_hstart = {1'b0,ram[PLAYER_X]} == hpos;
|
||||
wire player_gfx;
|
||||
wire player_is_drawing;
|
||||
|
||||
// flags for enemy sprite renderer module
|
||||
wire enemy_vstart = {1'0,ram[ENEMY_Y]} == vpos;
|
||||
wire enemy_hstart = {1'0,ram[ENEMY_X]} == hpos;
|
||||
wire enemy_vstart = {1'b0,ram[ENEMY_Y]} == vpos;
|
||||
wire enemy_hstart = {1'b0,ram[ENEMY_X]} == hpos;
|
||||
wire enemy_gfx;
|
||||
wire enemy_is_drawing;
|
||||
|
||||
// flags shared between sprite renderer modules
|
||||
wire [3:0] car_sprite_yofs;
|
||||
wire [7:0] car_sprite_bits;
|
||||
|
||||
// car bitmap ROM
|
||||
// select player or enemy access to ROM
|
||||
wire player_load = (hpos >= 256) && (hpos < 260);
|
||||
wire enemy_load = (hpos >= 260);
|
||||
// wire up car sprite ROM
|
||||
// multiplex between player and enemy ROM address
|
||||
wire [3:0] player_sprite_yofs;
|
||||
wire [3:0] enemy_sprite_yofs;
|
||||
wire [3:0] car_sprite_yofs = player_load ? player_sprite_yofs : enemy_sprite_yofs;
|
||||
wire [7:0] car_sprite_bits;
|
||||
car_bitmap car(
|
||||
.yofs(car_sprite_yofs),
|
||||
.bits(car_sprite_bits));
|
||||
@ -131,8 +135,8 @@ module racing_game_cpu_top(clk, reset, hsync, vsync, hpaddle, vpaddle,
|
||||
.clk(clk),
|
||||
.vstart(player_vstart),
|
||||
.hstart(player_hstart),
|
||||
.load(hpos == 256), //TODO?
|
||||
.rom_addr(car_sprite_yofs),
|
||||
.load(player_load),
|
||||
.rom_addr(player_sprite_yofs),
|
||||
.rom_bits(car_sprite_bits),
|
||||
.gfx(player_gfx),
|
||||
.in_progress(player_is_drawing));
|
||||
@ -142,8 +146,8 @@ module racing_game_cpu_top(clk, reset, hsync, vsync, hpaddle, vpaddle,
|
||||
.clk(clk),
|
||||
.vstart(enemy_vstart),
|
||||
.hstart(enemy_hstart),
|
||||
.load(hpos == 260), //TODO?
|
||||
.rom_addr(car_sprite_yofs),
|
||||
.load(enemy_load),
|
||||
.rom_addr(enemy_sprite_yofs),
|
||||
.rom_bits(car_sprite_bits),
|
||||
.gfx(enemy_gfx),
|
||||
.in_progress(player_is_drawing));
|
||||
|
@ -24,6 +24,7 @@ export class WaveformView {
|
||||
pageWidth : number;
|
||||
clocksPerPage : number;
|
||||
clockMax : number;
|
||||
hexformat : boolean = false;
|
||||
|
||||
constructor(parent:HTMLElement, wfp:WaveformProvider) {
|
||||
this.parent = parent;
|
||||
@ -118,6 +119,10 @@ export class WaveformView {
|
||||
this.setSelTime(0);
|
||||
this.setOrgTime(0);
|
||||
});
|
||||
Mousetrap(wlc).bind('h', (e,combo) => {
|
||||
this.hexformat = !this.hexformat;
|
||||
this.refresh();
|
||||
});
|
||||
$(window).resize(() => {
|
||||
this.recreate();
|
||||
}); // TODO: remove?
|
||||
@ -224,7 +229,8 @@ export class WaveformView {
|
||||
var val = data[this.tsel - this.t0];
|
||||
ctx.textAlign = 'right';
|
||||
if (val !== undefined) {
|
||||
ctx.fillText(val.toString(), w-fh, ycen);
|
||||
var s = this.hexformat ? val.toString(16) : val.toString();
|
||||
ctx.fillText(s, w-fh, ycen);
|
||||
}
|
||||
}
|
||||
// draw labels
|
||||
|
Loading…
Reference in New Issue
Block a user