This game started them all. Once I saw a guy who struggled with his own program and on his screen there was a character that moved from left to right and when he pushed "any key" this character started again from the left, leaving its dead image at last position. This was clearly not what he wanted, but I thought it may become a game.

The first version written was longer than 3 lines but was really short (for such a cool game), so I decided to make it as short as possible. Starting by squeesing out spaces, joining the lines etc., I made it into 4 or so lines. Then by rearranging some IFs and adding extra ELSE I managed it into 3 lines.

That's where the lightning stroke. 3 was a magic number and I stopped there. And thats where I asked myself "what other games can I put into 3 lines of MSX BASIC?"

In later years I returned to this game and rewrote it into 2 lines, but I present original variant here since it has some personal significance to me. Unfortunately, I am not sure that presented code is the original 3 line code I wrote in 1987. There might have been changes to it since.


The object of the game is to build straight row of characters from A to Z in the top line of the screen. Use space bar to stop the > character and place a letter in its place. As you build the row it becomes more and more difficult. If you fell that it is too easy, try to decrease delay in line 2 FORJ=0to20:NEXTJ, or even eliminate it completely.

String in PRINT statement in line 3 may be unreadable on your MSX -- I wrote original program on Yamaha YIS-503IIR with cyrillic character set. There is really nothing to it -- it just says that you have completed the game successfully.

Code and comments

Download the original code or modified for international character set.

2 things deserve attention in this program.

First, POKE &HFBB1,1 is used to block STOP (and as a consequence -- Ctrl+STOP). It was done to make it impossible to cheat by pressing stop. As a side effect you cannot terminate the game other than completing it.

Second, istead of polling keyboard with INKEY$ program uses ON STRIG GOSUB (space bar has been pressed) interrupt. This is done to leave main loop as tight as possible to achieve fastest possible speed. Apparently the speed is too fast and delay FORJ=0TO20:NEXTJ should be inserted to make it possible to finish the game.

Since keyboard is not polled, lots of space characters end up in the keyboard buffer after game ends. Keyboard buffer is cleared by BIOS function at &h156.

[ MSX BASIC | << Previous | Next >> | Feedback ]