obj/video.o \
obj/vj.o \
$(ICON)
-# obj/anajoy.o
-# obj/cdbios.o
-# obj/cdi.o
all: checkenv message obj $(TARGET)$(EXESUFFIX)
@echo
// to Curt. ;-) Without that excellent documentation which shows *exactly*
// what's going on inside the TOM chip, we'd all still be guessing as to how
// the wily blitter and other pieces of the Jaguar puzzle actually work.
+// Now how about those JERRY ASIC nets gentlemen...? ;-)
//
-#include "jaguar.h"
#include "blitter.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "jaguar.h"
+#include "log.h"
+
// Various conditional compilation goodies...
//#define USE_ORIGINAL_BLITTER
void LogBlit(void)
{
- char * opStr[16] = { "LFU_CLEAR", "LFU_NSAND", "LFU_NSAD", "LFU_NOTS", "LFU_SAND", "LFU_NOTD", "LFU_N_SXORD", "LFU_NSORND",
+ const char * opStr[16] = { "LFU_CLEAR", "LFU_NSAND", "LFU_NSAD", "LFU_NOTS", "LFU_SAND", "LFU_NOTD", "LFU_N_SXORD", "LFU_NSORND",
"LFU_SAD", "LFU_XOR", "LFU_D", "LFU_NSORD", "LFU_REPLACE", "LFU_SORND", "LFU_SORD", "LFU_ONE" };
uint32 cmd = GET32(blitter_ram, 0x38);
uint32 m = (REG(A1_FLAGS) >> 9) & 0x03, e = (REG(A1_FLAGS) >> 11) & 0x0F;
return false;
}
+ WriteLog("CDINTF: Successfully opened CD-ROM interface.\n");
+
return true;
}
// Extensive rewrites/cleanups/fixes by James L. Hammons
//
+#include "cdrom.h"
+
+#include <string.h> // For memset, etc.
#include "jaguar.h" // For GET32/SET32 macros
#include "m68k.h"
#include "cdintf.h" // System agnostic CD interface functions
-#include "cdrom.h"
+#include "log.h"
+#include "dac.h"
//#define CDROM_LOG // For CDROM logging, obviously
#define I2SDAT2 BUTCH + 0x28 // i2s FIFO data (old)
#define UNKNOWN BUTCH + 0x2C // Seems to be some sort of I2S interface
-char * BReg[12] = { "BUTCH", "DSCNTRL", "DS_DATA", "???", "I2CNTRL", "SBCNTRL", "SUBDATA", "SUBDATB",
+const char * BReg[12] = { "BUTCH", "DSCNTRL", "DS_DATA", "???", "I2CNTRL", "SBCNTRL", "SUBDATA", "SUBDATB",
"SB_TIME", "FIFO_DATA", "I2SDAT2", "UNKNOWN" };
-extern char * whoName[9];
+extern const char * whoName[9];
static uint8 cdRam[0x100];
// - Handling for an event that occurs NOW
//
-//#include <SDL.h>
-//#include "SDL.h"
-//#include "SDL_opengl.h"
-//#include "jaguar.h"
-//#include "m68k.h"
-//#include "gpu.h"
-//#include "dsp.h"
-//#include "settings.h"
-//#include "video.h"
-#include "log.h"
#include "clock.h"
+#include "log.h"
+
#define EVENT_LIST_SIZE 512
/*
// work correctly...! Perhaps just need to set up SSI stuff so BUTCH doesn't get
// confused...
+#include "dac.h"
+
#include "SDL.h"
#include "m68k.h"
#include "jaguar.h"
#include "settings.h"
-#include "dac.h"
+#include "log.h"
//#define DEBUG_DAC
// We can get away with using native endian here because we can tell SDL to use the native
// endian when looking at the sample buffer, i.e., no need to worry about it.
-static uint16 * DACBuffer;
+static uint16 DACBuffer[BUFFER_SIZE];
static uint8 SCLKFrequencyDivider = 19; // Default is roughly 22 KHz (20774 Hz in NTSC mode)
/*static*/ uint16 serialMode = 0;
//
void DACInit(void)
{
- memory_malloc_secure((void **)&DACBuffer, BUFFER_SIZE * sizeof(uint16), "DAC buffer");
+// memory_malloc_secure((void **)&DACBuffer, BUFFER_SIZE * sizeof(uint16), "DAC buffer");
+// DACBuffer = (uint16 *)memory_malloc(BUFFER_SIZE * sizeof(uint16), "DAC buffer");
desired.freq = GetCalculatedFrequency(); // SDL will do conversion on the fly, if it can't get the exact rate. Nice!
desired.format = AUDIO_S16SYS; // This uses the native endian (for portability)...
SDL_CloseAudio();
}
- memory_free(DACBuffer);
+// memory_free(DACBuffer);
WriteLog("DAC: Done.\n");
}
// Extensive cleanups/rewrites by James L. Hammons
//
+#include "dsp.h"
+
#include <stdlib.h>
#include <SDL.h> // Used only for SDL_GetTicks...
-#include "dsp.h"
+#include "memory.h"
+#include "log.h"
+#include "jaguar.h"
+#include "jerry.h"
+#include "gpu.h"
+#include "jagdasm.h"
+#include "m68k.h"
//#define DSP_DEBUG
//#define DSP_DEBUG_IRQ
uint32 dsp_opcode_use[65];
-char * dsp_opcode_str[65]=
+const char * dsp_opcode_str[65]=
{
"add", "addc", "addq", "addqt",
"sub", "subc", "subq", "subqt",
uint32 dsp_control;
static uint32 dsp_div_control;
static uint8 dsp_flag_z, dsp_flag_n, dsp_flag_c;
-static uint32 * dsp_reg, * dsp_alternate_reg;
-static uint32 * dsp_reg_bank_0, * dsp_reg_bank_1;
+static uint32 * dsp_reg = NULL, * dsp_alternate_reg = NULL;
+static uint32 dsp_reg_bank_0[32], dsp_reg_bank_1[32];
static uint32 dsp_opcode_first_parameter;
static uint32 dsp_opcode_second_parameter;
uint32 dsp_convert_zero[32] = { 32,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 };
uint8 * dsp_branch_condition_table = NULL;
static uint16 * mirror_table = NULL;
-static uint8 * dsp_ram_8 = NULL;
+static uint8 dsp_ram_8[0x2000];
#define BRANCH_CONDITION(x) dsp_branch_condition_table[(x) + ((jaguar_flags & 7) << 5)]
{
// Allocate the mirror table
if (!mirror_table)
- mirror_table = (uint16 *)malloc(65536 * sizeof(mirror_table[0]));
+ mirror_table = (uint16 *)memory_malloc(65536 * sizeof(uint16), "DSP mirror table");
// Fill in the mirror table
if (mirror_table)
if (!dsp_branch_condition_table)
{
- dsp_branch_condition_table = (uint8 *)malloc(32 * 8 * sizeof(dsp_branch_condition_table[0]));
+ dsp_branch_condition_table = (uint8 *)memory_malloc(32 * 8 * sizeof(uint8), "DSP branch condition table");
// Fill in the condition table
if (dsp_branch_condition_table)
if (offset==0xF1B2C2) return(0x0000);
}
*/
- // pour permettre à wolfenstein 3d de tourner sans le dsp
+ // pour permettre � wolfenstein 3d de tourner sans le dsp
/* if ((offset==0xF1B0D0)||(offset==0xF1B0D2))
return(0);
*/
- // pour permettre à nba jam de tourner sans le dsp
+ // pour permettre � nba jam de tourner sans le dsp
/* if (jaguar_mainRom_crc32==0x4faddb18)
{
if (offset==0xf1b2c0) return(0);
void DSPInit(void)
{
- memory_malloc_secure((void **)&dsp_ram_8, 0x2000, "DSP work RAM");
- memory_malloc_secure((void **)&dsp_reg_bank_0, 32 * sizeof(int32), "DSP bank 0 regs");
- memory_malloc_secure((void **)&dsp_reg_bank_1, 32 * sizeof(int32), "DSP bank 1 regs");
+// memory_malloc_secure((void **)&dsp_ram_8, 0x2000, "DSP work RAM");
+// memory_malloc_secure((void **)&dsp_reg_bank_0, 32 * sizeof(int32), "DSP bank 0 regs");
+// memory_malloc_secure((void **)&dsp_reg_bank_1, 32 * sizeof(int32), "DSP bank 1 regs");
dsp_build_branch_condition_table();
DSPReset();
static void dsp_opcode_jump(void)
{
#ifdef DSP_DIS_JUMP
-char * condition[32] =
+const char * condition[32] =
{ "T", "nz", "z", "???", "nc", "nc nz", "nc z", "???", "c", "c nz",
"c z", "???", "???", "???", "???", "???", "???", "???", "???",
"???", "nn", "nn nz", "nn z", "???", "n", "n nz", "n z", "???",
static void dsp_opcode_jr(void)
{
#ifdef DSP_DIS_JR
-char * condition[32] =
+const char * condition[32] =
{ "T", "nz", "z", "???", "nc", "nc nz", "nc z", "???", "c", "c nz",
"c z", "???", "???", "???", "???", "???", "???", "???", "???",
"???", "nn", "nn nz", "nn z", "???", "n", "n nz", "n z", "???",
static void DSP_jr(void)
{
#ifdef DSP_DIS_JR
-char * condition[32] =
+const char * condition[32] =
{ "T", "nz", "z", "???", "nc", "nc nz", "nc z", "???", "c", "c nz",
"c z", "???", "???", "???", "???", "???", "???", "???", "???",
"???", "nn", "nn nz", "nn z", "???", "n", "n nz", "n z", "???",
static void DSP_jump(void)
{
#ifdef DSP_DIS_JUMP
-char * condition[32] =
+const char * condition[32] =
{ "T", "nz", "z", "???", "nc", "nc nz", "nc z", "???", "c", "c nz",
"c z", "???", "???", "???", "???", "???", "???", "???", "???",
"???", "nn", "nn nz", "nn z", "???", "n", "n nz", "n z", "???",
#ifndef __DSP_H__
#define __DSP_H__
-#include "jaguar.h"
+//#include "jaguar.h"
+#include "types.h"
#define DSP_CONTROL_RAM_BASE 0x00F1A100
#define DSP_WORK_RAM_BASE 0x00F1B000
// Cleanups/enhancements by James L. Hammons
//
-#include <stdlib.h>
#include "eeprom.h"
+
+#include <string.h> // For memset
+#include <stdlib.h>
#include "settings.h"
+#include "log.h"
+#include "jaguar.h"
#define eeprom_LOG
#ifndef __EEPROM_H__
#define __EEPROM_H__
-#include "jaguar.h"
+//#include "jaguar.h"
+#include "types.h"
void eeprom_init(void);
void eeprom_reset(void);
// Same problem with ADDC...
//
-#include <stdlib.h>
#include "gpu.h"
+#include <string.h> // For memset
+#include <stdlib.h>
+#include "log.h"
+#include "jaguar.h"
+#include "m68k.h"
+#include "tom.h"
+#include "memory.h"
+#include "jagdasm.h"
+#include "dsp.h"
+
//#define GPU_DEBUG
// For GPU dissasembly...
gpu_opcode_store_r14_ri, gpu_opcode_store_r15_ri, gpu_opcode_sat24, gpu_opcode_pack,
};
-static uint8 * gpu_ram_8;
+static uint8 gpu_ram_8[0x1000];
uint32 gpu_pc;
static uint32 gpu_acc;
static uint32 gpu_remain;
// a bit before writing a result. I.e., if the result of an operation leaves a zero in
// the carry flag, you don't have to zero gpu_flag_c before you can write that zero!
static uint8 gpu_flag_z, gpu_flag_n, gpu_flag_c;
-static uint32 * gpu_reg_bank_0;
-static uint32 * gpu_reg_bank_1;
+static uint32 gpu_reg_bank_0[32];
+static uint32 gpu_reg_bank_1[32];
static uint32 * gpu_reg;
static uint32 * gpu_alternate_reg;
uint32 gpu_opcode_use[64];
-char * gpu_opcode_str[64]=
+const char * gpu_opcode_str[64]=
{
"add", "addc", "addq", "addqt",
"sub", "subc", "subq", "subqt",
void gpu_init(void)
{
- memory_malloc_secure((void **)&gpu_ram_8, 0x1000, "GPU work RAM");
- memory_malloc_secure((void **)&gpu_reg_bank_0, 32 * sizeof(int32), "GPU bank 0 regs");
- memory_malloc_secure((void **)&gpu_reg_bank_1, 32 * sizeof(int32), "GPU bank 1 regs");
+// memory_malloc_secure((void **)&gpu_ram_8, 0x1000, "GPU work RAM");
+// memory_malloc_secure((void **)&gpu_reg_bank_0, 32 * sizeof(int32), "GPU bank 0 regs");
+// memory_malloc_secure((void **)&gpu_reg_bank_1, 32 * sizeof(int32), "GPU bank 1 regs");
build_branch_condition_table();
static void gpu_opcode_jump(void)
{
#ifdef GPU_DIS_JUMP
-char * condition[32] =
+const char * condition[32] =
{ "T", "nz", "z", "???", "nc", "nc nz", "nc z", "???", "c", "c nz",
"c z", "???", "???", "???", "???", "???", "???", "???", "???",
"???", "nn", "nn nz", "nn z", "???", "n", "n nz", "n z", "???",
static void gpu_opcode_jr(void)
{
#ifdef GPU_DIS_JR
-char * condition[32] =
+const char * condition[32] =
{ "T", "nz", "z", "???", "nc", "nc nz", "nc z", "???", "c", "c nz",
"c z", "???", "???", "???", "???", "???", "???", "???", "???",
"???", "nn", "nn nz", "nn z", "???", "n", "n nz", "n z", "???",
#ifndef __GPU_H__
#define __GPU_H__
-#include "jaguar.h"
+//#include "jaguar.h"
+#include "types.h"
#define GPU_CONTROL_RAM_BASE 0x00F02100
#define GPU_WORK_RAM_BASE 0x00F03000
// by James L. Hammons
//
+#include "gui.h"
+
#include <stdarg.h>
#include <sys/types.h> // For MacOS <dirent.h> dependency
#include <dirent.h>
#include "zlib.h"
#include "unzip.h"
#include "sdlemu_opengl.h"
-#include "gui.h"
+#include "log.h"
+#include "jaguar.h"
+#include "eeprom.h"
using namespace std; // For STL stuff
int mouseX = 0, mouseY = 0;
uint32 background[1280 * 256]; // GUI background buffer
-char separator[] = "--------------------------------------------------------";
+const char separator[] = "--------------------------------------------------------";
//
// Case insensitive string compare function
// Select the first element of each string:
string::const_iterator p1 = s1.begin(), p2 = s2.begin();
- while (p1 != s1.end() && p2 != s2.end()) // Don\92t run past the end
+ while (p1 != s1.end() && p2 != s2.end()) // Don�t run past the end
{
if (toupper(*p1) != toupper(*p2)) // Compare upper-cased chars
return (toupper(*p1) < toupper(*p2) ? -1 : 1);// Report which was lexically greater
else if (jaguar_mainRom_crc32 == 0x55A0669C)
cartType = 3;
- char * cartTypeName[5] = { "2M Cartridge", "4M Cartridge", "CD BIOS", "CD Dev BIOS", "Homebrew" };
+ const char * cartTypeName[5] = { "2M Cartridge", "4M Cartridge", "CD BIOS", "CD Dev BIOS", "Homebrew" };
uint32 elapsedTicks = SDL_GetTicks(), frameCount = 0, framesPerSecond = 0;
while (!finished)
+#include "jagdasm.h"
+
+#include <stdio.h>
#include "jaguar.h"
#define ROPCODE(a) JaguarReadWord(a)
uint8 convert_zero[32] =
{ 32,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 };
-char * condition[32] =
+const char * condition[32] =
{
"",
"nz,",
#define JAGUAR_GPU 0
#define JAGUAR_DSP 1
-unsigned dasmjag(int dsp_type, char *buffer, unsigned pc);
+unsigned dasmjag(int dsp_type, char * buffer, unsigned pc);
#endif
//
#include "jaguar.h"
+
#include "video.h"
#include "settings.h"
//#include "m68kdasmAG.h"
#include "clock.h"
#include <SDL.h>
#include "SDL_opengl.h"
+#include "m68k.h"
+#include "log.h"
+#include "tom.h"
+#include "jerry.h"
+#include "cdrom.h"
+#include "dsp.h"
+#include "gpu.h"
+#include "memory.h"
+#include "joystick.h"
#define CPU_DEBUG
//Do this in makefile??? Yes! Could, but it's easier to define here...
// Memory debugging identifiers
-char * whoName[9] =
+const char * whoName[9] =
{ "Unknown", "Jaguar", "DSP", "GPU", "TOM", "JERRY", "M68K", "Blitter", "OP" };
uint32 jaguar_active_memory_dumps = 0;
#ifndef __JAGUAR_H__
#define __JAGUAR_H__
+#include "types.h"
+
+#if 0
#include <string.h> // Why??? (for memset, etc... Lazy!) Dunno why, but this just strikes me as wrong...
#include <stdlib.h> // For exit()
#include "types.h"
#include "objectp.h"
#include "blitter.h"
#include "clock.h"
-//#include "anajoy.h"
#include "joystick.h"
#include "dac.h"
#include "jagdasm.h"
#include "cdrom.h"
#include "eeprom.h"
-//#include "cdi.h"
-//#include "cdbios.h"
+#endif
// Exports from JAGUAR.CPP
extern int32 jaguar_cpu_in_exec;
extern uint32 jaguar_mainRom_crc32, jaguarRomSize, jaguarRunAddress;
extern char * jaguar_eeproms_path;
-extern char * whoName[9];
+extern const char * whoName[9];
void jaguar_init(void);
void jaguar_reset(void);
// F1DE00 R xxxxxxxx xxxxxxxx ROM_NOISE - white noise
// ------------------------------------------------------------
+#include "jerry.h"
+
+#include <string.h> // For memcpy
//#include <math.h>
#include "jaguar.h"
#include "wavetable.h"
-#include "jerry.h"
#include "clock.h"
+#include "dsp.h"
+#include "dac.h"
+#include "joystick.h"
+#include "eeprom.h"
+#include "log.h"
+#include "cdrom.h"
//Note that 44100 Hz requires samples every 22.675737 usec.
#define NEW_TIMER_SYSTEM
//#define JERRY_DEBUG
-/*static*/ uint8 * jerry_ram_8;
+/*static*/ uint8 jerry_ram_8[0x10000];
//#define JERRY_CONFIG 0x4002 // ??? What's this ???
{
// Why is it called this? Instead of SCLK? Shouldn't this be read from DAC.CPP???
//Yes, it should. !!! FIX !!!
+#warning Yes, it should. !!! FIX !!!
jerry_i2s_interrupt_divide &= 0xFF;
// We don't have to divide the RISC clock rate by this--the reason is a bit
// convoluted. Will put explanation here later...
DACInit();
//This should be handled with the cart initialization...
// eeprom_init();
- memory_malloc_secure((void **)&jerry_ram_8, 0x10000, "JERRY RAM/ROM");
+// memory_malloc_secure((void **)&jerry_ram_8, 0x10000, "JERRY RAM/ROM");
memcpy(&jerry_ram_8[0xD000], wave_table, 0x1000);
JERRYPIT1Prescaler = 0xFFFF;
void jerry_done(void)
{
WriteLog("JERRY: M68K Interrupt control ($F10020) = %04X\n", GET16(jerry_ram_8, 0x20));
- memory_free(jerry_ram_8);
+// memory_free(jerry_ram_8);
// clock_done();
// anajoy_done();
joystick_done();
// Cleanups/fixes by James L. Hammons
//
+#include "joystick.h"
+
#include <time.h>
#include <SDL.h>
#include "jaguar.h"
#include "video.h"
#include "settings.h"
+#include "gpu.h"
+#include "log.h"
#define BUTTON_U 0
#define BUTTON_D 1
// Cleanups/new stuff by James L. Hammons
//
+#include "log.h"
+
#include <stdlib.h>
#include <stdarg.h>
#include "types.h"
-#include "log.h"
#define MAX_LOG_SIZE 10000000 // Maximum size of log file (10 MB)
static FILE * log_stream = NULL;
static uint32 logSize = 0;
-int log_init(char * path)
+int log_init(const char * path)
{
log_stream = fopen(path, "wrt");
extern "C" {
#endif
-int log_init(char *);
+int log_init(const char *);
FILE * log_get(void);
void log_done(void);
void WriteLog(const char * text, ...);
// Cleanups by James L. Hammons
//
+#include "memory.h"
+
#include <malloc.h>
#include <stdlib.h>
#include "log.h"
-#include "memory.h"
// Useful structs (for doubly linked list in this case)
typedef struct sMemBlockInfo
{
void * ptr;
- char * info;
+ const char * info;
uint32 size;
sMemBlockInfo * next;
sMemBlockInfo * prev;
static uint32 maximumAllocatedMemory;
-void memory_addMemInfo(void * ptr, uint32 size, char * info)
+void memory_addMemInfo(void * ptr, uint32 size, const char * info)
{
sMemBlockInfo * alias = &memoryInfo;
{
}
-void * memory_malloc(uint32 size, char * info)
+void * memory_malloc(uint32 size, const char * info)
{
void * ptr = (void *)malloc(size);
return ptr;
}
-void memory_malloc_secure(void ** new_ptr, uint32 size, char * info)
+// OK, this sux, causes the compiler to complain about type punned pointers.
+// The only difference between this and the previous is that this one ABORTS
+// if it can't allocate the memory. BAD BAD BAD
+
+void memory_malloc_secure(void ** new_ptr, uint32 size, const char * info)
{
WriteLog("Memory: Allocating %i bytes of memory for <%s>...", size, (info == NULL ? "unknown" : info));
{
WriteLog("Failed!\n");
log_done();
+
+//BAD, BAD, BAD! Need to do better than this!!!
+//And since we ARE keeping track of all memory allocations, we should unwind the stack here as well...!
+// !!! FIX !!!
+
exit(0);
}
WriteLog("OK\n");
}
+/*
+void * memory_malloc_secure2(uint32 size, const char * info)
+{
+ WriteLog("Memory: Allocating %i bytes of memory for <%s>...", size, (info == NULL ? "unknown" : info));
+
+ void * ptr = malloc(size);
+
+ if (ptr == NULL)
+ {
+ WriteLog("Failed!\n");
+ log_done();
+
+//BAD, BAD, BAD! Need to do better than this!!!
+//And since we ARE keeping track of all memory allocations, we should unwind the stack here as well...!
+// !!! FIX !!!
+
+ exit(0);
+ }
+
+ memory_addMemInfo(ptr, size, info);
+ currentAllocatedMemory += size;
+
+ if (currentAllocatedMemory > maximumAllocatedMemory)
+ maximumAllocatedMemory = currentAllocatedMemory;
+
+ new_ptr = ptr;
+ WriteLog("OK\n");
+}
+*/
+
void memory_free(void * ptr)
{
// sMemBlockInfo * alias= &memoryInfo;
#ifndef __MEMORY_H__
#define __MEMORY_H__
-#include <stdio.h>
-//#include <stdlib.h>
-//#include <malloc.h>
+//This module needs some serious cleanup. !!! FIX !!!
+#include <stdio.h> // For FILE struct
#include "types.h"
-//#include "log.h"
void InitMemory(void);
void MemoryDone(void);
-void memory_malloc_secure(void ** new_ptr, uint32 size, char * info);
-void * memory_malloc(uint32 size, char * info);
+void memory_malloc_secure(void ** new_ptr, uint32 size, const char * info);
+//void * memory_malloc_secure2(uint32 size, const char * info);
+void * memory_malloc(uint32 size, const char * info);
void memory_free(void * ptr);
void memory_memoryUsage(FILE * fp);
// Extensive cleanups/fixes/rewrites by James L. Hammons
//
-//#include <stdio.h>
+#include "objectp.h"
+
#include <stdlib.h>
#include <string.h>
+#include "tom.h"
#include "jaguar.h"
+#include "log.h"
+#include "gpu.h"
+#include "m68k.h"
//#define OP_DEBUG
//#define OP_DEBUG_BMP
// Local global variables
-static uint8 * op_blend_y;
-static uint8 * op_blend_cr;
+// Blend tables (64K each)
+static uint8 op_blend_y[0x10000];
+static uint8 op_blend_cr[0x10000];
// There may be a problem with this "RAM" overlapping (and thus being independent of)
// some of the regular TOM RAM...
-static uint8 objectp_ram[0x40]; // This is based at $F00000
-uint8 objectp_running;
+//#warning objectp_ram is separated from TOM RAM--need to fix that!
+//static uint8 objectp_ram[0x40]; // This is based at $F00000
+uint8 objectp_running = 0;
//bool objectp_stop_reading_list;
static uint8 op_bitmap_bit_depth[8] = { 1, 2, 4, 8, 16, 24, 32, 0 };
//
void op_init(void)
{
- // Blend tables (64K each)
- memory_malloc_secure((void **)&op_blend_y, 0x10000, "Jaguar Object processor Y blend lookup table");
- memory_malloc_secure((void **)&op_blend_cr, 0x10000, "Jaguar Object processor CR blend lookup table");
-
// Here we calculate the saturating blend of a signed 4-bit value and an
// existing Cyan/Red value as well as a signed 8-bit value and an existing intensity...
// Note: CRY is 4 bits Cyan, 4 bits Red, 16 bits intensitY
//
void op_reset(void)
{
- memset(objectp_ram, 0x00, 0x40);
+// memset(objectp_ram, 0x00, 0x40);
objectp_running = 0;
}
void op_done(void)
{
- char * opType[8] =
+ const char * opType[8] =
{ "(BITMAP)", "(SCALED BITMAP)", "(GPU INT)", "(BRANCH)", "(STOP)", "???", "???", "???" };
- char * ccType[8] =
+ const char * ccType[8] =
{ "\"==\"", "\"<\"", "\">\"", "(opflag set)", "(second half line)", "?", "?", "?" };
uint32 olp = op_get_list_pointer();
}
WriteLog("\n");
- memory_free(op_blend_y);
- memory_free(op_blend_cr);
+// memory_free(op_blend_y);
+// memory_free(op_blend_cr);
}
//
// F00026 W -------- -------x OBF - object processor flag
//
+#if 0
uint8 OPReadByte(uint32 offset, uint32 who/*=UNKNOWN*/)
{
offset &= 0x3F;
if (offset == 0x22)
WriteLog("OP: Setting hi list pointer: %04X\n", data);//*/
}
+#endif
uint32 op_get_list_pointer(void)
{
// Note: This register is LO / HI WORD, hence the funky look of this...
-// return (objectp_ram[0x22] << 24) | (objectp_ram[0x23] << 16) | (objectp_ram[0x20] << 8) | objectp_ram[0x21];
- return GET16(objectp_ram, 0x20) | (GET16(objectp_ram, 0x22) << 16);
+ return GET16(tom_ram_8, 0x20) | (GET16(tom_ram_8, 0x22) << 16);
}
// This is WRONG, since the OBF is only 16 bits wide!!! [FIXED]
uint32 op_get_status_register(void)
{
-// return (objectp_ram[0x26] << 24) | (objectp_ram[0x27] << 16) | (objectp_ram[0x28] << 8) | objectp_ram[0x29];
-// return GET32(objectp_ram, 0x26);
- return GET16(objectp_ram, 0x26);
+ return GET16(tom_ram_8, 0x26);
}
// This is WRONG, since the OBF is only 16 bits wide!!! [FIXED]
void op_set_status_register(uint32 data)
{
-/* objectp_ram[0x26] = (data & 0xFF000000) >> 24;
- objectp_ram[0x27] = (data & 0x00FF0000) >> 16;
- objectp_ram[0x28] = (data & 0x0000FF00) >> 8;
- objectp_ram[0x29] |= (data & 0xFE);*/
- objectp_ram[0x26] = (data & 0x0000FF00) >> 8;
- objectp_ram[0x27] |= (data & 0xFE);
+ tom_ram_8[0x26] = (data & 0x0000FF00) >> 8;
+ tom_ram_8[0x27] |= (data & 0xFE);
}
void op_set_current_object(uint64 object)
objectp_ram[0x15] = object & 0xFF; object >>= 8;
objectp_ram[0x14] = object & 0xFF;*/
// Let's try regular good old big endian...
- objectp_ram[0x17] = object & 0xFF; object >>= 8;
- objectp_ram[0x16] = object & 0xFF; object >>= 8;
- objectp_ram[0x15] = object & 0xFF; object >>= 8;
- objectp_ram[0x14] = object & 0xFF; object >>= 8;
-
- objectp_ram[0x13] = object & 0xFF; object >>= 8;
- objectp_ram[0x12] = object & 0xFF; object >>= 8;
- objectp_ram[0x11] = object & 0xFF; object >>= 8;
- objectp_ram[0x10] = object & 0xFF;
+ tom_ram_8[0x17] = object & 0xFF; object >>= 8;
+ tom_ram_8[0x16] = object & 0xFF; object >>= 8;
+ tom_ram_8[0x15] = object & 0xFF; object >>= 8;
+ tom_ram_8[0x14] = object & 0xFF; object >>= 8;
+
+ tom_ram_8[0x13] = object & 0xFF; object >>= 8;
+ tom_ram_8[0x12] = object & 0xFF; object >>= 8;
+ tom_ram_8[0x11] = object & 0xFF; object >>= 8;
+ tom_ram_8[0x10] = object & 0xFF;
}
uint64 op_load_phrase(uint32 offset)
//
//Need to fix this so that when an GPU object IRQ happens, we can pick up OP processing
//where we left off. !!! FIX !!!
+#warning Need to fix this so that when an GPU object IRQ happens, we can pick up OP processing where we left off. !!! FIX !!!
void OPProcessList(int scanline, bool render)
{
extern int op_start_log;
//???Does this really happen??? Doesn't seem to work if you do this...!
//Probably not. Must be a bug in the documentation...!
// uint32 link = (p0 & 0x7FFFF000000) >> 21;
-// SET16(objectp_ram, 0x20, link & 0xFFFF); // OLP
-// SET16(objectp_ram, 0x22, link >> 16);
+// SET16(tom_ram_8, 0x20, link & 0xFFFF); // OLP
+// SET16(tom_ram_8, 0x22, link >> 16);
/* uint32 height = (p0 & 0xFFC000) >> 14;
if (height - 1 > 0)
height--;*/
uint32 op_get_status_register(void);
void op_set_current_object(uint64 object);
-uint8 OPReadByte(uint32, uint32 who = UNKNOWN);
-uint16 OPReadWord(uint32, uint32 who = UNKNOWN);
-void OPWriteByte(uint32, uint8, uint32 who = UNKNOWN);
-void OPWriteWord(uint32, uint16, uint32 who = UNKNOWN);
+//uint8 OPReadByte(uint32, uint32 who = UNKNOWN);
+//uint16 OPReadWord(uint32, uint32 who = UNKNOWN);
+//void OPWriteByte(uint32, uint8, uint32 who = UNKNOWN);
+//void OPWriteWord(uint32, uint16, uint32 who = UNKNOWN);
#endif // __OBJECTP_H__
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+
+#include "sdlemu_config.h"
+
#include <stdio.h>
#include <string>
#include <list>
-#include "sdlemu_config.h"
using namespace std;
// by James L. Hammons
//
+#include "settings.h"
+
#include <stdlib.h>
#include <string>
#include "SDL.h"
#include "sdlemu_config.h"
#include "log.h"
-#include "settings.h"
using namespace std;
// F02298 W xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx B_Z0 - Z0
// ------------------------------------------------------------
-//#include <SDL.h>
#include "tom.h"
+
+#include <string.h> // For memset()
+#include <stdlib.h> // For rand()
#include "video.h"
#include "gpu.h"
#include "objectp.h"
#include "cry2rgb.h"
#include "settings.h"
#include "clock.h"
+#include "jaguar.h"
+#include "log.h"
+#include "blitter.h"
+#include "m68k.h"
#define NEW_TIMER_SYSTEM
extern uint8 objectp_running;
-static uint8 * tom_ram_8;
+uint8 tom_ram_8[0x4000];
uint32 tom_width, tom_height;
static uint32 tom_timer_prescaler;
static uint32 tom_timer_divider;
//int16 * TOMBackbuffer;
uint32 * TOMBackbuffer;
-static char * videoMode_to_str[8] =
+static const char * videoMode_to_str[8] =
{ "16 BPP CRY", "24 BPP RGB", "16 BPP DIRECT", "16 BPP RGB",
"Mixed mode", "24 BPP RGB", "16 BPP DIRECT", "16 BPP RGB" };
op_init();
blitter_init();
//This should be done by JERRY! pcm_init();
- memory_malloc_secure((void **)&tom_ram_8, 0x4000, "TOM RAM");
+// memory_malloc_secure((void **)&tom_ram_8, 0x4000, "TOM RAM");
tom_reset();
// Setup the non-stretchy scanline rendering...
memcpy(scanline_render, scanline_render_normal, sizeof(scanline_render));
// WriteLog("tom: INT1=0x%.2x%.2x\n",TOMReadByte(0xf000e0),TOMReadByte(0xf000e1));
// gpu_done();
// dsp_done();
- memory_free(tom_ram_8);
+// memory_free(tom_ram_8);
// memory_free(tom_cry_rgb_mix_lut);
}
return GPUReadByte(offset, who);
else if ((offset >= GPU_WORK_RAM_BASE) && (offset < GPU_WORK_RAM_BASE+0x1000))
return GPUReadByte(offset, who);
- else if ((offset >= 0xF00010) && (offset < 0xF00028))
- return OPReadByte(offset, who);
+/* else if ((offset >= 0xF00010) && (offset < 0xF00028))
+ return OPReadByte(offset, who);*/
else if ((offset >= 0xF02200) && (offset < 0xF022A0))
return BlitterReadByte(offset, who);
else if (offset == 0xF00050)
return GPUReadWord(offset, who);
else if ((offset >= GPU_WORK_RAM_BASE) && (offset < GPU_WORK_RAM_BASE + 0x1000))
return GPUReadWord(offset, who);
- else if ((offset >= 0xF00010) && (offset < 0xF00028))
- return OPReadWord(offset, who);
+/* else if ((offset >= 0xF00010) && (offset < 0xF00028))
+ return OPReadWord(offset, who);*/
else if ((offset >= 0xF02200) && (offset < 0xF022A0))
return BlitterReadWord(offset, who);
else if (offset == 0xF00050)
GPUWriteByte(offset, data, who);
return;
}
- else if ((offset >= 0xF00010) && (offset < 0xF00028))
+/* else if ((offset >= 0xF00010) && (offset < 0xF00028))
{
OPWriteByte(offset, data, who);
return;
- }
+ }*/
else if ((offset >= 0xF02200) && (offset < 0xF022A0))
{
BlitterWriteByte(offset, data, who);
TOMWriteByte(offset, data >> 8);
TOMWriteByte(offset+1, data & 0xFF);
}*/
- else if ((offset >= 0xF00010) && (offset < 0xF00028))
+/* else if ((offset >= 0xF00010) && (offset < 0xF00028))
{
OPWriteWord(offset, data, who);
return;
- }
+ }*/
else if (offset == 0xF00050)
{
tom_timer_prescaler = data;
offset &= 0x3FFF;
if (offset == 0x28) // VMODE (Why? Why not OBF?)
+//Actually, we should check to see if the Enable bit of VMODE is set before doing this... !!! FIX !!!
+#warning Actually, we should check to see if the Enable bit of VMODE is set before doing this... !!! FIX !!!
objectp_running = 1;
if (offset >= 0x30 && offset <= 0x4E)
#ifndef __TOM_H__
#define __TOM_H__
-#include "jaguar.h"
+//#include "jaguar.h"
+#include "types.h"
#define VIDEO_MODE_16BPP_CRY 0
#define VIDEO_MODE_24BPP_RGB 1
extern uint32 tom_width;
extern uint32 tom_height;
+extern uint8 tom_ram_8[];
#endif // __TOM_H__
#ifndef __UNZIP_H__
#define __UNZIP_H__
-//#include "types.h"
#include <stdio.h>
#include <stdint.h>
// by James L. Hammons
//
+#include "video.h"
+
#include "tom.h"
#include "sdlemu_opengl.h"
#include "settings.h"
-#include "video.h"
+#include "log.h"
// External global variables
//
#ifdef __GCCUNIX__
-#include <unistd.h> // Is this necessary anymore?
+//#include <unistd.h> // Is this necessary anymore?
+//Looks like the answer is no...
#endif
#include <time.h>
#include "gui.h"
#include "sdlemu_opengl.h"
#include "settings.h" // Pull in "vjs" struct
+#include "log.h"
+#include "version.h"
+#include "memory.h"
// Uncomment this to use built-in BIOS/CD-ROM BIOS
// You'll need a copy of jagboot.h & jagcd.h for this to work...!
extern uint8 * jaguar_CDBootROM;
// Global variables (export capable)
-//should these even be here anymore?
+//should these even be here anymore? prolly not...
bool finished = false;
bool showGUI = false;
if (!strcmp(argv[i], "-ntsc"))
vjs.hardwareTypeNTSC = true;
- if (!strcmp(argv[i], "-help") || !strcmp(argv[i], "-?"))
+ if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-?"))
{
printf("Usage: \n\n");
printf("vj [romfile] [switches]\n");
- printf(" -? or -help : Display usage and switches \n");
+ printf(" -? or --help : Display usage and switches \n");
printf(" -frameskip 1-10 : Enable frameskip 1 - 10 (default: none) \n");
printf(" -joystick : Enable joystick/gamepad \n");
printf(" -joyport 0-3 : Select desired joystick port \n");
// Set up SDL library
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER) < 0)
-// | SDL_INIT_CDROM) < 0)
-// | SDL_INIT_CDROM | SDL_INIT_NOPARACHUTE) < 0)
{
WriteLog("VJ: Could not initialize the SDL library: %s\n", SDL_GetError());
return -1;
log_done();
// Free SDL components last...!
-// SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_CDROM);
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO | SDL_INIT_TIMER);
SDL_Quit();