mirror of
https://github.com/bradgrantham/apple2e.git
synced 2025-01-13 22:30:18 +00:00
fix regular mode changes, disable prints
This commit is contained in:
parent
0cdabd22ad
commit
eaffc29115
14
apple2e.cpp
14
apple2e.cpp
@ -880,28 +880,28 @@ struct MAINboard : board_base
|
||||
if(TEXT || !HIRES || (MIXED && mixed_text_scanout)) {
|
||||
// TEXT or GR mode; they read the same addresses.
|
||||
int addr2 = get_text_scanout_address(byte_in_frame) + (page1 ? 0 : 0x0400);
|
||||
printf("got text scanout address $%04X\n", addr2);
|
||||
if(0)printf("got text scanout address $%04X\n", addr2);
|
||||
if(addr2 > 0xC00) {
|
||||
printf("read 0C00 floating bus\n");
|
||||
if(0)printf("read 0C00 floating bus\n");
|
||||
ram_0C00.read(addr2, result);
|
||||
} else {
|
||||
if(page1) {
|
||||
printf("read text page1 floating bus\n");
|
||||
if(0)printf("read text page1 floating bus\n");
|
||||
text_page1.read(addr2, result);
|
||||
} else {
|
||||
printf("read text page2 floating bus\n");
|
||||
if(0)printf("read text page2 floating bus\n");
|
||||
text_page2.read(addr2, result);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// HGR mode and not in text region if MIXED
|
||||
int addr2 = get_hires_scanout_address(byte_in_frame) + (page1 ? 0 : 0x2000);
|
||||
printf("got hires scanout address $%04X\n", addr2);
|
||||
if(0)printf("got hires scanout address $%04X\n", addr2);
|
||||
if(page1) {
|
||||
printf("read hires page1 floating bus\n");
|
||||
if(0)printf("read hires page1 floating bus\n");
|
||||
hires_page1.read(addr2, result);
|
||||
} else {
|
||||
printf("read hires page2 floating bus\n");
|
||||
if(0)printf("read hires page2 floating bus\n");
|
||||
hires_page2.read(addr2, result);
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,7 @@ bool force_caps_on = true;
|
||||
bool draw_using_color = false;
|
||||
|
||||
ModeSettings line_to_mode[192];
|
||||
ModePoint most_recent_modepoint;
|
||||
vertex_array line_to_area[192];
|
||||
|
||||
bool event_waiting()
|
||||
@ -1874,6 +1875,7 @@ void start(bool run_fast, bool add_floppies, bool floppy0_inserted, bool floppy1
|
||||
{
|
||||
for(int i = 0; i < 192; i++)
|
||||
line_to_mode[i] = ModeSettings(TEXT, false, 1, false, false);
|
||||
most_recent_modepoint = make_tuple(0, ModeSettings(TEXT, false, 1, false, false));
|
||||
|
||||
aodev = open_ao();
|
||||
if(aodev == NULL)
|
||||
@ -1930,41 +1932,47 @@ void apply_writes(void);
|
||||
// Someone could probably optimize this so that every line is only touched once, but it's also likely
|
||||
// that this function will be called every 16ms of simulation time and so will only contain a couple
|
||||
// of frames worth of mode changes anyway.
|
||||
void map_modes_to_lines(const ModeHistory& history, unsigned long long current_byte)
|
||||
void map_mode_to_lines(const ModePoint& p, unsigned long long to_byte)
|
||||
{
|
||||
for(size_t i = 0; i < history.size(); i++) {
|
||||
auto& h = history[i];
|
||||
unsigned int byte = get<0>(p);
|
||||
const ModeSettings& settings = get<1>(p);
|
||||
int line = (byte + 17029) / 65;
|
||||
|
||||
unsigned int byte = get<0>(h);
|
||||
const ModeSettings& settings = get<1>(h);
|
||||
int line = (byte + 17029) / 65;
|
||||
int to_line = (to_byte + 17029) / 65;
|
||||
|
||||
int next_line;
|
||||
if(i < history.size() - 1) {
|
||||
auto& h2 = history[i + 1];
|
||||
unsigned int byte2 = get<0>(h2);
|
||||
next_line = (byte2 + 17029) / 65;
|
||||
} else {
|
||||
next_line = (current_byte + 17029) / 65;
|
||||
}
|
||||
|
||||
for(int l = line; l < next_line; l++) {
|
||||
int line_in_frame = l % 262;
|
||||
if(0)printf("line %d : mode %s\n", line_in_frame, (settings.mode == APPLE2Einterface::TEXT) ? "TEXT" : ((settings.mode == APPLE2Einterface::LORES) ? "LORES" : "HIRES"));
|
||||
if(line_in_frame < 192)
|
||||
line_to_mode[line_in_frame] = settings;
|
||||
}
|
||||
|
||||
if(0)printf("%u, TEXT %s, HIRES %s, MIXED %s, line_in_frame = %d\n",
|
||||
byte % 17030,
|
||||
(settings.mode == TEXT) ? "true" : "false",
|
||||
(settings.mode == HIRES) ? "true" : "false",
|
||||
settings.mixed ? "true" : "false",
|
||||
line % 262);
|
||||
for(int l = line; l < to_line; l++) {
|
||||
int line_in_frame = l % 262;
|
||||
if(0)printf("to_byte %llu, line %d : mode %s\n", to_byte, line_in_frame, (settings.mode == APPLE2Einterface::TEXT) ? "TEXT" : ((settings.mode == APPLE2Einterface::LORES) ? "LORES" : "HIRES"));
|
||||
if(line_in_frame < 192)
|
||||
line_to_mode[line_in_frame] = settings;
|
||||
}
|
||||
}
|
||||
|
||||
void iterate(const ModeHistory& history, unsigned long long current_byte_in_frame)
|
||||
// All the "lines" in this function are from the beginning of time, to properly set the mode for
|
||||
// scanlines as they are scanned out and persisted. E.g. frame N, line 191 through frame N+2, line 0
|
||||
// should actually set the entire frame to the provided display mode. I'm being lazy at the moment
|
||||
// and just touching every line the first history record touches through the next.
|
||||
// Someone could probably optimize this so that every line is only touched once, but it's also likely
|
||||
// that this function will be called every 16ms of simulation time and so will only contain a couple
|
||||
// of frames worth of mode changes anyway.
|
||||
void map_history_to_lines(const ModeHistory& history, unsigned long long current_byte)
|
||||
{
|
||||
for(size_t i = 0; (i + 1) < history.size(); i++) {
|
||||
auto& current = history[i];
|
||||
auto& next = history[i + 1];
|
||||
|
||||
unsigned int byte2 = get<0>(next);
|
||||
|
||||
map_mode_to_lines(current, byte2);
|
||||
}
|
||||
|
||||
if(!history.empty())
|
||||
most_recent_modepoint = history[history.size() - 1];
|
||||
|
||||
map_mode_to_lines(most_recent_modepoint, current_byte);
|
||||
}
|
||||
|
||||
void iterate(const ModeHistory& history, unsigned long long current_byte)
|
||||
{
|
||||
apply_writes();
|
||||
|
||||
@ -1973,7 +1981,7 @@ void iterate(const ModeHistory& history, unsigned long long current_byte_in_fram
|
||||
event_queue.push_back({QUIT, 0});
|
||||
}
|
||||
|
||||
map_modes_to_lines(history, current_byte_in_frame);
|
||||
map_history_to_lines(history, current_byte);
|
||||
|
||||
CheckOpenGL(__FILE__, __LINE__);
|
||||
redraw(my_window);
|
||||
|
@ -77,7 +77,8 @@ struct ModeSettings
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<std::tuple<unsigned long long, ModeSettings> > ModeHistory;
|
||||
typedef std::tuple<unsigned long long, ModeSettings> ModePoint;
|
||||
typedef std::vector<ModePoint> ModeHistory;
|
||||
|
||||
bool write(int addr, bool aux, unsigned char data);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user