diff --git a/lib/screen1.h b/lib/screen1.h index 26d933a..133e561 100644 --- a/lib/screen1.h +++ b/lib/screen1.h @@ -9,11 +9,8 @@ const word SCREEN1_SIZE = (32*24); void screen1_load_font() { byte *source = FONT; - // start writing into VRAM from space character (32..127) - tms_set_vram_write_addr(TMS_PATTERN_TABLE+(32*8)); - for(word i=768;i!=0;i--) { - TMS_WRITE_DATA_PORT(*source++); - } + // copy normal FONT 32..127 + tms_copy_to_vram(source, 768, TMS_PATTERN_TABLE+(32*8)); // reverse font (32..127) source = FONT; diff --git a/lib/tms9918.h b/lib/tms9918.h index b99321d..33ecfa3 100644 --- a/lib/tms9918.h +++ b/lib/tms9918.h @@ -164,6 +164,15 @@ inline void tms_wait_end_of_frame() { while(!FRAME_BIT(TMS_READ_CTRL_PORT)); } +// loads the font on the pattern table +void tms_copy_to_vram(byte *source, word size, word dest) { + // start writing into VRAM from space character (32..127) + tms_set_vram_write_addr(dest); + for(word i=size;i!=0;i--) { + TMS_WRITE_DATA_PORT(*source++); + } +} + #include "apple1.h" #include "font8x8.h" #include "sprites.h"