diff --git a/README.md b/README.md index 7fa4146..6799b53 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ while(1) { ### Building the source code -To link the library, simply `#include` the `.h` files +To link the library, simply `#include` the `tms9918.h` file from the `lib/` directory in your C source files. Compile your sources with the KickC compiler, the `tools/` diff --git a/demo/demo.c b/demo/demo.c index d23e5b4..b80f392 100644 --- a/demo/demo.c +++ b/demo/demo.c @@ -1,10 +1,4 @@ -#include "../lib/utils.h" -#include "../lib/apple1.h" #include "../lib/tms9918.h" -#include "../lib/font8x8.h" -#include "../lib/tms_screen1.h" -#include "../lib/tms_screen2.h" -#include "../lib/interrupt.h" #include "demo_screen1.h" #include "demo_screen2.h" diff --git a/lib/tms9918.h b/lib/tms9918.h index c3c1d23..99cf9c1 100644 --- a/lib/tms9918.h +++ b/lib/tms9918.h @@ -5,11 +5,12 @@ // TODO do fonts need to start from 32 or 0? // TODO sprite routines // TODO test the interrupt routines -// TODO provide a single .h file (tms_lib.h or tms9918.h?) // TODO finalize hexdump.js and update README.md #pragma encoding(ascii) // encode strings in plain ascii +#include "utils.h" + #ifdef APPLE1 const byte *VDP_DATA = 0xCC00; // TMS9918 data port (VRAM) const byte *VDP_REG = 0xCC01; // TMS9918 register port (write) or status (read) @@ -153,3 +154,9 @@ void tms_set_external_video(byte val) { if(val) regvalue |= REG0_EXTVID_MASK; tms_write_reg(0, regvalue); } + +#include "apple1.h" +#include "font8x8.h" +#include "tms_screen1.h" +#include "tms_screen2.h" +#include "interrupt.h" diff --git a/tetris/tetris.c b/tetris/tetris.c index 262d170..cd5e781 100644 --- a/tetris/tetris.c +++ b/tetris/tetris.c @@ -25,13 +25,7 @@ // TODO solve division by counter_factor -#include "../lib/utils.h" -#include "../lib/apple1.h" #include "../lib/tms9918.h" -#include "../lib/font8x8.h" -#include "../lib/tms_screen1.h" -#include "../lib/tms_screen2.h" -#include "../lib/interrupt.h" #include "draw.h" #include "pieces.h"