Display tweaks, add vbGetPixels()
This commit is contained in:
parent
448658430c
commit
eecc55bbd7
40
core/vb.c
40
core/vb.c
|
@ -279,6 +279,46 @@ VBAPI vbOnFrame vbGetFrameCallback(VB *sim) {
|
||||||
return sim->onFrame;
|
return sim->onFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Retrieve the most recent frame image pixels */
|
||||||
|
VBAPI void vbGetPixels(VB *sim, void *left, int leftStrideX, int leftStrideY,
|
||||||
|
void *right, int rightStrideX, int rightStrideY) {
|
||||||
|
uint8_t *dest; /* Output data */
|
||||||
|
int offset; /* Horizontal offset of output pixel */
|
||||||
|
uint8_t *src; /* Source data */
|
||||||
|
int xStride; /* Bytes between output pixels */
|
||||||
|
int yStride; /* Bytes between output lines */
|
||||||
|
int i, x, y; /* Iterators */
|
||||||
|
|
||||||
|
/* Process both eyes */
|
||||||
|
for (i = 0; i < 2; i++) {
|
||||||
|
|
||||||
|
/* Working variables for left image */
|
||||||
|
if (i == 0) {
|
||||||
|
dest = left;
|
||||||
|
xStride = leftStrideX;
|
||||||
|
yStride = leftStrideY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Working variables for right image */
|
||||||
|
else {
|
||||||
|
dest = right;
|
||||||
|
xStride = rightStrideX;
|
||||||
|
yStride = rightStrideY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nothing to do */
|
||||||
|
if (dest == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Transfer pixels to the destination */
|
||||||
|
src = sim->vip.frames[sim->vip.dp.buffer][i];
|
||||||
|
for (y = 0; y < 224; y++, dest += yStride)
|
||||||
|
for (x = offset = 0; x < 384; x++, offset += xStride)
|
||||||
|
dest[offset] = *src++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* Retrieve the value of the program counter */
|
/* Retrieve the value of the program counter */
|
||||||
VBAPI uint32_t vbGetProgramCounter(VB *sim) {
|
VBAPI uint32_t vbGetProgramCounter(VB *sim) {
|
||||||
return sim->cpu.pc;
|
return sim->cpu.pc;
|
||||||
|
|
|
@ -107,6 +107,7 @@ VBAPI vbOnException vbGetExceptionCallback(VB *sim);
|
||||||
VBAPI vbOnExecute vbGetExecuteCallback (VB *sim);
|
VBAPI vbOnExecute vbGetExecuteCallback (VB *sim);
|
||||||
VBAPI vbOnFetch vbGetFetchCallback (VB *sim);
|
VBAPI vbOnFetch vbGetFetchCallback (VB *sim);
|
||||||
VBAPI vbOnFrame vbGetFrameCallback (VB *sim);
|
VBAPI vbOnFrame vbGetFrameCallback (VB *sim);
|
||||||
|
VBAPI void vbGetPixels (VB *sim, void *left, int leftStrideX, int leftStrideY, void *right, int rightStrideX, int rightStrideY);
|
||||||
VBAPI uint32_t vbGetProgramCounter (VB *sim);
|
VBAPI uint32_t vbGetProgramCounter (VB *sim);
|
||||||
VBAPI int32_t vbGetProgramRegister (VB *sim, int index);
|
VBAPI int32_t vbGetProgramRegister (VB *sim, int index);
|
||||||
VBAPI vbOnRead vbGetReadCallback (VB *sim);
|
VBAPI vbOnRead vbGetReadCallback (VB *sim);
|
||||||
|
|
39
core/vip.c
39
core/vip.c
|
@ -45,12 +45,25 @@ static void vipThrow(VB *sim, uint16_t cause) {
|
||||||
/* Transfer one column of frame buffer pixels to output */
|
/* Transfer one column of frame buffer pixels to output */
|
||||||
static void vipTransferColumn(VB *sim, int32_t eye) {
|
static void vipTransferColumn(VB *sim, int32_t eye) {
|
||||||
int32_t bits; /* Pixel bits from frame buffer */
|
int32_t bits; /* Pixel bits from frame buffer */
|
||||||
|
uint8_t *dest; /* Host frame image output */
|
||||||
|
uint8_t *src; /* Simulation frame buffer input */
|
||||||
int y, z; /* Iterators */
|
int y, z; /* Iterators */
|
||||||
|
|
||||||
/* Select source and destination addresses in host memory */
|
/* Select destination address in host memory */
|
||||||
uint8_t *dest = &sim->vip.frames
|
dest = &sim->vip.frames
|
||||||
[sim->vip.dp.buffer][eye][sim->vip.dp.column];
|
[sim->vip.dp.buffer][eye][sim->vip.dp.column];
|
||||||
uint8_t *src = &sim->vip.ram[
|
|
||||||
|
/* Output is disabled */
|
||||||
|
if ((sim->vip.dp.disp & sim->vip.dp.synce) == 0) {
|
||||||
|
for (z = 0; z < 0x15000; z += 4) {
|
||||||
|
busWriteBuffer(dest, VB_S32, 0);
|
||||||
|
dest += 4;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Select source address in host memory */
|
||||||
|
src = &sim->vip.ram[
|
||||||
eye << 16 |
|
eye << 16 |
|
||||||
sim->vip.dp.buffer << 15 |
|
sim->vip.dp.buffer << 15 |
|
||||||
sim->vip.dp.column << 6
|
sim->vip.dp.column << 6
|
||||||
|
@ -363,9 +376,9 @@ static int vipOnFrame(VB *sim) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************** Library Functions *****************************/
|
/***************************** Display Processor *****************************/
|
||||||
|
|
||||||
/* Display processor */
|
/* Process sub-component */
|
||||||
static int vipEmulateDisplay(VB *sim, uint32_t clocks) {
|
static int vipEmulateDisplay(VB *sim, uint32_t clocks) {
|
||||||
|
|
||||||
/* Process all clocks */
|
/* Process all clocks */
|
||||||
|
@ -474,10 +487,24 @@ static int vipEmulateDisplay(VB *sim, uint32_t clocks) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****************************** Pixel Processor ******************************/
|
||||||
|
|
||||||
|
/* Process sub-component */
|
||||||
|
static void vipEmulateDrawing(VB *sim, uint32_t clocks) {
|
||||||
|
(void) sim;
|
||||||
|
(void) clocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***************************** Library Functions *****************************/
|
||||||
|
|
||||||
/* Process component */
|
/* Process component */
|
||||||
static int vipEmulate(VB *sim, uint32_t clocks) {
|
static int vipEmulate(VB *sim, uint32_t clocks) {
|
||||||
int brk = vipEmulateDisplay(sim, clocks);
|
int brk = vipEmulateDisplay(sim, clocks);
|
||||||
/*vipEmulateDrawing(sim, clocks);*/
|
vipEmulateDrawing(sim, clocks);
|
||||||
return brk;
|
return brk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue