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 \
|
||||
$(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)
|
||||
@echo
|
||||
@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 $@
|
||||
|
||||
#GUI compilation...
|
||||
#obj/%.o: src/gui/%.cpp
|
||||
# @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
|
||||
# @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
|
||||
obj/%.o: src/gui/%.cpp
|
||||
@echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
|
||||
@$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
|
||||
|
||||
$(TARGET)$(EXESUFFIX): $(OBJS)
|
||||
@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
|
||||
|
||||
BIOSROM = ./ROMs/apple2e-enhanced.rom
|
||||
diskROM = ./ROMs/disk.rom
|
||||
ROMs = ./ROMs
|
||||
#default
|
||||
#BIOSROM = ./ROMs/apple2e-enhanced.rom
|
||||
#Not used anymore
|
||||
#diskROM = ./ROMs/disk.rom
|
||||
#ROMs = ./ROMs
|
||||
|
||||
# Auto state loading/saving upon starting/quitting Apple2 (1 - use, 0 - don't use)
|
||||
|
||||
autoSaveState = 1
|
||||
#This is the default--we don't advertise it just yet... ;-)
|
||||
#These are the defaults--we don't advertise it just yet... ;-)
|
||||
#autoSaveState = 1
|
||||
#autoStateFilename = ./apple2auto.state
|
||||
|
||||
# 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>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 11/12/2005 Initial port to SDL
|
||||
// JLH 11/18/2005 Wired up graphic soft switches
|
||||
// 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 ram2[0x10000]; // Auxillary RAM
|
||||
//uint8_t diskRom[0x100]; // Disk ROM space
|
||||
V65C02REGS mainCPU; // v65C02 execution context
|
||||
uint8_t appleType = APPLE_TYPE_IIE;
|
||||
FloppyDrive floppyDrive;
|
||||
//bool powerOnState = true; // Virtual power switch
|
||||
bool powerStateChangeRequested = false;
|
||||
|
||||
// Local variables
|
||||
// Local variables (actually, they're global since they're not static)
|
||||
|
||||
uint8_t lastKeyPressed = 0;
|
||||
bool keyDown = false;
|
||||
|
@ -98,9 +96,8 @@ static bool fullscreenDebounce = false;
|
|||
static bool capsLock = 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 bool LoadApple2State(const char * filename);
|
||||
static void ResetApple2State(void);
|
||||
|
@ -122,10 +119,10 @@ static bool cpuFinished = false;
|
|||
// NB: Apple //e Manual sez 6502 is running @ 1,022,727 Hz
|
||||
|
||||
// Let's try a thread...
|
||||
/*
|
||||
Here's how it works: Execute 1 frame's worth, then sleep.
|
||||
Other stuff wakes it up
|
||||
*/
|
||||
//
|
||||
// Here's how it works: Execute 1 frame's worth, then sleep. Other stuff wakes
|
||||
// it up
|
||||
//
|
||||
int CPUThreadFunc(void * data)
|
||||
{
|
||||
// Mutex must be locked for conditional to work...
|
||||
|
@ -201,31 +198,13 @@ WriteLog("CPU: SDL_mutexV(cpuMutex);\n");
|
|||
#endif
|
||||
|
||||
|
||||
#if 1
|
||||
//
|
||||
// Request a change in the power state of the emulated Apple
|
||||
//
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
|
@ -375,13 +354,10 @@ static void ResetApple2State(void)
|
|||
ioudis = true;
|
||||
dhires = false;
|
||||
lcState = 0x02;
|
||||
// SwitchLC(); // Make sure MMU is in sane state
|
||||
//NOPE, does nothing SetupAddressMap();
|
||||
ResetMMUPointers();
|
||||
|
||||
// Without this, you can wedge the system :-/
|
||||
memset(ram, 0, 0x10000);
|
||||
// memset(ram2, 0, 0x10000);
|
||||
mainCPU.cpuFlags |= V65C02_ASSERT_LINE_RESET;
|
||||
}
|
||||
|
||||
|
@ -415,18 +391,12 @@ int main(int /*argc*/, char * /*argv*/[])
|
|||
mainCPU.WrMem = AppleWriteMem;
|
||||
mainCPU.cpuFlags |= V65C02_ASSERT_LINE_RESET;
|
||||
|
||||
// alternateCharset = true;
|
||||
// if (!LoadImg(settings.BIOSPath, rom + 0xD000, 0x3000))
|
||||
if (!LoadImg(settings.BIOSPath, rom + 0xC000, 0x4000))
|
||||
{
|
||||
WriteLog("Could not open file '%s'!\n", settings.BIOSPath);
|
||||
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");
|
||||
|
||||
if (!InitVideo())
|
||||
|
@ -470,23 +440,18 @@ int main(int /*argc*/, char * /*argv*/[])
|
|||
double timeToNextEvent = GetTimeToNextEvent();
|
||||
#ifndef THREADED_65C02
|
||||
Execute65C02(&mainCPU, USEC_TO_M6502_CYCLES(timeToNextEvent));
|
||||
#endif
|
||||
|
||||
#ifdef CPU_CLOCK_CHECKING
|
||||
#ifndef THREADED_65C02
|
||||
#ifdef CPU_CLOCK_CHECKING
|
||||
totalCPU += USEC_TO_M6502_CYCLES(timeToNextEvent);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
HandleNextEvent();
|
||||
}
|
||||
|
||||
#ifdef THREADED_65C02
|
||||
WriteLog("Main: cpuFinished = true;\n");
|
||||
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...
|
||||
cpuFinished = true;
|
||||
|
||||
WriteLog("Main: SDL_SemWait(mainSem);\n");
|
||||
// Only do this if NOT in power off/emulation paused mode!
|
||||
if (!pauseMode)
|
||||
|
@ -494,20 +459,17 @@ WriteLog("Main: SDL_SemWait(mainSem);\n");
|
|||
SDL_SemWait(mainSem);
|
||||
#endif
|
||||
|
||||
WriteLog("Main: SDL_CondSignal(cpuCond);//thread is probably asleep, wake it up\n");
|
||||
SDL_CondSignal(cpuCond);//thread is probably asleep, wake it up
|
||||
WriteLog("Main: SDL_CondSignal(cpuCond);\n");
|
||||
SDL_CondSignal(cpuCond);//thread is probably asleep, so wake it up
|
||||
WriteLog("Main: SDL_WaitThread(cpuThread, NULL);\n");
|
||||
SDL_WaitThread(cpuThread, NULL);
|
||||
//nowok:SDL_WaitThread(CPUThreadFunc, NULL);
|
||||
WriteLog("Main: SDL_DestroyCond(cpuCond);\n");
|
||||
SDL_DestroyCond(cpuCond);
|
||||
SDL_DestroySemaphore(mainSem);
|
||||
|
||||
// Autosave state here, if requested...
|
||||
if (settings.autoStateSaving)
|
||||
{
|
||||
// Save state here...
|
||||
SaveApple2State(settings.autoStatePath);
|
||||
}
|
||||
|
||||
floppyDrive.SaveImage(0);
|
||||
floppyDrive.SaveImage(1);
|
||||
|
@ -574,9 +536,8 @@ Z $DA $9A $DA $9A
|
|||
<- $88 $88 $88 $88
|
||||
-> $95 $95 $95 $95
|
||||
ESC $9B $9B $9B $9B No xlation
|
||||
|
||||
*/
|
||||
//static uint64_t lastCPUCycles = 0;
|
||||
|
||||
static uint32_t frameCount = 0;
|
||||
static void FrameCallback(void)
|
||||
{
|
||||
|
@ -607,15 +568,24 @@ static void FrameCallback(void)
|
|||
break;
|
||||
#endif
|
||||
case SDL_KEYDOWN:
|
||||
// Use ALT+Q to exit, as well as the usual window decoration method
|
||||
if (event.key.keysym.sym == SDLK_q && (event.key.keysym.mod & KMOD_ALT))
|
||||
// Use CTRL+SHIFT+Q to exit, as well as the usual window decoration
|
||||
// method
|
||||
if ((event.key.keysym.mod & KMOD_CTRL)
|
||||
&& (event.key.keysym.mod & KMOD_SHIFT)
|
||||
&& (event.key.keysym.sym == SDLK_q))
|
||||
{
|
||||
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+`)
|
||||
// This doesn't work...
|
||||
// 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_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 !!!
|
||||
//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
|
||||
// if (event.key.keysym.sym == SDLK_INSERT)
|
||||
if (event.key.keysym.sym == SDLK_LALT)
|
||||
openAppleDown = true;
|
||||
// if (event.key.keysym.sym == SDLK_PAGEUP)
|
||||
if (event.key.keysym.sym == SDLK_RALT)
|
||||
closedAppleDown = true;
|
||||
|
||||
|
@ -841,26 +809,28 @@ static void FrameCallback(void)
|
|||
// SpawnMessage("Image swapped...");
|
||||
}//*/
|
||||
|
||||
if (event.key.keysym.sym == SDLK_F2)// Toggle the palette
|
||||
if (event.key.keysym.sym == SDLK_F2)
|
||||
TogglePalette();
|
||||
else if (event.key.keysym.sym == SDLK_F3)// Cycle through screen types
|
||||
else if (event.key.keysym.sym == SDLK_F3)
|
||||
CycleScreenTypes();
|
||||
else if (event.key.keysym.sym == SDLK_F5)
|
||||
{
|
||||
VolumeDown();
|
||||
char volStr[19] = "[****************]";
|
||||
// volStr[GetVolume()] = 0;
|
||||
|
||||
for(int i=GetVolume(); i<16; i++)
|
||||
volStr[1 + i] = '-';
|
||||
|
||||
SpawnMessage("Volume: %s", volStr);
|
||||
}
|
||||
else if (event.key.keysym.sym == SDLK_F6)
|
||||
{
|
||||
VolumeUp();
|
||||
char volStr[19] = "[****************]";
|
||||
// volStr[GetVolume()] = 0;
|
||||
|
||||
for(int i=GetVolume(); i<16; i++)
|
||||
volStr[1 + i] = '-';
|
||||
|
||||
SpawnMessage("Volume: %s", volStr);
|
||||
}
|
||||
else if (event.key.keysym.sym == SDLK_F12)
|
||||
|
@ -889,16 +859,11 @@ static void FrameCallback(void)
|
|||
capsLockDebounce = false;
|
||||
|
||||
// Paddle buttons 0 & 1
|
||||
// if (event.key.keysym.sym == SDLK_INSERT)
|
||||
if (event.key.keysym.sym == SDLK_LALT)
|
||||
openAppleDown = false;
|
||||
// if (event.key.keysym.sym == SDLK_PAGEUP)
|
||||
if (event.key.keysym.sym == SDLK_RALT)
|
||||
closedAppleDown = false;
|
||||
|
||||
// if (event.key.keysym.sym >= SDLK_a && event.key.keysym.sym <= SDLK_z)
|
||||
// keyDown = false;
|
||||
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
GUI::MouseDown(event.motion.x, event.motion.y, event.motion.state);
|
||||
|
@ -925,7 +890,6 @@ static void FrameCallback(void)
|
|||
if (GUI::powerOnState)
|
||||
{
|
||||
pauseMode = false;
|
||||
// SoundResume();
|
||||
// Unlock the CPU thread...
|
||||
SDL_SemPost(mainSem);
|
||||
}
|
||||
|
@ -934,20 +898,14 @@ static void FrameCallback(void)
|
|||
pauseMode = true;
|
||||
// Should lock until CPU thread is waiting...
|
||||
SDL_SemWait(mainSem);
|
||||
// SoundPause();
|
||||
ResetApple2State();
|
||||
}
|
||||
|
||||
powerStateChangeRequested = false;
|
||||
}
|
||||
|
||||
//#warning "!!! Taking MAJOR time hit with the video frame rendering !!!"
|
||||
// if (!pauseMode)
|
||||
{
|
||||
RenderVideoFrame();
|
||||
}
|
||||
|
||||
RenderScreenBuffer();
|
||||
RenderVideoFrame(); // Render Apple screen to buffer
|
||||
RenderScreenBuffer(); // Render buffer to host screen
|
||||
GUI::Render(sdlRenderer);
|
||||
SDL_RenderPresent(sdlRenderer);
|
||||
SetCallbackTime(FrameCallback, 16666.66666667);
|
||||
|
@ -997,8 +955,9 @@ if (counter == 60)
|
|||
|
||||
static void BlinkTimer(void)
|
||||
{
|
||||
// Set up blinking at 1/4 sec intervals
|
||||
flash = !flash;
|
||||
SetCallbackTime(BlinkTimer, 250000); // Set up blinking at 1/4 sec intervals
|
||||
SetCallbackTime(BlinkTimer, 250000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1027,3 +986,4 @@ while (!done)
|
|||
time = 20;
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ enum { APPLE_TYPE_II, APPLE_TYPE_IIE, APPLE_TYPE_IIC };
|
|||
// Exported functions
|
||||
|
||||
void SetPowerState(void);
|
||||
bool LoadImg(char * filename, uint8_t * ram, int size);
|
||||
|
||||
// Global variables (exported)
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
// All the video modes that a real Apple 2 supports are handled here
|
||||
//
|
||||
// by James Hammons
|
||||
// (c) 2005 Underground Software
|
||||
// (c) 2005-2017 Underground Software
|
||||
//
|
||||
// JLH = James Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// 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 Fixed lo-res color TV/mono emulation modes
|
||||
|
@ -17,9 +17,9 @@
|
|||
// STILL TO DO:
|
||||
//
|
||||
// - Fix LoRes mode green mono to skip every other scanline instead of fill
|
||||
// like white mono does
|
||||
// - Double HiRes
|
||||
// - 80 column text
|
||||
// like white mono does [DONE]
|
||||
// - Double HiRes [DONE]
|
||||
// - 80 column text [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 <stdio.h>
|
||||
#include <stdarg.h> // for va_* stuff
|
||||
//#include <string> // for vsprintf()
|
||||
#include "apple2.h"
|
||||
#include "video.h"
|
||||
#include "charset.h"
|
||||
#include "video.h"
|
||||
#include "gui/font14pt.h"
|
||||
#include "gui/gui.h"
|
||||
|
||||
|
@ -70,7 +69,6 @@ bool displayPage2 = false;
|
|||
bool hiRes = false;
|
||||
bool alternateCharset = false;
|
||||
bool col80Mode = false;
|
||||
//void SpawnMessage(const char * text, ...);
|
||||
|
||||
// Local variables
|
||||
|
||||
|
@ -497,7 +495,7 @@ static void Render80ColumnTextLine(uint8_t line)
|
|||
if (x & 0x01)
|
||||
chr = ram[lineAddrLoRes[line] + (x >> 1)];
|
||||
else
|
||||
chr = ram2[lineAddrLoRes[line] + (x >> 1)];
|
||||
chr = ram2[lineAddrLoRes[line] + (x >> 1)];
|
||||
#endif
|
||||
|
||||
// Render character at (x, y)
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
// --------------------------
|
||||
// This chapter might not apply to specific portions of MAME (e.g. CPU
|
||||
// emulators) which bear different copyright notices.
|
||||
// The source code cannot be used in a commercial product without the written
|
||||
// authorization of the authors. Use in non-commercial products is allowed, and
|
||||
// indeed encouraged. If you use portions of the MAME source code in your
|
||||
// program, however, you must make the full source code freely available as
|
||||
// well.
|
||||
// Usage of the _information_ contained in the source code is free for any 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
|
||||
// freely available as well.
|
||||
// The source code cannot be used in a commercial product without the
|
||||
// written authorization of the authors. Use in non-commercial products is
|
||||
// allowed, and indeed encouraged. If you use portions of the MAME source
|
||||
// code in your program, however, you must make the full source code freely
|
||||
// available as well.
|
||||
// Usage of the _information_ contained in the source code is free for any
|
||||
// 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 freely available as well.
|
||||
//
|
||||
|
||||
// JLH: Commented out MAME specific crap
|
||||
|
@ -91,14 +91,14 @@ void _AYWriteReg(int n, int r, int v)
|
|||
PSG->Regs[r] = v;
|
||||
|
||||
/* A note about the period of tones, noise and envelope: for speed reasons, *
|
||||
* we count down from the period to 0, but careful studies of the chip *
|
||||
* output prove that it instead counts up from 0 until the counter becomes *
|
||||
* greater or equal to the period. This is an important difference when the *
|
||||
* program is rapidly changing the period to modulate the sound. *
|
||||
* To compensate for the difference, when the period is changed we adjust *
|
||||
* our internal counter. *
|
||||
* Also, note that period = 0 is the same as period = 1. This is mentioned *
|
||||
* in the YM2203 data sheets. However, this does NOT apply to the Envelope *
|
||||
* we count down from the period to 0, but careful studies of the chip *
|
||||
* output prove that it instead counts up from 0 until the counter becomes *
|
||||
* greater or equal to the period. This is an important difference when the *
|
||||
* program is rapidly changing the period to modulate the sound. *
|
||||
* To compensate for the difference, when the period is changed we adjust *
|
||||
* our internal counter. *
|
||||
* Also, note that period = 0 is the same as period = 1. This is mentioned *
|
||||
* in the YM2203 data sheets. However, this does NOT apply to the Envelope *
|
||||
* period. In that case, period = 0 is half as period = 1. */
|
||||
switch (r)
|
||||
{
|
||||
|
|
1154
src/charset.cpp
1154
src/charset.cpp
File diff suppressed because it is too large
Load Diff
|
@ -113,6 +113,7 @@ int Decode65C02(char * outbuf, uint16_t pc)
|
|||
char buf[32], buf2[32];
|
||||
|
||||
uint16_t addr = pc;
|
||||
uint16_t w;
|
||||
uint8_t opcode = mainCPU.RdMem(addr++); // Get the opcode
|
||||
|
||||
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++));
|
||||
break;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
case 13: // Relative
|
||||
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>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 12/03/2005 Created this file
|
||||
// JLH 12/15/2005 Fixed nybblization functions to work properly
|
||||
// JLH 12/27/2005 Added blank disk creation, fixed saving to work properly
|
||||
|
@ -21,8 +21,6 @@
|
|||
#include "log.h"
|
||||
#include "applevideo.h" // For message spawning... Though there's probably a better approach than this!
|
||||
|
||||
//using namespace std;
|
||||
|
||||
// Useful enums
|
||||
|
||||
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*/)
|
||||
{
|
||||
// Probably want to save a dirty image... ;-)
|
||||
SaveImage(driveNum);
|
||||
// Sanity check
|
||||
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])
|
||||
delete[] disk[driveNum];
|
||||
|
@ -717,14 +718,15 @@ void FloppyDrive::WriteLong(FILE * file, uint32_t l)
|
|||
// 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
|
||||
sectors of 256 bytes each, making 143,360 bytes in total. The PO format is exactly the same
|
||||
size as DSK and is also organized as 35 sequential tracks, but the sectors within each track
|
||||
are in a different sequence. The NIB format is a nybblized format: a more direct representation
|
||||
of the disk's data as encoded by the Apple II floppy drive hardware. NIB contains 35 tracks of
|
||||
6656 bytes each, for a total size of 232,960 bytes. Although this format is much larger, it is
|
||||
also more versatile and can represent the older 13-sector disks, many copy-protected disks, and
|
||||
other unusual encodings.
|
||||
The DSK format is a byte-for-byte image of a 16-sector Apple II floppy disk: 35
|
||||
tracks of 16 sectors of 256 bytes each, making 143,360 bytes in total. The PO
|
||||
format is exactly the same size as DSK and is also organized as 35 sequential
|
||||
tracks, but the sectors within each track are in a different sequence. The NIB
|
||||
format is a nybblized format: a more direct representation of the disk's data
|
||||
as encoded by the Apple II floppy drive hardware. NIB contains 35 tracks of
|
||||
6656 bytes each, for a total size of 232,960 bytes. Although this format is
|
||||
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)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// JLH = James Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 10/13/2013 Created this file
|
||||
//
|
||||
// STILL TO DO:
|
||||
|
@ -130,13 +130,6 @@ void DiskSelector::FindDisks(const char * path)
|
|||
|
||||
closedir(dir);
|
||||
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,
|
||||
bool invert/*=false*/)
|
||||
void DiskSelector::DrawCharacter(SDL_Renderer * renderer, int x, int y, uint8_t c, 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 pixel = 0xFFFFC000; // RRGGBBAA
|
||||
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_RenderCopy(renderer, charStamp, NULL, &dst);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void DiskSelector::()
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void DiskSelector::ShowWindow(int drive)
|
||||
{
|
||||
entered = false;
|
||||
|
@ -259,7 +228,6 @@ void DiskSelector::MouseDown(int32_t x, int32_t y, uint32_t buttons)
|
|||
{
|
||||
char buffer[2048];
|
||||
sprintf(buffer, "%s/%s", settings.disksPath, &imageList[diskSelected][0]);
|
||||
// floppyDrive.LoadImage(&imageList[diskSelected][0], driveNumber);
|
||||
floppyDrive.LoadImage(buffer, driveNumber);
|
||||
}
|
||||
|
||||
|
@ -293,11 +261,8 @@ void DiskSelector::MouseMove(int32_t x, int32_t y, uint32_t buttons)
|
|||
return;
|
||||
}
|
||||
|
||||
// prevDiskSelected = diskSelected;
|
||||
int xChar = (x - DS_XPOS) / FONT_WIDTH;
|
||||
int yChar = (y - DS_YPOS) / FONT_HEIGHT;
|
||||
// int currentX = (count / 27) * 22;
|
||||
// int currentY = (count % 27);
|
||||
diskSelected = ((xChar / 22) * 27) + yChar;
|
||||
|
||||
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)
|
||||
{
|
||||
// if (diskSelected == prevDiskSelected)
|
||||
// return;
|
||||
|
||||
SDL_UpdateTexture(window, NULL, windowPixels, 128 * sizeof(Uint32));
|
||||
DrawFilenames(renderer);
|
||||
}
|
||||
|
@ -326,12 +288,7 @@ void DiskSelector::Render(SDL_Renderer * renderer)
|
|||
if (!(window && showWindow))
|
||||
return;
|
||||
|
||||
// HandleSelection(renderer);
|
||||
|
||||
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_Rect dst = { DS_XPOS, DS_YPOS, DS_WIDTH, DS_HEIGHT };
|
||||
SDL_RenderCopy(renderer, window, NULL, &dst);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// JLH = James Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 02/03/2006 Created this file
|
||||
// JLH 03/13/2006 Added functions to allow shutting down GUI externally
|
||||
// JLH 03/22/2006 Finalized basic multiple window support
|
||||
|
@ -430,7 +430,6 @@ void GUI::DrawEjectButton(SDL_Renderer * renderer, int driveNumber)
|
|||
|| (driveNumber == 1 && disk2EjectHovered))
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// JLH = James Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 01/03/2006 Moved includes out of header file for faster compilation
|
||||
//
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// JLH = James Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 09/27/2013 Created this file
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// JLH = James Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// 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[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.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"));
|
||||
CheckForTrailingSlash(settings.disksPath);
|
||||
}
|
||||
|
|
|
@ -23,15 +23,15 @@
|
|||
struct Settings
|
||||
{
|
||||
bool useJoystick;
|
||||
int32_t joyport; // Joystick port
|
||||
bool hardwareTypeNTSC; // Set to false for PAL
|
||||
int32_t joyport; // Joystick port
|
||||
bool hardwareTypeNTSC; // Set to false for PAL
|
||||
bool fullscreen;
|
||||
bool useOpenGL;
|
||||
uint32_t glFilter;
|
||||
uint32_t frameSkip;
|
||||
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, #, *
|
||||
|
||||
uint16_t p1KeyBindings[21];
|
||||
|
@ -41,11 +41,7 @@ struct Settings
|
|||
|
||||
char BIOSPath[MAX_PATH];
|
||||
char disksPath[MAX_PATH];
|
||||
char diskImagePath1[MAX_PATH];
|
||||
char diskImagePath2[MAX_PATH];
|
||||
char autoStatePath[MAX_PATH];
|
||||
// char CDBootPath[MAX_PATH];
|
||||
// char EEPROMPath[MAX_PATH];
|
||||
};
|
||||
|
||||
// Render types
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// JLH = James Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 12/02/2005 Fixed a problem with sound callback thread signaling the
|
||||
// main thread
|
||||
// JLH 12/03/2005 Fixed sound callback dropping samples when the sample buffer
|
||||
// is shorter than the callback sample buffer
|
||||
// JLH 12/03/2005 Fixed sound callback dropping samples when the sample
|
||||
// buffer is shorter than the callback sample buffer
|
||||
//
|
||||
|
||||
// STILL TO DO:
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// JLH = James L. Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 01/04/2006 Cosmetic changes (like this one ;-)
|
||||
//
|
||||
|
||||
|
|
|
@ -7,15 +7,16 @@
|
|||
// JLH = James Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 01/04/2006 Added changelog ;-)
|
||||
// JLH 01/18/2009 Fixed EA_ABS_* macros
|
||||
//
|
||||
|
||||
//OK, the wraparound bug exists in both the Apple and Atari versions of Ultima II.
|
||||
//However, the Atari version *does* occassionally pick strength while the Apple
|
||||
//versions do not--which would seem to indicate a bug either in the RNG algorithm,
|
||||
//the 65C02 core, or the Apple hardware. Need to investigate all three!
|
||||
//OK, the wraparound bug exists in both the Apple and Atari versions of Ultima
|
||||
//II. However, the Atari version *does* occassionally pick strength while the
|
||||
//Apple versions do not--which would seem to indicate a bug either in the RNG
|
||||
//algorithm, the 65C02 core, or the Apple hardware. Need to investigate all
|
||||
//three!
|
||||
|
||||
#define __DEBUG__
|
||||
//#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
|
||||
//
|
||||
// JLH = James Hammons <jlhamm@acm.org>
|
||||
//
|
||||
// WHO WHEN WHAT
|
||||
// --- ---------- ------------------------------------------------------------
|
||||
// --- ---------- -----------------------------------------------------------
|
||||
// JLH 01/04/2006 Added changelog ;-)
|
||||
// JLH 01/20/2006 Cut out unnecessary buffering
|
||||
//
|
||||
|
||||
#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 "gui/gui.h"
|
||||
#include "apple2-icon-64x64.h"
|
||||
#include "log.h"
|
||||
#include "settings.h"
|
||||
|
||||
|
||||
// Exported global variables (actually, these are LOCAL global variables, EXPORTED...)
|
||||
|
||||
// Local vars
|
||||
static SDL_Window * sdlWindow = NULL;
|
||||
SDL_Renderer * sdlRenderer = NULL;
|
||||
static SDL_Texture * sdlTexture = NULL;
|
||||
|
||||
// Exported vars
|
||||
SDL_Renderer * sdlRenderer = NULL;
|
||||
uint32_t scrBuffer[VIRTUAL_SCREEN_WIDTH * VIRTUAL_SCREEN_HEIGHT * sizeof(uint32_t)];
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue