mirror of
https://github.com/robmcmullen/apple2.git
synced 2024-09-28 18:55:12 +00:00
Miscellaneous minor code cleanup.
This commit is contained in:
parent
721ead373f
commit
717eaa2219
18
Makefile
18
Makefile
@ -124,18 +124,6 @@ OBJS = \
|
|||||||
obj/apple2.o \
|
obj/apple2.o \
|
||||||
$(ICON)
|
$(ICON)
|
||||||
|
|
||||||
#foooked:
|
|
||||||
# obj/button.o \
|
|
||||||
obj/diskwindow.o \
|
|
||||||
obj/draggablewindow.o \
|
|
||||||
obj/draggablewindow2.o \
|
|
||||||
obj/element.o \
|
|
||||||
obj/guimisc.o \
|
|
||||||
obj/menu.o \
|
|
||||||
obj/text.o \
|
|
||||||
obj/textedit.o \
|
|
||||||
obj/window.o \
|
|
||||||
|
|
||||||
all: message obj $(TARGET)$(EXESUFFIX)
|
all: message obj $(TARGET)$(EXESUFFIX)
|
||||||
@echo
|
@echo
|
||||||
@echo -e "\033[01;33m***\033[00;32m Looks like it compiled OK... Give it a whirl!\033[00m"
|
@echo -e "\033[01;33m***\033[00;32m Looks like it compiled OK... Give it a whirl!\033[00m"
|
||||||
@ -181,9 +169,9 @@ obj/%.o: src/%.cpp
|
|||||||
@$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
|
@$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
|
||||||
|
|
||||||
#GUI compilation...
|
#GUI compilation...
|
||||||
#obj/%.o: src/gui/%.cpp
|
obj/%.o: src/gui/%.cpp
|
||||||
# @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
|
@echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
|
||||||
# @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
|
@$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
|
||||||
|
|
||||||
$(TARGET)$(EXESUFFIX): $(OBJS)
|
$(TARGET)$(EXESUFFIX): $(OBJS)
|
||||||
@echo -e "\033[01;33m***\033[00;32m Linking it all together...\033[00m"
|
@echo -e "\033[01;33m***\033[00;32m Linking it all together...\033[00m"
|
||||||
|
12
apple2.cfg
12
apple2.cfg
@ -4,14 +4,16 @@
|
|||||||
|
|
||||||
# Apple ROM paths
|
# Apple ROM paths
|
||||||
|
|
||||||
BIOSROM = ./ROMs/apple2e-enhanced.rom
|
#default
|
||||||
diskROM = ./ROMs/disk.rom
|
#BIOSROM = ./ROMs/apple2e-enhanced.rom
|
||||||
ROMs = ./ROMs
|
#Not used anymore
|
||||||
|
#diskROM = ./ROMs/disk.rom
|
||||||
|
#ROMs = ./ROMs
|
||||||
|
|
||||||
# Auto state loading/saving upon starting/quitting Apple2 (1 - use, 0 - don't use)
|
# Auto state loading/saving upon starting/quitting Apple2 (1 - use, 0 - don't use)
|
||||||
|
|
||||||
autoSaveState = 1
|
#These are the defaults--we don't advertise it just yet... ;-)
|
||||||
#This is the default--we don't advertise it just yet... ;-)
|
#autoSaveState = 1
|
||||||
#autoStateFilename = ./apple2auto.state
|
#autoStateFilename = ./apple2auto.state
|
||||||
|
|
||||||
# OpenGL filtering type: 1 - blurry, 0 - sharp
|
# OpenGL filtering type: 1 - blurry, 0 - sharp
|
||||||
|
116
src/apple2.cpp
116
src/apple2.cpp
@ -12,7 +12,7 @@
|
|||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 11/12/2005 Initial port to SDL
|
// JLH 11/12/2005 Initial port to SDL
|
||||||
// JLH 11/18/2005 Wired up graphic soft switches
|
// JLH 11/18/2005 Wired up graphic soft switches
|
||||||
// JLH 12/02/2005 Setup timer subsystem for more accurate time keeping
|
// JLH 12/02/2005 Setup timer subsystem for more accurate time keeping
|
||||||
@ -66,14 +66,12 @@
|
|||||||
|
|
||||||
uint8_t ram[0x10000], rom[0x10000]; // RAM & ROM spaces
|
uint8_t ram[0x10000], rom[0x10000]; // RAM & ROM spaces
|
||||||
uint8_t ram2[0x10000]; // Auxillary RAM
|
uint8_t ram2[0x10000]; // Auxillary RAM
|
||||||
//uint8_t diskRom[0x100]; // Disk ROM space
|
|
||||||
V65C02REGS mainCPU; // v65C02 execution context
|
V65C02REGS mainCPU; // v65C02 execution context
|
||||||
uint8_t appleType = APPLE_TYPE_IIE;
|
uint8_t appleType = APPLE_TYPE_IIE;
|
||||||
FloppyDrive floppyDrive;
|
FloppyDrive floppyDrive;
|
||||||
//bool powerOnState = true; // Virtual power switch
|
|
||||||
bool powerStateChangeRequested = false;
|
bool powerStateChangeRequested = false;
|
||||||
|
|
||||||
// Local variables
|
// Local variables (actually, they're global since they're not static)
|
||||||
|
|
||||||
uint8_t lastKeyPressed = 0;
|
uint8_t lastKeyPressed = 0;
|
||||||
bool keyDown = false;
|
bool keyDown = false;
|
||||||
@ -98,9 +96,8 @@ static bool fullscreenDebounce = false;
|
|||||||
static bool capsLock = false;
|
static bool capsLock = false;
|
||||||
static bool capsLockDebounce = false;
|
static bool capsLockDebounce = false;
|
||||||
|
|
||||||
// Local functions (technically, they're global...)
|
// Local functions
|
||||||
|
|
||||||
bool LoadImg(char * filename, uint8_t * ram, int size);
|
|
||||||
static void SaveApple2State(const char * filename);
|
static void SaveApple2State(const char * filename);
|
||||||
static bool LoadApple2State(const char * filename);
|
static bool LoadApple2State(const char * filename);
|
||||||
static void ResetApple2State(void);
|
static void ResetApple2State(void);
|
||||||
@ -122,10 +119,10 @@ static bool cpuFinished = false;
|
|||||||
// NB: Apple //e Manual sez 6502 is running @ 1,022,727 Hz
|
// NB: Apple //e Manual sez 6502 is running @ 1,022,727 Hz
|
||||||
|
|
||||||
// Let's try a thread...
|
// Let's try a thread...
|
||||||
/*
|
//
|
||||||
Here's how it works: Execute 1 frame's worth, then sleep.
|
// Here's how it works: Execute 1 frame's worth, then sleep. Other stuff wakes
|
||||||
Other stuff wakes it up
|
// it up
|
||||||
*/
|
//
|
||||||
int CPUThreadFunc(void * data)
|
int CPUThreadFunc(void * data)
|
||||||
{
|
{
|
||||||
// Mutex must be locked for conditional to work...
|
// Mutex must be locked for conditional to work...
|
||||||
@ -201,31 +198,13 @@ WriteLog("CPU: SDL_mutexV(cpuMutex);\n");
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
//
|
//
|
||||||
// Request a change in the power state of the emulated Apple
|
// Request a change in the power state of the emulated Apple
|
||||||
//
|
//
|
||||||
void SetPowerState(void)
|
void SetPowerState(void)
|
||||||
{
|
{
|
||||||
// powerOnState = state;
|
|
||||||
// pauseMode = !state;
|
|
||||||
|
|
||||||
// if (!pauseMode)
|
|
||||||
// {
|
|
||||||
//printf("Turning on...\n");
|
|
||||||
// Transitioning from OFF to ON
|
|
||||||
// mainCPU.cpuFlags |= V65C02_ASSERT_LINE_RESET;
|
|
||||||
// SoundResume();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
//printf("Turning off...\n");
|
|
||||||
// Turn it off...
|
|
||||||
// SoundPause();
|
|
||||||
// }
|
|
||||||
powerStateChangeRequested = true;
|
powerStateChangeRequested = true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -375,13 +354,10 @@ static void ResetApple2State(void)
|
|||||||
ioudis = true;
|
ioudis = true;
|
||||||
dhires = false;
|
dhires = false;
|
||||||
lcState = 0x02;
|
lcState = 0x02;
|
||||||
// SwitchLC(); // Make sure MMU is in sane state
|
|
||||||
//NOPE, does nothing SetupAddressMap();
|
|
||||||
ResetMMUPointers();
|
ResetMMUPointers();
|
||||||
|
|
||||||
// Without this, you can wedge the system :-/
|
// Without this, you can wedge the system :-/
|
||||||
memset(ram, 0, 0x10000);
|
memset(ram, 0, 0x10000);
|
||||||
// memset(ram2, 0, 0x10000);
|
|
||||||
mainCPU.cpuFlags |= V65C02_ASSERT_LINE_RESET;
|
mainCPU.cpuFlags |= V65C02_ASSERT_LINE_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,18 +391,12 @@ int main(int /*argc*/, char * /*argv*/[])
|
|||||||
mainCPU.WrMem = AppleWriteMem;
|
mainCPU.WrMem = AppleWriteMem;
|
||||||
mainCPU.cpuFlags |= V65C02_ASSERT_LINE_RESET;
|
mainCPU.cpuFlags |= V65C02_ASSERT_LINE_RESET;
|
||||||
|
|
||||||
// alternateCharset = true;
|
|
||||||
// if (!LoadImg(settings.BIOSPath, rom + 0xD000, 0x3000))
|
|
||||||
if (!LoadImg(settings.BIOSPath, rom + 0xC000, 0x4000))
|
if (!LoadImg(settings.BIOSPath, rom + 0xC000, 0x4000))
|
||||||
{
|
{
|
||||||
WriteLog("Could not open file '%s'!\n", settings.BIOSPath);
|
WriteLog("Could not open file '%s'!\n", settings.BIOSPath);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load up disk image from config file (for now)...
|
|
||||||
floppyDrive.LoadImage(settings.diskImagePath1, 0);
|
|
||||||
floppyDrive.LoadImage(settings.diskImagePath2, 1);
|
|
||||||
|
|
||||||
WriteLog("About to initialize video...\n");
|
WriteLog("About to initialize video...\n");
|
||||||
|
|
||||||
if (!InitVideo())
|
if (!InitVideo())
|
||||||
@ -470,23 +440,18 @@ int main(int /*argc*/, char * /*argv*/[])
|
|||||||
double timeToNextEvent = GetTimeToNextEvent();
|
double timeToNextEvent = GetTimeToNextEvent();
|
||||||
#ifndef THREADED_65C02
|
#ifndef THREADED_65C02
|
||||||
Execute65C02(&mainCPU, USEC_TO_M6502_CYCLES(timeToNextEvent));
|
Execute65C02(&mainCPU, USEC_TO_M6502_CYCLES(timeToNextEvent));
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CPU_CLOCK_CHECKING
|
#ifdef CPU_CLOCK_CHECKING
|
||||||
#ifndef THREADED_65C02
|
|
||||||
totalCPU += USEC_TO_M6502_CYCLES(timeToNextEvent);
|
totalCPU += USEC_TO_M6502_CYCLES(timeToNextEvent);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
HandleNextEvent();
|
HandleNextEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef THREADED_65C02
|
#ifdef THREADED_65C02
|
||||||
WriteLog("Main: cpuFinished = true;\n");
|
WriteLog("Main: cpuFinished = true;\n");
|
||||||
cpuFinished = true;
|
cpuFinished = true;
|
||||||
//#warning "If sound thread is behind, CPU thread will never wake up... !!! FIX !!!" [DONE]
|
|
||||||
//What to do? How do you know when the CPU is sleeping???
|
|
||||||
//USE A CONDITIONAL!!! OF COURSE!!!!!!11!11!11!!!1!
|
|
||||||
//Nope, use a semaphore...
|
|
||||||
WriteLog("Main: SDL_SemWait(mainSem);\n");
|
WriteLog("Main: SDL_SemWait(mainSem);\n");
|
||||||
// Only do this if NOT in power off/emulation paused mode!
|
// Only do this if NOT in power off/emulation paused mode!
|
||||||
if (!pauseMode)
|
if (!pauseMode)
|
||||||
@ -494,20 +459,17 @@ WriteLog("Main: SDL_SemWait(mainSem);\n");
|
|||||||
SDL_SemWait(mainSem);
|
SDL_SemWait(mainSem);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WriteLog("Main: SDL_CondSignal(cpuCond);//thread is probably asleep, wake it up\n");
|
WriteLog("Main: SDL_CondSignal(cpuCond);\n");
|
||||||
SDL_CondSignal(cpuCond);//thread is probably asleep, wake it up
|
SDL_CondSignal(cpuCond);//thread is probably asleep, so wake it up
|
||||||
WriteLog("Main: SDL_WaitThread(cpuThread, NULL);\n");
|
WriteLog("Main: SDL_WaitThread(cpuThread, NULL);\n");
|
||||||
SDL_WaitThread(cpuThread, NULL);
|
SDL_WaitThread(cpuThread, NULL);
|
||||||
//nowok:SDL_WaitThread(CPUThreadFunc, NULL);
|
|
||||||
WriteLog("Main: SDL_DestroyCond(cpuCond);\n");
|
WriteLog("Main: SDL_DestroyCond(cpuCond);\n");
|
||||||
SDL_DestroyCond(cpuCond);
|
SDL_DestroyCond(cpuCond);
|
||||||
SDL_DestroySemaphore(mainSem);
|
SDL_DestroySemaphore(mainSem);
|
||||||
|
|
||||||
|
// Autosave state here, if requested...
|
||||||
if (settings.autoStateSaving)
|
if (settings.autoStateSaving)
|
||||||
{
|
|
||||||
// Save state here...
|
|
||||||
SaveApple2State(settings.autoStatePath);
|
SaveApple2State(settings.autoStatePath);
|
||||||
}
|
|
||||||
|
|
||||||
floppyDrive.SaveImage(0);
|
floppyDrive.SaveImage(0);
|
||||||
floppyDrive.SaveImage(1);
|
floppyDrive.SaveImage(1);
|
||||||
@ -574,9 +536,8 @@ Z $DA $9A $DA $9A
|
|||||||
<- $88 $88 $88 $88
|
<- $88 $88 $88 $88
|
||||||
-> $95 $95 $95 $95
|
-> $95 $95 $95 $95
|
||||||
ESC $9B $9B $9B $9B No xlation
|
ESC $9B $9B $9B $9B No xlation
|
||||||
|
|
||||||
*/
|
*/
|
||||||
//static uint64_t lastCPUCycles = 0;
|
|
||||||
static uint32_t frameCount = 0;
|
static uint32_t frameCount = 0;
|
||||||
static void FrameCallback(void)
|
static void FrameCallback(void)
|
||||||
{
|
{
|
||||||
@ -607,15 +568,24 @@ static void FrameCallback(void)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
// Use ALT+Q to exit, as well as the usual window decoration method
|
// Use CTRL+SHIFT+Q to exit, as well as the usual window decoration
|
||||||
if (event.key.keysym.sym == SDLK_q && (event.key.keysym.mod & KMOD_ALT))
|
// method
|
||||||
|
if ((event.key.keysym.mod & KMOD_CTRL)
|
||||||
|
&& (event.key.keysym.mod & KMOD_SHIFT)
|
||||||
|
&& (event.key.keysym.sym == SDLK_q))
|
||||||
|
{
|
||||||
running = false;
|
running = false;
|
||||||
|
// We return here, because we don't want to pick up any
|
||||||
|
// spurious keypresses with our exit sequence.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// CTRL+RESET key emulation (mapped to CTRL+`)
|
// CTRL+RESET key emulation (mapped to CTRL+`)
|
||||||
// This doesn't work...
|
// This doesn't work...
|
||||||
// if (event.key.keysym.sym == SDLK_BREAK && (event.key.keysym.mod & KMOD_CTRL))
|
// if (event.key.keysym.sym == SDLK_BREAK && (event.key.keysym.mod & KMOD_CTRL))
|
||||||
// if (event.key.keysym.sym == SDLK_PAUSE && (event.key.keysym.mod & KMOD_CTRL))
|
// if (event.key.keysym.sym == SDLK_PAUSE && (event.key.keysym.mod & KMOD_CTRL))
|
||||||
if (event.key.keysym.sym == SDLK_BACKQUOTE && (event.key.keysym.mod & KMOD_CTRL))
|
if ((event.key.keysym.mod & KMOD_CTRL)
|
||||||
|
&& (event.key.keysym.sym == SDLK_BACKQUOTE))
|
||||||
{
|
{
|
||||||
//NOTE that this shouldn't take place until the key is lifted... !!! FIX !!!
|
//NOTE that this shouldn't take place until the key is lifted... !!! FIX !!!
|
||||||
//ALSO it seems to leave the machine in an inconsistent state vis-a-vis the language card...
|
//ALSO it seems to leave the machine in an inconsistent state vis-a-vis the language card...
|
||||||
@ -820,10 +790,8 @@ static void FrameCallback(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Paddle buttons 0 & 1
|
// Paddle buttons 0 & 1
|
||||||
// if (event.key.keysym.sym == SDLK_INSERT)
|
|
||||||
if (event.key.keysym.sym == SDLK_LALT)
|
if (event.key.keysym.sym == SDLK_LALT)
|
||||||
openAppleDown = true;
|
openAppleDown = true;
|
||||||
// if (event.key.keysym.sym == SDLK_PAGEUP)
|
|
||||||
if (event.key.keysym.sym == SDLK_RALT)
|
if (event.key.keysym.sym == SDLK_RALT)
|
||||||
closedAppleDown = true;
|
closedAppleDown = true;
|
||||||
|
|
||||||
@ -841,26 +809,28 @@ static void FrameCallback(void)
|
|||||||
// SpawnMessage("Image swapped...");
|
// SpawnMessage("Image swapped...");
|
||||||
}//*/
|
}//*/
|
||||||
|
|
||||||
if (event.key.keysym.sym == SDLK_F2)// Toggle the palette
|
if (event.key.keysym.sym == SDLK_F2)
|
||||||
TogglePalette();
|
TogglePalette();
|
||||||
else if (event.key.keysym.sym == SDLK_F3)// Cycle through screen types
|
else if (event.key.keysym.sym == SDLK_F3)
|
||||||
CycleScreenTypes();
|
CycleScreenTypes();
|
||||||
else if (event.key.keysym.sym == SDLK_F5)
|
else if (event.key.keysym.sym == SDLK_F5)
|
||||||
{
|
{
|
||||||
VolumeDown();
|
VolumeDown();
|
||||||
char volStr[19] = "[****************]";
|
char volStr[19] = "[****************]";
|
||||||
// volStr[GetVolume()] = 0;
|
|
||||||
for(int i=GetVolume(); i<16; i++)
|
for(int i=GetVolume(); i<16; i++)
|
||||||
volStr[1 + i] = '-';
|
volStr[1 + i] = '-';
|
||||||
|
|
||||||
SpawnMessage("Volume: %s", volStr);
|
SpawnMessage("Volume: %s", volStr);
|
||||||
}
|
}
|
||||||
else if (event.key.keysym.sym == SDLK_F6)
|
else if (event.key.keysym.sym == SDLK_F6)
|
||||||
{
|
{
|
||||||
VolumeUp();
|
VolumeUp();
|
||||||
char volStr[19] = "[****************]";
|
char volStr[19] = "[****************]";
|
||||||
// volStr[GetVolume()] = 0;
|
|
||||||
for(int i=GetVolume(); i<16; i++)
|
for(int i=GetVolume(); i<16; i++)
|
||||||
volStr[1 + i] = '-';
|
volStr[1 + i] = '-';
|
||||||
|
|
||||||
SpawnMessage("Volume: %s", volStr);
|
SpawnMessage("Volume: %s", volStr);
|
||||||
}
|
}
|
||||||
else if (event.key.keysym.sym == SDLK_F12)
|
else if (event.key.keysym.sym == SDLK_F12)
|
||||||
@ -889,16 +859,11 @@ static void FrameCallback(void)
|
|||||||
capsLockDebounce = false;
|
capsLockDebounce = false;
|
||||||
|
|
||||||
// Paddle buttons 0 & 1
|
// Paddle buttons 0 & 1
|
||||||
// if (event.key.keysym.sym == SDLK_INSERT)
|
|
||||||
if (event.key.keysym.sym == SDLK_LALT)
|
if (event.key.keysym.sym == SDLK_LALT)
|
||||||
openAppleDown = false;
|
openAppleDown = false;
|
||||||
// if (event.key.keysym.sym == SDLK_PAGEUP)
|
|
||||||
if (event.key.keysym.sym == SDLK_RALT)
|
if (event.key.keysym.sym == SDLK_RALT)
|
||||||
closedAppleDown = false;
|
closedAppleDown = false;
|
||||||
|
|
||||||
// if (event.key.keysym.sym >= SDLK_a && event.key.keysym.sym <= SDLK_z)
|
|
||||||
// keyDown = false;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
GUI::MouseDown(event.motion.x, event.motion.y, event.motion.state);
|
GUI::MouseDown(event.motion.x, event.motion.y, event.motion.state);
|
||||||
@ -925,7 +890,6 @@ static void FrameCallback(void)
|
|||||||
if (GUI::powerOnState)
|
if (GUI::powerOnState)
|
||||||
{
|
{
|
||||||
pauseMode = false;
|
pauseMode = false;
|
||||||
// SoundResume();
|
|
||||||
// Unlock the CPU thread...
|
// Unlock the CPU thread...
|
||||||
SDL_SemPost(mainSem);
|
SDL_SemPost(mainSem);
|
||||||
}
|
}
|
||||||
@ -934,20 +898,14 @@ static void FrameCallback(void)
|
|||||||
pauseMode = true;
|
pauseMode = true;
|
||||||
// Should lock until CPU thread is waiting...
|
// Should lock until CPU thread is waiting...
|
||||||
SDL_SemWait(mainSem);
|
SDL_SemWait(mainSem);
|
||||||
// SoundPause();
|
|
||||||
ResetApple2State();
|
ResetApple2State();
|
||||||
}
|
}
|
||||||
|
|
||||||
powerStateChangeRequested = false;
|
powerStateChangeRequested = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#warning "!!! Taking MAJOR time hit with the video frame rendering !!!"
|
RenderVideoFrame(); // Render Apple screen to buffer
|
||||||
// if (!pauseMode)
|
RenderScreenBuffer(); // Render buffer to host screen
|
||||||
{
|
|
||||||
RenderVideoFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
RenderScreenBuffer();
|
|
||||||
GUI::Render(sdlRenderer);
|
GUI::Render(sdlRenderer);
|
||||||
SDL_RenderPresent(sdlRenderer);
|
SDL_RenderPresent(sdlRenderer);
|
||||||
SetCallbackTime(FrameCallback, 16666.66666667);
|
SetCallbackTime(FrameCallback, 16666.66666667);
|
||||||
@ -997,8 +955,9 @@ if (counter == 60)
|
|||||||
|
|
||||||
static void BlinkTimer(void)
|
static void BlinkTimer(void)
|
||||||
{
|
{
|
||||||
|
// Set up blinking at 1/4 sec intervals
|
||||||
flash = !flash;
|
flash = !flash;
|
||||||
SetCallbackTime(BlinkTimer, 250000); // Set up blinking at 1/4 sec intervals
|
SetCallbackTime(BlinkTimer, 250000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1027,3 +986,4 @@ while (!done)
|
|||||||
time = 20;
|
time = 20;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ enum { APPLE_TYPE_II, APPLE_TYPE_IIE, APPLE_TYPE_IIC };
|
|||||||
// Exported functions
|
// Exported functions
|
||||||
|
|
||||||
void SetPowerState(void);
|
void SetPowerState(void);
|
||||||
|
bool LoadImg(char * filename, uint8_t * ram, int size);
|
||||||
|
|
||||||
// Global variables (exported)
|
// Global variables (exported)
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
// All the video modes that a real Apple 2 supports are handled here
|
// All the video modes that a real Apple 2 supports are handled here
|
||||||
//
|
//
|
||||||
// by James Hammons
|
// by James Hammons
|
||||||
// (c) 2005 Underground Software
|
// (c) 2005-2017 Underground Software
|
||||||
//
|
//
|
||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 12/01/2005 Added color TV/monochrome emulation to hi-res code
|
// JLH 12/01/2005 Added color TV/monochrome emulation to hi-res code
|
||||||
// JLH 12/09/2005 Cleaned up color TV emulation code
|
// JLH 12/09/2005 Cleaned up color TV emulation code
|
||||||
// JLH 12/09/2005 Fixed lo-res color TV/mono emulation modes
|
// JLH 12/09/2005 Fixed lo-res color TV/mono emulation modes
|
||||||
@ -17,9 +17,9 @@
|
|||||||
// STILL TO DO:
|
// STILL TO DO:
|
||||||
//
|
//
|
||||||
// - Fix LoRes mode green mono to skip every other scanline instead of fill
|
// - Fix LoRes mode green mono to skip every other scanline instead of fill
|
||||||
// like white mono does
|
// like white mono does [DONE]
|
||||||
// - Double HiRes
|
// - Double HiRes [DONE]
|
||||||
// - 80 column text
|
// - 80 column text [DONE]
|
||||||
// - Fix OSD text display so that it's visible no matter what background is there [DONE]
|
// - Fix OSD text display so that it's visible no matter what background is there [DONE]
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -30,10 +30,9 @@
|
|||||||
#include <string.h> // for memset()
|
#include <string.h> // for memset()
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h> // for va_* stuff
|
#include <stdarg.h> // for va_* stuff
|
||||||
//#include <string> // for vsprintf()
|
|
||||||
#include "apple2.h"
|
#include "apple2.h"
|
||||||
#include "video.h"
|
|
||||||
#include "charset.h"
|
#include "charset.h"
|
||||||
|
#include "video.h"
|
||||||
#include "gui/font14pt.h"
|
#include "gui/font14pt.h"
|
||||||
#include "gui/gui.h"
|
#include "gui/gui.h"
|
||||||
|
|
||||||
@ -70,7 +69,6 @@ bool displayPage2 = false;
|
|||||||
bool hiRes = false;
|
bool hiRes = false;
|
||||||
bool alternateCharset = false;
|
bool alternateCharset = false;
|
||||||
bool col80Mode = false;
|
bool col80Mode = false;
|
||||||
//void SpawnMessage(const char * text, ...);
|
|
||||||
|
|
||||||
// Local variables
|
// Local variables
|
||||||
|
|
||||||
|
@ -16,15 +16,15 @@
|
|||||||
// --------------------------
|
// --------------------------
|
||||||
// This chapter might not apply to specific portions of MAME (e.g. CPU
|
// This chapter might not apply to specific portions of MAME (e.g. CPU
|
||||||
// emulators) which bear different copyright notices.
|
// emulators) which bear different copyright notices.
|
||||||
// The source code cannot be used in a commercial product without the written
|
// The source code cannot be used in a commercial product without the
|
||||||
// authorization of the authors. Use in non-commercial products is allowed, and
|
// written authorization of the authors. Use in non-commercial products is
|
||||||
// indeed encouraged. If you use portions of the MAME source code in your
|
// allowed, and indeed encouraged. If you use portions of the MAME source
|
||||||
// program, however, you must make the full source code freely available as
|
// code in your program, however, you must make the full source code freely
|
||||||
// well.
|
// available as well.
|
||||||
// Usage of the _information_ contained in the source code is free for any use.
|
// Usage of the _information_ contained in the source code is free for any
|
||||||
// However, given the amount of time and energy it took to collect this
|
// use. However, given the amount of time and energy it took to collect this
|
||||||
// information, if you find new information we would appreciate if you made it
|
// information, if you find new information we would appreciate if you made
|
||||||
// freely available as well.
|
// it freely available as well.
|
||||||
//
|
//
|
||||||
|
|
||||||
// JLH: Commented out MAME specific crap
|
// JLH: Commented out MAME specific crap
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
// by James Hammons
|
// by James Hammons
|
||||||
// (C) 2005 Underground Software
|
// (C) 2005 Underground Software
|
||||||
//
|
//
|
||||||
// While we could pack things into bytes, it doesn't cost too much to have everything
|
// While we could pack things into bytes, it doesn't cost too much to have
|
||||||
// unpacked as we have it here.
|
// everything unpacked as we have it here.
|
||||||
//
|
//
|
||||||
|
|
||||||
// Apple II character set has 64 chars (56 bytes for each character)
|
// Apple II character set has 64 chars (56 bytes for each character)
|
||||||
|
@ -113,6 +113,7 @@ int Decode65C02(char * outbuf, uint16_t pc)
|
|||||||
char buf[32], buf2[32];
|
char buf[32], buf2[32];
|
||||||
|
|
||||||
uint16_t addr = pc;
|
uint16_t addr = pc;
|
||||||
|
uint16_t w;
|
||||||
uint8_t opcode = mainCPU.RdMem(addr++); // Get the opcode
|
uint8_t opcode = mainCPU.RdMem(addr++); // Get the opcode
|
||||||
|
|
||||||
switch (op_mat[opcode]) // Decode the addressing mode...
|
switch (op_mat[opcode]) // Decode the addressing mode...
|
||||||
@ -142,19 +143,29 @@ int Decode65C02(char * outbuf, uint16_t pc)
|
|||||||
sprintf(buf, "%s ($%02X),Y", mnemonics[opcode], mainCPU.RdMem(addr++));
|
sprintf(buf, "%s ($%02X),Y", mnemonics[opcode], mainCPU.RdMem(addr++));
|
||||||
break;
|
break;
|
||||||
case 8: // Absolute
|
case 8: // Absolute
|
||||||
sprintf(buf, "%s $%04X", mnemonics[opcode], mainCPU.RdMem(addr++) | (mainCPU.RdMem(addr++) << 8));
|
w = mainCPU.RdMem(addr++);
|
||||||
|
w |= mainCPU.RdMem(addr++) << 8;
|
||||||
|
sprintf(buf, "%s $%04X", mnemonics[opcode], w);
|
||||||
break;
|
break;
|
||||||
case 9: // Absolute, X
|
case 9: // Absolute, X
|
||||||
sprintf(buf, "%s $%04X,X", mnemonics[opcode], mainCPU.RdMem(addr++) | (mainCPU.RdMem(addr++) << 8));
|
w = mainCPU.RdMem(addr++);
|
||||||
|
w |= mainCPU.RdMem(addr++) << 8;
|
||||||
|
sprintf(buf, "%s $%04X,X", mnemonics[opcode], w);
|
||||||
break;
|
break;
|
||||||
case 10: // Absolute, Y
|
case 10: // Absolute, Y
|
||||||
sprintf(buf, "%s $%04X,Y", mnemonics[opcode], mainCPU.RdMem(addr++) | (mainCPU.RdMem(addr++) << 8));
|
w = mainCPU.RdMem(addr++);
|
||||||
|
w |= mainCPU.RdMem(addr++) << 8;
|
||||||
|
sprintf(buf, "%s $%04X,Y", mnemonics[opcode], w);
|
||||||
break;
|
break;
|
||||||
case 11: // Indirect
|
case 11: // Indirect
|
||||||
sprintf(buf, "%s ($%04X)", mnemonics[opcode], mainCPU.RdMem(addr++) | (mainCPU.RdMem(addr++) << 8));
|
w = mainCPU.RdMem(addr++);
|
||||||
|
w |= mainCPU.RdMem(addr++) << 8;
|
||||||
|
sprintf(buf, "%s ($%04X)", mnemonics[opcode], w);
|
||||||
break;
|
break;
|
||||||
case 12: // Indirect, X
|
case 12: // Indirect, X
|
||||||
sprintf(buf, "%s ($%04X,X)", mnemonics[opcode], mainCPU.RdMem(addr++) | (mainCPU.RdMem(addr++) << 8));
|
w = mainCPU.RdMem(addr++);
|
||||||
|
w |= mainCPU.RdMem(addr++) << 8;
|
||||||
|
sprintf(buf, "%s ($%04X,X)", mnemonics[opcode], w);
|
||||||
break;
|
break;
|
||||||
case 13: // Relative
|
case 13: // Relative
|
||||||
sprintf(buf, "%s $%04X", mnemonics[opcode], addr + (int16_t)((int8_t)mainCPU.RdMem(addr)) + 1);
|
sprintf(buf, "%s $%04X", mnemonics[opcode], addr + (int16_t)((int8_t)mainCPU.RdMem(addr)) + 1);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 12/03/2005 Created this file
|
// JLH 12/03/2005 Created this file
|
||||||
// JLH 12/15/2005 Fixed nybblization functions to work properly
|
// JLH 12/15/2005 Fixed nybblization functions to work properly
|
||||||
// JLH 12/27/2005 Added blank disk creation, fixed saving to work properly
|
// JLH 12/27/2005 Added blank disk creation, fixed saving to work properly
|
||||||
@ -21,8 +21,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "applevideo.h" // For message spawning... Though there's probably a better approach than this!
|
#include "applevideo.h" // For message spawning... Though there's probably a better approach than this!
|
||||||
|
|
||||||
//using namespace std;
|
|
||||||
|
|
||||||
// Useful enums
|
// Useful enums
|
||||||
|
|
||||||
enum { IO_MODE_READ, IO_MODE_WRITE };
|
enum { IO_MODE_READ, IO_MODE_WRITE };
|
||||||
@ -541,10 +539,13 @@ const char * FloppyDrive::ImageName(uint8_t driveNum/*= 0*/)
|
|||||||
|
|
||||||
void FloppyDrive::EjectImage(uint8_t driveNum/*= 0*/)
|
void FloppyDrive::EjectImage(uint8_t driveNum/*= 0*/)
|
||||||
{
|
{
|
||||||
// Probably want to save a dirty image... ;-)
|
// Sanity check
|
||||||
SaveImage(driveNum);
|
if (IsEmpty(driveNum))
|
||||||
|
return;
|
||||||
|
|
||||||
WriteLog("FLOPPY: Ejected image file '%s' from drive %u...\n", imageName[driveNum], driveNum);
|
// Probably want to save a dirty image... ;-)
|
||||||
|
if (SaveImage(driveNum))
|
||||||
|
WriteLog("FLOPPY: Ejected image file '%s' from drive %u...\n", imageName[driveNum], driveNum);
|
||||||
|
|
||||||
if (disk[driveNum])
|
if (disk[driveNum])
|
||||||
delete[] disk[driveNum];
|
delete[] disk[driveNum];
|
||||||
@ -717,14 +718,15 @@ void FloppyDrive::WriteLong(FILE * file, uint32_t l)
|
|||||||
// Memory mapped I/O functions
|
// Memory mapped I/O functions
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The DSK format is a byte-for-byte image of a 16-sector Apple II floppy disk: 35 tracks of 16
|
The DSK format is a byte-for-byte image of a 16-sector Apple II floppy disk: 35
|
||||||
sectors of 256 bytes each, making 143,360 bytes in total. The PO format is exactly the same
|
tracks of 16 sectors of 256 bytes each, making 143,360 bytes in total. The PO
|
||||||
size as DSK and is also organized as 35 sequential tracks, but the sectors within each track
|
format is exactly the same size as DSK and is also organized as 35 sequential
|
||||||
are in a different sequence. The NIB format is a nybblized format: a more direct representation
|
tracks, but the sectors within each track are in a different sequence. The NIB
|
||||||
of the disk's data as encoded by the Apple II floppy drive hardware. NIB contains 35 tracks of
|
format is a nybblized format: a more direct representation of the disk's data
|
||||||
6656 bytes each, for a total size of 232,960 bytes. Although this format is much larger, it is
|
as encoded by the Apple II floppy drive hardware. NIB contains 35 tracks of
|
||||||
also more versatile and can represent the older 13-sector disks, many copy-protected disks, and
|
6656 bytes each, for a total size of 232,960 bytes. Although this format is
|
||||||
other unusual encodings.
|
much larger, it is also more versatile and can represent the older 13-sector
|
||||||
|
disks, many copy-protected disks, and other unusual encodings.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void FloppyDrive::ControlStepper(uint8_t addr)
|
void FloppyDrive::ControlStepper(uint8_t addr)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 10/13/2013 Created this file
|
// JLH 10/13/2013 Created this file
|
||||||
//
|
//
|
||||||
// STILL TO DO:
|
// STILL TO DO:
|
||||||
@ -130,13 +130,6 @@ void DiskSelector::FindDisks(const char * path)
|
|||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
std::sort(imageList.begin(), imageList.end());
|
std::sort(imageList.begin(), imageList.end());
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
std::vector<ci_string>::iterator i;
|
|
||||||
for(i=imageList.begin(); i!=imageList.end(); i++)
|
|
||||||
printf("GUI::DS::Found \"%s\"\n", (*i).c_str());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,24 +192,8 @@ void DiskSelector::DrawFilenames(SDL_Renderer * renderer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DiskSelector::DrawCharacter(SDL_Renderer * renderer, int x, int y, uint8_t c,
|
void DiskSelector::DrawCharacter(SDL_Renderer * renderer, int x, int y, uint8_t c, bool invert/*=false*/)
|
||||||
bool invert/*=false*/)
|
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
// uint32_t pixel = 0xFF7F0000;
|
|
||||||
uint8_t * ptr = (uint8_t *)&font2[(c - 0x20) * FONT_WIDTH * FONT_HEIGHT];
|
|
||||||
|
|
||||||
for(int j=0; j<FONT_HEIGHT; j++)
|
|
||||||
{
|
|
||||||
for(int i=0; i<FONT_WIDTH; i++)
|
|
||||||
{
|
|
||||||
SDL_SetRenderDrawColor(renderer, 0xFF, 0x7F, 0x00, ptr[(j * FONT_WIDTH) + i]);
|
|
||||||
SDL_RenderDrawPoint(renderer, (x * FONT_WIDTH) + i, (y * FONT_HEIGHT) + j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);
|
|
||||||
#else
|
|
||||||
uint32_t inv = (invert ? 0x000000FF : 0x00000000);
|
uint32_t inv = (invert ? 0x000000FF : 0x00000000);
|
||||||
uint32_t pixel = 0xFFFFC000; // RRGGBBAA
|
uint32_t pixel = 0xFFFFC000; // RRGGBBAA
|
||||||
uint8_t * ptr = (uint8_t *)&font10pt[(c - 0x20) * FONT_WIDTH * FONT_HEIGHT];
|
uint8_t * ptr = (uint8_t *)&font10pt[(c - 0x20) * FONT_WIDTH * FONT_HEIGHT];
|
||||||
@ -228,17 +205,9 @@ void DiskSelector::DrawCharacter(SDL_Renderer * renderer, int x, int y, uint8_t
|
|||||||
|
|
||||||
SDL_UpdateTexture(charStamp, NULL, stamp, FONT_WIDTH * sizeof(Uint32));
|
SDL_UpdateTexture(charStamp, NULL, stamp, FONT_WIDTH * sizeof(Uint32));
|
||||||
SDL_RenderCopy(renderer, charStamp, NULL, &dst);
|
SDL_RenderCopy(renderer, charStamp, NULL, &dst);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
void DiskSelector::()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void DiskSelector::ShowWindow(int drive)
|
void DiskSelector::ShowWindow(int drive)
|
||||||
{
|
{
|
||||||
entered = false;
|
entered = false;
|
||||||
@ -259,7 +228,6 @@ void DiskSelector::MouseDown(int32_t x, int32_t y, uint32_t buttons)
|
|||||||
{
|
{
|
||||||
char buffer[2048];
|
char buffer[2048];
|
||||||
sprintf(buffer, "%s/%s", settings.disksPath, &imageList[diskSelected][0]);
|
sprintf(buffer, "%s/%s", settings.disksPath, &imageList[diskSelected][0]);
|
||||||
// floppyDrive.LoadImage(&imageList[diskSelected][0], driveNumber);
|
|
||||||
floppyDrive.LoadImage(buffer, driveNumber);
|
floppyDrive.LoadImage(buffer, driveNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,11 +261,8 @@ void DiskSelector::MouseMove(int32_t x, int32_t y, uint32_t buttons)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevDiskSelected = diskSelected;
|
|
||||||
int xChar = (x - DS_XPOS) / FONT_WIDTH;
|
int xChar = (x - DS_XPOS) / FONT_WIDTH;
|
||||||
int yChar = (y - DS_YPOS) / FONT_HEIGHT;
|
int yChar = (y - DS_YPOS) / FONT_HEIGHT;
|
||||||
// int currentX = (count / 27) * 22;
|
|
||||||
// int currentY = (count % 27);
|
|
||||||
diskSelected = ((xChar / 22) * 27) + yChar;
|
diskSelected = ((xChar / 22) * 27) + yChar;
|
||||||
|
|
||||||
if ((yChar >= 27) || (diskSelected >= (int)imageList.size()))
|
if ((yChar >= 27) || (diskSelected >= (int)imageList.size()))
|
||||||
@ -313,9 +278,6 @@ void DiskSelector::MouseMove(int32_t x, int32_t y, uint32_t buttons)
|
|||||||
|
|
||||||
void DiskSelector::HandleSelection(SDL_Renderer * renderer)
|
void DiskSelector::HandleSelection(SDL_Renderer * renderer)
|
||||||
{
|
{
|
||||||
// if (diskSelected == prevDiskSelected)
|
|
||||||
// return;
|
|
||||||
|
|
||||||
SDL_UpdateTexture(window, NULL, windowPixels, 128 * sizeof(Uint32));
|
SDL_UpdateTexture(window, NULL, windowPixels, 128 * sizeof(Uint32));
|
||||||
DrawFilenames(renderer);
|
DrawFilenames(renderer);
|
||||||
}
|
}
|
||||||
@ -326,12 +288,7 @@ void DiskSelector::Render(SDL_Renderer * renderer)
|
|||||||
if (!(window && showWindow))
|
if (!(window && showWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// HandleSelection(renderer);
|
SDL_Rect dst = { DS_XPOS, DS_YPOS, DS_WIDTH, DS_HEIGHT };
|
||||||
|
|
||||||
SDL_Rect dst;
|
|
||||||
// dst.x = (VIRTUAL_SCREEN_WIDTH - DS_WIDTH) / 2, dst.y = (VIRTUAL_SCREEN_HEIGHT - DS_HEIGHT) / 2, dst.w = DS_WIDTH, dst.h = DS_HEIGHT;
|
|
||||||
dst.x = DS_XPOS, dst.y = DS_YPOS, dst.w = DS_WIDTH, dst.h = DS_HEIGHT;
|
|
||||||
|
|
||||||
SDL_RenderCopy(renderer, window, NULL, &dst);
|
SDL_RenderCopy(renderer, window, NULL, &dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 02/03/2006 Created this file
|
// JLH 02/03/2006 Created this file
|
||||||
// JLH 03/13/2006 Added functions to allow shutting down GUI externally
|
// JLH 03/13/2006 Added functions to allow shutting down GUI externally
|
||||||
// JLH 03/22/2006 Finalized basic multiple window support
|
// JLH 03/22/2006 Finalized basic multiple window support
|
||||||
@ -430,7 +430,6 @@ void GUI::DrawEjectButton(SDL_Renderer * renderer, int driveNumber)
|
|||||||
|| (driveNumber == 1 && disk2EjectHovered))
|
|| (driveNumber == 1 && disk2EjectHovered))
|
||||||
r = 0x20, g = 0xFF, b = 0x20;
|
r = 0x20, g = 0xFF, b = 0x20;
|
||||||
|
|
||||||
// DrawCharArray(renderer, ejectIcon, 29, 31, 8, 7, 0x00, 0xAA, 0x00);
|
|
||||||
DrawCharArray(renderer, ejectIcon, 29, 31, 8, 7, r, g, b);
|
DrawCharArray(renderer, ejectIcon, 29, 31, 8, 7, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 01/03/2006 Moved includes out of header file for faster compilation
|
// JLH 01/03/2006 Moved includes out of header file for faster compilation
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 09/27/2013 Created this file
|
// JLH 09/27/2013 Created this file
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 01/04/2006 Added changelog ;-)
|
// JLH 01/04/2006 Added changelog ;-)
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -98,10 +98,8 @@ void LoadSettings(void)
|
|||||||
settings.p2KeyBindings[19] = sdlemu_getval_int("p2k_pound", SDL_SCANCODE_KP_DIVIDE);
|
settings.p2KeyBindings[19] = sdlemu_getval_int("p2k_pound", SDL_SCANCODE_KP_DIVIDE);
|
||||||
settings.p2KeyBindings[20] = sdlemu_getval_int("p2k_star", SDL_SCANCODE_KP_MULTIPLY);
|
settings.p2KeyBindings[20] = sdlemu_getval_int("p2k_star", SDL_SCANCODE_KP_MULTIPLY);
|
||||||
|
|
||||||
strcpy(settings.BIOSPath, sdlemu_getval_string("BIOSROM", "./ROMs/apple2.rom"));
|
strcpy(settings.BIOSPath, sdlemu_getval_string("BIOSROM", "./ROMs/apple2e-enhanced.rom"));
|
||||||
strcpy(settings.disksPath, sdlemu_getval_string("disks", "./disks"));
|
strcpy(settings.disksPath, sdlemu_getval_string("disks", "./disks"));
|
||||||
strcpy(settings.diskImagePath1, sdlemu_getval_string("floppyImage1", "./disks/bt1_boot.dsk"));
|
|
||||||
strcpy(settings.diskImagePath2, sdlemu_getval_string("floppyImage2", "./disks/bt1_char.dsk"));
|
|
||||||
strcpy(settings.autoStatePath, sdlemu_getval_string("autoStateFilename", "./apple2auto.state"));
|
strcpy(settings.autoStatePath, sdlemu_getval_string("autoStateFilename", "./apple2auto.state"));
|
||||||
CheckForTrailingSlash(settings.disksPath);
|
CheckForTrailingSlash(settings.disksPath);
|
||||||
}
|
}
|
||||||
|
@ -23,14 +23,14 @@
|
|||||||
struct Settings
|
struct Settings
|
||||||
{
|
{
|
||||||
bool useJoystick;
|
bool useJoystick;
|
||||||
int32_t joyport; // Joystick port
|
int32_t joyport; // Joystick port
|
||||||
bool hardwareTypeNTSC; // Set to false for PAL
|
bool hardwareTypeNTSC; // Set to false for PAL
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool useOpenGL;
|
bool useOpenGL;
|
||||||
uint32_t glFilter;
|
uint32_t glFilter;
|
||||||
uint32_t frameSkip;
|
uint32_t frameSkip;
|
||||||
uint32_t renderType;
|
uint32_t renderType;
|
||||||
bool autoStateSaving; // Auto-state loading/saving on entry/exit
|
bool autoStateSaving; // Auto-state loading/saving on entry/exit
|
||||||
|
|
||||||
// Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
|
// Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
|
||||||
|
|
||||||
@ -41,11 +41,7 @@ struct Settings
|
|||||||
|
|
||||||
char BIOSPath[MAX_PATH];
|
char BIOSPath[MAX_PATH];
|
||||||
char disksPath[MAX_PATH];
|
char disksPath[MAX_PATH];
|
||||||
char diskImagePath1[MAX_PATH];
|
|
||||||
char diskImagePath2[MAX_PATH];
|
|
||||||
char autoStatePath[MAX_PATH];
|
char autoStatePath[MAX_PATH];
|
||||||
// char CDBootPath[MAX_PATH];
|
|
||||||
// char EEPROMPath[MAX_PATH];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Render types
|
// Render types
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 12/02/2005 Fixed a problem with sound callback thread signaling the
|
// JLH 12/02/2005 Fixed a problem with sound callback thread signaling the
|
||||||
// main thread
|
// main thread
|
||||||
// JLH 12/03/2005 Fixed sound callback dropping samples when the sample buffer
|
// JLH 12/03/2005 Fixed sound callback dropping samples when the sample
|
||||||
// is shorter than the callback sample buffer
|
// buffer is shorter than the callback sample buffer
|
||||||
//
|
//
|
||||||
|
|
||||||
// STILL TO DO:
|
// STILL TO DO:
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// JLH = James L. Hammons <jlhamm@acm.org>
|
// JLH = James L. Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 01/04/2006 Cosmetic changes (like this one ;-)
|
// JLH 01/04/2006 Cosmetic changes (like this one ;-)
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -7,15 +7,16 @@
|
|||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 01/04/2006 Added changelog ;-)
|
// JLH 01/04/2006 Added changelog ;-)
|
||||||
// JLH 01/18/2009 Fixed EA_ABS_* macros
|
// JLH 01/18/2009 Fixed EA_ABS_* macros
|
||||||
//
|
//
|
||||||
|
|
||||||
//OK, the wraparound bug exists in both the Apple and Atari versions of Ultima II.
|
//OK, the wraparound bug exists in both the Apple and Atari versions of Ultima
|
||||||
//However, the Atari version *does* occassionally pick strength while the Apple
|
//II. However, the Atari version *does* occassionally pick strength while the
|
||||||
//versions do not--which would seem to indicate a bug either in the RNG algorithm,
|
//Apple versions do not--which would seem to indicate a bug either in the RNG
|
||||||
//the 65C02 core, or the Apple hardware. Need to investigate all three!
|
//algorithm, the 65C02 core, or the Apple hardware. Need to investigate all
|
||||||
|
//three!
|
||||||
|
|
||||||
#define __DEBUG__
|
#define __DEBUG__
|
||||||
//#define __DEBUGMON__
|
//#define __DEBUGMON__
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
//
|
//
|
||||||
// VIDEO.CPP: SDL/local hardware specific video routines
|
// VIDEO.CPP: SDL2/local hardware specific video routines
|
||||||
//
|
//
|
||||||
// by James Hammons
|
// by James Hammons
|
||||||
//
|
//
|
||||||
// JLH = James Hammons <jlhamm@acm.org>
|
// JLH = James Hammons <jlhamm@acm.org>
|
||||||
//
|
//
|
||||||
// WHO WHEN WHAT
|
// WHO WHEN WHAT
|
||||||
// --- ---------- ------------------------------------------------------------
|
// --- ---------- -----------------------------------------------------------
|
||||||
// JLH 01/04/2006 Added changelog ;-)
|
// JLH 01/04/2006 Added changelog ;-)
|
||||||
// JLH 01/20/2006 Cut out unnecessary buffering
|
// JLH 01/20/2006 Cut out unnecessary buffering
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include <string.h> // Why??? (for memset, etc... Lazy!) Dunno why, but this just strikes me as wrong...
|
#include <string.h> // (for memset, etc... Lazy!)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
//#include "gui/gui.h"
|
|
||||||
#include "apple2-icon-64x64.h"
|
#include "apple2-icon-64x64.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
|
|
||||||
// Exported global variables (actually, these are LOCAL global variables, EXPORTED...)
|
// Local vars
|
||||||
|
|
||||||
static SDL_Window * sdlWindow = NULL;
|
static SDL_Window * sdlWindow = NULL;
|
||||||
SDL_Renderer * sdlRenderer = NULL;
|
|
||||||
static SDL_Texture * sdlTexture = NULL;
|
static SDL_Texture * sdlTexture = NULL;
|
||||||
|
|
||||||
|
// Exported vars
|
||||||
|
SDL_Renderer * sdlRenderer = NULL;
|
||||||
uint32_t scrBuffer[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT * sizeof(uint32_t)];
|
uint32_t scrBuffer[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT * sizeof(uint32_t)];
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user