"2k Sweeper of Mines", by chill
BASIC and Machine Language versions
chill@gol.com

A less-than-2-kilobyte entry for the 2001 Minigame competition
http://demo.raww.net/minigame/
mailto:minigame@demo.raww.net


The Idea
========
This is just great.  No, I'm not bragging about my entry (I'll do that later),
I'm talking about the idea of this competition.
- Several of the most popular 8-bits of their day - you get to pick the one
  you're most nostalgiac about.
- BASIC or assembly, or both! - whichever you're comfortable with or want to
  tackle.
- Write it small - a "put up or shutup"-challenge like a red flag to a bull
  for all of us who rant night and day about code bloat.
- "No prizes, it's just for fun..." - not that I'd mind winning something cool,
  but if somebody had to put up prizes, a community event like this would never
  happen.  And my 8-bit experiences *are* for fun!


The Game
========
Anyone who has had a few minutes to kill on a Windows machine has probably
played Minesweeper, and there are versions of this game for many OSen.  Now
we have one for the CBM line of 8-bits, too.

I won't bore people by explaining the rules in great detail... if you were
able to download and unzip this, I'm sure you've played Minesweeper somewhere
before.  Use the CRSR keys to move, press SPACE to reveal the square under the
cursor (neighbouring squares will automatically be revealed if safe), use
ENTER to toggle the marking of an unrevealed square.  While marking a sqaure
prevents you from accidentally revealing it and gives you a visual assist in
tracking where you think mines might be, the goal of the game is not to mark
all the mines but to reveal all squares EXCEPT the ones which contain the
nasty mines.

No "Beginner" or "Advanced" configurations.  You choose the playfield
dimensions and number of mines to place within it.  Because of the slowness
of my program, it doesn't keep track of how long you take to complete a game.
You either win or lose.


The Program:  BASIC VERSION
===========================
I wrote this entirely in BASIC because, when I first checked out the
competition website last week, there were no BASIC entries.  For the average
8-bit user, BASIC was more accessible than machine language in many ways.
I know I always learned something as I eagerly devoured the program listings
in each months issue of COMPUTE!'s Gazette.  This may sound vain, but I hope
somebody learns something from my contribution.  I wish the 2k limit allowed
me a few REMs to comment my code more, although as you can see from this
text file I'd probably just ramble on and on and on and on.  Comment bloat?

While my entry is for the C64, I have written it so that it should run on
a range of CBM 8-bit machines... those which I can test it on using VICE,
anyway.  C64, C128, VIC20, CBM2 & PET appear to work and the game tries its
best to determine the available screen width.  No POKEs, PEEKs, SYSs, USRs,
or color codes are used anywhere in the program.  The advantage is tremendous
portability.  The disadvantages are slow gameplay and bland, boring monochrome
on all platforms.  The austerity doesn't concern me, but I found myself
toggling Warp mode in x64 more than a few times.

August 26, 2001


The Program:  MACHINE LANGUAGE VERSION
======================================
I originally hoped to be able to squeeze this into a 512-byte entry but,
modesty aside, I'm pretty damn lousy at programming in assembly.  The only
other project like this I've tackled was a demo I wrote about 6 years ago.
Finishing just a day before the compo deadline, it has taken me, on and off,
one whole month since submitting the original BASIC version to complete this
machine language version.  Regardless of whether the result impresses anyone
else or not, I'm pleased with it and what I've had to learn in the process of
accomplishing this.

Four notable changes from the BASIC version:
1)  Written only for the C64.  It's actually still fairly generic, but would
    need a few tweaks for it to ever work right on other CBMs.
2)  Color!  Having given up the generic aspect, I've added some color and
    even make limited use of Extended Background Color mode (a first for me).
3)  Rather than typing the numbers for your desired minefield parameters,
    use the CURSOR keys to increase/decrease the shown value.  Press ENTER
    to select the shown value.
4)  Warp mode no longer necessary.

The source code for this version is available for the asking.  I don't include
it here because... well... it's 1800+ lines of embarassing naivete.

September 29, 2001

