move all demos under a folder; use #include<> syntax

This commit is contained in:
nino-porcino 2021-12-17 16:42:22 +01:00
parent 301eb433e9
commit b17a7010d0
35 changed files with 36 additions and 26 deletions

View File

@ -206,13 +206,19 @@ while(1) {
### Building the source code
To link the library, simply `#include` the `tms9918.h` file
from the `lib/` directory in your C source files.
To link the library, simply `#include` the `tms9918.h` file
in your C sources. The recommended way is to add the KickC
command line switch `-includedir=thisrepo/lib` to your
build script and then include the file with `#include <tms9918.h>`.
Compile your sources with the KickC compiler, the `tools/`
directory contains a `build.bat` script example for Windows.
The the `tools/` directory contains a simple `build.bat` script
example (for Windows) that you can customize to your needs.
There are three configurations you can target with the switches `-t target -targetdir thisrepopath/kickc` of the KickC compiler:
### Setting a machine target
There are three configurations you can target with
the switches `-t target -targetdir thisrepo/kickc`
of the KickC compiler:
- `apple1`
- `apple1_jukebox`

View File

@ -1,2 +0,0 @@
@call ..\tools\build demo

View File

@ -1,4 +1,4 @@
#include "../lib/tms9918.h"
#include <tms9918.h>
#include "demo_screen1.h"
#include "demo_screen2.h"

2
demos/demo/m.bat Normal file
View File

@ -0,0 +1,2 @@
@call ..\..\tools\build demo

2
demos/picshow/m.bat Normal file
View File

@ -0,0 +1,2 @@
@call ..\..\tools\build picshow

View File

@ -1,7 +1,7 @@
// image converted with: Convert9918 - A simple image converter for the TMS9918A
// http://harmlesslion.com
#include "../lib/tms9918.h"
#include <tms9918.h>
#pragma data_seg(Code)
#include "pic_c.h"
@ -20,18 +20,18 @@ void main() {
tms_init_regs(SCREEN2_TABLE);
screen2_init_bitmap(FG_BG(COLOR_WHITE,COLOR_BLACK));
// bulk copy color table to VRAM
tms_set_vram_write_addr(TMS_COLOR_TABLE);
for(word t=0; t<sizeof(pic_c); t++) {
TMS_WRITE_DATA_PORT(pic_c[t]);
}
// bulk copy pattern table to VRAM
tms_set_vram_write_addr(TMS_PATTERN_TABLE);
for(word t=0; t<sizeof(pic_p); t++) {
TMS_WRITE_DATA_PORT(pic_p[t]);
}
// bulk copy color table to VRAM
tms_set_vram_write_addr(TMS_COLOR_TABLE);
for(word t=0; t<sizeof(pic_c); t++) {
TMS_WRITE_DATA_PORT(pic_c[t]);
}
// bye
while(apple1_getkey()!=CHR_RETURN);
woz_puts("BYE!\r");

View File

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View File

Before

Width:  |  Height:  |  Size: 416 KiB

After

Width:  |  Height:  |  Size: 416 KiB

2
demos/tetris/m.bat Normal file
View File

@ -0,0 +1,2 @@
@rem === BUILD TETRIS ===
call ..\..\tools\build tetris

View File

@ -25,7 +25,7 @@
// TODO solve division by counter_factor
#include "../lib/tms9918.h"
#include <tms9918.h>
#include "draw.h"
#include "pieces.h"

View File

@ -7,7 +7,8 @@
"emulator": "x64sc",
"defines": {
"__APPLE1__": 1,
"APPLE1": 1
"APPLE1": 1,
"__KICKC__": 1
}
}

View File

@ -8,7 +8,8 @@
"defines": {
"__APPLE1__": 1,
"APPLE1": 1,
"APPLE1_JUKEBOX": 1
"APPLE1_JUKEBOX": 1,
"__KICKC__": 1
}
}

View File

@ -8,6 +8,7 @@
"emulator": "xvic",
"defines": {
"__VIC20__": 1,
"VIC20": 1
"VIC20": 1,
"__KICKC__": 1
}
}

View File

@ -1,2 +0,0 @@
@call ..\tools\build picshow

View File

@ -1,2 +0,0 @@
@rem === BUILD TETRIS ===
call ..\tools\build tetris

View File

@ -1,16 +1,17 @@
@rem === BUILD SCRIPT ===
@SET TARGET=%1
@SET TMS9918=..\..
@echo ======================== VIC20 ===================================================
call kickc -targetdir ..\kickc\ -t VIC20_8K %TARGET%.c -o out\%TARGET%_vic20.prg -e
call kickc -includedir %TMS9918%\lib -targetdir %TMS9918%\kickc\ -t VIC20_8K %TARGET%.c -o out\%TARGET%_vic20.prg -e
copy out\%TARGET%.prg out\%TARGET%_vic20.prg
@echo ======================== APPLE 1 =================================================
call kickc -targetdir ..\kickc\ -t apple1_jukebox %TARGET%.c -o out\%TARGET%_apple1.prg -e
call kickc -includedir %TMS9918%\lib -targetdir %TMS9918%\kickc\ -t apple1_jukebox %TARGET%.c -o out\%TARGET%_apple1.prg -e
@rem builds the apple1 eprom file
call node ..\tools\mkeprom out out\%TARGET%_apple1.bin
call node %TMS9918%\tools\mkeprom out out\%TARGET%_apple1.bin
@rem clean up files
@del out\apple1_codeseg.bin