mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-22 12:30:01 +00:00
added P2 gamepad buttons; lwlink parses symbol map
This commit is contained in:
parent
01b01b169a
commit
c1cbb51c71
@ -197,6 +197,7 @@ export class VectorVideo extends RasterVideo {
|
||||
// TODO: landscape vs portrait
|
||||
var alpha = Math.pow(intensity / 255.0, this.gamma);
|
||||
ctx.globalAlpha = alpha;
|
||||
ctx.lineWidth = 3;
|
||||
ctx.beginPath();
|
||||
// TODO: bright dots
|
||||
var jx = this.jitter * (Math.random() - 0.5);
|
||||
@ -349,8 +350,8 @@ export const Keys = {
|
||||
B: {c: 16, n: "Shift", plyr:0, button:1},
|
||||
GP_A: {c: 88, n: "X", plyr:0, button:0},
|
||||
GP_B: {c: 90, n: "Z", plyr:0, button:1},
|
||||
GP_C: {c: 83, n: "S", plyr:0, button:2},
|
||||
GP_D: {c: 65, n: "A", plyr:0, button:3},
|
||||
GP_C: {c: 86, n: "V", plyr:0, button:2},
|
||||
GP_D: {c: 67, n: "C", plyr:0, button:3},
|
||||
SELECT: {c: 220, n: "\\", plyr:0, button:8},
|
||||
START: {c: 13, n: "Enter", plyr:0, button:9},
|
||||
// gamepad and keyboard (player 1)
|
||||
@ -360,6 +361,10 @@ export const Keys = {
|
||||
P2_RIGHT: {c: 68, n: "D", plyr:1, xaxis:1},
|
||||
P2_A: {c: 84, n: "T", plyr:1, button:0},
|
||||
P2_B: {c: 82, n: "R", plyr:1, button:1},
|
||||
P2_GP_A: {c: 69, n: "E", plyr:1, button:0},
|
||||
P2_GP_B: {c: 82, n: "R", plyr:1, button:1},
|
||||
P2_GP_C: {c: 84, n: "T", plyr:1, button:2},
|
||||
P2_GP_D: {c: 89, n: "Y", plyr:1, button:3},
|
||||
P2_SELECT: {c: 70, n: "F", plyr:1, button:8},
|
||||
P2_START: {c: 71, n: "G", plyr:1, button:9},
|
||||
// keyboard only
|
||||
|
@ -29,6 +29,15 @@ var VECTREX_KEYCODE_MAP = makeKeycodeMap([
|
||||
[Keys.GP_B, 2, 0x02],
|
||||
[Keys.GP_C, 2, 0x04],
|
||||
[Keys.GP_D, 2, 0x08],
|
||||
|
||||
[Keys.P2_LEFT, 1, 0x01],
|
||||
[Keys.P2_RIGHT, 1, 0x02],
|
||||
[Keys.P2_DOWN, 1, 0x04],
|
||||
[Keys.P2_UP, 1, 0x08],
|
||||
[Keys.P2_GP_A, 2, 0x10],
|
||||
[Keys.P2_GP_B, 2, 0x20],
|
||||
[Keys.P2_GP_C, 2, 0x40],
|
||||
[Keys.P2_GP_D, 2, 0x80],
|
||||
]);
|
||||
|
||||
//
|
||||
@ -815,10 +824,13 @@ class VectrexPlatform extends Base6809Platform {
|
||||
setKeyboardFromMap(this.video, this.inputs, VECTREX_KEYCODE_MAP); // true = always send function);
|
||||
}
|
||||
|
||||
// TODO: loadControlsState
|
||||
updateControls() {
|
||||
// joystick (analog simulation)
|
||||
this.alg.jch0 = (this.inputs[0] & 0x1) ? 0x00 : (this.inputs[0] & 0x2) ? 0xff : 0x80;
|
||||
this.alg.jch1 = (this.inputs[0] & 0x4) ? 0x00 : (this.inputs[0] & 0x8) ? 0xff : 0x80;
|
||||
this.alg.jch2 = (this.inputs[1] & 0x1) ? 0x00 : (this.inputs[1] & 0x2) ? 0xff : 0x80;
|
||||
this.alg.jch3 = (this.inputs[1] & 0x4) ? 0x00 : (this.inputs[1] & 0x8) ? 0xff : 0x80;
|
||||
// buttons (digital)
|
||||
this.psg.psg.register[14] = ~this.inputs[2];
|
||||
}
|
||||
|
@ -1,5 +1,17 @@
|
||||
define basesympat s_%s
|
||||
define lensympat l_%s
|
||||
section code load 0x0
|
||||
section *,!bss
|
||||
section bss load 0x9000
|
||||
section start load 0
|
||||
section code
|
||||
section constructors_start
|
||||
section constructors
|
||||
section constructors_end
|
||||
section destructors_start
|
||||
section destructors
|
||||
section destructors_end
|
||||
section initgl_start
|
||||
section initgl
|
||||
section initgl_end
|
||||
section rodata
|
||||
section rwdata load 0x9800
|
||||
section bss,bss
|
||||
entry program_start
|
||||
|
@ -95,6 +95,7 @@ var PLATFORM_PARAMS = {
|
||||
data_start: 0x9800,
|
||||
data_size: 0x2800,
|
||||
stack_end: 0xc000,
|
||||
//extra_compile_args: ['--vectrex'],
|
||||
extra_link_files: ['williams.scr', 'libcmoc-crt-vec.a', 'libcmoc-std-vec.a'],
|
||||
extra_link_args: ['-swilliams.scr', '-lcmoc-crt-vec', '-lcmoc-std-vec'],
|
||||
},
|
||||
@ -2192,7 +2193,7 @@ function linkLWLINK(step:BuildStep) {
|
||||
var args = [
|
||||
'-L.',
|
||||
'--entry=program_start',
|
||||
'--format=raw',
|
||||
'--raw',
|
||||
'--output=main',
|
||||
'--map=main.map'].concat(libargs, step.args);
|
||||
console.log(args);
|
||||
@ -2206,10 +2207,27 @@ function linkLWLINK(step:BuildStep) {
|
||||
// return unchanged if no files changed
|
||||
if (!anyTargetChanged(step, ["main", "main.map"]))
|
||||
return;
|
||||
// parse symbol map (TODO: omit segments, constants)
|
||||
// parse symbol map
|
||||
//console.log(mapout);
|
||||
var symbolmap = {};
|
||||
// TODO: build segment map
|
||||
var segments = {};
|
||||
var segments = [];
|
||||
for (var s of mapout.split("\n")) {
|
||||
var toks = s.split(" ");
|
||||
// TODO: use regex
|
||||
if (toks[0] == 'Symbol:') {
|
||||
let ident = toks[1];
|
||||
let ofs = parseInt(toks[4], 16);
|
||||
if (ident && ofs >= 0 && !ident.startsWith("l_")) {
|
||||
symbolmap[ident] = ofs;
|
||||
}
|
||||
}
|
||||
else if (toks[0] == 'Section:') {
|
||||
let seg = toks[1];
|
||||
let segstart = parseInt(toks[5], 16);
|
||||
let segsize = parseInt(toks[7], 16);
|
||||
segments.push({name:seg, start:segstart, size:segsize});
|
||||
}
|
||||
}
|
||||
// build listings
|
||||
var listings : CodeListingMap = {};
|
||||
for (var fn of step.files) {
|
||||
|
Loading…
Reference in New Issue
Block a user