----- MonoSol v1.1, 3/2022, ClassicBits.net -----

MonoSol, Monochrome Solitaire, is a tiny Klondike Solitaire game for DOS.  It's free for personal use.  Basic controls are displayed when the game first launches.  Just select a source then a destination by pressing the key associated to the pile.  

Full controls are listed at the end of this document.

---FILES---

MONOSOL.COM     Keyboard only       3KB (2953 bytes native)
MONOSOLM.COM	Keyboard and Mouse  3KB (3072 bytes compressed, 3247 bytes native)

---TIPS---

The gamestate can be saved/restored at any time using the +/- keys respectively.  A gamestate is automatically saved when a new game is started so pressing '-' will restart the current game if you haven't yet saved a new gamestate.

Upon launch a very basic attempt is made to detect CGA, EGA, or VGA graphics.  Modes can be changed on the fly with F1-F4 keys.

TAB or Right-Click will automatically send a card to a foundation pile (if legal).

---FEATURES---

Runs on anything (DOS, 8086 and up, CGA-VGA)
Fits anywhere (small 3KB footprint)
Easy viewing on vintage screens
Save/Restore gamestate
Playable with a keyboard or a mouse

---VERSION HISTORY---

1.0	03/2022	Initial release
1.1 11/2022	Bug fixes, optimization, performance, added ending screen

---UNDER THE HOOD---

MonoSol was written in x86 Assembly and assembled with NASM.
	
Each pile index is hex 1-D as shown below and those	are also the
associated keyboard keys.
	Row1:	8 9   A B C D	8=Deck, 9=Waste, A-D=Foundations	
	Row0:	1 2 3 4 5 6 7	1-7=Tableau Pile's

Each card is one byte.  Cards are popped and pushed to/from piles strucs
    BITS:   7: Unused
            6: Flag,  0=FaceUp, 1=FaceDown
          5-4: Suit, 00=Diamond, 01=Club, 10=Heart, 11=Spade
            4: Color, 0=Red, 1=Black
          3-0: Face Value 1-13

Drawing uses the Int 10h set-pixel routine to keep size down while maintaining compatibility with many video modes.  To retain some level of performance it draws only the minimum pixels required. Cards are drawn in white and erased by re-drawing them in black.  This seems to perform fine even on slow computers.

There is a simple Rules Engine to determine the legality of actions.  Each pile has a one byte rule for which each of the 8-bits defines what's allowed.  When a card move is requested the source and destination pile rules are tested and the move is either permitted or denied.

---THANKS---

Oscar Toledo G. (nanochess.org) did some preliminary testing and identified a few bugs. This resolved crashing in Windows XP under VirtualBox.  Oscar's games are also what first inspired me to try writing my own.
https://nanochess.org
	
To draw circles I was impressed with this code and stripped it down then modified to suit my needs.
https://computer-programming-forum.com/45-asm/67a67818aff8a94a.htm

My shuffling routine was too big so I used some parts of this concept, which I found to be quite elegant.
https://www.geeksforgeeks.org/shuffle-a-deck-of-cards-3/

---MOUSE CONTROLS--- (requires a mouse driver)
NOTE: CuteMouse doesn't support AT&T 6300 640x400 mode (doesn't draw cursor)

Left click the source then click the destination
Right click a card to auto-send to a foundation pile
Click N for New Game
Click X to Quit

---KEYBOARD CONTROLS---
1-7: selects a tableau pile
A-D: selects a foundation pile
8/SPACE: deals 3 cards
9/ENTER: select card from draw pile
TAB: auto-send selected card to a foundation pile
Up/Down: Modify card selection within pile
+: Save game state
-: Restore game state	
n: New game
x: Quit game
F1: 640x200x2 CGA Monochrome
F2: 640x400x2 ATT Monochrome
F3: 640x350x2 EGA Monochrome
F4: 640x480x2 VGA Monochrome
