diff --git a/include/apple2.h b/include/apple2.h index e287b3d..ed387f7 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -3,6 +3,7 @@ #include "apple2.dd.h" #include "mos6502.h" +#include "vm_bitfont.h" #include "vm_screen.h" enum video_modes { @@ -39,6 +40,12 @@ typedef struct { */ vm_screen *screen; + /* + * This is the system font (the only font the Apple II knows about, + * really); anywhere we render text, we have to use this font. + */ + vm_bitfont *sysfont; + /* * This is the mode in which we must interpret graphics. This will * tell us not only if we're in lo- or hi-res, but also if we are in @@ -68,6 +75,7 @@ extern void apple2_clear_strobe(apple2 *); extern void apple2_release_key(apple2 *); extern int apple2_boot(apple2 *); extern void apple2_run_loop(apple2 *); +extern void apple2_set_color(apple2 *, int); extern void apple2_set_video(apple2 *, int); #endif diff --git a/src/apple2.c b/src/apple2.c index d99cb54..1e8c72d 100644 --- a/src/apple2.c +++ b/src/apple2.c @@ -64,6 +64,16 @@ apple2_create(int width, int height) // We default to lo-res mode. apple2_set_video(mach, VIDEO_LORES); + // Let's install our bitmap font. + mach->sysfont = vm_bitfont_create(mach->screen, + "apple2-system", + 7, 8, // 7 pixels wide, 8 pixels tall + 0x7f); // 7-bit values only + if (mach->sysfont == NULL) { + log_critical("Could not initialize apple2: bad font"); + return NULL; + } + return mach; } @@ -80,8 +90,6 @@ void apple2_run_loop(apple2 *mach) { while (vm_screen_active(mach->screen)) { - vm_screen_set_color(mach->screen, 255, 0, 0, 255); - vm_screen_draw_rect(mach->screen, 50, 50, 20, 20); vm_screen_refresh(mach->screen); } } diff --git a/src/apple2.draw.c b/src/apple2.draw.c index 379b060..53f9346 100644 --- a/src/apple2.draw.c +++ b/src/apple2.draw.c @@ -10,4 +10,7 @@ apple2_draw_pixel(apple2 *mach, vm_16bit addr) void apple2_draw_text(apple2 *mach, vm_16bit addr) { + // Drawing text is a two-step process; first you need to wipe out + // the block on the screen at that point. Then you need to draw the + // text in over that. }