VSU performance tweak, add immediate notation setting
This commit is contained in:
parent
b4b9131f39
commit
7e31fbd582
|
@ -87,9 +87,6 @@ static void vsuEmulateChannel(VB *sim, int index, uint32_t clocks) {
|
||||||
if (!chan->int_.enb)
|
if (!chan->int_.enb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Process all clocks */
|
|
||||||
do {
|
|
||||||
|
|
||||||
/* Frequency modifications are active */
|
/* Frequency modifications are active */
|
||||||
freqmod =
|
freqmod =
|
||||||
index == 4 && /* Channel 5 */
|
index == 4 && /* Channel 5 */
|
||||||
|
@ -97,6 +94,9 @@ static void vsuEmulateChannel(VB *sim, int index, uint32_t clocks) {
|
||||||
sim->vsu.freqmod.interval != 0 /* Modifications valid */
|
sim->vsu.freqmod.interval != 0 /* Modifications valid */
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/* Process all clocks */
|
||||||
|
do {
|
||||||
|
|
||||||
/* Clocks until next state change */
|
/* Clocks until next state change */
|
||||||
until = clocks;
|
until = clocks;
|
||||||
if (chan->clocks < until)
|
if (chan->clocks < until)
|
||||||
|
|
|
@ -253,18 +253,24 @@ static void dasmOpDisp26(char*dest, VBU_DasmConfig*config, VBU_DasmLine*line) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Format a 5-bit sign-extended immediate operand */
|
/* Format a 5-bit sign-extended immediate operand */
|
||||||
static void dasmOpImm5S(char *dest, VBU_DasmLine *line) {
|
static void dasmOpImm5S(char *dest, VBU_DasmConfig*config, VBU_DasmLine *line){
|
||||||
|
if (config->immediateNotation == VBU_NUMBER)
|
||||||
|
*dest++ = '#';
|
||||||
sprintf(dest, "%d", SignExtend(line->code[0], 5));
|
sprintf(dest, "%d", SignExtend(line->code[0], 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Format a 5-bit zero-filled immediate operand */
|
/* Format a 5-bit zero-filled immediate operand */
|
||||||
static void dasmOpImm5U(char *dest, VBU_DasmLine *line) {
|
static void dasmOpImm5U(char *dest, VBU_DasmConfig*config, VBU_DasmLine *line){
|
||||||
|
if (config->immediateNotation == VBU_NUMBER)
|
||||||
|
*dest++ = '#';
|
||||||
sprintf(dest, "%d", line->code[0] & 31);
|
sprintf(dest, "%d", line->code[0] & 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Format a 16-bit sign-extended immediate operand */
|
/* Format a 16-bit sign-extended immediate operand */
|
||||||
static void dasmOpImm16S(char*dest, VBU_DasmConfig*config, VBU_DasmLine*line) {
|
static void dasmOpImm16S(char*dest, VBU_DasmConfig*config, VBU_DasmLine*line) {
|
||||||
int32_t imm = (int16_t) ((int16_t) line->code[3] << 8 | line->code[2]);
|
int32_t imm = (int16_t) ((int16_t) line->code[3] << 8 | line->code[2]);
|
||||||
|
if (config->immediateNotation == VBU_NUMBER)
|
||||||
|
*dest++ = '#';
|
||||||
if (imm >= -256 && imm <= 256) {
|
if (imm >= -256 && imm <= 256) {
|
||||||
sprintf(dest, "%d", imm);
|
sprintf(dest, "%d", imm);
|
||||||
return;
|
return;
|
||||||
|
@ -279,6 +285,8 @@ static void dasmOpImm16S(char*dest, VBU_DasmConfig*config, VBU_DasmLine*line) {
|
||||||
/* Format a 16-bit zero-filled immediate operand */
|
/* Format a 16-bit zero-filled immediate operand */
|
||||||
static void dasmOpImm16U(char*dest, VBU_DasmConfig*config, VBU_DasmLine*line) {
|
static void dasmOpImm16U(char*dest, VBU_DasmConfig*config, VBU_DasmLine*line) {
|
||||||
uint16_t imm = (uint16_t) line->code[3] << 8 | line->code[2];
|
uint16_t imm = (uint16_t) line->code[3] << 8 | line->code[2];
|
||||||
|
if (config->immediateNotation == VBU_NUMBER)
|
||||||
|
*dest++ = '#';
|
||||||
dasmToHex(dest, config, 4, imm);
|
dasmToHex(dest, config, 4, imm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,8 +462,8 @@ static void dasmOperand(char *dest, VBU_DasmConfig *config,
|
||||||
case DASM_BCOND : dasmOpBCOND (dest, config, line); break;
|
case DASM_BCOND : dasmOpBCOND (dest, config, line); break;
|
||||||
case DASM_DISP9 : dasmOpDisp9 (dest, config, line); break;
|
case DASM_DISP9 : dasmOpDisp9 (dest, config, line); break;
|
||||||
case DASM_DISP26: dasmOpDisp26(dest, config, line); break;
|
case DASM_DISP26: dasmOpDisp26(dest, config, line); break;
|
||||||
case DASM_IMM5S : dasmOpImm5S (dest, line); break;
|
case DASM_IMM5S : dasmOpImm5S (dest, config, line); break;
|
||||||
case DASM_IMM5U : dasmOpImm5U (dest, line); break;
|
case DASM_IMM5U : dasmOpImm5U (dest, config, line); break;
|
||||||
case DASM_IMM16S: dasmOpImm16S(dest, config, line); break;
|
case DASM_IMM16S: dasmOpImm16S(dest, config, line); break;
|
||||||
case DASM_IMM16U: dasmOpImm16U(dest, config, line); break;
|
case DASM_IMM16U: dasmOpImm16U(dest, config, line); break;
|
||||||
case DASM_JMP : dasmOpJMP (dest, config, line); break;
|
case DASM_JMP : dasmOpJMP (dest, config, line); break;
|
||||||
|
@ -680,7 +688,7 @@ static VBU_DasmLine* dasmDisassemble(VB *sim, uint32_t address,
|
||||||
if (dasmLine(sim, &addr, pc, config, &lines, &size, &offset, x))
|
if (dasmLine(sim, &addr, pc, config, &lines, &size, &offset, x))
|
||||||
goto catch;
|
goto catch;
|
||||||
}
|
}
|
||||||
return lines;
|
return VBU_REALLOC(lines, offset);
|
||||||
|
|
||||||
/* Exception handler */
|
/* Exception handler */
|
||||||
catch:
|
catch:
|
||||||
|
|
|
@ -47,6 +47,7 @@ VBUAPI VBU_DasmConfig* vbuDasmInit(VBU_DasmConfig *config) {
|
||||||
config->conditionNotation = VBU_NAMES;
|
config->conditionNotation = VBU_NAMES;
|
||||||
config->hexCase = VBU_UPPER;
|
config->hexCase = VBU_UPPER;
|
||||||
config->hexNotation = VBU_0X;
|
config->hexNotation = VBU_0X;
|
||||||
|
config->immediateNotation = VBU_NONE;
|
||||||
config->memoryNotation = VBU_OUTSIDE;
|
config->memoryNotation = VBU_OUTSIDE;
|
||||||
config->mnemonicCase = VBU_UPPER;
|
config->mnemonicCase = VBU_UPPER;
|
||||||
config->operandOrder = VBU_DEST_LAST;
|
config->operandOrder = VBU_DEST_LAST;
|
||||||
|
|
|
@ -29,6 +29,8 @@ extern "C" {
|
||||||
#define VBU_L 0
|
#define VBU_L 0
|
||||||
#define VBU_LOWER 1
|
#define VBU_LOWER 1
|
||||||
#define VBU_NAMES 1
|
#define VBU_NAMES 1
|
||||||
|
#define VBU_NONE 0
|
||||||
|
#define VBU_NUMBER 1
|
||||||
#define VBU_NUMBERS 0
|
#define VBU_NUMBERS 0
|
||||||
#define VBU_OUTSIDE 0
|
#define VBU_OUTSIDE 0
|
||||||
#define VBU_SPLIT 1
|
#define VBU_SPLIT 1
|
||||||
|
@ -48,6 +50,7 @@ typedef struct { /* Defaults listed first */
|
||||||
uint8_t conditionNotation; /* NAMES, NUMBERS */
|
uint8_t conditionNotation; /* NAMES, NUMBERS */
|
||||||
uint8_t hexCase; /* UPPER, LOWER */
|
uint8_t hexCase; /* UPPER, LOWER */
|
||||||
uint8_t hexNotation; /* 0X, H, DOLLAR */
|
uint8_t hexNotation; /* 0X, H, DOLLAR */
|
||||||
|
uint8_t immediateNotation; /* NONE, NUMBER */
|
||||||
uint8_t memoryNotation; /* OUTSIDE, INSIDE */
|
uint8_t memoryNotation; /* OUTSIDE, INSIDE */
|
||||||
uint8_t mnemonicCase; /* UPPER, LOWER */
|
uint8_t mnemonicCase; /* UPPER, LOWER */
|
||||||
uint8_t operandOrder; /* DEST_LAST, DEST_FIRST */
|
uint8_t operandOrder; /* DEST_LAST, DEST_FIRST */
|
||||||
|
|
|
@ -61,6 +61,8 @@ let Constants = {
|
||||||
L : 0,
|
L : 0,
|
||||||
LOWER : 1,
|
LOWER : 1,
|
||||||
NAMES : 1,
|
NAMES : 1,
|
||||||
|
NONE : 0,
|
||||||
|
NUMBER : 1,
|
||||||
NUMBERS : 0,
|
NUMBERS : 0,
|
||||||
OUTSIDE : 0,
|
OUTSIDE : 0,
|
||||||
SPLIT : 1,
|
SPLIT : 1,
|
||||||
|
|
|
@ -128,6 +128,7 @@ new class Core {
|
||||||
message.config.conditionNotation,
|
message.config.conditionNotation,
|
||||||
message.config.hexCase,
|
message.config.hexCase,
|
||||||
message.config.hexNotation,
|
message.config.hexNotation,
|
||||||
|
message.config.immediateNotation,
|
||||||
message.config.memoryNotation,
|
message.config.memoryNotation,
|
||||||
message.config.mnemonicCase,
|
message.config.mnemonicCase,
|
||||||
message.config.operandOrder,
|
message.config.operandOrder,
|
||||||
|
|
15
web/VB.js
15
web/VB.js
|
@ -19,6 +19,7 @@ class DasmConfig {
|
||||||
#conditionNotation;
|
#conditionNotation;
|
||||||
#hexCase;
|
#hexCase;
|
||||||
#hexNotation;
|
#hexNotation;
|
||||||
|
#immediateNotation;
|
||||||
#memoryNotation;
|
#memoryNotation;
|
||||||
#mnemonicCase;
|
#mnemonicCase;
|
||||||
#operandOrder;
|
#operandOrder;
|
||||||
|
@ -40,6 +41,7 @@ class DasmConfig {
|
||||||
this.#conditionNotation = Constants.VBU.NAMES;
|
this.#conditionNotation = Constants.VBU.NAMES;
|
||||||
this.#hexCase = Constants.VBU.UPPER;
|
this.#hexCase = Constants.VBU.UPPER;
|
||||||
this.#hexNotation = Constants.VBU["0X"];
|
this.#hexNotation = Constants.VBU["0X"];
|
||||||
|
this.#immediateNotation = Constants.VBU.NONE;
|
||||||
this.#memoryNotation = Constants.VBU.OUTSIDE;
|
this.#memoryNotation = Constants.VBU.OUTSIDE;
|
||||||
this.#mnemonicCase = Constants.VBU.UPPER;
|
this.#mnemonicCase = Constants.VBU.UPPER;
|
||||||
this.#operandOrder = Constants.VBU.DEST_LAST;
|
this.#operandOrder = Constants.VBU.DEST_LAST;
|
||||||
|
@ -125,6 +127,16 @@ class DasmConfig {
|
||||||
this.#hexNotation = value;
|
this.#hexNotation = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get immediateNotation() { return this.#immediateNotation; }
|
||||||
|
set immediateNotation(value) {
|
||||||
|
switch (value) {
|
||||||
|
case Constants.VBU.NONE :
|
||||||
|
case Constants.VBU.NUMBER: break;
|
||||||
|
default: return;
|
||||||
|
}
|
||||||
|
this.#immediateNotation = value;
|
||||||
|
}
|
||||||
|
|
||||||
get memoryNotation() { return this.#memoryNotation; }
|
get memoryNotation() { return this.#memoryNotation; }
|
||||||
set memoryNotation(value) {
|
set memoryNotation(value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
@ -407,6 +419,7 @@ class Sim extends HTMLElement {
|
||||||
conditionNotation: config.conditionNotation,
|
conditionNotation: config.conditionNotation,
|
||||||
hexCase : config.hexCase,
|
hexCase : config.hexCase,
|
||||||
hexNotation : config.hexNotation,
|
hexNotation : config.hexNotation,
|
||||||
|
immediateNotation: config.immediateNotation,
|
||||||
memoryNotation : config.memoryNotation,
|
memoryNotation : config.memoryNotation,
|
||||||
mnemonicCase : config.mnemonicCase,
|
mnemonicCase : config.mnemonicCase,
|
||||||
operandOrder : config.operandOrder,
|
operandOrder : config.operandOrder,
|
||||||
|
@ -650,6 +663,8 @@ class VB {
|
||||||
static get L () { return Constants.VBU.L ; }
|
static get L () { return Constants.VBU.L ; }
|
||||||
static get LOWER () { return Constants.VBU.LOWER ; }
|
static get LOWER () { return Constants.VBU.LOWER ; }
|
||||||
static get NAMES () { return Constants.VBU.NAMES ; }
|
static get NAMES () { return Constants.VBU.NAMES ; }
|
||||||
|
static get NONE () { return Constants.VBU.NONE ; }
|
||||||
|
static get NUMBER () { return Constants.VBU.NUMBER ; }
|
||||||
static get NUMBERS () { return Constants.VBU.NUMBERS ; }
|
static get NUMBERS () { return Constants.VBU.NUMBERS ; }
|
||||||
static get OUTSIDE () { return Constants.VBU.OUTSIDE ; }
|
static get OUTSIDE () { return Constants.VBU.OUTSIDE ; }
|
||||||
static get RELATIVE () { return Constants.VBU.RELATIVE ; }
|
static get RELATIVE () { return Constants.VBU.RELATIVE ; }
|
||||||
|
|
|
@ -108,9 +108,9 @@ EMSCRIPTEN_KEEPALIVE void* CreateSim() {
|
||||||
// Disassemble from a simulation
|
// Disassemble from a simulation
|
||||||
EMSCRIPTEN_KEEPALIVE void* Disassemble(
|
EMSCRIPTEN_KEEPALIVE void* Disassemble(
|
||||||
int bcondNotation, int conditionCase, int conditionCL, int conditionEZ,
|
int bcondNotation, int conditionCase, int conditionCL, int conditionEZ,
|
||||||
int conditionNotation, int hexCase, int hexNotation, int memoryNotation,
|
int conditionNotation, int hexCase, int hexNotation, int immediateNotation,
|
||||||
int mnemonicCase, int operandOrder, int programCase, int programNotation,
|
int memoryNotation, int mnemonicCase, int operandOrder, int programCase,
|
||||||
int setfNotation, int systemCase, int systemNotation,
|
int programNotation, int setfNotation, int systemCase, int systemNotation,
|
||||||
VB *sim, uint32_t address, unsigned length, int line
|
VB *sim, uint32_t address, unsigned length, int line
|
||||||
) {
|
) {
|
||||||
VBU_DasmConfig config;
|
VBU_DasmConfig config;
|
||||||
|
@ -121,6 +121,7 @@ EMSCRIPTEN_KEEPALIVE void* Disassemble(
|
||||||
config.conditionNotation = conditionNotation;
|
config.conditionNotation = conditionNotation;
|
||||||
config.hexCase = hexCase;
|
config.hexCase = hexCase;
|
||||||
config.hexNotation = hexNotation;
|
config.hexNotation = hexNotation;
|
||||||
|
config.immediateNotation = immediateNotation;
|
||||||
config.memoryNotation = memoryNotation;
|
config.memoryNotation = memoryNotation;
|
||||||
config.mnemonicCase = mnemonicCase;
|
config.mnemonicCase = mnemonicCase;
|
||||||
config.operandOrder = operandOrder;
|
config.operandOrder = operandOrder;
|
||||||
|
|
Loading…
Reference in New Issue