From 40ad25b725ae55d948ea78d24808600540be5f82 Mon Sep 17 00:00:00 2001 From: acn Date: Tue, 10 Mar 2020 15:47:00 +0100 Subject: [PATCH] Added Blocks --- Blocks/BLOCKS.COM | Bin 0 -> 9216 bytes Blocks/CC.COM | Bin 0 -> 29056 bytes Blocks/CCOPT.COM | Bin 0 -> 19072 bytes Blocks/HEXTOCOM.COM | Bin 0 -> 6272 bytes Blocks/README.md | 34 ++ Blocks/ZSM.COM | Bin 0 -> 12288 bytes Blocks/blocks.c | 866 ++++++++++++++++++++++++++++++++++++++++ Blocks/ctype.h | 203 ++++++++++ Blocks/kslib.h | 158 ++++++++ Blocks/kslibfun.h | 72 ++++ Blocks/mescc.h | 945 ++++++++++++++++++++++++++++++++++++++++++++ Blocks/sprintf.h | 104 +++++ Blocks/string.h | 249 ++++++++++++ Blocks/xprintf.h | 365 +++++++++++++++++ README.md | 1 + 15 files changed, 2997 insertions(+) create mode 100644 Blocks/BLOCKS.COM create mode 100644 Blocks/CC.COM create mode 100644 Blocks/CCOPT.COM create mode 100644 Blocks/HEXTOCOM.COM create mode 100644 Blocks/README.md create mode 100644 Blocks/ZSM.COM create mode 100644 Blocks/blocks.c create mode 100644 Blocks/ctype.h create mode 100644 Blocks/kslib.h create mode 100644 Blocks/kslibfun.h create mode 100644 Blocks/mescc.h create mode 100644 Blocks/sprintf.h create mode 100644 Blocks/string.h create mode 100644 Blocks/xprintf.h diff --git a/Blocks/BLOCKS.COM b/Blocks/BLOCKS.COM new file mode 100644 index 0000000000000000000000000000000000000000..f1196303559912986a9e19dfa5a765b050f4d88a GIT binary patch literal 9216 zcmds74RBP~b-ue#TCEmPwE9`z3b5YOTkK_50%;{=V;XD)3y_gm8DSe$4bCDh@&=)$ z`Y}R3IC0}lCQZ}2wH=yz+BEKTT-S~XKb9vY9>G>?l*zV!}q1d6Q(mXH_A5dzPU2$b_DAIk2kuI^NR9*Ba`1&%k5K!{@cqLBOU)Y z{#xw6`hQG+#x6_xi}wCoS;~Ts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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/Blocks/HEXTOCOM.COM b/Blocks/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;qiN8;R7ze8XDj9lnXO0{In~6bEVH8bD1S< zgt2?~boR9GN+|2Px{_VWLSF#N6*?F`2Bj!Koay`bzUtIY(^ROoMpv$+6`R7XN zGcK2lX+y&io>L;12Ll7aK(K=5-khRbUdH$tb&iy>%u_+e$j1N2&pp!D|7GSOiOc5i zrOx@x$d8ATrN3yKo@qOhhWT@Xy&#Qmc~TcSv=y&no33#*yWQS!*+EWiYdt0onJOBK7|nAS2s9 zeEg2lZ;sC6m+j$#!my5imL($ti`oVk!3FW983TM+UPmWkA?VsEm#yPk+%k`FfZ z9=bafmwab{TFu|jBE9TPw*PfaDerq-Db*g*9?0rvHBGC^p3%?Ny9~H&+_%*=HFbFW zCBzgn^h|opN{tN#wBWEZnaR&KeA4FDK-F->9n|;)V<)XSl zPjm9&J;BI_Wv8M_lBkS#`_k0bpKTV7Eeho3duVAgk5mUa@Nz3G3oi7(5b$EtxJ5P6TjFVsd>L{HlTFPa)P;2u?>Z@^=KY3S(kX}8YW>Yss!Hx-6O z&@u?y0ep0;ZWIt0r_eSlENJqi2Lm+Lveb=YXqkv!H`EV#_$;RdO)TMeBosZ%HBe(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I+RcWqez8TO}zx_>{%bcLTE*1S0cMr>KlH@G>GuO!$ z=;@I8sD!uJ;F3>y#+uKty);RZ75x~lMvGUGSG~p7XQ&NxE%i?P-GjfPY;47JJO1eP zA`(OmpT(4R(i-(Kuzps|MruX+M7HTkXQ}m|JnY8x13Z%Qs)w8)s3HPGuNrZ!9jA(V z)niVyGENKFb3nI1iKYG(yyY0Ffom||$ul9Tp2FmpICjGqc>V$a-KQPh5LYkc5g!*L zK5-Cu4Nvg!BuDpzr+D~^cptk$(J6Y5Jy@Nud{$lQ#N|eQ|A`{uEI{VXCxhY7#ph)n zy^NO(wq>f%lc-PlGBK=?%IYW};;8gN3}!~u>ZmJZlQf9gE+BXGk4Cs3fDJSPFk09Z z;%mpZOptc_wt15?BdA}L;9095E)0M!h?gW>@qgKt+25g$TANS=++=>gms6G$M1dkPyhPfr;ndDe+#lxbm zHfp<9Dz)A9Wo$#D_rB!XG+^H;yFJ1-^5RsNT%;L)z5=mL#k=(s|-=^e_p1sXo33h*Xb6bMkp4KGvcQ)@z z2v^7$O_WGyQt8>ZJF!67-H~YSPSjn+?nx$+-rY^0mLwFgO+C$BJxX(HYgeMXTiLazyGPlcP~wZ@@eRVH!(sP#?(9tN z?NquFEy=D{;hW&MJd$YH*}Z2M%d727?4{hZwH--err=ASP;g{@dl#%Z29TBb(%v%m r-R5GNL)_Hfmr#;B;BqU{Cx}X. + +Original Repository: https://github.com/MiguelVis/RetroProjects +Website: http://www.floppysoftware.es/blocks.html?path=cpm_projects|blocks + +The file ``BLOCKS.COM`` is the compiled game file. + +## Commands + +Move the cursor using Q, O, P and A as shown on the screen. + +## Compile: + +To compile, use MESCC, "Mike's Enhanced Small C Compiler". +See: http://www.floppysoftware.es/mescc.html?path=cpm_projects|mescc + +I provide the files neccessary to compile Blocks, using: + + CC BLOCKS + CCOPT BLOCKS + ZSM BLOCKS + HEXTOCOM BLOCKS + +## License: + +GPL Version 2, see copying.txt - valid for MESCC and Blocks. diff --git a/Blocks/ZSM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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/Blocks/blocks.c b/Blocks/blocks.c new file mode 100644 index 0000000..631f6c2 --- /dev/null +++ b/Blocks/blocks.c @@ -0,0 +1,866 @@ +/* BLOCKS! + + Game from Floppy Software for MESCC - Mike's Enhanced Small C Compiler. + + Copyright (c) 2012 Miguel I. Garcia Lopez, Valencia, 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 2, 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. + + Revisions: + + 02 Jul 2012 : Generic CP/M version 1.0 for 24x80 VT52 screen. +*/ + +#include /* MESCC header & runtime */ +#include /* We need strlen() */ +#include /* We need toupper() */ +#include /* We need sprintf() */ + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef WORD +#define WORD unsigned int +#endif + +#include /* Screen output for CP/M */ +#include /* More functions for kslib */ + +/* GAME DEFS +*/ + +#define BOARD_ROW 6 /* Screen position for board */ +#define BOARD_COL 25 /* id */ + +#define BORDER_ROW 5 /* Screen position for border */ +#define BORDER_COL 24 /* id */ + +#define BOARD_ROWS 10 /* Board rows */ +#define BOARD_COLS 10 /* Board columns */ + +#define BLOCK_COLS 3 /* Block size */ +#define BLOCK_ROWS 1 /* id */ + +#define BLOCK_EMPTY ' ' /* Value if block is empty */ + +#define LEVEL_ROW 2 /* Screen position for level info - used to show blocks killed */ +#define LEVEL_COL 2 /* id */ + +#define SCORE_ROW 2 /* Screen position for score info */ +#define SCORE_COL 73 /* id */ + +#define K_UP 'Q' /* Key up */ +#define K_DOWN 'A' /* Key down */ +#define K_LEFT 'O' /* Key left */ +#define K_RIGHT 'P' /* Key right */ +#define K_EXIT 'X' /* Key exit */ +#define K_SELECT 'S' /* Key select */ +#define K_KILL 'K' /* Key kill */ +#define K_GRAV_UP '1' /* Key gravity up */ +#define K_GRAV_LEFT '2' /* Key gravity left */ +#define K_GRAV_RIGHT '3' /* Key gravity right */ +#define K_GRAV_DOWN '4' /* Key gravity down */ + +/* VARIABLES +*/ + +WORD board[BOARD_ROWS]; /* Array for blocks values <> */ +WORD board_sel[BOARD_ROWS]; /* Array for blocks selections <> */ + +int score, /* Score */ + blocks, /* Blocks remaining */ + randindex, /* Random number used for generate blocks values */ + selected, /* Number of blocks selected */ + add_to_score, /* How much can I add to score if I kill selected blocks */ + automode, /* Non zero if automode is selected */ + ChkPlsCtr, /* CheckPlease variable */ + ChkPlsMul, /* id */ + ChkPlsVal; /* id */ + +/* MAIN FUNCTION +*/ + +main(argc, argv) +int argc, argv[]; +{ + int opt; + + /* SETUP KSLIB ENVIRONMENT + */ + + KbdScrStart(); + + /* SETUP SOME THINGS + */ + + board[0]="1234567890"; board_sel[0]="1234567890"; + board[1]="1234567890"; board_sel[1]="1234567890"; + board[2]="1234567890"; board_sel[2]="1234567890"; + board[3]="1234567890"; board_sel[3]="1234567890"; + board[4]="1234567890"; board_sel[4]="1234567890"; + board[5]="1234567890"; board_sel[5]="1234567890"; + board[6]="1234567890"; board_sel[6]="1234567890"; + board[7]="1234567890"; board_sel[7]="1234567890"; + board[8]="1234567890"; board_sel[8]="1234567890"; + board[9]="1234567890"; board_sel[9]="1234567890"; + + /* PLAY THE GAME, PLEASE + */ + + while((opt=Menu())) + { + if(opt==1) + Play(); + } + + /* GAME IS OVER - BEST TO CLEAN THE SCREEN + */ + + ScrClr(); ScrCurOn(); + + /* WE SAY GOOD BYE TO KSLIB ENVIRONMENT & WE SAY HELLO TO CP/M + */ + + KbdScrEnd(); +} + +/* MENU - RETURN 0 IF WE WANT TO END GAME, 1 IF WE WANT TO PLAY GAME, OR 2 IF WE WANT TO RETURN TO MENU +*/ + +Menu() +{ + ScrClr(); ScrCurOff(); + + ScrTitle(0, "BLOCKS"); + ScrTitle(1, "v1.0"); + ScrTitle(3, "(c) 2012 FLOPPY SOFTWARE"); + + ScrOutStrRC( 6, 25, "1 : PLAY GAME IN NORMAL MODE"); + ScrOutStrRC( 8, 25, "2 : PLAY GAME IN AUTOMATIC MODE"); + ScrOutStrRC(10, 25, "3 : SHOW HELP"); + + ScrOutStrRC(12, 25, "X : EXIT GAME"); + + ScrTitle(SCR_ROWS-2, "SELECT YOUR CHOICE"); + + randindex=0; /* This is used to generate a random number */ + + while(1) + { + while(!KbdChk()) + { + if(++randindex==BOARD_ROWS*BOARD_COLS) + randindex=0; + } + + switch(toupper(KbdIn())) + { + case '1' : automode=0; return 1; + case '2' : automode=1; return 1; + case '3' : Help(); return 2; + case 'X' : return 0; + } + } +} + +/* HELP -- SHOW HELP +*/ + +Help() +{ + ScrClr(); + + ScrTitle( 0, "BLOCKS"); + + ScrTitle( 2, "The object of the game is to remove all the"); + ScrTitle( 3, "blocks of the board."); + ScrTitle( 5, "You can select just one block, or a group of"); + ScrTitle( 6, "blocks of the same type."); + ScrTitle( 8, "Then, if you are in the normal mode, you can place all"); + ScrTitle( 9, "the blocks against a side (top, bottom, left or right)."); + ScrTitle(11, "If you are in the automatic mode, the blocks rows will be"); + ScrTitle(12, "placed on the bottom side of the board, and the columns"); + ScrTitle(13, "will be placed on the middle of the board."); + ScrTitle(15, "The partial score is the square of the number of"); + ScrTitle(16, "blocks selected."); + ScrTitle(18, "The special block 'X', multiplies that result by 10."); + ScrTitle(20, "Good luck!"); + ScrTitle(22, "PRESS ANY KEY"); + + KbdIn(); +} + +/* PLAY THE GAME, PLEASE +*/ + +Play() +{ + int row, col, run, val, key; + + /* SETUP VARIABLES & BOARD + */ + + row=col=selected=score=0; run=1; + + blocks=BOARD_ROWS*BOARD_COLS; + + SetupBoard(); + + /* DRAW SCREEN + */ + + ScrClr(); + + ScrBox(0, 0, SCR_ROWS-1, SCR_COLS, NULL); ScrTitle(0, "| BLOCKS |"); + + ScrOutStrRC(LEVEL_ROW, LEVEL_COL, "BLOCKS"); PrintBlocks(); + + ScrOutStrRC(SCORE_ROW, SCORE_COL, "SCORE"); PrintScore(); + + + ScrBox(BORDER_ROW, BORDER_COL, BOARD_ROWS*BLOCK_ROWS+2, BOARD_COLS*BLOCK_COLS+2, NULL); + + + PaintBoard(); + + + if(!automode) + { + scrTitle(BORDER_ROW-1, "1"); + + ScrTitle(BORDER_ROW+BOARD_ROWS+2, "4"); + + ScrOutStrRC(BORDER_ROW+5, BORDER_COL-2, "2"); + + ScrOutStrRC(BORDER_ROW+5, BORDER_COL+BOARD_COLS*BLOCK_COLS+3, "3"); + } + + ScrOutStrRC(BORDER_ROW+3, 7, " Q"); + ScrOutStrRC(BORDER_ROW+4, 7, " |"); + ScrOutStrRC(BORDER_ROW+5, 7, "O --x-- P"); + ScrOutStrRC(BORDER_ROW+6, 7, " |"); + ScrOutStrRC(BORDER_ROW+7, 7, " A"); + + ScrOutStrRC(BORDER_ROW+4, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, "S> SELECT BLOCKS"); + ScrOutStrRC(BORDER_ROW+5, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, "K> KILL BLOCKS"); + ScrOutStrRC(BORDER_ROW+6, BORDER_COL+BOARD_COLS*BLOCK_COLS+8, "X> EXIT"); + + /* PLAY GAME + */ + + while(run) + { + /* DRAW CURSOR + */ + + ScrSetRC(BOARD_ROW+row*BLOCK_ROWS, BOARD_COL+col*BLOCK_COLS+1); ScrCurOn(); + + /* USER ACTION + */ + + key=toupper(KbdIn()); + + ScrCurOff(); + + switch(key) + { + case K_UP: if(row) --row; + break; + + case K_DOWN: if(++row==BOARD_ROWS) --row; + break; + + case K_LEFT: if(col) --col; + break; + + case K_RIGHT: if(++col==BOARD_COLS) -- col; + break; + + case K_SELECT: /* CHECK FOR VALID BLOCKS + */ + + val=GetBlock(row, col); + + if(val==BLOCK_EMPTY || val=='X') + break; + + /* CHECK IF ALREADY SELECTED + */ + + if(TstSelBlock(row, col)) + break; + + /* UNSELECT PREVIOUS SELECTION + */ + + if(selected) + { + /* HEY! TOO MUCH WORK IF ONLY 1 SELECTED */ + + UnSelAllBlocks(); + PaintBoard(); + } + + /* SELECT + */ + + selected=CheckPlease(row, col); + + add_to_score=selected*selected*ChkPlsMul; + + PrintSelec(); + + break; + + case K_KILL: if(selected) + { + /* HEY! TOO MUCH WORK IF ONLY 1 SELECTED */ + + KillSelBlocks(); + + score+=add_to_score; + + PrintScore(); + + blocks-=selected; PrintBlocks(); + + selected=add_to_score=0; + + PrintSelec(); + + if(!blocks) + { + GameOver(); run=0; + } + else if(automode) + { + DoAutoMode(); PaintBoard(); + } + } + + break; + + case K_GRAV_UP: if(automode) + break; + + GravityUp(); + + if(selected) + { + UnSelAllBlocks(); selected=0; + } + + PaintBoard(); + + break; + + case K_GRAV_DOWN: + if(automode) + break; + + GravityDown(); + + if(selected) + { + UnSelAllBlocks(); selected=0; + } + + PaintBoard(); + + break; + + case K_GRAV_LEFT: + if(automode) + break; + + GravityLeft(); + + if(selected) + { + UnSelAllBlocks(); selected=0; + } + + PaintBoard(); + + break; + + case K_GRAV_RIGHT: + if(automode) + break; + + GravityRight(); + + if(selected) + { + UnSelAllBlocks(); selected=0; + } + + PaintBoard(); + + break; + + case K_EXIT : + PrintMsg("ARE YOU SURE Y/N?"); + + if(toupper(KbdIn())=='Y') + run=0; + else + PrintMsg(""); + + break; + } + } +} + +/* GAME IS OVER +*/ + +GameOver() +{ + ScrTitle(BORDER_ROW+4, "*** GAME OVER ***"); + + PrintMsg("PRESS ANY KEY"); + + KbdIn(); +} + +/* SETUP BOARD +*/ + +SetupBoard() +{ + int r, c; unsigned char *values; + + /* 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 (width 100) */ + values="4321242333123432411123443444432111234332222343331214422444441243444132222311114242423111133222441111"; + + for(r=0; r!=BOARD_ROWS; ++r) + { + for(c=0; c!=BOARD_COLS; ++c) + { + SetBlock(r, c, values[randindex]); + + UnSelBlock(r, c); + + if(++randindex==BOARD_ROWS*BOARD_COLS) + randindex=0; + } + } + + if(randindex<25) + SetBlock(2, 5, 'X'); + else if(randindex<50) + SetBlock(9, 4, 'X'); + else if(randindex<75) + SetBlock(4, 8, 'X'); + else + SetBlock(7, 3, 'X'); +} + +/* SET BLOCK WITH VALUE +*/ + +SetBlock(row, col, value) +int row, col, value; +{ + char *ptr; + + ptr=board[row]; + + ptr[col]=value; +} + +/* GET BLOCK VALUE +*/ + +GetBlock(row, col) +int row, col; +{ + char *ptr; + + ptr=board[row]; + + return ptr[col]; +} + +/* SELECT BLOCK +*/ + +SelBlock(row, col) +int row, col; +{ + char *ptr; + + ptr=board_sel[row]; + + ptr[col]=1; +} + +/* UNSELECT BLOCK +*/ + +UnSelBlock(row, col) +int row, col; +{ + char *ptr; + + ptr=board_sel[row]; + + ptr[col]=0; +} + +/* UNSELECT ALL BLOCKS +*/ + +UnSelAllBlocks() +{ + int r, c; + + for(r=0; r!=BOARD_ROWS; ++r) + for(c=0; c!=BOARD_COLS; ++c) + UnSelBlock(r, c); +} + +/* TEST IF A BLOCK IS SELECTED +*/ + +TstSelBlock(row, col) +int row, col; +{ + char *ptr; + + ptr=board_sel[row]; + + return ptr[col]; +} + +/* KILL SELECTED BLOCKS +*/ + +KillSelBlocks() +{ + int r, c; + + for(r=0; r!=BOARD_ROWS; ++r) + { + for(c=0; c!=BOARD_COLS; ++c) + { + if(TstSelBlock(r, c)) + { + SetBlock(r, c, BLOCK_EMPTY); + UnSelBlock(r, c); + PaintBlock(r, c); + } + } + } +} + +/* PAINT BLOCK +*/ + +PaintBlock(row, col) +int row, col; +{ + int selected; + + ScrSetRC(BOARD_ROW+row*BLOCK_ROWS, BOARD_COL+col*BLOCK_COLS); + + ScrOut((selected=TstSelBlock(row, col)) ? ':' : ' '); + + switch(GetBlock(row, col)) + { + case '1' : ScrOut('$'); break; + case '2' : ScrOut('O'); break; + case '3' : ScrOut('+'); break; + case '4' : ScrOut('#'); break; + case 'X' : ScrOut('X'); break; + case BLOCK_EMPTY : ScrOut(' '); break; + default : ScrOut('?'); break; + } + + ScrOut(selected ? ':' : ' '); +} + +/* PAINT ALL BLOCKS +*/ + +PaintBoard() +{ + int r, c; + + for(r=0; r!=BOARD_ROWS; ++r) + for(c=0; c!=BOARD_COLS; ++c) + PaintBlock(r, c); +} + +/* CHECK WHAT BLOCKS CAN BE SELECTED - SETUP THREE VARIABLES +*/ + +CheckPlease(row, col) +int row, col; +{ + ChkPlsCtr=0; ChkPlsMul=1; ChkPlsVal=GetBlock(row, col); + + ChkPls2(row, col); + + return ChkPlsCtr; +} + +ChkPls2(row, col) +int row, col; +{ + int val; + + SelBlock(row, col); PaintBlock(row, col); + + if(GetBlock(row, col)=='X') + ChkPlsMul=10; + + if(row) + { + if(((val=GetBlock(row-1, col))==ChkPlsVal || val=='X') && (!TstSelBlock(row-1, col))) + ChkPls2(row-1, col); + } + + if(col<(BOARD_COLS-1)) + { + if(((val=GetBlock(row, col+1))==ChkPlsVal || val=='X') && (!TstSelBlock(row, col+1))) + ChkPls2(row, col+1); + } + + if(row<(BOARD_ROWS-1)) + { + if(((val=GetBlock(row+1, col))==ChkPlsVal || val=='X') && (!TstSelBlock(row+1, col))) + ChkPls2(row+1, col); + } + + if(col) + { + if(((val=GetBlock(row, col-1))==ChkPlsVal || val=='X') && (!TstSelBlock(row, col-1))) + ChkPls2(row, col-1); + } + + ++ChkPlsCtr; +} + +/* GRAVITY DOWN (BOARD BOTTOM) +*/ + +GravityDown() +{ + int r, c, i, blk, row[BOARD_ROWS]; + + for(c=0; c!=BOARD_COLS; ++c) + { + for((r=i=BOARD_ROWS-1); r!=-1; --r) + { + if((blk=GetBlock(r, c))!=BLOCK_EMPTY) + row[i--]=blk; + } + + while(i!=-1) + row[i--]=BLOCK_EMPTY; + + for(r=0; r!=BOARD_ROWS; ++r) + SetBlock(r, c, row[r]); + } +} + +/* GRAVITY UP (WE PUT BLOCKS ON BOARD TOP) +*/ + +GravityUp() +{ + int r, c, i, blk, row[BOARD_ROWS]; + + for(c=0; c!=BOARD_COLS; ++c) + { + for((r=i=0); r!=BOARD_ROWS; ++r) + { + if((blk=GetBlock(r, c))!=BLOCK_EMPTY) + row[i++]=blk; + } + + while(i!=BOARD_ROWS) + row[i++]=BLOCK_EMPTY; + + for(r=0; r!=BOARD_ROWS; ++r) + SetBlock(r, c, row[r]); + } +} + +/* GRAVITY LEFT (WE PUT BLOCKS ON BOARD LEFT) +*/ + +GravityLeft() +{ + int r, c, i, blk, col[BOARD_ROWS]; + + for(r=0; r!=BOARD_ROWS; ++r) + { + for((c=i=0); c!=BOARD_COLS; ++c) + { + if((blk=GetBlock(r, c))!=BLOCK_EMPTY) + col[i++]=blk; + } + + while(i!=BOARD_COLS) + col[i++]=BLOCK_EMPTY; + + for(c=0; c!=BOARD_COLS; ++c) + SetBlock(r, c, col[c]); + } +} + +/* GRAVITY RIGHT (WE PUT BLOCKS ON BOARD RIGHT) +*/ + +GravityRight() +{ + int r, c, i, blk, col[BOARD_ROWS]; + + for(r=0; r!=BOARD_ROWS; ++r) + { + for((c=i=BOARD_COLS-1); c!=-1; --c) + { + if((blk=GetBlock(r, c))!=BLOCK_EMPTY) + col[i--]=blk; + } + + while(i!=-1) + col[i--]=BLOCK_EMPTY; + + for(c=0; c!=BOARD_COLS; ++c) + SetBlock(r, c, col[c]); + } +} + +/* AUTOMATIC MODE (WE PUT BLOKS FIRST ON BOARD BOTTOM, THEN WE CENTER THE COLUMNS) +*/ + +DoAutoMode() +{ + int r, c, i, pos, cols; + + GravityDown(); + + /* COPY NON EMPTY COLUMNS TO THE LEFT + */ + + for(i=c=0; c!=BOARD_COLS; ++c) + { + if(GetBlock(BOARD_ROWS-1, c) != BLOCK_EMPTY) + { + if(i!=c) + { + for(r=0; r!=BOARD_ROWS; ++r) + SetBlock(r, i, GetBlock(r, c)); + } + + ++i; + } + } + + /* DO NOTHING IF ALL COLUMNS ARE NON EMPTY + */ + + if(i==BOARD_COLS) + return; + + /* CALCULATE WHERE TO PUT THE COLUMNS + */ + + pos=(BOARD_COLS-i)/2; + + /* COPY COLUMNS WITHOUT OVERLAP + */ + + cols=i; + + for(c=pos+i-1; i!=-1; --c) + { + --i; + + for(r=0; r!=BOARD_ROWS; ++r) + SetBlock(r, c, GetBlock(r, i)); + } + + /* EMPTY COLUMNS TO THE LEFT + */ + + for(c=0; c!=pos; ++c) + for(r=0; r!=BOARD_ROWS; ++r) + SetBlock(r, c, BLOCK_EMPTY); + + /* EMPTY COLUMNS TO THE RIGHT + */ + + for(c=pos+cols; c!=BOARD_COLS; ++c) + for(r=0; r!=BOARD_ROWS; ++r) + SetBlock(r, c, BLOCK_EMPTY); +} + +/* PRINT HOW MANY BLOCKS ARE REMAINING +*/ + +PrintBlocks() +{ + char str[6]; + + sprintf(str, "%d ", blocks); + + ScrOutStrRC(LEVEL_ROW+1, LEVEL_COL, str); +} + +/* PRINT SCORE +*/ + +PrintScore() +{ + char str[6]; + + sprintf(str, "%5d", score); + + ScrOutStrRC(SCORE_ROW+1, SCORE_COL, str); +} + +/* PRINT SELECTION INFO. +*/ + +PrintSelec() +{ + char str[7]; + + sprintf(str, "x%d ", selected); + + ScrOutStrRC(LEVEL_ROW+3, LEVEL_COL, str); + + sprintf(str, "%5d+", add_to_score); + + ScrOutStrRC(SCORE_ROW+3, SCORE_COL-1, str); +} + +/* PRINT TEXT STRING (MESSAGE) +*/ + +PrintMsg(str) +char *str; +{ + ScrSetRC(SCR_ROWS-4, 2); + ScrOutRpt(' ', SCR_COLS-4); + + ScrTitle(SCR_ROWS-4, str); +} diff --git a/Blocks/ctype.h b/Blocks/ctype.h new file mode 100644 index 0000000..bad2be9 --- /dev/null +++ b/Blocks/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/Blocks/kslib.h b/Blocks/kslib.h new file mode 100644 index 0000000..221ba67 --- /dev/null +++ b/Blocks/kslib.h @@ -0,0 +1,158 @@ +/* kslib.h + + Keyboard & screen functions library for CP/M & MESCC - Mike's Enhanced Small C Compiler. + + Copyright (c) 2012 Miguel I. Garcia Lopez, Valencia, 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 2, 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. + + Revisions: + + 02 Jul 2012 : Version 1.0 for 24x80 VT52 screen. + 10 Mar 2020 : Version 1.1 for 24x80 VT100 screen. + + Functions: + + int KbdScrStart(void) + int KbdScrEnd(void) + int KbdIn(void) + int KbdChk(void) + int KbdStat(void) + void ScrOut(ch) + void ScrOutStr(str) + void ScrSetRC(row, col) + void ScrCurOn(void) + void ScrCurOff(void) + void ScrClr(void) +*/ + +#define SCR_ROWS 24 +#define SCR_COLS 80 + +#asm + +xDirConInSt: + jp 0 +xDirConIn: + jp 0 +xDirConOut: + jp 0 + +KbdScrStart: + ld hl,(1) + inc hl + inc hl + inc hl ;HL = JP CONST (BIOS VECTOR) + ld de,xDirConInSt + ld bc,9 + ldir + ld hl,0 ;Success + ret + +KbdScrEnd: + ld hl,0 ;Success + ret + +KbdIn: + call xDirConIn +KbdIn2: + ld h,0 + ld l,a + ret + +KbdChk: + call xDirConInSt + ld h,0 + ld l,a + ret + +KbdStat: + call xDirConInSt + or a + jr nz,KbdIn + jr KbdIn2 + +ScrOut: + ld c,l + jp xDirConOut + +ScrOutStr: + ld a,(hl) + or a + ret z + push hl + ld c,a + call xDirConOut + pop hl + inc hl + jr ScrOutStr + +#endasm + +ScrSetRC(row, col) +int row, col; +{ + char str[9]; + sprintf(str, "%c[%d;%dH", 27, row+1, col+1); + ScrOutStr(str); +} + +#asm + +ScrCurOn: + call xScrEsc + ld c,'[' + call xDirConOut + ld c,'?' + call xDirConOut + ld c,'2' + call xDirConOut + ld c,'5' + call xDirConOut + ld c,'h' + jp xDirConOut + +ScrCurOff: + call xScrEsc + ld c,'[' + call xDirConOut + ld c,'?' + call xDirConOut + ld c,'2' + call xDirConOut + ld c,'5' + call xDirConOut + ld c,'l' + jp xDirConOut + +ScrClr: + call xScrEsc + ld c,'[' + call xDirConOut + ld c,'2' + call xDirConOut + ld c,'J' + call xDirConOut + call xScrEsc + ld c,'[' + call xDirConOut + ld c,'H' + jp xDirConOut + +xScrEsc: + ld c,27 + jp xDirConOut + +#endasm diff --git a/Blocks/kslibfun.h b/Blocks/kslibfun.h new file mode 100644 index 0000000..b8955d1 --- /dev/null +++ b/Blocks/kslibfun.h @@ -0,0 +1,72 @@ +/* kslibfun.h + + More functions for kslib.h for CP/M and MESCC - Mike's Enhanced Small C Compiler. + + Copyright (c) 2012 Miguel I. Garcia Lopez, Valencia, 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 2, 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. + + Revisions: + + 02 Jul 2012 : Version 1.0. + + Functions: + + ScrOutRpt(ch, times) + ScrOutStrRC(row, col, str) + ScrBox(row, col, rows, cols, fill) + ScrTitle(row, str) +*/ + +ScrOutRpt(ch, times) +int ch, times; +{ + while(times--) + ScrOut(ch); +} + +ScrOutStrRC(row, col, str) +int row, col; char *str; +{ + ScrSetRC(row, col); ScrOutStr(str); +} + +ScrBox(row, col, rows, cols, fill) +int row, col, rows, cols, fill; +{ + int i; + + ScrSetRC(row++, col); ScrOut('+'); + ScrOutRpt('-', cols-2); + ScrOut('+'); + + for(i=rows-2; i; --i) + { + ScrSetRC(row, col); ScrOut('|'); + if(fill!=NULL) + ScrOutRpt(fill, cols-2); + ScrSetRC(row++, col+cols-1); ScrOut('|'); + } + + ScrSetRC(row, col); ScrOut('+'); + ScrOutRpt('-', cols-2); + ScrOut('+'); +} + +ScrTitle(row, str) +int row; char *str; +{ + ScrOutStrRC(row, (SCR_COLS-strlen(str))/2, str); +} diff --git a/Blocks/mescc.h b/Blocks/mescc.h new file mode 100644 index 0000000..d826374 --- /dev/null +++ b/Blocks/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/Blocks/sprintf.h b/Blocks/sprintf.h new file mode 100644 index 0000000..00fa6a5 --- /dev/null +++ b/Blocks/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/Blocks/string.h b/Blocks/string.h new file mode 100644 index 0000000..0cca902 --- /dev/null +++ b/Blocks/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/Blocks/xprintf.h b/Blocks/xprintf.h new file mode 100644 index 0000000..2a22a4b --- /dev/null +++ b/Blocks/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 b9d85f5..67d022c 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ See this repository: https://git.imzadi.de/acn/backgammon-vt100 * [Cpmtris](cpmtris/) * [Sokoban](Sokoban/) * [Battleships](Battleships/) +* [Blocks](Blocks/) ## More Games on the Interwebs