Search code examples
assemblydata-structuresnibble

Snake in assembly , what datastructure to use?


Im totally new to assembly and believe it or not, our first assignment is to create snake in assembly. How should i store the snake? should i have it in the stack, or should i place it into some register? I have done some research about this "terrible" language for about 3 days, but cant figure out a good way to start. I would probably use a linked list of some sort in c++ , but unfortunately this is not c++.

Any help is very appreciated


Solution

  • How should i store the snake? should i have it in the stack, or should i place it into some register?

    Assuming you are talking about a Snake animation / game, the answer is probably neither. You most likely use a 2-D array to represent the cells on the "screen", and represent the snake's body as cells of a given "colour".

    I would probably start by working out the simplest way to implement the code in C or C++ ... without using any data structure libraries ... and then recode the algorithm in assembler.