moved declare vars to ui module imports

This commit is contained in:
Steven Hugg 2018-09-16 19:45:32 -04:00
parent d1d761406c
commit 51bf1226d0
8 changed files with 45 additions and 32 deletions

View File

@ -64,6 +64,9 @@ TODO:
- 'undefined' for bitmap replacer
- astrocade: run to cursor in hello world messes up emulation
- requestInterrupt needs to be disabled after breakpoint?
- verilog resets randomly (lfsr enable bit)
- verilog: when paused scope doesn't work
- verilog: don't need fps controls when no video
WEB WORKER FORMAT

6
package-lock.json generated
View File

@ -524,6 +524,12 @@
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
"dev": true
},
"jquery": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz",
"integrity": "sha1-LInWiJterFIqfuoywUUhVZxsvwI=",
"dev": true
},
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",

View File

@ -11,6 +11,7 @@
"btoa": "^1.2.1",
"clipboard": "^2.0.1",
"heapdump": "^0.3.9",
"jquery": "^2.x",
"jsdom": "^12.0.0",
"lzg": "^1.0.0",
"mocha": "^5.2.0",

View File

@ -1,4 +1,4 @@

`ifndef SPRITE_RENDERER_H
`define SPRITE_RENDERER_H
@ -17,22 +17,23 @@ module sprite_renderer(clk, vstart, load, hstart, rom_addr, rom_bits,
output gfx; // output pixel
output in_progress; // 0 if waiting for vstart
assign in_progress = state != WAIT_FOR_VSTART;
reg [2:0] state; // current state #
reg [3:0] ycount; // number of scanlines drawn so far
reg [3:0] xcount; // number of horiz. pixels in this line
reg [7:0] outbits; // register to store bits from ROM
// states
// states for state machine
localparam WAIT_FOR_VSTART = 0;
localparam WAIT_FOR_LOAD = 1;
localparam LOAD1_SETUP = 2;
localparam LOAD1_FETCH = 3;
localparam WAIT_FOR_HSTART = 4;
localparam DRAW = 5;
// assign in_progress output bit
assign in_progress = state != WAIT_FOR_VSTART;
always @(posedge clk)
begin
case (state)
@ -86,6 +87,7 @@ module sprite_renderer(clk, vstart, load, hstart, rom_addr, rom_bits,
endmodule
/// TEST MODULE
module sprite_render_test_top(clk, hsync, vsync, rgb, hpaddle, vpaddle);
@ -97,12 +99,15 @@ module sprite_render_test_top(clk, hsync, vsync, rgb, hpaddle, vpaddle);
wire [8:0] hpos;
wire [8:0] vpos;
// player position
reg [7:0] player_x;
reg [7:0] player_y;
// paddle position
reg [7:0] paddle_x;
reg [7:0] paddle_y;
// video sync generator
hvsync_generator hvsync_gen(
.clk(clk),
.reset(0),
@ -113,6 +118,7 @@ module sprite_render_test_top(clk, hsync, vsync, rgb, hpaddle, vpaddle);
.vpos(vpos)
);
// car bitmap ROM and associated wires
wire [3:0] car_sprite_addr;
wire [7:0] car_sprite_bits;
@ -120,11 +126,14 @@ module sprite_render_test_top(clk, hsync, vsync, rgb, hpaddle, vpaddle);
.yofs(car_sprite_addr),
.bits(car_sprite_bits));
wire vstart = {1'd0,player_y} == vpos;
wire hstart = {1'd0,player_x} == hpos;
wire car_gfx;
wire in_progress;
// convert player X/Y to 9 bits and compare to CRT hpos/vpos
wire vstart = {1'b0,player_y} == vpos;
wire hstart = {1'b0,player_x} == hpos;
wire car_gfx; // car sprite video signal
wire in_progress; // 1 = rendering taking place on scanline
// sprite renderer module
sprite_renderer renderer(
.clk(clk),
.vstart(vstart),
@ -135,6 +144,7 @@ module sprite_render_test_top(clk, hsync, vsync, rgb, hpaddle, vpaddle);
.gfx(car_gfx),
.in_progress(in_progress));
// measure paddle position
always @(posedge hpaddle)
paddle_x <= vpos[7:0];
@ -147,6 +157,7 @@ module sprite_render_test_top(clk, hsync, vsync, rgb, hpaddle, vpaddle);
player_y <= paddle_y;
end
// video RGB output
wire r = display_on && car_gfx;
wire g = display_on && car_gfx;
wire b = display_on && in_progress;

View File

@ -61,7 +61,7 @@ const _BallyAstrocadePlatform = function(mainElement, arcade) {
const sheight = arcade ? 204 : 102;
const swbytes = Math.floor(swidth / 4);
const cpuFrequency = 1789000;
const cpuCyclesPerLine = cpuFrequency/(60*sheight);
const cpuCyclesPerLine = cpuFrequency/(60*sheight); // TODO: wait states?
const INITIAL_WATCHDOG = 256;
const PIXEL_ON = 0xffeeeeee;
const PIXEL_OFF = 0xff000000;

View File

@ -5,15 +5,11 @@ import { PLATFORMS, RAM, newAddressDecoder, dumpRAM } from "../emu";
import { hex, lpad, tobin, byte2signed } from "../util";
import { CodeAnalyzer_vcs } from "../analysis";
import { disassemble6502 } from "../cpu/disasm6502";
import { platform, symbolmap, addr2symbol } from "../ui";
declare var platform : Platform; // global platform object
declare var Javatari : any;
declare var jt : any; // 6502
// TODO: import or put in platform
declare var symbolmap : {[ident:string]:number};
declare var addr2symbol : {[addr:number]:string};
const VCS_PRESETS = [
{id:'examples/hello', chapter:4, name:'Hello 6502 and TIA'},
{id:'examples/vsync', chapter:5, name:'Painting on the CRT', title:'Color Bars'},

View File

@ -23,12 +23,13 @@ declare var exports;
if (window['Javatari']) window['Javatari'].AUTO_START = false;
var PRESETS : Preset[]; // presets array
var platform_id : string; // platform ID string
var platform : Platform; // platform object
export var platform_id : string; // platform ID string
export var platform : Platform; // platform object
var toolbar = $("#controls_top");
var current_project : CodeProject; // current CodeProject object
export var current_project : CodeProject; // current CodeProject object
var projectWindows : ProjectWindows; // window manager
@ -57,13 +58,14 @@ var userPaused : boolean; // did user explicitly pause?
var current_output; // current ROM
var current_preset_entry : Preset; // current preset object (if selected)
var main_file_id : string; // main file ID
var symbolmap; // symbol map
declare var addr2symbol; // address to symbol name map
var compparams; // received build params from worker
var store; // persistent store
export var symbolmap; // symbol map
export var addr2symbol; // address to symbol name map
export var compparams; // received build params from worker
export var lastDebugState; // last debug state (object)
var lastDebugInfo; // last debug info (CPU text)
var lastDebugState; // last debug state (object)
var debugCategory; // current debug category
function getCurrentPresetTitle() : string {
@ -563,7 +565,7 @@ function setDebugButtonState(btnid:string, btnstate:string) {
}
function setupDebugCallback(btnid? : string) {
platform.setupDebug(function(state) {
if (platform.setupDebug) platform.setupDebug((state) => {
lastDebugState = state;
showDebugInfo(state);
projectWindows.refresh(true);
@ -1130,7 +1132,7 @@ function loadScript(scriptfn, onload) {
}
// start
function startUI(loadplatform : boolean) {
export function startUI(loadplatform : boolean) {
installErrorHandler();
// add default platform?
platform_id = qs['platform'] || localStorage.getItem("__lastplatform");

View File

@ -4,9 +4,10 @@ import $ = require("jquery");
//import CodeMirror = require("codemirror");
import { CodeProject } from "./project";
import { SourceFile, WorkerError } from "./workertypes";
import { Platform } from "./baseplatform";
import { Platform, EmuState } from "./baseplatform";
import { hex, lpad, rpad } from "./util";
import { CodeAnalyzer } from "./analysis";
import { platform, platform_id, compparams, symbolmap, addr2symbol, current_project, lastDebugState } from "./ui";
export interface ProjectView {
createDiv(parent:HTMLElement, text:string) : HTMLElement;
@ -25,14 +26,7 @@ export interface ProjectView {
// TODO: move to different namespace
declare var CodeMirror;
declare var platform : Platform;
declare var platform_id : string;
declare var compparams;
declare var symbolmap : {[ident:string]:number};
declare var addr2symbol : {[addr:number]:string};
declare var current_project : CodeProject;
declare var VirtualList;
declare var lastDebugState;
// helper function for editor
function jumpToLine(ed, i:number) {