diff --git a/include/apple2.draw.h b/include/apple2.draw.h index 0c6b1c1..ee2df6d 100644 --- a/include/apple2.draw.h +++ b/include/apple2.draw.h @@ -6,6 +6,7 @@ extern void apple2_draw(apple2 *); extern void apple2_draw_40col(apple2 *); +extern void apple2_draw_hires(apple2 *); extern void apple2_draw_lores(apple2 *); extern void apple2_draw_pixel(apple2 *, vm_16bit); diff --git a/include/apple2.hires.h b/include/apple2.hires.h new file mode 100644 index 0000000..4f2efa1 --- /dev/null +++ b/include/apple2.hires.h @@ -0,0 +1,8 @@ +#ifndef _APPLE2_HIRES_H_ +#define _APPLE2_HIRES_H_ + +#include "apple2.h" + +extern void apple2_hires_draw(apple2 *, size_t); + +#endif diff --git a/sources.cmake b/sources.cmake index 3edb7f9..3bc9a3e 100644 --- a/sources.cmake +++ b/sources.cmake @@ -6,6 +6,7 @@ set(erc_sources apple2.dec.c apple2.draw.c apple2.enc.c + apple2.hires.c apple2.kb.c apple2.lores.c apple2.mem.c diff --git a/src/apple2.draw.c b/src/apple2.draw.c index 8184231..a182a19 100644 --- a/src/apple2.draw.c +++ b/src/apple2.draw.c @@ -7,6 +7,7 @@ */ #include "apple2.h" +#include "apple2.hires.h" #include "apple2.lores.h" #include "apple2.text.h" @@ -96,6 +97,21 @@ apple2_draw_lores(apple2 *mach) } } +/* + * Draw high-resolution graphics on the screen + */ +void +apple2_draw_hires(apple2 *mach) +{ + size_t addr; + + vm_screen_prepare(mach->screen); + + for (addr = 0x2000; addr < 0x4000; addr++) { + apple2_hires_draw(mach, addr); + } +} + /* * Find the right draw method for the machine, based on its display * mode, and use that to refresh the screen. @@ -106,7 +122,11 @@ apple2_draw(apple2 *mach) if (mach->display_mode & DISPLAY_TEXT) { apple2_draw_40col(mach); return; + } else if (mach->memory_mode & MEMORY_HIRES) { + apple2_draw_hires(mach); + return; } + // The fallback mode is to draw lores graphics apple2_draw_lores(mach); } diff --git a/src/apple2.hires.c b/src/apple2.hires.c new file mode 100644 index 0000000..464fab6 --- /dev/null +++ b/src/apple2.hires.c @@ -0,0 +1,24 @@ +/* + * apple2.hires.c + * + * High resolution graphics in Apple are a significant change from its + * low-resolution graphics. Where one byte can hold the color data for + * two onscreen cells in lores graphics, in hires, each _bit_ + * corresponds to a pixel. The colors you can show depend on the pattern + * of high and low bits within a given data byte. Certain rows have + * black, purple, or blue available; alternating rows can be black, + * green, or orange. + * + * Some of this has to do with the space constraints available to the + * Apple II: the hires graphics buffer is held between $2000 and $3FFF, + * which is only 8k RAM. Some of this has to do with the peculiarities + * of the NTSC format, because the Apple II was designed to work with + * standard television screens. + */ + +#include "apple2.hires.h" + +void +apple2_hires_draw(apple2 *mach, size_t addr) +{ +} diff --git a/tests/apple2.hires.c b/tests/apple2.hires.c new file mode 100644 index 0000000..a869cef --- /dev/null +++ b/tests/apple2.hires.c @@ -0,0 +1,10 @@ +#include + +#include "apple2.hires.h" +#include "apple2.tests.h" + +TestSuite(apple2_hires, .init = setup, .fini = teardown); + +Test(apple2_hires, draw) +{ +}