Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions VecXGL/VecXGL-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<string>1.2a</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2</string>
<string>1.2a</string>
<key>NSPrincipalClass</key>
<string>OEGameCoreController</string>
<key>OEGameCoreClass</key>
Expand Down
1 change: 0 additions & 1 deletion VecXGL/osint.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ void load_overlay(char *filename);
extern uint8_t *pWave;

#endif

45 changes: 34 additions & 11 deletions VecXGL/osint.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,16 @@ void openCart(const char *romName)
FILE *cartfile;
cartname = romName;
cartfile = fopen (cartname, "rb");


unsigned b;
unsigned char cart[65536];
if (cartfile != NULL) {
fread (cart, 1, sizeof (cart), cartfile);
fclose (cartfile);
}
}
for ( b = 0; b < sizeof (cart); b++) {
set_cart(b, cart[b]);
}
}


Expand All @@ -96,16 +101,16 @@ int osint_defaults (void)
memcpy(rom, bios_data, bios_data_size);

/* the cart is empty by default */
for (b = 0; b < sizeof (cart); b++) {
cart[b] = 0;
for (b = 0; b < sizeof (65536); b++) {
set_cart(b, 0);
}

e8910_init_sound();

//initialize and zero audio buffer
pWave = malloc(882);
memset(pWave, 0, 882);

g_overlay.width = 0;

return 0;
Expand Down Expand Up @@ -262,7 +267,7 @@ void osint_render (void)
// draw lines for this frame
for (v = 0; v < vector_draw_cnt; v++) {
c = VX_color_set[vectors_draw[v].color];

glColor4f( c, c, c, 0.75f );
glVertex3i( (int)vectors_draw[v].x0, (int)vectors_draw[v].y0, 0 );
glVertex3i( (int)vectors_draw[v].x1, (int)vectors_draw[v].y1, 0 );
Expand Down Expand Up @@ -290,21 +295,39 @@ void osint_btnDown(OEVectrexButton btn) {
switch(btn) {
case OEVectrexButton1:
snd_regs[14] &= ~0x01;
#ifdef ALG_DEBUG
incOffset();
#endif
break;
case OEVectrexButton2:
snd_regs[14] &= ~0x02;
#ifdef ALG_DEBUG
decOffset();
#endif
break;
case OEVectrexButton3:
snd_regs[14] &= ~0x04;
#ifdef ALG_DEBUG
alg_print();
#endif
break;
case OEVectrexButton4:
snd_regs[14] &= ~0x08;
#ifdef ALG_DEBUG
change();
#endif
break;
case OEVectrexAnalogUp:
alg_jch1 = 0xFF;
#ifdef ALG_DEBUG
alg_next();
#endif
break;
case OEVectrexAnalogDown:
alg_jch1 = 0x00;
#ifdef ALG_DEBUG
alg_prev();
#endif
break;
case OEVectrexAnalogLeft:
alg_jch0 = 0x00;
Expand Down Expand Up @@ -362,9 +385,9 @@ void load_overlay(char *filename)
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glBindTexture(GL_TEXTURE_2D, g_overlay.texID); // Select Our Font Texture

//glScissor(1 ,64,637,288); // Define Scissor Region

//return TRUE;
*/
}
}
67 changes: 56 additions & 11 deletions VecXGL/vecx.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ enum {

enum {
VECTREX_PDECAY = 30, /* phosphor decay rate */

/* number of 6809 cycles before a frame redraw */

FCYCLES_INIT = VECTREX_MHZ / VECTREX_PDECAY,

/* max number of possible vectors that maybe on the screen at one time.
* one only needs VECTREX_MHZ / VECTREX_PDECAY but we need to also store
* deleted vectors in a single table
*/

VECTOR_CNT = VECTREX_MHZ / VECTREX_PDECAY,

VECTOR_HASH = 65521
};

Expand All @@ -36,6 +36,32 @@ typedef struct vector_type {
unsigned char color;
} vector_t;

// Malban
// maximum possible offset
// offsets are "warpped"
#define ALG_MAX_OFFSET 20

// if defined you can change the
// offset settings "on the fly" by using the buttons and joytick
// debug info is printed to console
//#define ALG_DEBUG

#ifdef ALG_DEBUG
void incOffset();
void decOffset();
void change();
void alg_next();
void alg_prev();
void alg_print();
#endif

// the following 11 "flags" can be provided
// with cycle offset
// each has an own queue offset and queue counter
#define ALG_SIZE 11
enum ALG_TYPES {ZSH_DIRECT=0, Z_DIRECT, X_DIRECT, Y_DIRECT, JOY_DIRECT, COMP_DIRECT, DX_DIRECT, DY_DIRECT, COL_DIRECT, BLANK_DIRECT, RAMP_DIRECT};


typedef struct VECXState {
//e6809 cpu regs
unsigned cpuRegs[10];
Expand All @@ -47,18 +73,39 @@ typedef struct VECXState {
//via 6522 regs
unsigned viaRegs[25];
//analog stuff
unsigned analogDevices[10];
long analogAlg[4];
unsigned analogDevices[4];
unsigned alg_jsh[ALG_MAX_OFFSET];
unsigned alg_rsh[ALG_MAX_OFFSET];
unsigned alg_xsh[ALG_MAX_OFFSET];
unsigned alg_ysh[ALG_MAX_OFFSET];
unsigned alg_zsh[ALG_MAX_OFFSET];
unsigned alg_compare[ALG_MAX_OFFSET];
unsigned sig_ramp[ALG_MAX_OFFSET];
unsigned sig_blank[ALG_MAX_OFFSET];

long analogAlg[2];
long alg_dx[ALG_MAX_OFFSET];
long alg_dy[ALG_MAX_OFFSET];

//vectoring stuff
unsigned algVectoring;
long vectorPoints[6];
unsigned char vecColor;
unsigned char vecColor[ALG_MAX_OFFSET];
long vecDrawInfo[2];


int alg_config[ALG_SIZE];
int alg_read_positions[ALG_SIZE];
int alg_used_offsets[ALG_SIZE];


} VECXState;

extern unsigned char ram[1024];
extern unsigned char rom[8192];
extern unsigned char cart[32768];

extern unsigned char get_cart(unsigned pos);
extern void set_cart(unsigned pos, unsigned char data); // only loading!

extern unsigned snd_regs[16];
extern unsigned alg_jch0;
Expand All @@ -78,5 +125,3 @@ VECXState * saveVecxState();
void loadVecxState(VECXState *state);

#endif


Loading