mirror of
https://github.com/bradgrantham/apple2e.git
synced 2024-06-26 02:29:36 +00:00
move to per-clock mode setting history within frame
delete set_switches() Pass history of mode settings to iterate()
This commit is contained in:
parent
114af20792
commit
55bbd69e28
14
apple2e.cpp
14
apple2e.cpp
|
@ -3006,10 +3006,14 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
mainboard->sync();
|
||||
|
||||
APPLE2Einterface::DisplayMode mode = mainboard->TEXT ? APPLE2Einterface::TEXT : (mainboard->HIRES ? APPLE2Einterface::HIRES : APPLE2Einterface::LORES);
|
||||
int page = (mainboard->PAGE2 && !mainboard->STORE80) ? 1 : 0;
|
||||
APPLE2Einterface::set_switches(mode, mainboard->MIXED, page, mainboard->VID80, mainboard->ALTCHAR);
|
||||
APPLE2Einterface::iterate();
|
||||
APPLE2Einterface::ModeSettings settings(mode, mainboard->MIXED, page, mainboard->VID80, mainboard->ALTCHAR);
|
||||
APPLE2Einterface::ModeHistory history;
|
||||
history.push_back(make_tuple(0, settings));
|
||||
APPLE2Einterface::iterate(history);
|
||||
|
||||
chrono::time_point<chrono::system_clock> now = std::chrono::system_clock::now();
|
||||
|
||||
auto elapsed_millis = chrono::duration_cast<chrono::milliseconds>(now - then);
|
||||
|
@ -3073,8 +3077,10 @@ int main(int argc, char **argv)
|
|||
|
||||
APPLE2Einterface::DisplayMode mode = mainboard->TEXT ? APPLE2Einterface::TEXT : (mainboard->HIRES ? APPLE2Einterface::HIRES : APPLE2Einterface::LORES);
|
||||
int page = (mainboard->PAGE2 && !mainboard->STORE80) ? 1 : 0;
|
||||
APPLE2Einterface::set_switches(mode, mainboard->MIXED, page, mainboard->VID80, mainboard->ALTCHAR);
|
||||
APPLE2Einterface::iterate();
|
||||
APPLE2Einterface::ModeSettings settings(mode, mainboard->MIXED, page, mainboard->VID80, mainboard->ALTCHAR);
|
||||
APPLE2Einterface::ModeHistory history;
|
||||
history.push_back(make_tuple(0, settings));
|
||||
APPLE2Einterface::iterate(history);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1927,7 +1927,7 @@ void start(bool run_fast, bool add_floppies, bool floppy0_inserted, bool floppy1
|
|||
|
||||
void apply_writes(void);
|
||||
|
||||
void iterate()
|
||||
void iterate(const ModeHistory& history)
|
||||
{
|
||||
apply_writes();
|
||||
|
||||
|
@ -1936,6 +1936,24 @@ void iterate()
|
|||
event_queue.push_back({QUIT, 0});
|
||||
}
|
||||
|
||||
for(auto& h: history) {
|
||||
unsigned int byte_in_frame = get<0>(h);
|
||||
const ModeSettings& settings = get<1>(h);
|
||||
int line_in_frame = byte_in_frame / 65;
|
||||
if(0)printf("%u, TEXT %s, HIRES %s, MIXED %s, line_in_frame = %d\n",
|
||||
byte_in_frame,
|
||||
(settings.mode == TEXT) ? "true" : "false",
|
||||
(settings.mode == HIRES) ? "true" : "false",
|
||||
settings.mixed ? "true" : "false",
|
||||
line_in_frame);
|
||||
// XXX for now just set whole frame to last mode setting
|
||||
display_mode = settings.mode;
|
||||
mixed_mode = settings.mixed;
|
||||
display_page = settings.page;
|
||||
vid80 = settings.vid80;
|
||||
altchar = settings.altchar;
|
||||
}
|
||||
|
||||
CheckOpenGL(__FILE__, __LINE__);
|
||||
redraw(my_window);
|
||||
CheckOpenGL(__FILE__, __LINE__);
|
||||
|
@ -1989,6 +2007,7 @@ void shutdown()
|
|||
glfwTerminate();
|
||||
}
|
||||
|
||||
#if 0
|
||||
void set_switches(DisplayMode mode_, bool mixed, int page, bool vid80_, bool altchar_)
|
||||
{
|
||||
display_mode = mode_;
|
||||
|
@ -2004,6 +2023,7 @@ void set_switches(DisplayMode mode_, bool mixed, int page, bool vid80_, bool alt
|
|||
altchar_warned = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static const int text_page1_base = 0x400;
|
||||
static const int text_page2_base = 0x800;
|
||||
|
|
29
interface.h
29
interface.h
|
@ -1,4 +1,5 @@
|
|||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
namespace APPLE2Einterface
|
||||
{
|
||||
|
@ -39,15 +40,29 @@ struct event {
|
|||
{}
|
||||
};
|
||||
|
||||
void start(bool run_fast, bool add_floppies, bool floppy0_inserted, bool floppy1_inserted);
|
||||
void iterate(); // display
|
||||
void shutdown();
|
||||
|
||||
bool event_waiting();
|
||||
event dequeue_event();
|
||||
|
||||
enum DisplayMode {TEXT, LORES, HIRES};
|
||||
void set_switches(DisplayMode mode, bool mixed, int page, bool vid80, bool altchar);
|
||||
|
||||
struct ModeSettings
|
||||
{
|
||||
DisplayMode mode;
|
||||
bool mixed;
|
||||
int page;
|
||||
bool vid80;
|
||||
bool altchar;
|
||||
ModeSettings(DisplayMode mode_, bool mixed_, int page_, bool vid80_, bool altchar_) :
|
||||
mode(mode_),
|
||||
mixed(mixed_),
|
||||
page(page_),
|
||||
vid80(vid80_),
|
||||
altchar(altchar_)
|
||||
{}
|
||||
};
|
||||
|
||||
typedef std::vector<std::tuple<unsigned int, ModeSettings> > ModeHistory;
|
||||
|
||||
bool write(int addr, bool aux, unsigned char data);
|
||||
|
||||
std::tuple<float,bool> get_paddle(int num);
|
||||
|
@ -56,4 +71,8 @@ void show_floppy_activity(int number, bool activity);
|
|||
|
||||
void enqueue_audio_samples(char *buf, size_t sz);
|
||||
|
||||
void start(bool run_fast, bool add_floppies, bool floppy0_inserted, bool floppy1_inserted);
|
||||
void iterate(const ModeHistory& history); // display
|
||||
void shutdown();
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user