From d4bf5da4809448addacd15e4d19760d5ce1b3d7e Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Thu, 18 Jan 2018 16:21:25 -0600 Subject: [PATCH] Draw text in 40 column mode --- include/apple2.draw.h | 1 + src/apple2.c | 1 + src/apple2.draw.c | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/include/apple2.draw.h b/include/apple2.draw.h index 91bac59..45d9b83 100644 --- a/include/apple2.draw.h +++ b/include/apple2.draw.h @@ -6,5 +6,6 @@ extern void apple2_draw_pixel(apple2 *, vm_16bit); extern void apple2_draw_text(apple2 *, vm_16bit); +extern void apple2_draw_40col(apple2 *); #endif diff --git a/src/apple2.c b/src/apple2.c index ba0292e..deb6857 100644 --- a/src/apple2.c +++ b/src/apple2.c @@ -324,6 +324,7 @@ apple2_run_loop(apple2 *mach) while (vm_screen_active(mach->screen)) { mos6502_dis_opcode(mach->cpu, stdout, mach->cpu->PC); mos6502_execute(mach->cpu); + apple2_draw_40col(mach); vm_screen_refresh(mach->screen); } } diff --git a/src/apple2.draw.c b/src/apple2.draw.c index 9d6a815..c57e38b 100644 --- a/src/apple2.draw.c +++ b/src/apple2.draw.c @@ -159,3 +159,17 @@ apple2_draw_text(apple2 *mach, vm_16bit addr) // Now show the goddamned thing vm_bitfont_render(mach->sysfont, mach->screen, &dest, ch); } + +void +apple2_draw_40col(apple2 *mach) +{ + size_t addr; + + for (addr = 0x400; addr < 0x800; addr++) { + if ((addr & 0xFF) == 0x39) { + addr += 0x40; + } + + apple2_draw_text(mach, addr); + } +}