mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-04-30 18:37:16 +00:00
fallback to network if include fails
This commit is contained in:
parent
89b1c64ac8
commit
6b4c3bdbc2
@ -1,17 +1,23 @@
|
||||
|
||||
// ALU operations
|
||||
parameter OP_LOAD_A = 4'h0;
|
||||
parameter OP_LOAD_B = 4'h1;
|
||||
parameter OP_OR = 4'h2;
|
||||
parameter OP_AND = 4'h3;
|
||||
parameter OP_XOR = 4'h4;
|
||||
parameter OP_INC = 4'h5;
|
||||
parameter OP_DEC = 4'h6;
|
||||
parameter OP_INC = 4'h2;
|
||||
parameter OP_DEC = 4'h3;
|
||||
parameter OP_OR = 4'h4;
|
||||
parameter OP_AND = 4'h5;
|
||||
parameter OP_XOR = 4'h6;
|
||||
parameter OP_ZERO = 4'h7;
|
||||
// operations that generate carry
|
||||
parameter OP_ADD = 4'h8;
|
||||
parameter OP_SUB = 4'h9;
|
||||
parameter OP_ASL = 4'ha;
|
||||
parameter OP_LSR = 4'hb;
|
||||
// operations that generate and use carry
|
||||
parameter OP_ADC = 4'h8;
|
||||
parameter OP_SBB = 4'h9;
|
||||
parameter OP_ROL = 4'ha;
|
||||
parameter OP_ROR = 4'hb;
|
||||
parameter OP_ADC = 4'hc;
|
||||
parameter OP_SBB = 4'hd;
|
||||
parameter OP_ROL = 4'he;
|
||||
parameter OP_ROR = 4'hf;
|
||||
|
||||
module ALU(A, B, Y, aluop, carry);
|
||||
|
||||
@ -25,18 +31,22 @@ module ALU(A, B, Y, aluop, carry);
|
||||
case (aluop)
|
||||
OP_LOAD_A: Y = {1'b0, A};
|
||||
OP_LOAD_B: Y = {1'b0, B};
|
||||
OP_INC: Y = A + 1;
|
||||
OP_DEC: Y = A - 1;
|
||||
OP_OR: Y = {1'b0, A | B};
|
||||
OP_AND: Y = {1'b0, A & B};
|
||||
OP_XOR: Y = {1'b0, A ^ B};
|
||||
OP_INC: Y = A + 1;
|
||||
OP_DEC: Y = A - 1;
|
||||
OP_ZERO: Y = 0;
|
||||
|
||||
OP_ADD: Y = A + B;
|
||||
OP_SUB: Y = A - B;
|
||||
OP_ASL: Y = {A, 1'b0};
|
||||
OP_LSR: Y = {A[0], 1'b0, A[7:1]};
|
||||
|
||||
OP_ADC: Y = A + B + (carry?1:0);
|
||||
OP_SBB: Y = A - B - (carry?1:0);
|
||||
OP_ROL: Y = {A, carry};
|
||||
OP_ROR: Y = {A[0], carry, A[7:1]};
|
||||
default: Y = 9'bx;
|
||||
endcase
|
||||
|
||||
endmodule
|
||||
|
@ -424,6 +424,7 @@ function loadFileDependencies(text) {
|
||||
while (m = re.exec(text)) {
|
||||
arr.push({
|
||||
filename:m[1],
|
||||
prefix:platform_id,
|
||||
text:store.loadFile(m[1]) || store.loadFile('local/'+m[1]) // TODO??
|
||||
});
|
||||
}
|
||||
|
@ -1049,6 +1049,18 @@ function writeDependencies(depends, FS, errors) {
|
||||
var d = depends[i];
|
||||
if (d.text) {
|
||||
FS.writeFile(d.filename, d.text, {encoding:'utf8'});
|
||||
} else {
|
||||
// load from network (hopefully cached)
|
||||
// TODO: get from indexeddb?
|
||||
var path = '../../presets/' + d.prefix + '/' + d.filename;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", path, false); // synchronous request
|
||||
xhr.send(null);
|
||||
if (xhr.response) {
|
||||
FS.writeFile(d.filename, xhr.response, {encoding:'utf8'});
|
||||
} else {
|
||||
console.log("Could not load " + path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user