From 506bff555789ba323cf06f958e3e95898e3ac084 Mon Sep 17 00:00:00 2001 From: acn Date: Mon, 20 Apr 2020 16:23:56 +0200 Subject: [PATCH] FindThatMine added --- FindThatMine/README.md | 74 +++ FindThatMine/ftm.c | 766 ++++++++++++++++++++++++++ FindThatMine/ftm.com | Bin 0 -> 8704 bytes FindThatMine/gpl-3.0.txt | 674 +++++++++++++++++++++++ FindThatMine/ks.h | 398 ++++++++++++++ FindThatMine/mescc/CCOPT.COM | Bin 0 -> 19072 bytes FindThatMine/mescc/HEXTOCOM.COM | Bin 0 -> 6272 bytes FindThatMine/mescc/ZSM.COM | Bin 0 -> 12288 bytes FindThatMine/mescc/cc.com | Bin 0 -> 29056 bytes FindThatMine/mescc/conio.h | 252 +++++++++ FindThatMine/mescc/ctype.h | 203 +++++++ FindThatMine/mescc/mescc.h | 945 ++++++++++++++++++++++++++++++++ FindThatMine/mescc/sprintf.h | 104 ++++ FindThatMine/mescc/string.h | 249 +++++++++ FindThatMine/mescc/xprintf.h | 365 ++++++++++++ README.md | 1 + 16 files changed, 4031 insertions(+) create mode 100644 FindThatMine/README.md create mode 100644 FindThatMine/ftm.c create mode 100644 FindThatMine/ftm.com create mode 100644 FindThatMine/gpl-3.0.txt create mode 100644 FindThatMine/ks.h create mode 100644 FindThatMine/mescc/CCOPT.COM create mode 100644 FindThatMine/mescc/HEXTOCOM.COM create mode 100644 FindThatMine/mescc/ZSM.COM create mode 100644 FindThatMine/mescc/cc.com create mode 100644 FindThatMine/mescc/conio.h create mode 100644 FindThatMine/mescc/ctype.h create mode 100644 FindThatMine/mescc/mescc.h create mode 100644 FindThatMine/mescc/sprintf.h create mode 100644 FindThatMine/mescc/string.h create mode 100644 FindThatMine/mescc/xprintf.h diff --git a/FindThatMine/README.md b/FindThatMine/README.md new file mode 100644 index 0000000..46be2f5 --- /dev/null +++ b/FindThatMine/README.md @@ -0,0 +1,74 @@ +# Find That Mine! + +A MineSweeper clon game for CP/M + +VT100 color version by Anna Christina Naß +Based on v2.0 - 07 April 2020. + +Copyright (c) 2012-2020 Miguel Garcia / FloppySoftware, Spain. + +The original repository can be found here: +https://github.com/MiguelVis/ftm + +## Introduction + +This is a clone (yes, one more!) of MineSweeper for CP/M with supported CRTs, +derived from the plain CP/M version (and itself from the Amstrad PCW +& Samaruc GUI version). + +It should run in any version of the CP/M operating system and a Z80 CPU. + +This version is patched to work with a VT100 terminal only and it uses +color ANSI codes. + +## The game + +The aim of the game is to find all the mines on the board, putting a flag on +them and uncovering the other squares. + +If you uncover a mine, you lose the game. + +There are three different levels: +* Level 1 : 08 x 08 squares, 08 mines +* Level 2 : 08 x 12 squares, 12 mines +* Level 3 : 08 x 16 squares, 16 mines + + +## How to play + +In the board, a number on a square means the quantity of mines around it. + +To uncover a square, you must enter a command telling its position as row and column - ie: +``` +1C +``` + +To put or remove a flag on a square, you must append a F character to the command - ie: +``` +3DF +``` + +## Technical notes + +To compile, use MESCC, "Mike's Enhanced Small C Compiler". +All files neccessary (and only these) to compile the game are included. +The complete package of MESCC can be found in its repository: + +See: https://github.com/MiguelVis/mescc + +Compile it using: + + CC FTM + CCOPT FTM + ZSM FTM + HEXTOCOM FTM + +## License + +This software is copyright of Miguel Garcia / FloppySoftware, Spain. All rights +reserved. + +This program is freeware, and it's licensed under the GNU General Public License. + +See the license file for more details. + diff --git a/FindThatMine/ftm.c b/FindThatMine/ftm.c new file mode 100644 index 0000000..567b5be --- /dev/null +++ b/FindThatMine/ftm.c @@ -0,0 +1,766 @@ +/* FIND THAT MINE! + + A MineSweeper clone for CRTs and CP/M. + + Derived from the plain CP/M version. + + Copyright (c) 2012-2020 Miguel Garcia / FloppySoftware, Spain. + + VT100 color version by Anna Christina Naß + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + + To compile with MESCC: + + cc ftm + ccopt ftm + zsm ftm + hextocom ftm + + Notes: + + LEVELS: 1 2 3 NOTES + + ROWS: 8 8 8 + COLS: 8 12 16 + SQUARES: 64 96 128 ROWS * COLS + MINES: 8 12 16 SQUARES / 8 (1 MINES EACH 8 SQUARES) +*/ + +/* Do you want debug tools? +*/ +#define DEBUG_MINES 0 + +/* MESCC libraries +*/ +#include +#include +#include +#include + +/* KS library +*/ +#include "ks.h" + +/* DEFs for BOARD +*/ +#define MAX_ROWS 8 /* Max. number of rows */ +#define MAX_COLS 16 /* Max. number of columns */ +#define MAX_SQ 128 /* Max. number of squares (MAX_ROWS * MAX_COLS) */ +#define MAX_BUF 512 /* MAX_SQ * 4 */ + +/* DEFs for SPRITES +*/ +#define SPR_MINE '*' /* Mine */ +#define SPR_FLAG 'P' /* Flag */ +#define SPR_UNK '?' /* Unknown */ +#define SPR_ERR 'X' /* Flag error */ +#define SPR_BLANK ' ' /* Blank */ + +/* Global variables +*/ +int brd_rows, /* Board size in rows */ + brd_cols; /* Board size in columns */ + +WORD mines_row[MAX_ROWS], /* Map for mines */ + visib_row[MAX_ROWS], /* Map for visible squares */ + flags_row[MAX_ROWS], /* Map for squares with flag */ + count_row[MAX_ROWS]; /* Map for counters */ + +BYTE sq_buf[MAX_BUF]; /* Buffer to hold the above maps */ + +int row_off[8], /* Array to help in calculation */ + col_off[8]; /* of adjacent squares */ + +int gameover, /* NZ if game is over */ + dead, /* NZ if player is dead */ + level, /* Current level */ + viscnt, /* Number of visible squares in board */ + flgcnt, /* Number of flags in board */ + squares, /* Number of squares in board */ + mines, /* Number of mines in board */ + random; /* Random number */ + +/* Code starts here +*/ +main(argc, argv) +int argc, argv[]; /* char *argv[] - unsupported by MESCC */ +{ + int i; + int tty_n; + int *tty_s; /* char *[] */ + + /* Init KS + */ + KsHello(0); + + /* Setup + */ + Setup(); + + /* Play game + */ + Play(); + + /* The end + */ + PrStr("\n\n\tBye, bye!\n\n\n"); +} + +/* Setup program +*/ +Setup() +{ + + int i; BYTE *p; + + /* Build array to help in calculation of adjacent squares + */ + row_off[0]=-1; col_off[0]= 0; /* Up */ + row_off[1]=-1; col_off[1]=+1; /* Upper Right */ + row_off[2]= 0; col_off[2]=+1; /* Right */ + row_off[3]=+1; col_off[3]=+1; /* Lower Right */ + row_off[4]=+1; col_off[4]= 0; /* Down */ + row_off[5]=+1; col_off[5]=-1; /* Lower Left */ + row_off[6]= 0; col_off[6]=-1; /* Left */ + row_off[7]=-1; col_off[7]=-1; /* Upper Left */ + + /* Setup maps + */ + p = sq_buf; + + for(i = 0; i < MAX_ROWS; ++i) + { + mines_row[i]=p; p+=MAX_COLS; + visib_row[i]=p; p+=MAX_COLS; + flags_row[i]=p; p+=MAX_COLS; + count_row[i]=p; p+=MAX_COLS; + } + + /* Other + */ + random = 0; +} + +/* Show copyright, etc. +*/ +Copyright() +{ + int r; + char str[80]; + + KsClear(); + + sprintf(str, "%sFind %sThat %sMine%s!%s\n", FGBRED, FGBCYN, FGBBLU, FGBYEL, RESET); + KsPosCursor(r = 0, 32); + KsPutStr(str); + //KsCenterStr(r = 0, "Find That Mine!\n"); + KsCenterStr(++r , "v2.0 for CP/M & Z80\n\n"); + ++r; + KsCenterStr(++r ,"A minesweeper type game.\n"); + ++r; + KsCenterStr(++r ,"(c) 2012-2020 Miguel Garcia / Floppy Software, Spain.\n"); + KsCenterStr(++r ,"www.floppysoftware.es\n"); + KsCenterStr(++r ,"VT100 color version by acn@acn.wtf\n\n"); +} + +/* Select and play a level +*/ +Play() +{ + int run; char buf[2]; + + run = 1; + + while(run) + { + Copyright(); + + PrStr("\t1 > Level 1 : 08 x 08 squares, 08 mines\n"); + PrStr("\t2 > Level 2 : 08 x 12 squares, 12 mines\n"); + PrStr("\t3 > Level 3 : 08 x 16 squares, 16 mines\n"); + PrStr("\tQ > Quit game\n\n"); + + PrStr("\t? "); + + ReadLine(buf, 1); + + switch(*buf) + { + case '1' : SetLevel(1); RunLevel(); break; + case '2' : SetLevel(2); RunLevel(); break; + case '3' : SetLevel(3); RunLevel(); break; + case 'Q' : run = 0; break; + default : break; + } + } +} + +/* Setup level +*/ +SetLevel(lev) +int lev; +{ + /* I'm thinking... + */ + PrStr("\n\n\tI'm thinking... "); + + /* Setup level values + */ + level = lev; brd_rows = 8; + + switch(level) + { + case 1 : brd_cols = 8; break; + case 2 : brd_cols = 12; break; + case 3 : brd_cols = 16; break; + } + + squares = brd_rows * brd_cols; + + mines = squares / 8; + + gameover = dead = viscnt = flgcnt = 0; + + /* Setup board + */ + ClrBoard(); + + /* Setup counters + */ + ClrCounts(); +} + +/* Play level +*/ +RunLevel() +{ + int row, col; char buf[4]; + + for(;;) + { + ShowBoard(); + + if(gameover) { + PrStr("\tRETURN > Quit level\n\n\t? "); + ReadLine(buf, 0); + break; + } + + PrStr("\trc > Select (ie 0B)\n"); + PrStr("\trcF > Set/remove flag (ie: 3DF)\n"); + PrStr("\tQ > Quit level\n\n"); + PrStr("\t? "); + + ReadLine(buf, 3); + + if(buf[0] >= '0' && buf[0] < '0' + brd_cols) + { + row = buf[0] - '0'; + + if(buf[1] >= 'A' && buf[1] < 'A' + brd_cols) + { + col = buf[1] - 'A'; + + if(!buf[2]) + Choice(row, col); + else if(buf[2] == 'F' && !buf[3]) + ChoiceFlag(row, col); + } + } + else if(buf[0] == 'Q' && !buf[1]) + gameover = 1; + } +} + +/* Test if player has win the game +*/ +TestIfWin() +{ + + if(flgcnt == mines && flgcnt + viscnt == squares) + gameover = 1; +} + +/* Set or remove a flag in a square +*/ +ChoiceFlag(row, col) +int row, col; +{ + if(!TstVis(row, col)) + { + if(TstFlag(row, col)) + { + SetFlag(row, col, 0); --flgcnt; + } + else + { + SetFlag(row, col, 1); ++flgcnt; + + TestIfWin(); + } + } +} + +/* Select a square +*/ +Choice(row, col) +int row, col; +{ + if(!TstVis(row, col) && !TstFlag(row, col)) + { + if(TstMine(row, col)) + { + gameover = dead = 1; return; + } + + /* Make visible this square. + */ + SetVis(row, col, 1); ++viscnt; + + /* Make visible the adjacent squares, if there are not mines around. + */ + if(!GetCount(row, col)) + VisAdj(row, col); + + TestIfWin(); + } +} + +/* Get square counter +*/ +GetCount(row, col) +int row, col; +{ + BYTE *p; + + p = count_row[row]; + + return p[col]; +} + +/* Set square counter +*/ +SetCount(row, col, val) +int row, col, val; +{ + BYTE *p; + + p=count_row[row]; + + p[col]=val; +} + +/* Return 1 if there is a mine in the square, else 0 +*/ +TstMine(row, col) +int row, col; +{ + BYTE *p; + + p=mines_row[row]; + + return p[col] ? 1 : 0; +} + +/* Set/remove a mine in a square +*/ +SetMine(row, col, val) +int row, col, val; +{ + BYTE *p; + + p=mines_row[row]; + + p[col]=val; +} + +/* Return 1 if there is a flag in the square, else 0 +*/ +TstFlag(row, col) +int row, col; +{ + BYTE *p; + + p=flags_row[row]; + + return p[col] ? 1 : 0; +} + +/* Set/remove a flag in a square +*/ +SetFlag(row, col, val) +int row, col, val; +{ + BYTE *p; + + p=flags_row[row]; + + p[col]=val; +} + +/* Return 1 if it is a visible square, else 0 +*/ +TstVis(row, col) +int row, col; +{ + BYTE *p; + + p=visib_row[row]; + + return p[col] ? 1 : 0; +} + +/* Set square to visible or invisible +*/ +SetVis(row, col, val) +int row, col, val; +{ + BYTE *p; + + p=visib_row[row]; + + p[col]=val; +} + +/* Return the number of mines in adjacent squares +*/ +FindAdj(row, col) +int row, col; +{ + int mines, rn, cn, i; + + for((mines = i = 0); i < 8; ++i) + { + rn = row + row_off[i]; + cn = col + col_off[i]; + + if(rn >= 0 && rn < brd_rows && cn >= 0 && cn < brd_cols) + if(TstMine(rn, cn)) + ++mines; + } + + return mines; +} + +/* Set adjacent squares visible - recursively +*/ +VisAdj(row, col) +int row, col; +{ + int rn, cn, i; + + for(i=0; i < 8; ++i) + { + rn = row + row_off[i]; + cn = col + col_off[i]; + + if(rn >= 0 && rn < brd_rows && cn >= 0 && cn < brd_cols) + { + if(!TstVis(rn, cn) && !TstFlag(rn, cn)) + { + SetVis(rn, cn, 1); ++viscnt; + + if(!GetCount(rn, cn)) + VisAdj(rn, cn); + } + } + } +} + +/* Display board +*/ +ShowBoard() +{ + int r, c; + + KsClear(); + + PrStr("\t "); + for(c = 0; c < brd_cols; ++c) { + PrCh(' '); PrCh('A' + c); + } + PrCh('\n'); + + PrStr(FGBGRY); + PrStr("\t "); PrCh(201); + PrChTimes(205, brd_cols + brd_cols + 1); + PrCh(187); PrCh('\n'); + PrStr(RESET); + + for(r = 0; r < brd_rows; ++r) + { + PrCh('\t'); PrCh('0' + r); PrStr(FGBGRY); PrCh(186); PrStr(RESET); + + for(c = 0; c < brd_cols; ++c) + { + PrCh(' '); + + if(TstVis(r, c)) + { + if(GetCount(r, c)) { + switch(GetCount(r, c)) + { + case 1: PrStr(FGBBLU); break; + case 2: PrStr(FGGRN); break; + case 3: PrStr(FGBRED); break; + case 4: PrStr(FGBLU); break; + case 5: PrStr(FGRED); break; + default: PrStr(FGCYN); break; + } + PrCh('0' + GetCount(r, c)); + PrStr(RESET); + } + else { + PrCh(SPR_BLANK); + } + } + else if(gameover) + { + if(TstMine(r, c)) { + if(TstFlag(r, c)) { + PrStr(FGRED); PrCh(SPR_FLAG); PrStr(RESET); + } + else { + PrStr(FGRED); PrCh(SPR_MINE); PrStr(RESET); + } + } + else { + if(TstFlag(r, c)) + PrCh(SPR_ERR); + else + PrStr(FGBGRY); PrCh(SPR_UNK); PrStr(RESET); + } + } + else + { +#if DEBUG_MINES + if(TstFlag(r, c)) + PrCh(SPR_FLAG); + else if(TstMine(r, c)) + PrCh(SPR_MINE); + else + PrCh(SPR_UNK); +#else + if(TstFlag(r, c)) { + PrStr(FGRED); PrCh(SPR_FLAG); PrStr(RESET); + } + else { + PrStr(FGBGRY); PrCh(SPR_UNK); PrStr(RESET); + } +#endif + } + } + + PrCh(' '); PrStr(FGBGRY); PrCh(186); PrStr(RESET); PrCh('0' + r); + + switch(r) + { + case 0 : + PrStr(" FIND THAT MINE!"); + break; + case 2 : + if(gameover) { + PrStr(" GAME OVER"); + } + else { + PrStr(" Level: "); PrNumber(level); + } + break; + case 4 : + if(gameover) { + if(dead) { + PrStr(" YOU'RE DEAD"); + } + else if(flgcnt + viscnt == squares) { + PrStr(" YOU WIN"); + } + else { + PrStr(" SEE YOU LATER"); + } + } + else { + PrStr(" Mines: "); PrNumber(mines); + } + break; + case 6 : + if(!gameover) { + PrStr(" Flags: "); PrNumber(flgcnt); + } + break; + } + + PrCh('\n'); + } + + PrStr(FGBGRY); + PrStr("\t "); PrCh(200); + PrChTimes(205, brd_cols + brd_cols + 1); + PrCh(188); PrCh('\n'); + PrStr(RESET); + + PrStr("\t "); + for(c = 0; c < brd_cols; ++c) { + PrCh(' '); PrCh('A' + c); + } + PrCh('\n'); + + PrCh('\n'); +} + + +/* Setup board. + All squares without mines, invisibles and without flags. + Set the mines randomly. +*/ +extern char RandStr[]; + +ClrBoard() +{ + int r, c; char *p; + + /* + */ + p = RandStr + 8 * (random & 0x0F); + + for(r = 0; r < brd_rows; ++r) + { + for(c = 0; c < brd_cols; ++c) + { + /* Set square + */ + SetVis(r, c, 0); + SetFlag(r, c, 0); + SetMine(r, c, *p == '@' ? 1 : 0); + + /* Update next value + */ + if((*++p)=='$') + p = RandStr; + } + } +} + +/* Setup counters of adjacent squares +*/ +ClrCounts() +{ + int r, c; char *p; + + for(r = 0; r < brd_rows; ++r) + for(c = 0; c < brd_cols; ++c) + SetCount(r, c, FindAdj(r, c)); +} + +/* String to setup board randomly (total of 128 bytes). 1 mine each 8 bytes. +*/ +#asm + +RandStr: + + ; v-------v-------v-------v------- + + defb '----@---@-------------@----@----' + defb '-@-----------@----@----------@--' + defb '--@---------@----------@--@-----' + defb '----@----@-----------@---@------' + defb '$' + +#endasm + +/* Read line from keyboard. + Setup random number. +*/ +ReadLine(buf, width) +char *buf; +int width; +{ + int len; char ch; + + len = 0; + + while(!KsGetKb()) + ++random; + + while(1) + { + switch(ch = KsGetCh()) + { + case 8 : + case 127 : + if(len) + { + PrCh(8); PrCh(' '); PrCh(8); --len; + } + break; + + case '\r' : + case '\n' : + buf[len] = 0; + return; + + default : + if(ch >= ' ' && len < width) + PrCh(buf[len++] = toupper(ch)); + } + } +} + +/* Print character. Supports simple '\t'. +*/ +PrCh(c) +int c; +{ + if(c != '\t') { + KsPutCh(c); + } + else { + PrChTimes(' ', 8); + } +} + +/* Print string +*/ +PrStr(s) +char *s; +{ + while(*s) { + PrCh(*s++); + } +} + +/* Print character X times +*/ +PrChTimes(ch, n) +int ch, n; +{ + while(n--) { + PrCh(ch); + } +} + +/* Print decimal number +*/ +PrNumber(n) +int n; +{ + int s[7]; + + sprintf(s, "%d", n); + + PrStr(s); +} + + diff --git a/FindThatMine/ftm.com b/FindThatMine/ftm.com new file mode 100644 index 0000000000000000000000000000000000000000..587de7b1dbbb834119b9d69408c6cec40de2a5b4 GIT binary patch literal 8704 zcmeHMeQ;dWb-(+em3AddTFI85K5XB+&oZl(Ev+R-_=67{{DD#=e+dIo1EYww&>&kz zk}X-51Yts^lhRNi4kUFb10>CmQWAR{WlF;E*lg-&=VeeDJDxI0M=`IAvsHk!m>Q_v z-?{I;)k+pF?KCs}BQkIAx#ygF?)kds-1mqDSRK0T6VuL#1>Tfxy;8s!?eYKP zui5)Q|HrH&Ud?B{=-s=FnJzrmoBP*Y(=&Z{uW5aa*k15XwLj_YPtTm{eQ9&Fq;#aj zWGwQecVeloGg`Wl2m=Y0Str^7VvEGrRUFPU_dPiQs@Lcc6vt8!M@uSCj@q1$U z*sIAhKjJuY{IxRwaubl5wmiPGD@^>JaE8}cn1>GEJ$yuX*awBaW9G4IO{>}=R{KCq zV+PLQA9C-ZAA!kC9~wV#{i*9tEz;h1z~vdRM*AR5n~c_lCzm`hjm~{P$n>4b^WsSijYm4l{N`@q0C=N>7yxAB%<$ zJvRK*2QT?XFL-(nJ$Co-Q@6i+J)eB{9q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(f%=ce+6y10)Ok(L$LEl7>Ra&uRu#g7Tfd!mm-Pop%fMaM{WKtb`#R*# z>RxB)!Eo&!{Lr(?0d}>mjK^8_Z}mMa6bjySFtMC}?qEWMLLpY&zqxzwJ-oWV?cR<7 z3@zPz6V?5qx<3R#jVsr!Bw3A3YFwqpMrVxgVFw!O;(Ry$f8fpA>Rb3S{+ZQrNZr8q zKu-T)BC#*g#|IAXOYp9aJ&C#yi+0xVhWN^c6%Fx*IB)6h+Mnp*TRQqWyE}M2-`vx? zZ{I<_vv>EvU`HR++_|r#doPv^4i47smc)KVt4lydX&mqD?STRZ5`F#My?bF9@95mS z9#7riz-}lLT*+_Xws;jHxEVyG++ig2qUG5%I z7<}Lk_H}ZgcP4rgodZ1Do#64CY9OeubF)Mb)b}O!^d3m?-8~&$L|@ArH*O}5?VJ|M z-IYAKeUNjCYMi1NBoKjg=kCM}b%P|ii6B#}Q6&XYoRt!B1t{gu!7>9sJ>h(FbL&Rl zcFTq~-qPH;{497w_USi6W_RL!$vum7=C+mE6sLp z+C&We)(vfPA*FS{T(}uNBFMGZwV!-~^D+CcoNZ&@sXAKqa@A{9X4TKCeqQy + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/FindThatMine/ks.h b/FindThatMine/ks.h new file mode 100644 index 0000000..4b8a9e0 --- /dev/null +++ b/FindThatMine/ks.h @@ -0,0 +1,398 @@ +/** + * KSvt100 + * + * This library offers a common interface for keyboard and screen devices + * using VT100 control codes + * + * This is a stripped down version of KS to only support VT100, but includes + * color codes + */ + +/* ks.h + + Keyboard & screen functions library for CP/M & MESCC - Mike's Enhanced Small C Compiler. + + Stripped down version for VT100+color by Anna Christina Naß + + Copyright (c) 2016, 2017 Miguel I. Garcia Lopez / FloppySoftware, Spain + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +int xks_rows = 25; // Screen rows +int xks_cols = 80; // Screen columns +BYTE *xks_clrscr = "\e[H\e[J"; // Clear screen +BYTE *xks_poscur = "\e[%r;%cH"; // Position cursor +BYTE *xks_shwcur = "\e[?25h"; // Show cursor +BYTE *xks_hidcur = "\e[?25l"; // Hide cursor +BYTE *xks_yrever = "\e[7m"; // Reverse on +BYTE *xks_nrever = "\e[m"; // Reverse off +BYTE *xks_yuline = "\e[4m"; // Underline on +BYTE *xks_nuline = "\e[m"; // Underline off + +#define RESET "\e[0m" // reset all attributes +#define FGBLK "\e[30m" // black +#define FGRED "\e[31m" // red +#define FGGRN "\e[32m" // green +#define FGYEL "\e[33m" // yellow +#define FGBLU "\e[34m" // blue +#define FGMAG "\e[35m" // magenta +#define FGCYN "\e[36m" // cyan +#define FGWHT "\e[37m" // white/gray +#define FGBGRY "\e[30;1m" // gray ("bright black") +#define FGBRED "\e[31;1m" // bright red +#define FGBGRN "\e[32;1m" // bright green +#define FGBYEL "\e[33;1m" // bright yellow +#define FGBBLU "\e[34;1m" // bright blue +#define FGBMAG "\e[35;1m" // bright magenta +#define FGBCYN "\e[36;1m" // bright cyan +#define FGBWHT "\e[37;1m" // bright white +#define BGBLK "\e[40m" // black +#define BGRED "\e[41m" // red +#define BGGRN "\e[42m" // green +#define BGYEL "\e[43m" // yellow +#define BGBLU "\e[44m" // blue +#define BGMAG "\e[45m" // magenta +#define BGCYN "\e[46m" // cyan +#define BGWHT "\e[47m" // white + + +/** + * @fn int KsHello(char *tty_name) + * @brief Initialize the KS library. + * Call this function before any other function (with a few exceptions). + * @param code - TTY code + * @return 0 on success, -1 on failure + */ +KsHello(code) +int code; +{ + // Setup BIOS jumps, etc. + xKsInit(); + return 0; +} + +/** + * @fn void KsBye(void) + * @brief Reset the KS library. + * Call this function before you stop your program, in order to reset the TTY. + */ +KsBye() +{ + // Nothing yet +} + +/** + * @fn int KsGetCode(char *name) + * @brief Get the code for a TTY name. + * This function can be called before KsHello(). + * @param name - TTY name + * @return TTY code if found, or -1 on unknown name + */ +KsGetCode(name) +char *name; +{ + if(strcmp(name, "VT100")) { + return 0; + } + else { + return -1; + } +} + +/** + * @fn int KsGetName(int code) + * @brief Get the name for a TTY code. + * This function can be called before KsHello(). + * @param code - TTY code + * @return TTY name, or NULL on unknown code + */ +KsGetName(code) +int code; +{ + if(code==0) { + return "VT100"; + } + else { + return NULL; + } +} + +/** + * @fn char **KsGetNames(void) + * @brief Get all supported TTY names. + * This function can be called before KsHello(). + * @return Pointer to an array of pointers to char + */ +KsGetNames() +{ + WORD xks_names[1]; + xks_names[0] = "VT100"; + return xks_names; +} + +/** + * @fn int KsGetHowMany(void) + * @brief Get the number of supported TTYs. + * This function can be called before KsHello(). + * @return Number of supported TTYs + */ +KsGetHowMany() +{ + return 1; +} + +/** + * @fn void KsClear(void) + * @brief Clear the screen and move the cursor to 0,0. + */ +KsClear() +{ + KsPutRawStr(xks_clrscr); +} + +/** + * @fn void KsPosCursor(int row, int col) + * @brief Move the cursor on screen. + * @param row - screen row from 0 + * @param col - screen column from 0 + */ +KsPosCursor(row, col) +int row, col; +{ + char *p; int v; + + for(p = xks_poscur; *p; ++p) { + if(*p != '%') { + KsPutRawCh(*p); + } + else { + v = (*(++p) == 'r' ? row : col); + xKsPutDec(1 + v); + } + } +} + +/** + * @fn void KsSetCursor(int toggle) + * @brief Show or hide the cursor on screen. + * @param toggle - 0 to hide, other to show + */ +KsSetCursor(toggle) +int toggle; +{ + if(xks_shwcur) { + KsPutRawStr(toggle ? xks_shwcur : xks_hidcur); + } +} + +/** + * @fn void KsUnderline(int toggle) + * @brief Set or reset underline text. + * If the TTY does not have this capability, does nothing. + * @param toggle - 0 to reset, other to set + */ +KsUnderline(toggle) +int toggle; +{ + if(xks_yuline) { + KsPutRawStr(toggle ? xks_yuline : xks_nuline); + } +} + +/** + * @fn void KsReverse(int toggle) + * @brief Set or reset reverse text. + * If the TTY does not have this capability, does nothing. + * @param toggle - 0 to reset, other to set + */ +KsReverse(toggle) +int toggle; +{ + if(xks_yrever) { + KsPutRawStr(toggle ? xks_yrever : xks_nrever); + } +} + +/** + * @fn int KsGetRows(void) + * @brief Get TTY rows. + * @return TTY rows. + */ +KsGetRows() +{ + return xks_rows; +} + +/** + * @fn int KsGetCols(void) + * @brief Get TTY columns. + * @return TTY columns. + */ +KsGetCols() +{ + return xks_cols; +} + +/** + * @fn void KsCenterStr(int row, char *s) + * @brief Print a string centered on screen. + * @param row - screen row + * @param s - string + */ +KsCenterStr(row, s) +int row; char *s; +{ + KsPosCursor(row, (KsGetCols() - strlen(s)) / 2); + KsPutStr(s); +} + +/** + * @fn void KsPutRawCh(int ch) + * @brief Send a character to the TTY. + * @param ch - character + */ +#asm +KsPutRawCh + ld c,l + jp xKsConOut +#endasm + +/** + * @fn void KsPutRawStr(char *s) + * @brief Send a string to the TTY using KsPutRawCh(). + * @param s - string + */ +KsPutRawStr(s) +char *s; +{ + while(*s) { + KsPutRawCh(*s++); + } +} + +/** + * @fn void KsPutCh(int ch) + * @brief Send a character to the TTY. + * This functions performs the following translations: + * - '\n' to '\r' + '\n' + * @param ch - character + */ +#asm +KsPutCh + ld a,l + cp 10 + jp nz,KsPutRawCh + ld l,13 + call KsPutRawCh + ld l,10 + jp KsPutRawCh +#endasm + +/** + * @fn void KsPutStr(char *s) + * @brief Send a string to the TTY using KsPutCh(). + * @param s - string + */ +KsPutStr(s) +char *s; +{ + while(*s) { + KsPutCh(*s++); + } +} + +/** + * @fn int KsGetKb(void) + * @brief Check if there is an input character from the keyboard. + * @return 0 for NO, other for YES + */ +#asm +KsGetKb: + call xKsConInSt + ld h,a + ld l,a + ret +#endasm + +/** + * @fn int KsGetCh(void) + * @brief Get character from the keyboard, waiting for one if necessary. + * @return character + */ +#asm +KsGetCh + call xKsConIn + ld h,0 + ld l,a + ret +#endasm + +/* Private functions + ----------------- +*/ + +// void xKsInit(void) : Set BIOS JUMPs. +#asm +xKsInit + ld hl,(1) + inc hl + inc hl + inc hl + ld de,xKsConInSt + ld bc,9 + ldir + ret + +xKsConInSt + jp 0 ; BIOS ConSt +xKsConIn + jp 0 ; BIOS ConIn +xKsConOut + jp 0 ; BIOS ConOut +#endasm + +// void xKsPutDec(int num) : Send positive decimal number to TTY. +xKsPutDec(num) +int num; +{ +#ifdef SPRINTF_H + char buf[6]; + + sprintf(buf, "%d", num); + + KsPutRawStr(buf); +#else + char buf[6]; + int i; + + for(i = 0; i < 6; ++i) { + if(num > 9) { + buf[i] = num % 10; + num /= 10; + } + else { + buf[i++] = num; + break; + } + } + + do { + KsPutRawCh('0' + buf[--i]); + } while(i); +#endif +} + + diff --git a/FindThatMine/mescc/CCOPT.COM b/FindThatMine/mescc/CCOPT.COM new file mode 100644 index 0000000000000000000000000000000000000000..1566fe561e68c9d40260e8e3164e584b31bfccef GIT binary patch literal 19072 zcmdU1d30RWdB3x0G#*QeM)LAxu>GFKl1HP(vhZ$sk!8!a5g-2}H9&k)q zBK$L*+Ls*;hX@=y8B|8q;D<*`21-jx3#jiMRn-rd2<5ys-8pFJwbeq<9REN5ZFWxn zKcPS5R9yOxoV}GIVYQD%@*nO@_X2w(3H|Q~?fcFPH-5z#O=fljeaXbplG1^agb?Ll zaSo4c3$z4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)u20C_(p zF5j&wztZR-#Q%b`yhX_1oS!m;xqY^MJw!R2)E1Lb%@4K}&1At4++=b<FC*OKN8Z3T%OM_>bgvI_LAx;rn@b?(;Q!UyLHsh&E;YRH#^ZHZs`U~^= zig|t0yuNQ18Odj( z{Nku0s#ZjOKCx#{WZ!;qM?+nGgStR%Sf;jyd)0>eg-Zm3gL|r|x44#u)RykZzI}&w zM)vMM5bo;`S4YF09V>{BWTWow>h4f)tnIr=)b0>NbhG8+L9Lb@S%U6Mf=< z*x1qA(HGv|)!V7|^>=qfS3rgZA$4=_p6>qk4#{CJ{)|m?^Y$yRs!{jf+M#aUu(P>Y zg_vDEU57jR)X)N-FA$FQ`0$r+Fkhgez0N0ySw*`KM-N)osb~nPCUdz%Ex{pV1?g<}c=GQWFb1)jdqeITQlZOKxz3nWRZ+)b<15$05LX)<^igu}S z6{$>;NAb6M_JyNS(qM%uDi*b?yASQhFtY`1?JG!Il-bjCMdleyH z71%Mpfr9{|85jI)tr1t^{|)%r zUPD14f7(SwyGgVz+|J&K^a^U?D~KMPYf`(ra5Sko+&h0ipdGztb5D09Y7O^wgxk&G z1ASflJD8kes5jixA+~^C-5-gl-I3l-u`RM+?dXm4ciyV@bo4~}4q-&?i$r>0fj$)j z9Xw%F?dnx`_wU`?(I>9%ZSU9%Chh7S;l8f$ZhSRD@bDotzagGrPTDHbfkt9x(jjU4DzJLu0Y37@YbTF1XBA?p6Dj}*+pzyASENJF^* literal 0 HcmV?d00001 diff --git a/FindThatMine/mescc/HEXTOCOM.COM b/FindThatMine/mescc/HEXTOCOM.COM new file mode 100644 index 0000000000000000000000000000000000000000..202be899bb34be6a09bac3c6afe1ff39d559c981 GIT binary patch literal 6272 zcmd5=e{7WH9e?h9uh+Y_l-`|`=bEAKd#}ao9h3tR3QmwAh}%jtQE_94r9Emx>5;Zb z=`Y~2yaam9q)(vNT*IdF&^BOO+#6=NL_GZDO4AjD^a^2_qyzgDF z42dRNvNpYYp6~bb{r!D@HR@sYY|_u9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&Tb zMyGFFAFeyWaJt4&<1rNeK(#i@#0FZDj6v^T+t8Ygv3&k&{aRKRuBu*8g<^eGHpA+J z{`#iL!y0{4u-d0%G`gmsZ$5*^rfQ#s9-DkiP*gVt%TV}zzG4&&f!awwDywT&<0)KS za}8C78W~2z*4OBvB+Wg?m^sBy3@`!MGfW2C6wGEaz_eOV53oRnE*$jnR5bY z^|u;5rmTMQag@zy{#zSS3>m2Zl+3wqatgB%K#z4AeVs4Zd>hS9 zpt)f(pwYH!a3Q6k6|StUoNm(}XzlEZc9gA)_Vz_?k;P-g(;kmc6SX3h3k8f96bEa-mOaB=x*B@S>9UL z2tvBXr#^<)(fvK_Diqf3eB0*D(Vlh+F?~^w$-uSp%lPHUL#fQeui<^mmxBdYM-6p> zmWvzsRx~wIQ)5%ZMNJ{Tm2cr2`3)GJTf?uS=+TBq!ngNOT;hpusH~A1QWdShyQAF^ zaBKmJ7Y1ZGA_#_?fo(|Fxzsp=TZmDmiFQZGc}l)?knAOjAmD}ji_z`f?FzyAZYA2F z&*q*8!fjb}Tcn$hZn`D1xsP{{W@@*;N37n7bdavo#262KQKM|tu15EQ|KaaH0bj0O ACIA2c literal 0 HcmV?d00001 diff --git a/FindThatMine/mescc/cc.com b/FindThatMine/mescc/cc.com new file mode 100644 index 0000000000000000000000000000000000000000..e9d6115cccbd1f42f4ea2b1fa11bda0f2d134c25 GIT binary patch literal 29056 zcmeHwdw5(|b???l8jodJ)=0KO2}nA70D<$4Zf|@K!IYCX`2cMLP;PAweRn@ z_C9Au@`IGyuiyOxC1+;uwfA1Hz4qE`Kh8K7REyOcVO93{xjprD50r%0_MdC}NC|S0 zx{sAComVw6TwmgrtE^IchLVH5hZFXe{{B?I-DvMj*#m>|uDj+r?^59hOG@6U&V8x* zeic-$&VwZrSF7+<0q5f-B_%3y^6{v3-j4p_M9uNqn%YX{L+5S#7ps-^qBAWpoOl0V zic+NU|Ht1Af&ch_%KcQpDs{gYNG?!0FMTpK;g5O>xkz^^=l&t9{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#I1)r-h(1-B!Acv<1IXrzm#MjpY#C<)<)F9^5#Gz(;qpFZu7E2s2 z!3hG61CCEs+?-0;hvUinj7M(Zbby&MPUoV1bK;Pr=V?c6$FN32(|*U$z@XikK#L^& zE}YU0eSL`@%zUx-1AaQ*-;ZgQ<65=ElM4so2d_q?G69Hfstig50~g&r)YqrBr@FxS zC5wCwiH99f_~)zQ@V)mWY!3iE+i{%}6=7OS*?p;GkMi5ngAVvy%Ea0&T7kFIA(B0o zAy1d_Lx=hk0|Q2Ry>O{Vd^Cw8X_ld##n3@L?cMl~H3yIIO zF$>&@h`^@frKdCB1vr5cpV{$o>honW(nor`2hbi9N})Ao0%Gj#9s}}ZiO{%UY=;a5 zBXPIxg7NsxwBU)JN+*&=3-@9Q^~|ZOFNL|uqoC({KYRF6L5E)|k%XUoAp|;k z&`u;%Lp^uem>^P&&=4bZ4s~}Y`UlkB 0x7F. + * - 20 Dec 2015 : Added macro CC_CONIO_BIOS to support direct console I/O using BIOS, instead of BDOS. + * - 08 Jan 2015 : Modified getch() when access BDOS (fn. 6 instead of 1). + * - 10 Dec 2016 : Documented. GPL v3. + * + * Copyright (c) 1999-2016 Miguel I. Garcia Lopez / FloppySoftware. + * + * Licensed under the GNU General Public License v3. + * + * http://www.floppysoftware.es + * floppysoftware@gmail.com + */ +#ifndef CONIO_H + +#define CONIO_H + +/** + * @fn int putch(int ch) + * @brief Send character to the console. + * @param ch - character + * @return ch + */ +#ifdef CC_CONIO_BIOS +#asm + +putch + PUSH HL + LD C,L + LD E,9 + CALL xbios + POP HL + RET + +xbios + LD HL,(1) + LD D,0 + ADD HL,DE + JP (HL) + +#endasm +#else +#asm + +putch + PUSH HL + LD C,2 + LD E,L + CALL 5 + POP HL + RET +#endasm +#endif + +/** + * @fn int getch(void) + * @brief Get character from the console without echo. + * + * Waits until a character is available. + * + * @return character + */ +#ifdef CC_CONIO_BIOS +#asm + +getch + LD E,6 + CALL xbios + LD H,0 + LD L,A + RET + +#endasm +#else +#asm + +getch + LD C,6 + LD E,255 + CALL 5 + OR A + JR Z,getch + LD H,0 + LD L,A + RET +#endasm +#endif + +/** + * @fn int kbhit(void) + * @brief Tests console input status. + * @return != 0 if a character is available, else 0. + */ +#ifdef CC_CONIO_BIOS +#asm + +kbhit + LD E, 3 + CALL xbios + LD H,A + LD L,A + RET + +#endasm +#else +#asm + +kbhit + LD C,11 + CALL 5 + LD H,A + LD L,A + RET +#endasm +#endif + +/** + * @fn int getchar(void) + * @brief Get character from the console or stdin. + * + * Waits until a character is available. + * + * #ifdef CC_STDIO: Returns a character from stdin, or EOF on end of file or error. + * #ifndef CC_STDIO: Returns a character from the console. Echoes the character. + * + * @return character on success, else EOF. + */ +getchar() +{ + +#ifdef CC_STDIO + + return fgetc(stdin); + +#else + + return putchar(getch()); + +#endif + +} + +/** + * @fn int putchar(int ch) + * @brief Send character to the console or stdout. + * + * #ifdef CC_STDIO: Returns ch, or EOF on error. + * #ifndef CC_STDIO: Returns ch. + * + * @param ch - character + * @return ch on success, else EOF. + */ +putchar(ch) +int ch; +{ + +#ifdef CC_STDIO + + return fputc(ch, stdout); + +#else + + if(ch == '\n') + putch('\r'); + + return putch(ch); + +#endif + +} + +/** + * @fn int putstr(char *s) + * @brief Send string to the console or stdout. + * + * #ifdef CC_STDIO: Returns the number of characters sent, or EOF on error. + * #ifndef CC_STDIO: Returns a non-negative value to indicate success. + * + * @param s - string + * @return number of characters sent on success, else EOF. + */ +putstr(s) +char *s; +{ + +#ifdef CC_STDIO + + /* FIXME : Better if call to fputs (if available) */ + + int i, c; + + i = 0; + + while(*s) + { + /* FIXME : -1 hardcoded -- < 0 causes strange + behaviour if ch > 0x7F */ + + if((c = putchar(*s++)) == -1) + return c; + ++i; + } + + return i; +#else + while(*s) + putchar(*s++); + + return 0; +#endif + +} + +/** + * @fn int puts(char *s) + * @brief Send string + '\n' to the console or stdout. + * + * #ifdef CC_STDIO: Returns the number of characters sent, or EOF on error. + * #ifndef CC_STDIO: Returns a non-negative value to indicate success. + * + * @param s - string + * @return number of characters sent on success, else EOF. + */ +puts(s) +char *s; +{ + putstr(s); + + return putchar('\n'); /* FIXME */ +} + +#endif + + \ No newline at end of file diff --git a/FindThatMine/mescc/ctype.h b/FindThatMine/mescc/ctype.h new file mode 100644 index 0000000..bad2be9 --- /dev/null +++ b/FindThatMine/mescc/ctype.h @@ -0,0 +1,203 @@ +/** + * @file ctype.h + * @brief Character tests and conversion functions. + * @author Miguel I. Garcia Lopez / FloppySoftware + * + * Character tests and conversion functions, for MESCC (Mike's Enhanced + * Small C Compiler for Z80 & CP/M). + * + * Revisions: + * - 19 Dec 2000 : Last revision. + * - 16 Apr 2007 : GPL'd. + * - 15 Aug 2016 : Documented. GPL v3. + * + * Copyright (c) 1999-2016 Miguel I. Garcia Lopez / FloppySoftware. + * + * Licensed under the GNU General Public License v3. + * + * http://www.floppysoftware.es + * floppysoftware@gmail.com + */ +#ifndef CTYPE_H + +#define CTYPE_H + +/** + * @fn int isalpha(char ch) + * @brief Test if ch is a letter. + * @param ch - character to test + * @return true or false + */ +#asm + +isalpha + ld a,l + ld hl,0 + cp 'A' + ret c + cp 'Z'+1 + jr c,isalpha1 + cp 'a' + ret c + cp 'z'+1 + ret nc +isalpha1 + inc l + ret + +#endasm + +/** + * @fn int isdigit(char ch) + * @brief Test if ch is a decimal digit. + * @param ch - character to test + * @return true or false + */ +#asm + +isdigit + ld a,l + ld hl,0 + cp '0' + ret c + cp '9'+1 + ret nc + inc l + ret + +#endasm + +/** + * @fn int isxdigit(char ch) + * @brief Test if ch is an hexadecimal digit. + * @param ch - character to test + * @return true or false + */ +#asm + +isxdigit + LD C,L + CALL isdigit + RET C + LD HL,0 + LD A,C + CP 'A' + RET C + CP 'G' + JR C,isxdigit1 + CP 'a' + RET C + CP 'g' + RET NC +isxdigit1 + INC L + RET + +#endasm + +/** + * @fn int isalnum(char ch) + * @brief Test if ch is a letter or a decimal digit. + * @param ch - character to test + * @return true or false + */ +#asm + +isalnum + LD C,L + CALL isdigit + RET C + LD L,C + JP isalpha + +#endasm + +/** + * @fn int isupper(char ch) + * @brief Test if ch is a letter in uppercase. + * @param ch - character to test + * @return true or false + */ +#asm + +isupper + ld a,l + ld hl,0 + cp 'A' + ret c + cp 'Z'+1 + ret nc + inc l + ret + +#endasm + +/** + * @fn int islower(char ch) + * @brief Test if ch is a letter in lowercase. + * @param ch - character to test + * @return true or false + */ +#asm + +islower + ld a,l + ld hl,0 + cp 'a' + ret c + cp 'z'+1 + ret nc + inc l + ret + +#endasm + +/** + * @fn int toupper(char ch) + * @brief Convert letter to uppercase. + * + * If ch is not a letter in lowercase, returns ch unchanged. + * + * @param ch - character to convert + * @return ch in uppercase + */ +#asm + +toupper + ld a,l + cp 'a' + ret c + cp 'z'+1 + ret nc + sub 20h + ld l,a + ret + +#endasm + +/** + * @fn int tolower(char ch) + * @brief Convert letter to lowercase. + * + * If ch is not a letter in uppercase, returns ch unchanged. + * + * @param ch - character to convert + * @return ch in lowercase + */ +#asm + +tolower + ld a,l + cp 'A' + ret c + cp 'Z'+1 + ret nc + add 20h + ld l,a + ret + +#endasm + +#endif + + \ No newline at end of file diff --git a/FindThatMine/mescc/mescc.h b/FindThatMine/mescc/mescc.h new file mode 100644 index 0000000..d826374 --- /dev/null +++ b/FindThatMine/mescc/mescc.h @@ -0,0 +1,945 @@ +/** + * @file mescc.h + * @brief Runtime library. + * @author Miguel I. Garcia Lopez / FloppySoftware + * + * Runtime library for MESCC (Mike's Enhanced + * Small C Compiler for Z80 & CP/M). + * + * This library file must be included first! + * + * Need following EQU's (generated by the compiler): + * - ccSTACKSIZE : Stack size in bytes. + * + * Supports following #defs: + * - #define CC_STDIO Support for stdin, stdout & stderr. + * - #define CC_REDIR Support for stdin & stdout redirection + * in command line (needs CC_STDIO). + * - #define CC_NO_MUL To exclude MULTIPLICATION code. + * - #define CC_NO_DIV To exclude DIVISION & MODULUS code. + * - #define CC_NO_SWITCH To exclude SWITCH code. + * - #define CC_NO_ARGS To exclude ARGC & ARGV code. + * - #define CC_NO_ORG To exclude ORG 0100H code. + * + * Sets the following #defines: + * + * - BYTE + * - WORD + * - BOOL + * - NULL + * - TRUE + * - FALSE + * - SIZEOF_CHAR + * - SIZEOF_INT + * - SIZEOF_PTR + * + * Revisions: + * - 16 Jan 2001 : Last revision. + * - 23 Mar 2007 : Expand ccladr1 and ccladr2 for more speed. + * - 16 Apr 2007 : GPL'd. + * - 26 Aug 2012 : Added standard defs. + * - 08 Dec 2014 : Minor changes. + * - 09 Dec 2014 : Added support for stdin, stdout & stderr with CC_STDIO. + * - 12 Dec 2014 : Added support for stdin & stdout redirection in command line with CC_REDIR. + * - 16 Jan 2015 : Added SIZEOF_??? definitions. + * - 16 Feb 2015 : Modified / added code in cctmpw, ccxpb2, ccxpb, ccxpb3, ccxpw2 + * ccxpw, ccxpw3, ccladr2sv, ccladr2, ccladr1sv, ccladr1, + * to avoid use of IX register. + * - 20 Mar 2015 : Added support for CC_NO_MUL, CC_NO_DIV, CC_NO_SWITCH, CC_NO_ARGS. + * - 12 Apr 2015 : Removed ccDEFARGS code. + * - 14 Jul 2015 : Modified code for << and >>, because a shift of 0 positions, + * resulted in a wrong value (they assumed a shift > 0) - ie: 128 >> 0 resulted in 0. + * - 19 Oct 2015 : Improved multiplication algorithm (ccmul & ccumul). + * - 05 Nov 2015 : Modified ccsxt. + * - 30 Nov 2015 : Added support for atexit(). + * - 24 Jan 2016 : Added support for CC_NO_ORG. + * - 10 Dec 2016 : Documented. GPL v3. + * + * Copyright (c) 1999-2016 Miguel I. Garcia Lopez / FloppySoftware. + * + * Licensed under the GNU General Public License v3. + * + * http://www.floppysoftware.es + * floppysoftware@gmail.com + */ + +/* STANDARD DEFs + ------------- +*/ + +#define BYTE unsigned char +#define WORD unsigned int +#define BOOL char +#define NULL 0 +#define TRUE 1 +#define FALSE 0 + +#define SIZEOF_CHAR 1 /* [unsigned] char */ +#define SIZEOF_INT 2 /* [unsigned] int */ +#define SIZEOF_PTR 2 /* pointer */ + +/* RUNTIME CODE + ------------ +*/ + +#ifndef CC_NO_ORG + +#asm +; Start at TPA + + ORG 0100H + +#endasm + +#endif + +#asm +; Runtime address + +ccrtadr: + +; Set stack under BDOS (xx00h) + + LD HL,(6) + LD L,0 + LD SP,HL + +; Leave space for stack and init. variables + + LD DE,ccSTACKSIZE + OR A + SBC HL,DE + DEC HL + LD (ccfreelast),HL + LD DE,ccfreemem + LD (ccfreefirst),DE + OR A + SBC HL,DE + INC HL + LD (ccfreebytes),HL + JR NC,ccargs + +; Error, no memory for stack + + LD C,9 + LD DE,ccerrstack + CALL 5 + JP 0 + +ccerrstack + DEFB 'Runtime Error - No stack$' + +; Setup command line arguments + +ccargs + +#endasm + +#ifndef CC_NO_ARGS + +#asm +; Copy command line + + LD HL,81H + LD DE,ccmdbuf + LD BC,127 + LDIR + + LD A,(80H) + LD B,0 + LD C,A + LD HL,ccmdbuf + ADD HL,BC + LD (HL),0 + +; Init. argc & argv + + LD DE,cchptr + LD HL,ccmdbuf - 1 + LD BC,1 +ccspc + INC HL + LD A,(HL) + OR A + JR Z,ccarg + CP ' ' + JR Z,ccspc + LD A,L + LD (DE),A + LD A,H + INC DE + LD (DE),A + INC DE + INC C +ccpar + INC HL + LD A,(HL) + OR A + JR Z,ccarg + CP ' ' + JR NZ,ccpar + LD (HL),0 + JR ccspc + +ccarg + LD HL,cchptr - 2 + PUSH BC ;argc + PUSH HL ;argv +#endasm + +#endif + +#ifdef CC_REDIR + +#asm + CALL redir ;FIXME - Check errors + POP DE + POP BC + PUSH HL ;argc + PUSH DE ;argv +#endasm + +#endif + +#asm + +; Execute program + + CALL main +#endasm + +/** + * @fn void exit(int code) + * @brief Exit to CP/M. + * + * FixMe: Return code is lost! + */ +#asm + +; Exit to CP/M + +exit + NOP ; Patch for atexit() -- 3 bytes. + NOP + NOP +#endasm + +#ifdef CC_STDIO + +BYTE *stdin, *stdout, *stderr; /* Sorry, no available FILE here */ + +#asm + LD HL,(stdin) + CALL ccflush + LD HL,(stdout) + CALL ccflush + + JP 0 + +ccflush + LD A,H + OR L + RET Z + PUSH HL + CALL fclose + POP BC + RET +#endasm + +#else + +#asm + JP 0 +#endasm + +#endif + +#asm + +; Variables for memory functions + +ccfreefirst + DEFW 0 ;Adr. first free byte +ccfreelast + DEFW 0 ;Adr. last free byte +ccfreebytes + DEFW 0 ;Number of free bytes + +#endasm + +#ifndef CC_NO_ARGS + +#asm +; Variables for command line arguments + +ccmdbuf + DEFS 128 ;Command line buffer + + DEFW ccNULL ;Pointers table for argv +cchptr + DEFW ccNULL,ccNULL,ccNULL,ccNULL,ccNULL + DEFW ccNULL,ccNULL,ccNULL,ccNULL,ccNULL + DEFW ccNULL,ccNULL,ccNULL,ccNULL,ccNULL + DEFW ccNULL,ccNULL,ccNULL,ccNULL,ccNULL + DEFW ccNULL,ccNULL,ccNULL,ccNULL,ccNULL + +ccNULL + DEFB 0 ;Null pointer +#endasm + +#endif + +#asm + +; Basic routines + +; Call formats to access locals: +; +; Format 1: CALL routine +; DEFB SpOffset +; +; Format 2: CALL routine +; DEFW SpOffset + +; HL = unsigned char from local (format 2) + +ccxgb2 + CALL ccladr2 + JR ccxgb3 + +; HL = unsigned char from local (format 1) + +ccxgb + CALL ccladr1 +ccxgb3 + LD L,(HL) + LD H,0 + RET + +; HL = signed char from local (format 2) + +ccxgc2 + CALL ccladr2 + JR ccgc + +; HL = signed char from local (format 1) + +ccxgc + CALL ccladr1 + +; HL = signed char from (HL) + +ccgc + LD A,(HL) + +; HL = signed char from A + +ccsxt + LD L,A + RLCA + SBC A + LD H,A + RET + +; LD H,0 +; LD L,A +; AND 128 +; RET Z +; DEC H +; RET + +; HL = word from local (format 2) + +ccxgw2 + CALL ccladr2 + JR ccgw + +; HL = word from local (format 1) + +ccxgw + CALL ccladr1 + +; HL = word from (HL) + +ccgw + LD A,(HL) + INC HL + LD H,(HL) + LD L,A + RET + +; char local = HL (format 2) + +ccxpb2 + CALL ccladr2sv + JR ccxpb3 + +; char local = HL (format 1) + +ccxpb + CALL ccladr1sv +ccxpb3 + LD DE,(cctmpw) + LD (HL),E + EX DE,HL + RET + +; int/ptr local = HL (format 2) + +ccxpw2 + CALL ccladr2sv + JR ccxpw3 + +; int/ptr local = HL (format 1) + +ccxpw + CALL ccladr1sv +ccxpw3 + LD DE,(cctmpw) + LD (HL),E + INC HL + LD (HL),D + EX DE,HL + RET + +; Copy 1 word from HL to (DE) + +ccpw + LD A,L + LD (DE),A + INC DE + LD A,H + LD (DE),A + RET + +; Calc. local adress + +cctmpw DEFW 0 + +ccladr2sv + LD (cctmpw),HL + +ccladr2 + POP DE + POP HL + LD C,(HL) + INC HL + LD B,(HL) + INC HL + PUSH HL + PUSH DE + LD HL,4 + ADD HL,BC + ADD HL,SP + RET + +ccladr1sv + LD (cctmpw),HL + +ccladr1 + POP DE + POP HL + LD B,0 + LD C,(HL) + INC HL + PUSH HL + PUSH DE + LD HL,4 + ADD HL,BC + ADD HL,SP + RET + +; OR HL = HL | DE + +ccor + LD A,L + OR E + LD L,A + LD A,H + OR D + LD H,A + RET + +; XOR HL = HL ^ DE + +ccxor + LD A,L + XOR E + LD L,A + LD A,H + XOR D + LD H,A + RET + +; AND HL = HL & DE + +ccand + LD A,L + AND E + LD L,A + LD A,H + AND D + LD H,A + RET + +; LOGIC OR HL = DE || HL + +cclgor + LD A,H + OR L + OR D + OR E + LD L,A + RET + + ;LD A,H + ;OR L + ;RET NZ + ;LD A,D + ;OR E + ;RET Z + ;INC L + ;RET + +; LOGIC AND HL = DE && HL + +cclgand + LD A,H + OR L + RET Z + LD A,D + OR E + RET NZ + JP ccfalse + +; HL = HL == DE + +cceq + OR A + SBC HL,DE + +; LOGIC NOT HL = !HL + +cclgnot + LD A,H + OR L + JP NZ,ccfalse + INC L + RET + +; HL = HL != DE + +ccne + OR A + SBC HL,DE + RET + +; HL = DE > HL (SIGNED) + +ccgt + EX DE,HL + +; HL = DE < HL (SIGNED) + +cclt + CALL cccmp + RET C + DEC L + RET + +; HL = DE <= HL (SIGNED) + +ccle + CALL cccmp + RET Z + RET C + DEC L + RET + +; HL = DE >= HL (SIGNED) + +ccge + CALL cccmp + RET NC + DEC L + RET + +; Compare DE with HL, and return: (SIGNED) +; +; CARRY if DE < HL +; ZERO if DE == HL +; HL = 1 + +cccmp + LD A,E + SUB L + LD E,A + LD A,D + SBC H + LD HL,1 + JP M,cccmp1 + OR E + RET + +cccmp1 + OR E + SCF + RET + +; HL = DE <= HL (UNSIGNED) + +ccule + CALL ccucmp + RET Z + RET C + DEC L + RET + +; HL = DE >= HL (UNSIGNED) + +ccuge + CALL ccucmp + RET NC + DEC L + RET + +; HL = DE > HL (UNSIGNED) + +ccugt + EX DE,HL + +; HL = DE < HL (UNSIGNED) + +ccult + CALL ccucmp + RET C + DEC L + RET + +; Compare DE with HL, and return: (UNSIGNED) +; +; CARRY if DE < HL +; ZERO if DE == HL +; HL = 1 + +ccucmp + LD A,D + CP H + JR NZ,ccucmp1 + LD A,E + CP L + +ccucmp1 + LD HL,1 + RET + +; HL = DE >> HL (UNSIGNED) + +ccuasr + EX DE,HL + LD A,E +ccuasr1 + OR A + RET Z + DEC A + SRL H + RR L + JR ccuasr1 + +; HL = DE >> HL (ARITMETIC) + +ccasr + EX DE,HL + LD A,E +ccasr1 + OR A + RET Z + DEC A + SRA H + RR L + JR ccasr1 + +; HL = DE << HL (UNSIGNED) + +ccuasl + +; HL = DE << HL (ARITMETIC) + +ccasl + EX DE,HL + LD A,E +ccasl1 + OR A + RET Z + DEC A + ADD HL,HL + JR ccasl1 + +; HL = DE - HL + +ccsub + EX DE,HL + OR A + SBC HL,DE + RET + +; HL = ~HL (1 COMPLEMENT) + +cccom + LD A,H + CPL + LD H,A + LD A,L + CPL + LD L,A + RET + +; HL = -HL (2 COMPLEMENT) + +ccneg + LD A,H + CPL + LD H,A + LD A,L + CPL + LD L,A + INC HL + RET + +#endasm + +#ifndef CC_NO_MUL + +#asm + +; HL = DE * HL (UNSIGNED) + +ccumul + +; HL = DE * HL (SIGNED) + +ccmul + LD A,H + LD C,L + LD HL,0 + LD B,16 +ccmul0 + ADD HL,HL + SLA C + RL A + JR NC,ccmul1 + ADD HL,DE +ccmul1 + DJNZ ccmul0 + RET + +#endasm + +#endif + +#ifndef CC_NO_DIV + +#asm + +; HL = DE % HL (SIGNED) + +ccmod + CALL ccdiv + EX DE,HL + RET + +; HL = DE / HL (SIGNED) +; DE = DE % HL (SIGNED) + +ccdiv + LD B,H + LD C,L + LD A,D + XOR B + PUSH AF + LD A,D + OR A + CALL M,ccdivdeneg + LD A,B + OR A + + JP P,ccdiv0 + + LD A,B + CPL + LD B,A + LD A,C + CPL + LD C,A + INC BC + +ccdiv0 + EX DE,HL + LD DE,0 + LD A,16 + +ccdiv1 + PUSH AF + + ADD HL,HL + + RL E + RL D + LD A,D + OR E + + JR Z,ccdiv2 + + LD A,E + SUB C + LD A,D + SBC B + + JP M,ccdiv2 + LD A,L + OR 1 + LD L,A + LD A,E + SUB C + LD E,A + LD A,D + SBC B + LD D,A + +ccdiv2 + POP AF + DEC A + JR NZ,ccdiv1 + POP AF + RET P + + CALL ccneg + +ccdivdeneg + LD A,D + CPL + LD D,A + LD A,E + CPL + LD E,A + INC DE + RET + +; HL = DE % HL (UNSIGNED) + +ccumod + CALL ccudiv + EX DE,HL + RET + +; HL = DE / HL (UNSIGNED) +; DE = DE % HL (UNSIGNED) + +ccudiv + LD (ccudiv_tmp),HL + LD HL,ccudiv_cnt + LD (HL),17 + LD BC,0 + PUSH BC + XOR A + +ccudiv0 + RL E + RL D + DEC (HL) + POP HL + JR Z,ccudiv2 + LD A,0 + ADC 0 + ADD HL,HL + LD B,H + ADD L + LD HL,(ccudiv_tmp) + SUB L + LD C,A + LD A,B + SBC H + LD B,A + PUSH BC + JR NC,ccudiv1 + ADD HL,BC + EX (SP),HL + +ccudiv1 + LD HL,ccudiv_cnt + CCF + JR ccudiv0 + +ccudiv2 + EX DE,HL + RET + +ccudiv_tmp + DEFW 0 +ccudiv_cnt + DEFB 0 + +#endasm + +#endif + +#ifndef CC_NO_SWITCH + +#asm + +; Switch, on entry: +; +; DE = Table address +; HL = Where to go if value was not found in table +; B = Number of entries in table + +ccswtch + EX (SP),HL + EX DE,HL + +ccswch1 + LD A,E + CP (HL) + INC HL + JR NZ,ccswch2 + LD A,D + CP (HL) + JR NZ,ccswch2 + INC HL + LD E,(HL) + INC HL + LD D,(HL) + EX DE,HL + POP BC + JP (HL) + +ccswch2 + INC HL + INC HL + INC HL + DJNZ ccswch1 + EX (SP),HL + POP BC + JP (HL) + +#endasm + +#endif + +#asm + +; HL = TRUE + +cctrue + LD L,1 + RET + +; HL = FALSE + +ccfalse + LD HL,0 + RET + +#endasm + + \ No newline at end of file diff --git a/FindThatMine/mescc/sprintf.h b/FindThatMine/mescc/sprintf.h new file mode 100644 index 0000000..00fa6a5 --- /dev/null +++ b/FindThatMine/mescc/sprintf.h @@ -0,0 +1,104 @@ +/** + * @file sprintf.h + * @brief Library for sprintf() function. + * @author Miguel I. Garcia Lopez / FloppySoftware + * + * Implementation of sprintf() function, for MESCC (Mike's Enhanced + * Small C Compiler for Z80 & CP/M). + * + * Revisions: + * - 20 Oct 2000 : Last revision. + * - 16 Apr 2007 : GPL'd. + * - 14 Apr 2015 : Ammended a bad closed comment. + * - 25 Aug 2016 : Documented. GPL v3. + * + * Copyright (c) 1999-2016 Miguel I. Garcia Lopez / FloppySoftware. + * + * Licensed under the GNU General Public License v3. + * + * http://www.floppysoftware.es + * floppysoftware@gmail.com + */ +#ifndef SPRINTF_H + +#define SPRINTF_H + +// Dependencies +// ------------ + +#ifndef XPRINTF_H + #include +#endif + +/** + * @fn int sprintf(char *dst, char *fmt, arg1, arg2, ...) + * @brief Formatted output to memory. + * + * See the documentation for xprintf.h to learn about the string format. + * + * @param dst - destination + * @param fmt - string format + * @param arg1 - argument #1 + * @param arg? - argument #? + * @return number or characters written, or -1 on failure (currently always #). + */ +#asm + +sprintf: + ADD HL,HL + ADD HL,SP ;HL=Adr. fmt + + LD DE,xspfout + PUSH DE + LD DE,xspfend + PUSH DE + PUSH HL + + INC HL + INC HL ;HL=Adr. dst + LD A,(HL) + INC HL + LD H,(HL) + LD L,A + LD (xspfout+2),HL + + CALL xprintf + + POP BC + POP BC + POP BC + + RET +#endasm + +// int xspfout(char ch) : output ch to memory; return 0 on success, !=0 on failure (currently always returns 0). + +#asm + +xspfout: + LD A,L + LD HL,0 ;Adr. + LD (HL),A + + INC HL + LD (xspfout+2),HL + + LD HL,0 + + RET +#endasm + +// void xspfend(void) : end formatted output; writes a trailing zero byte. + +#asm + +xspfend: + LD HL,(xspfout+2) + LD (HL),0 + RET + +#endasm + +#endif + + \ No newline at end of file diff --git a/FindThatMine/mescc/string.h b/FindThatMine/mescc/string.h new file mode 100644 index 0000000..0cca902 --- /dev/null +++ b/FindThatMine/mescc/string.h @@ -0,0 +1,249 @@ +/** + * @file string.h + * @brief String functions. + * @author Miguel I. Garcia Lopez / FloppySoftware + * + * String functions, for MESCC (Mike's Enhanced + * Small C Compiler for Z80 & CP/M). + * + * Revisions: + * - 19 Mar 2001 : Last revision. + * - 16 Apr 2007 : GPL'd. + * - 15 Aug 2016 : Documented. GPL v3. + * + * Copyright (c) 1999-2016 Miguel I. Garcia Lopez / FloppySoftware. + * + * Licensed under the GNU General Public License v3. + * + * http://www.floppysoftware.es + * floppysoftware@gmail.com + */ +#ifndef STRING_H + +#define STRING_H + +/** + * @fn int strlen(char *str) + * @brief Return string length. + * @param str - string + * @return length in characters + */ +#asm +strlen: + LD D,H + LD E,L + LD BC,0FFFFH + XOR A + CPIR + OR A + SBC HL,DE + DEC HL + RET +#endasm + +/** + * @fn char *strcpy(char *dst, char *src) + * @brief Copy string. + * @param dst - destination string + * @param src - source string + * @return pointer to dst + */ +#asm +strcpy: + POP BC + POP HL + POP DE + PUSH DE + PUSH HL + PUSH BC + + PUSH DE + +strcpy2: + LD A,(HL) + LD (DE),A + INC HL + INC DE + OR A + JR NZ,strcpy2 + POP HL + RET +#endasm + +/** + * @fn char *strcat(char *dst, char *src) + * @brief Copy string at the end of another string. + * @param dst - destination string + * @param src - source string + * @return pointer to dst + */ +#asm +strcat: + POP BC + POP HL + POP DE + PUSH DE + PUSH HL + PUSH BC + + PUSH DE + +strcat2 + LD A,(DE) + OR A + JR Z,strcpy2 + INC DE + JR strcat2 +#endasm + +/** + * @fn int strcmp(char *str1, char *str2) + * @brief Compare two strings. + * @param str1 - a string + * @param str2 - a string + * @return <0 on str1 < str2; =0 on str1 == str2; >0 on str1 > str2 + */ +#asm +strcmp + POP BC + POP HL + POP DE + PUSH DE + PUSH HL + PUSH BC +strcmp1 + LD A,(DE) + CP (HL) + JR NZ,strcmp2 + + OR A + JR Z,strcmp2 + + INC DE + INC HL + JR strcmp1 + +strcmp2 + LD HL,0 + RET Z + JR NC,strcmp3 + DEC HL + RET +strcmp3 + INC L + RET +#endasm + +/** + * @fn char *strchr(char *str, char ch) + * @brief Search a character in a string. + * @param str - the string where to search + * @param ch - the character to find + * @return pointer to ch in the string, or NULL on failure + */ +#asm +strchr + POP BC + POP DE + POP HL + PUSH HL + PUSH DE + PUSH BC + + +strchr2 + LD A,(HL) + CP E + RET Z + + INC HL + OR A + JR NZ,strchr2 + + LD H,A + LD L,A + RET +#endasm + +/** + * @fn char *strupr(char *str) + * @brief Convert a string to upper case. + * @param str - a string + * @return pointer to str + */ +#asm +strupr + POP BC + POP HL + PUSH HL + PUSH BC + + PUSH HL + +strupr1 + LD A,(HL) + OR A + JR Z,strupr3 + + CP 'a' + JR C,strupr2 + CP 'z'+1 + JR NC,strupr2 + SUB 32 + LD (HL),A + +strupr2 + INC HL + JR strupr1 + +strupr3 + POP HL + RET +#endasm + +/** + * @fn int atoi(char *s) + * @brief Convert string to a integer. + * + * This function parses a string, interpreting its content as + * a decimal integer number, until the end of the string, or + * a non decimal digit: + * + * [+|-][[0..9]...][ZERO|NON_DECIMAL_DIGIT] + * + * Examples: + * - "-256" == -256 + * - "64" == 64 + * - "1024 bytes" == 1024 + * - "what?" == 0 + * + * @param s - a string + * @return integer value + */ +atoi(s) +char *s; +{ + int sign, val; + + if(*s == '+') + { + ++s; sign = 1; + } + else if(*s == '-') + { + ++s; sign = -1; + } + else + sign = 1; + + val=0; + + while(*s >= '0' && *s <= '9') + val = val * 10 + (*s++ - '0'); + + return val * sign; +} + +#endif + + \ No newline at end of file diff --git a/FindThatMine/mescc/xprintf.h b/FindThatMine/mescc/xprintf.h new file mode 100644 index 0000000..2a22a4b --- /dev/null +++ b/FindThatMine/mescc/xprintf.h @@ -0,0 +1,365 @@ +/** + * @file xprintf.h + * @brief Support library for formatted output. + * @author Miguel I. Garcia Lopez / FloppySoftware + * + * Support library for formatted output, + * for MESCC (Mike's Enhanced Small C Compiler for Z80 & CP/M). + * + * All functions with formatted output like printf(), fprintf() + * and sprintf() call some private functions in this order: + * - pf_sf() + * - pf_s() + * - pf_out() + * + * Revisions: + * - 19 Mar 2001 : Last revision. + * - 16 Apr 2007 : GPL'd. + * - 09 Dec 2016 : Documented. Optimized. GPL v3. + * - 02 Aug 2017 : Output '%%' as '%'. + * + * Copyright (c) 1999-2016 Miguel I. Garcia Lopez / FloppySoftware. + * + * Licensed under the GNU General Public License v3. + * + * http://www.floppysoftware.es + * floppysoftware@gmail.com + */ +#ifndef XPRINTF_H + +#define XPRINTF_H + +// Dependencies +// ------------ + +#ifndef STRING_H + #include +#endif + +// Private globals +// --------------- + +BYTE xpf_err; // True on error + +extern WORD xpf_out; // Output function +extern WORD xpf_end; // End function + +int xpf_fw; // Field width +BYTE xpf_fa; // Field alignment: 0=left, 1=right +BYTE xpf_fz; // True on zero filling + +int xpf_cnt; // # of characters sent + +/** + * @fn int xprintf(WORD funout, WORD funend, WORD adrpars) + * @brief Formatted output. + * + * This function performs formatted output. It is used + * by printf(), fprintf() and sprintf() functions. + * + * The format is indicated in the string as follows: + * + * %[-][0][w]t + * + * | - : Left align (default: right align). + * | 0 : Zero filling on right align. + * | w : Width for alignment. If the specified width + * | is lower than the argument length, output is + * | done without aligment. Care with sprinf()! + * | t : d = Signed decimal integer. + * | u = Unsigned decimal integer. + * | x = Hexadecimal integer. + * | s = String. + * | c = Character. + * + * The pair %% outputs a single %. + * + * @param funout - function to output a character + * @param funend - function to end output + * @param adrpars - arguments addresses + * @return # of characters sent on sucess, -1 on failure + */ +xprintf(funout, funend, adrpars) +WORD funout, funend; +WORD *adrpars; +{ + WORD *parg; // Pointer to arguments + char *pfor; // Pointer to formatted string + int ivalue; + char ch; + + // Setup + xpf_out = funout; + xpf_end = funend; + + pfor = *adrpars; + parg = --adrpars; + + xpf_err = xpf_cnt = 0; + + // Loop + while((ch = *pfor++)) + { + if(ch == '%') + { + // Character % + if(*pfor == '%') + { + pf_out(ch); + ++pfor; + + continue; + } + + // Align + if(*pfor == '-') + { + xpf_fa = 0; // Left align + ++pfor; + } + else + xpf_fa = 1; // Right align + + // Zero filling + if(*pfor == '0') + { + xpf_fz = 1; // Zero filling + ++pfor; + } + else + xpf_fz = 0; + + // Width + xpf_fw = 0; + + while(*pfor >= '0' && *pfor <= '9') + xpf_fw = xpf_fw * 10 + (*pfor++) - '0'; + + // Type + switch(ch = *pfor++) + { + case 'd' : + ivalue = *parg--; + pf_dec(ivalue); + break; + case 'u' : + ivalue = *parg--; + pf_udec(ivalue); + break; + case 'x' : + ivalue = *parg--; + pf_hex(ivalue); + break; + case 'c' : + pf_cf(*parg--); + break; + case 's' : + pf_sf(*parg--); + break; + case '\0' : + --pfor; + // P'abajo + default : + pf_out('!'); + break; + } + } + else + pf_out(ch); + + if(xpf_err) + break; + } + + pf_end(); + + return xpf_err ? -1 : xpf_cnt; +} + +// void pf_sf(char *s) : output formatted string. + +pf_sf(s) +char *s; +{ + int len; + char fill; + + if(xpf_fw) + { + if((len = strlen(s)) < xpf_fw) + { + xpf_fw = xpf_fw-len; + + if(xpf_fa) + { + // Left align + fill = (xpf_fz ? '0' : ' '); + + while(xpf_fw--) + pf_out(fill); + pf_s(s); + } + else + { + // Right align + pf_s(s); + + while(xpf_fw--) + pf_out(' '); + } + + return; + } + } + + pf_s(s); +} + +// void pf_cf(char c) : output formatted character. + +pf_cf(c) +char c; +{ + char tmp[2]; + + tmp[0] = c; tmp[1] = '\0'; + + pf_sf(tmp); +} + +unsigned char xpf_dst[7]; // Buffer for numbers +unsigned char *xpf_dpt; // Buffer pointer + +// void pf_dec(int i) : output signed decimal integer. + +pf_dec(i) +int i; +{ + xpf_dpt = xpf_dst; + + if(i < 0) + { + *xpf_dpt++ = '-'; i = -i; + } + + pf_dec2(i); + + *xpf_dpt = '\0'; + + pf_sf(xpf_dst); +} + +// void pf_dec2(int i) : helper for pf_dec(). + +pf_dec2(i) +int i; +{ + int n; + + if(n = i / 10) + pf_dec2(n); + + *xpf_dpt++ = i % 10 + '0'; +} + +// void pf_udec(unsigned int i) : output unsigned decimal integer. + +pf_udec(i) +unsigned i; +{ + xpf_dpt = xpf_dst; + + pf_udec2(i); + + *xpf_dpt = '\0'; + + pf_sf(xpf_dst); +} + +// void pf_udec2(unsigned int i) : helper for pf_udec(). + +pf_udec2(i) +unsigned i; +{ + unsigned n; + + if(n = i / 10) + pf_udec2(n); + + *xpf_dpt++ = i % 10 + '0'; +} + +// void pf_hex(unsigned int i) : output hexadecimal integer. + +pf_hex(i) +unsigned i; +{ + xpf_dpt = xpf_dst; + + pf_hex2(i); + + *xpf_dpt = '\0'; + + pf_sf(xpf_dst); +} + +// void pf_hex2(unsigned int i) : helper for pf_hex(). + +pf_hex2(i) +unsigned i; +{ + unsigned n; + + if(n = i / 16) + pf_hex2(n); + + i %= 16; + + *xpf_dpt++ = i < 10 ? '0' + i : 'A' + i - 10; +} + +// void pf_s(char *s) : output string. + +pf_s(s) +char *s; +{ + while(*s) + pf_out(*s++); +} + +// void pf_out(char c) : output character. + +#asm +pf_out: + PUSH HL + DEFB 0CDH +xpf_out: + DEFW 0 + POP BC + + EX DE,HL + + LD HL,(xpf_cnt) + INC HL + LD (xpf_cnt),HL + + LD A,D + OR E + RET Z +;; LD A,255 + LD (xpf_err),A + RET +#endasm + +// void pf_end(void) : end output. + +#asm +pf_end: + DEFB 0C3H +xpf_end: + DEFW 0 +#endasm + +#endif + + \ No newline at end of file diff --git a/README.md b/README.md index e92b0da..a8a5256 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ See this repository: https://git.imzadi.de/acn/backgammon-vt100 * [Battleships](Battleships/) * [Blocks](Blocks/) * [Robots](Robots/) +* [FindThatMine](FindThatMine/) ## More Games on the Interwebs