June 27

A Snake game entirely written in assembler


Snake is always been for me my hello world program. I implemented it in many different languages Basic, C, C++, Java and Javascript. But I didn’t limited myself at high level languages. At the second year of university (something like 7 years ago) I actually implemented it entirely in assembler MASM in roughly 600 lines of code. It is so old that the variables and the comments are in italian 🙂

Unfortunately I can’t run it (and provide a screenshot of the game) because is using a library called compatib that I am not able to find. Friends can confirm that this code actually worked at the time 🙂

This is the main procedure:

This is the game loop:

This is the procedure that print the snake on the screen:

The entire code is available in my repository on copeplex.

This program is very old but I still remember the feeling after I implemented it in one evening and in particular the satisfaction of the following day when I showed it to my class mates. They were shocked!

This is what I call fun!


You may also like

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Subscribe to our newsletter now!

    Get instant access to the Master C# 9 webinar to learn all the new exciting C# 9 features quickly.
    Get regular videos and news on C# and .NET and offers on products and services to master C#.

    We will collect, use and protect your data in accordance with our Privacy Policy.