1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-06-10 14:29:30 +00:00

Defensive conditionals

This commit is contained in:
Peter Evans 2018-03-26 20:46:55 -05:00
parent 81bcc7d973
commit b2e9198ede

View File

@ -10,6 +10,7 @@
#include "apple2.dbuf.h"
#include "apple2.draw.h"
#include "vm_reflect.h"
static size_t switch_reads[] = {
0xC01A,
@ -58,11 +59,12 @@ SEGMENT_READER(apple2_dbuf_read)
// in hires graphics page 1, then that must also use aux memory
// if _both_ the PAGE2 and HIRES bits are set.
if (addr >= 0x400 && addr < 0x800 &&
mach->memory_mode & MEMORY_PAGE2
(mach->memory_mode & MEMORY_PAGE2)
) {
segment = mach->aux;
} else if (addr >= 0x2000 && addr < 0x4000 &&
mach->memory_mode & MEMORY_PAGE2 & MEMORY_HIRES
(mach->memory_mode & MEMORY_PAGE2) &&
(mach->memory_mode & MEMORY_HIRES)
) {
segment = mach->aux;
}
@ -84,12 +86,12 @@ SEGMENT_WRITER(apple2_dbuf_write)
if (mach->memory_mode & MEMORY_80STORE) {
if (addr >= 0x400 && addr < 0x800 &&
mach->memory_mode & MEMORY_PAGE2
(mach->memory_mode & MEMORY_PAGE2)
) {
segment = mach->aux;
} else if (addr >= 0x2000 && addr < 0x4000 &&
mach->memory_mode & MEMORY_PAGE2 &&
mach->memory_mode & MEMORY_HIRES
(mach->memory_mode & MEMORY_PAGE2) &&
(mach->memory_mode & MEMORY_HIRES)
) {
segment = mach->aux;
}