
#ON SCREEN SNAKE GAME CODE#
Note that all key presses have the same break code in common: F0. To look up the keyboard make/break codes, there are many sources. It wants to make the total number of ones an odd number. If there are an even number of ones, it will be 1, and if there are an odd number of ones, the parity bit will be 0. The parity bit is either a one or a zero, depending on how many 1s are in the make code. It sends first a zero to start, then 8 bits of data specific to the key you pressed (the make code), a parity bit (PB), and finally a one to stop. To expand, the first image shows what the keyboard will send within every 11 bits. You do not need to define your own clock to work with the keyboard.

The keyboard has its own clock that you can read. The keyboard sends data on the negative edge of its clock.Ħ. The keyboard will send the same 11 bits containing the make code over and over again while you hold a specific key down.ĥ. (There are exceptions when pressing specific keys, don't worry about these too much)Ĥ. When it is released, it will send an 11 bit 'break' code, proceeding with the same make code again. When a key is first pressed, it sends 11 bits of data in the form of a 'make' code. A single key press will consist of at least 33 bits of input from the keyboard.ģ. When the keyboard is not sending input, it is sending a constant 1 (high) for its data, as well as the clock.Ģ. The input from the keyboard is straightforward to understand. **Mainly, this instructable tries to be a concise guideline for future project-goers who need a reference for various modules, and to understand more of the capabilities of the FPGA board. These were the most difficult parts of the project to do, because there is not a great amount of useful information on the internet for implementing these functions with Verilog.
#ON SCREEN SNAKE GAME HOW TO#
Subsequent steps will explain the features of the game, and explain VGA output/keyboard input to give future students a better idea of how they work, and how to implement them in their own projects.
#ON SCREEN SNAKE GAME SOFTWARE#
Quartus II Software to edit and open the Verilog code USB cable to upload program to the board PS/2 keyboard (a USB keyboard with a PS/2 adapter may or may not work, do not count on it) The four contributors to this project are:Ĭomputer Engineering students: Daniel Lovegrove, Ian SweetlandĮlectrical Engineering students: Kristjan Jacobson, Roberto Alves For example, in the YouTube website, you can play snake over a video while it loads, and Google has made a doodle in which you can play a slightly updated version of snake. The game originated from the 1976 arcade game Blockade, and variations on the game are still around today.

You lose if the head of the snake collides with its own body, or if the snake hits one of the borders. The snake gets longer and harder to control the more items it consumes.

"Snake" is a simple game where the user controls a snake to eat items generated at random locations in the play area. Coding is done with Verilog HDL via Quartus II. The board used throughout the project is an Altera DE2 Cyclone IV board. This project was completed for the class ECE2220, at the University of Manitoba, for the Fall 2015 term.
