Wednesday, 9 June 2021

APF and Some Matra Alice Stuff

I've been taking some inspiration from the APF Imagination Machine for many of my recent BASIC 10-Liner programs.  However, what got me on to the kick was working a much more substantial programming project.  This was a complete re-code, based on videos and documentation, of the APF program Mission Improbable: Operation Alpha.  I wandered into some videos on Youtube of someone playing APF games. There were some nice playthroughs of some of the best machine language arcade games for the system.  But there were also videos showing humbler programs, including many that could easily be implemented in BASIC (although on the APF they were machine language). Mission Improbable was one these.

Getting APF cassette games running on the emulators for the APF takes some struggle.  I found converting the files to WAVs helpful.  However, I couldn't get this one to load properly or run. So I don't know if some or all of it was made in Basic.  However, I decided that I could probably just re-program the game.  I took a slow and careful approach (unlike when I'm programming 10Liners).  First I developed the menu systems and all the complex mission selection stuff.  Then I drew the main screen graphic.  Then I converted a variation of minesweeper to replace the alternate escape route option of the original.  Finally, I made the main game itself.  You can find a demo of the finished product here:

The toughest part was getting the flashlight beam effect of the roving guard. Besides that, the movement and other animations are pretty standard fare from other games I've made. Finally, my son Charlie used his finely tuned musical ear to recreate the win refrain-- The Stars and Stripes forever, although it first sounded like "Be kind to your web footed friends" to me.

Besides altering the escape route I also slightly altered the missions. Especially the Assassinate option.  The original had some complex activity of going into a dark room and listening to tones to zero in on the hiding Commandant. The APF has better sound generation than the MC-10, so perhaps such an activity would work, but the main game screen was already a little faster than the original game, so I opted for a moving Commandant that forces you to try to get close to him before he moves again.  He also is always flanked by two machine guns, which get left behind when he moves.  So the map screen gets progressively more difficult to navigate without getting shot.  I think it's an adequate replacement for the original mission activity.  

The final step was tuning the timer to make for challenge, but without making it mission impossible.  I've hopefully hit the right balance.  I had to play quite a few games to satisfy myself.  I still don't know if I've got it right, but considering that I will likely be the only person to play the game, besides my increasingly reluctant beta-tester son Charlie, I eventually had to just pull the plug.  Since I played so much, it's often hard to tell if levels are too easy, or whether they just seem so because I've got so good (and as the programmer have inside knowledge).

Another system that I have taken actual source code from is the Matra Alice.  I'd seen "Coloric" listed for many years on Alice software sites, but as it was a puzzle game (and not an "action") game I always put it on the back-burner for porting.  However, I decided to finally get around to it.  Robert Sieg has been discussion Alice graphics on the Facebook group, and his comments reminded me that the Alice, despite its powerful new graphic chip, maintained a certain basic level of compatibility with the old MC-10 semigraphic 4 screen.  In other conversions I've found that there are often simpler MC-10 graphics hiding under what is essentially a thin veneer of extra special effect based on the new graphic chip.

This turned out to be the case with Coloric.  Although it was placed on 40X24 character Alice screen, it still used standard SET/RESET for a lot of the basic work..  I just had to shift things into the smaller 32X16 space.  I found that every thing fit.  I just had to omit some of the embellishments and minor extra instructions present on the screen.

Now the MC-10 has an interesting puzzle game from a French 8-bit computer, translated to English.  I don't think I've played anything like it.  The French, like the Japanese, make some interesting puzzle games.  Here are my translations of the instructions:

Jumping Jack: Yet Another 10Liner and Some Updates

Oops I did it again.  It's a dull time of the year.  I sit waiting for emails to come back from students who need advising for the next academic year.  Otherwise, I'm reading or attending virtual meetings. But to break up the monotony, and sometimes just to escape the heat, its nice to head down into the basement and do some Basic coding.

I've got a third entry for the ASCII Basic 10Liner Jam on  It's based on a game for the Sinclair Spectrum that I stumbled across called Jumping Jack.  I had originally envisioned a game using Semi-graphics 6 mode.

  I'd even worked up an elaborate set of characters.

But when the 10Liner contest came along I decided to try for something less complex.  Obviously, I put the SG6 version on the shelf because getting the game logic running would require more of a time investment than I'm willing to give right now.  I needed a simpler set of projects.  The 10 line limitation really provides that.  Perhaps some day I'll work up a more full version in SG6 using Greg Dionne's Basic compiler.

In the meantime here is what my first stab at making little ASCII Basic version of the game looked like:

I eventually cleaned it up a little in terms of animation of the main character and his final jump up off the screen, along with some other tweaks, including the ability to type in a difficulty level from 1 to 3 at the "new game" prompt.  Here's a vid of the latest rendition:

If you want to compare it to the original Sinclair version the following is a Vid on Youtube showing the game play.  Mine is obviously a little more finicky than the original.  But that's what you get when you are limited to 10 Lines.  No frills.

JUMPJACK can be played online here using a JAVASCRIPT emulator.  Just select JUMPJACK from the cassette menu and type RUN in the main screen.

I also made some updates to my DFENDER entry (it can also be played at the link above).  I made the trail behind your cursor stay visible.  This makes more apparent where you have switched the background character to the ASCII values for the buff coloured semigraphic characters. This is all you have to do to explode the incoming missiles. When incoming missile characters are set into place, if they notice that the underlying character they are replaying is from the different colour set in the ASCII values above 128 (the 8 colors are represented in 8, 16 character sets) they explode and reset to the top of the screen.  So although you don't have to actually see the "trail" for this to work, people without knowledge of semigraphics might not be aware that, so I made the trail visible.  Now I'm thinking that it is like a trail of your anti-missile missile as it shoots through the sky.  I also added a little red explosion with the space saved in the code by removing the need to reset the pointer character, and some other reorganizing I did.


Monday, 7 June 2021

Pac-Rat: 10-Liner Game for Game Jam 2021

I have another game for the ASCII Basic 10Liner programming Jam. It's also inspired by the APF Imagination Machine. Since that early 8-bit computer/game system it shares the same video chip as the MC-10 (and the Coco and Dragon), it is a good place to look for inspiration for game ideas.  The original was a two player game, with each player using their paddles to steer their "rat" through a maze to get to the cheese first.  I thought it might be possible to get a very concise AI to play against.  But the 72 character line limit was just a wee bit too confining to get that in along with the maze and human player with movement.  In the end I settled for a simple game of collecting cheeses as quickly as possible.  They only stay in place a brief time, so you have to plan the quickest and most efficient routes to get to them before they disappear.  You get 30 cheeses, so that's your highest possible score.

The following is a video of the APF game.  It's a little slower in its movement.  It didn't take as much back in the 70s to impress.  The playing board is just made up of solid color characters from the character set above 128.

The game can be played from my website.  Just select the "PACRAT" from the cassette menu.  Then type RUN and hit <Enter>

The source can be viewed here:

Saturday, 5 June 2021

Defender: 10-Liner Game for Game Jam 2021

Working on a project for the Basic 10-Liner Contest being run on based on the image of the city from a APF Imagination Machine TS-1000 1970s game console:

My version is written in Micro Color Basic on my favourite 8-bit computer, and the first computer I ever owned, the TRS-80 Micro Color Computer 10 or MC-10.  Some call it the Poco because it is the little brother to the Tandy Color Computer.  It's a budget 8-bit micro along the lines of the Sinclair ZX-81.

The game can be played at my website using Mike Tinnes TRS-80 MC-10 Javascript emulator. Just select DEFENDER from the cassette menu, and the type RUN in the main screen and hit <Enter>. Type list to see some instructions listed at the end as REM statements.

Here is the Basic code for the game:

0 D(T)=RND(0):I(T)=RND(31):J(T)=0:IFRND(2)=1THEND(T)=-D(T):I(T)=I(T)+32

1 CLS0:?@320,"€€€€€€€€€€€—’€€€€€€€€€€““’€€€€€€€€€€€€óÿò€‘››€€€€€€£££“›";

2 ?"›š€€€€€€€€óóò€ûúþú•——€ÞÞÞÞÚ««¯›››š€þþþú€€óûûûòûÿýú———’ÞÞÞÞÚ««¯›››š";

3 ?"€þþûú€€ûûûûúûþþú››››ÞÞÞÞÚ««¯›››šóûþûú€®ûûÿüúûþÿÿ›š•—ßÜßÜß««®››žŸþ÷";



6 RESET(X,Y):X=X+A:X=X-(X<0)+(X>63):Y=Y+B:Y=Y-(Y<0)+(Y>19):SET(X,Y,5)


8 T=RND(5):I(T)=I(T)+D(T):J(T)=J(T)+1:IFPOINT(I(T),J(T))>1THENH=H+1:GOTO

9 SET(I(T),J(T),0):?@508,H;:ON-(H<10)GOTO4:?"SCORE"S;:INPUT"enter";A:RUN

10 REM   1         2         3         4         5         6         7  

11 REM789012345678901234567890123456789012345678901234567890123456789012









You'll notice in line 8 the GOTO has no line number.  I'm taking advantage of the fact that if no line number is provided then Basic assumes line 0, which is the line I want it to go to.  This keeps me under the 72 character limit.

Lines 1-3 are the ASCII characters in strings for the city.  These characters are from the different block characters in the Motorola MC6847 character set, values 128-255.

Line 0 sets random starting points for the incoming missiles.

Lines 4-5 peek the keyboard input buffer so I can get continuous input in 8 directions using the AWSZ keys.  If you hold down two at a time, you can get diagonal motion.

Key Input:

    AW      W       WS

           \      |      /

          A     +    W

            /     |     \ 

    AZ        Z        SZ

Lines 6-9 move the targeting cursor and the missiles.  Line 9 also has the restart instructions for the end of the game.


Tuesday, 18 May 2021

An Iron Curtain Adventure: Miroslav Fídler's P.R.E.S.T.A.V.B.A

In the past I ported a Hungarian game and translated it to English (A Hös Lovag) with the help of Google and a lot of guess work. I recently came across another game from "behind the Iron curtain." It's a Czech game with an anti-Soviet theme, written as a protest when Czechoslovakia was still under the thumb of the USSR. It’s called P.R.E.S.T.A.V.B.A.

I picked up on this fascinating game from Arron Reed’s fascinating writeup. The author, Miroslav Fídler, was one of the few good programmers in Czechoslovakia at the time and knew how to code in assembler, so he intentionally used humble Sinclair Spectrum Basic to program the game in order to disguise his identity.  It was funny to read about how Basic was used as a screen to prevent his identity from being rumbled by the authorities– The people’s language being used to protect him against "the people’s government."  He also apparently, according to Reed, intentionally mangled the code to further disguise his identity.

However, the code was generally pretty clean. I'm not sure if he designed it completely himself, or drew on some standard Basic text adventure engine. There was an error in the room DATA that would have the program read beyond the room description strings available, at least in my Micro Color Basic version. There are only 19 room descriptions, but there is no reference to room 19 (which is the location outside the church), but instead some rooms send you to room 20. In any other machine than the Spectrum, this would cause some kind of error, but due to some quirk in Speccy Basic this discrepancy doesn't seem to cause a problem. I think Fidler might be taking advantage of some features of the Speccy that allows it somehow to ignore anomalous reads so that the data from room 19 is left in place despite there being no room 20 data. So no harm no foul.  But I'm not 100% sure what's going on.

I believe that string DATA items and number DATA items are handled completely separately in a Speccy and you can RESTORE to the beginning of any line number you desire, which is a feature Fídler uses extensively. This means you can read all the strings in order or all the number items in order– the Speccy just doesn’t care. But in other BASICs you have to read all items, string and numeric, in their precise sequence, so I had to do some fixing of how DATA statements were read. The program also has a hidden DATA statement that never gets used. Line 103 reads DATA”DON’T BE AFRAID OF THEM!” Chilling.

The program also contains a weird technique of using the PI function along with the functions NOT, SGN, and INT as replacements for the numbers 0, 1 and 3.  For other numbers, instead of using simple digit, Fídler uses the VAL function and then the number expressed as a string "11."  This might be why Reed suggests that the code was somehow mangled as a further protection against detection by the authorities.  However, this might just be a memory saving trick of Speccy Basic. Instead of multiple bytes being used for each numeric value, 2 bytes, one for each keyword token, is all that is needed. I know in Micro Color Basic floating point numbers require 5 bytes, but it might be more in Speccy Basic. Perhaps then even the VAL plus a string and its 2 quote marks can provide a memory saving.  Again, I can't be sure, and I'm not going to pour over the idiosyncrasies of Sinclair Basic to find out.  Reed might be right that it is some kind of red herring for the authorities.

I also fixed a few quirks and annoyances in the parser and added some responses that are shown by Reed, but were not part of the Speccy version.  I think Reed might have used an Atari port as the basis for his translations and discussion. I was able to draw on Reed's translations to help with my own, especially his English transliteration of the satirical acronym used as the title.

I also added a few tweaks to the descriptions.  I added the date to the slogan about "golden February" since most non-Czechs will be unfamiliar with the year of the February coup that brought in communism.  The downstairs hall now "echoes strangely" to give some clue of where to dig. It now prints a message when you hit your item max, chiding you not to be a "hoarder." And a few others. All the graphics and sound in my version are my additions, including a flashing screen for the pyrotechnics at the end.

Info about playing the game can be found here:

The game can be played here under the "Play our 8-bit Text Adventures" link:

Saturday, 1 May 2021

4K Tandy Micro Checkers: Another Bug Found


Well I think I uncovered another bug in Micro Checkers for the TRS-80 MC-10.  In my initial post about this program I noted that there was some spottiness regarding the implementation of forced jumping by the A.I.  What prompted this comment was my recollection of a moment of the computer moving a piece from its back row, despite the fact that lower down the board there was an opportunity for it to jump one of my pieces.  This struck me as odd for two reasons.  First, as noted, it is normal to expect mandatory jumping.  Second, it is a normal strategy in checkers to protect your back row, in order to delay or prevent the opponent from kinging their pieces.  So I resolved to examine the movement algorithm of the A.I to see if there was some obvious mistake.  To help me do this I decided to do a line by line comparison  of the similar code from the GWCheckers program I found online on a French blog site.  I found some differences.  The key one I think is this line in Micro Checkers:

230 IFY=7THENN=N+2

(In my updated and renumbered version, as a memory saving measure, this line became: 23 IFY=7THENN=N+2). The corresponding line from the GWCheckers version was:

960 IF Y = 7 THEN Q = Q-2

Since in Micro Checkers the top line is line 7 (computer's side), I had the suspicion that the function of this line was to "demote" moves from the computer's back row in terms of priority.  The N variable in Micro Checkers and the Q variable in GWCheckers seem to be a count for prioritizing moves.  The higher the value, the more attractive the move.  In other words, the move option that gets the highest N/Q value is the one that gets selected.  I think it is possible that the aberrant behaviour I witnessed might have been a result of this + sign instead of a - sign in line 230.  Why else would a back row move be prioritized over a possible jump?

However, I also found an additional check as part of the Micro Checkers code:


Whereas, the corresponding line from the GWCheckers version was:

230 FOR X = 0 TO 7: FOR Y = 0 TO 7: IF S (X, Y)> - 1 THEN 350

Also, you will note the Micro Checkers searches from the top row (7) down (0-- the player's side), whereas GWCheckers searches from the bottom row up.  I don't know what the significance of that change is.  I did try simply removing the red highlighted check for S(X,Y)=3, but the resulting game play was terrible, with the A.I moving into positions in which it could be jumped.  So I obviously didn't make that change permanent.  However, I wondered whether I should adopt the bottom up direction of  search.  I suspect that the algorithm simply selects any move with a higher N/Q value as it does its search.  So if it searches from bottom of the board (the human player's side) up, as in the GWCheckers, then a certain priority is given to offensive moves, since they could then be prioritized over any equal weighted top of board (computer side) moves.  I want the program to be more aggressive, especially early in the game, so I made the change to the GWCheckers search order.

Here is the line in Micro Checkers where the move is selected:

290 NEXTC:IFN>R(0)THENR(0)=N:R(1)=X:R(2)=Y:R(3)=J:R(4)=K


1080 NEXT C: IF Q> R (0) THEN R (0) = Q: R ( 1) = X: R (2) = Y: R (3) = U: R (4) = V

Because the check is for if a move (N/Q) is greater than any prior highest move, if a move further down the board (towards the human player) has the highest number, no equally high numbered move further back will be able to supplant it. Whereas in the original Micro Checkers, any back row move that gets established as highest (such as the aberrant back row move I noted above) can never be supplanted by any equally high move closer to the human side of the board (i.e more "offensive" plays). I'm not 100% sure the GW Strategy will result in better play and I am starting to lose my taste for playing these games of Checkers against a fairly simple A.I.  But I will continue testing and let you know if I think it needs to be changed back.

Another change that I made is that I noticed that the initial move was always the same from a fresh boot of the computer. The game had no way of randomly seeding the random number process.  However with a little change this could be easily accomplished via the initial INKEY$ input routine for asking whether one wanted to move first.  By relocating the RND assignment to variable T, within that key press routine, the operator's initial key press would randomly seed the random number sequence. So I changed:

60 A$=INKEY$:IFA$=""THEN60
70 IFA$="Y"THEN450
80 R(1)=(RND(4)*2)-1:R(2)=5:T=RND(2):T=T-1:IFT=0THENT=T-1


7 R(1)=RND(4)*2-1:R(2)=5:T=T-1:T=T+(T=0):R(3)=R(1)+T:R(4)=4:ON-(R(3)>7)GOTO7:GOTO32

I also found some more memory savings by consolidating a lot of additions and subtractions to N by way of simply adding and subtracting appropriately multiplied results from logical comparisons, rather than having separate lines using IF statements.  This allowed me to fix up the prompt clearing function.  Now when you change your mind about a move, and hit <ENTER> on an inappropriate square, the cancellation and return to the FROM prompt is signaled by the CLEARING of the TO prompt.

The Game MCCHKRS can  be played >>>here<<<. Select the "Play Game" button, then select the "Play Our Other 8-Bit Basic Game Ports" link, and then choose the filename from the Cassette list and type RUN.

Below is an image of me being trounced by the latest version of the game.  If you make a critical error in the early game, the computer can get and stay ahead of you.

Me getting trounced by the latest A.I.

P.S. I put 100 FORX=7TO0STEP-1:FORY=7TO0STEP-1 back in place. It seemed that there was some suicidal behaviour of kinged pieces that might resulted from the change to a search order as in:
230 FOR X = 0 TO 7: FOR Y = 0 TO 7

Friday, 30 April 2021

4K Tandy Checkers Versus Tim Hartnell Checkers

Well it looks like I was perhaps a bit hasty in criticizing Micro Checkers by Tandy for the TRS-80 MC-10 (AKA GW BASIC Checkers-- see my last post).  While I was investigating that program I also came across Tim Hartnell's Basic Checkers program.  I was able to copy much of it from a scan and with a little editing to get it to work. The scan can be found here:

Then I modified it a little by flipping the board display routine. This helped put it into an orientation that allowed me to input moves from Micro Checkers to make the two programs play each other.  It was Micro Checkers for the win!  Way to go Tandy! I might have called it a weak A.I. but at least it's not as weak as Tim Hartnell's Checkers!  I've seen someone on the net also try to put Tim Hartnell's Chess up against the 1K ZX81 chess program.  

Hartnell's Chess, which I also have typed in, bugged out of the contest not too far in. From my experience it is a pretty weak and buggy version of chess.

Micro Checkers gave Hartnell's game a fairly good trouncing. But who knows, it is only one game.  Perhaps I just caught Harrtnell's checkers on an off day. Here is a display of the final board layouts of the two programs running side-by-side:

The green pieces of Micro Chess (on the right) are the A.I. but on the left side those pieces are listed as "H"s (for human), since I was inputting those moves into Tim Hartnell's Checkers as my move (as the "Human" player).  The computer's pieces were listed as "C"s, but they have all been removed.  At least Hartnell's Checkers recognizes that it has been defeated, and I have to say that it has done so graciously.  Hartnell's programs might not be strong, but they always have class.  His checkers even posts the occasional random remark like, "Great move!" and "You got  me!", which is a nice touch.  But Hartnell's program was aimed at computers that probably had at least 16K, so such flourishes were possible.  The fact that Micro Checkers cannot recognize its own victory doesn't take anything away from its more powerful play.  Especially when one considers that it all fits in 4K!

Here's a rough breakdown of the match: