Skip to content

Commit

Permalink
Q-TRIS bitstream, updated README.md, english version of Tic-Tac-Toe demo
Browse files Browse the repository at this point in the history
  • Loading branch information
sy2002 committed Dec 26, 2016
1 parent 369f495 commit 38870a1
Show file tree
Hide file tree
Showing 5 changed files with 1,017 additions and 930 deletions.
27 changes: 23 additions & 4 deletions README.md
Expand Up @@ -179,8 +179,9 @@ app within the Monitor environment:
cd demos
../assembler/asm q-tris.asm
```
Transfer it via your terminal program using Monitor's `M L` command sequence
and start Q-TRIS using `C R` and the address `8000`.
Transfer the resulting `q-tris.out` via your terminal program using
Monitor's `M L` command sequence and start Q-TRIS using `C R` and the
address `8000`.

Programming in Assembler
------------------------
Expand Down Expand Up @@ -267,15 +268,33 @@ you are getting started:

* **Important hint**: You either need to run `source setenv.source` each time
you open a new terminal when you want to work with C - or - you need to add
the paths and the `VBCC` enviornment variable in your shell preferences,
the paths and the enviornment variables in your shell preferences,
so that they are being set automatically.

* Switch from ANSI-C to C99 using the `-c99` command line switch.

* Standard C Library: When using the `qvc` shell script, located in the
folder `c/qnice` and to which `source setenv.source` automatically sets up
a path, all the include and library paths are automatically set correctly,
so that you can just work with the Standard C Library as you would expect
it. For example, have a look at `fread_basic.c`, which shows how to read
files and some printf examples. (Make sure you run fread_basic.out while
being in the folder /qbin, because only there are the text files needed
by the program.)

* Additionally and sometimes alternatively to the Standard C Library, you
might want to use the "operating system" library aka the Monitor library.
All include and library paths are set, so just include `qmon.h` for
getting started. You find it in `c/qnice/monitor-lib/include`. The
above-mentioned `shell.c` is an example of how to read files without
using the Standard C library but by directly using Monitor functions.

Acknowledgements
----------------

* [sy2002](http://www.sy2002.de): Creator and maintainer of QNICE-FPGA:
hardware development (VHDL), FAT32 library, additional Monitor libraries and
functions, additional QNICE specific vbcc toolchain.
functions, Q-TRIS, additional QNICE specific vbcc toolchain.

* [vaxman](http://www.vaxman.de): Inventor of the [QNICE ISA](http://qnice.sourceforge.net):
system architect, assembler, emulator, Monitor and Monitor libraries, tools.
Expand Down
20 changes: 10 additions & 10 deletions c/test_programs/ttt2.c
Expand Up @@ -38,18 +38,20 @@ int bi,bj;

main()
{
putsnl("Tic-Tac-Toe for QNICE by Volker Barthelmann in September 2016\r\n");

int i,j,w,amzug,zug;
char key=0;

for(i=0;i<3;++i)
for(j=0;j<3;j++)
f[i][j]=0;

question("Darf ich anfangen (j/n)? ");
while(key!='j'&&key!='n')
question("May I begin and have the first turn (y/n)? ");
while(key!='y'&&key!='n')
key=getchar();
putkey(key);
if(key=='j') amzug=1; else amzug=0;
if(key=='y') amzug=1; else amzug=0;
puts("");

zug=0;printfield();
Expand All @@ -58,25 +60,25 @@ main()
bi=bj=4;
if(w=win()){
if(w>0){
puts("Ich habe gewonnen");
puts("I won!");
exit(0);
}else{
puts("Sie haben gewonnen, das darf nicht sein!");
puts("You won - this is impossible!");
exit(0);
}
}
zug++;
if(zug>9){
puts("Unentschieden");
puts("Nobody wins - draw!");
exit(0);
}
if(amzug){
if(zug>1) w=rek(0); else {w=0;bi=bj=1;}
f[bi][bj]=1;
if(w&&zug<9) puts("Ich werde gewinnen");
if(w&&zug<9) puts("I will win...");
}else{
while(bi<1||bi>3||bj<1||bj>3||f[bi-1][bj-1]){
question("Ihr Zug (x,y): ");
question("Your turn (x,y): ");
bj=bi=0;
while(bj<'1'||bj>'3')
bj=getchar();
Expand Down Expand Up @@ -151,5 +153,3 @@ printfield()
puts(" 1 2 3");

}


Binary file added dist_kit/q-tris.bit
Binary file not shown.

0 comments on commit 38870a1

Please sign in to comment.