+ All Categories
Home > Documents > SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake...

SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake...

Date post: 10-Jun-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
18
1 SNAKE MASTER EC 316: Microprocessors Lab Project Netaji Subhas Institute of Technology, New Delhi Submitted by: Kanika (74/EC/13) Kirtika (81/EC/13)
Transcript
Page 1: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

1

SNAKE MASTER EC 316: Microprocessors Lab Project Netaji Subhas Institute of Technology,

New Delhi

Submitted by:

Kanika (74/EC/13)

Kirtika (81/EC/13)

Page 2: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

2

ACKNOWLEDGEMENTS

It was a wonderful experience to work on this project and we would like to

express our gratitude towards anyone who helped us at any stage.

We would like to thank Prof. Dhananjay V. Gadre who has always tried to

impart hands on practical knowledge and made microprocessors an

extremely interesting subject to study. We would also like to extend our

thanks to all the members of CEDT who were always there to clear each

and every doubt.

This project wouldn’t have been possible without the help of CEDT

members who helped us immensely in both hardware and software

debugging.

Page 3: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

3

CONTENTS

SNO. TOPIC PAGE NO.

1. Description 4 2. Schematic 7 3. Board File 8 4. Testing 10 5. Hardware Debugging 11 6. Code 12 7. Software Debugging 16 8. Gantt Chart and

Conclusion 17

Page 4: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

4

DESCRIPTION The main aim of this project is to design the game, ‘Snake Master’ using the

8085 microprocessor.

The game is displayed on an 8X8 LED Matrix wherein three successive

glowing LED’s represent the snake and another glowing LED signifies the

target which the snake has to reach. Aim of the snake will be to reach the

goal point without hitting the boundary of the LED panel. Every time the

goal is reached the level of the hardness of the game is increased by

increasing the frequency of the steps of the same.

Left: target; right bottom corner: snake head

Every LED on the LED matrix does not have a dedicated line for switching it

ON and OFF ad therefore, multiple LED’s are switched on simultaneously

on the 8X8 LED matrix using a technique called Multiplexing. In this, the

time interval between switching ON and OFF the LED is less than the

persistence of vision (1/16th of a second) so that the eye perceives the LED

to be continuously ON. We have achieved this optimum time delay using

polling rather than using interrupts.

Page 5: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

5

Snake moving towards the target!

This game has multiple levels and the speed of the snake increases with

each subsequent level therefore, making the game progressively harder.

The level number that the player has crossed is displayed on the matrix

before the commencement of the next level.

Level 3 completed!

Page 6: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

6

The boundaries of the LED matrix act as walls i.e. if the user fails to

navigate carefully on the board and collides with the wall then, all the 64

LED’s are switched on for a short duration to indicate that the game is over

and the game is reset back to level 1.

All the 64 LED’s glow if snake touch the boundary!

(one LED was defective )

Page 7: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

7

SCHEMATIC

Page 8: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

8

BOARD LAYOUT

Page 9: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

9

Board before any component was soldered!

Page 10: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

10

TESTING The very first test we conducted was to test the led matrix, to ensure each

of its pins lights up and we noted the combination i.e which pin is to given

high voltage and which low, to ensure that particular led lights up. This was

recorded in a table, as shown in the image below. It helped us in the code.

The second test was the Sod-Led test. We burnt the following code into the

ram and after certain difficulties, the sod led did light up.

.ORG 00000H

READ: RIM

ANI 080H

ORI 040H

SIM

JMP READ

.END

SOD LED glew! =D

Page 11: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

11

HARDWARE DEBUGGING We encountered the following five major problems in the board and we

debugged them successfully.

1. The power LED we soldered was not working. So, we had to change it

which was really difficult due to its position.

2. While testing the board we realised one pin of the connector was not

connected with that of 8085 but eventually that was connected

directly wherever needed so there was no need to correct that.

3. SOD LED didn’t glow which made us realise that connections were

loose and we had to resolder the 8085, ROM and some of the

resistors.

4. The major mistake that took maximum time to be detected was the

LED matrix which we bought was common anode but in the

schematic we used common cathode configuration due to which we

had to short the driver (ULN2803A) and the resistors connected to

the pnp transistors and also the base and collector of each of the pnp

transistor was shorted which means that the outputs of the outlatch2

was directly connected to the LED matrix.

5. Some LED’s were not glowing or glowing at the wrong time so we

had to improve the soldering of some resistors and IC’s.

Page 12: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

12

Corrected board!

CODE It would be necessary to mention some details about the code.

REGISTERS D contains info of what last switch was pressed

E contains whether a switch is pressed during a particular delay or

not

C contains level number

B contains multiplexing variable i.e. which light is to be kept on

ADDRESSES: a0000 & a0001 contains info of position of snake head;

a002 & a0003 contains bit2 & a004&a0005 contains bit3

b0000&b0001 contains info of position of target

b1000&b1001 onwards it contains various target positions for

different levels

f0000&f0001 contains delay value which controls speed of game

.ORG 0000H

JMP 01000H

.ORG 01000H

LXI SP,0000H

targets: LXI H,0B100H

MVI M,02H

INX H

MVI M,04H

INX H

MVI M,80H

INX H

MVI M,10H

INX H

MVI M,02H

Page 13: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

13

INX H

MVI M,80H

INX H

MVI M,80H

INX H

MVI M,80H

INX H

MVI M,01H

INX H

MVI M,80H

INX H

MVI M,80H

INX H

MVI M,40H

INX H

MVI M,01H

INX H

MVI M,80H

INX H

MVI M,80H

INX H

MVI M,01H

INIT: LXI H,0B000H

MVI M,40H

INX H

MVI M,20H

MVI C,00H

MVI A,00H

STA 0F000H

MVI A,080H

STA 0F001H

NEWLEVEL: MVI D,00H

LXI H,0A000H

MVI M,01H

INX H

MVI M,01H

INX H

MVI M,01H

INX H

MVI M,01H

INX H

MVI M,01H

INX H

MVI M,01H

MOVE: CALL MULPXG

CALL DELAY

CALL INPUT

CALL ROTATE

JMP MOVE

HLT

DISP_S: PUSH PSW

LDA 0A000H

OUT 80H

LDA 0A001H

CMA

OUT 00H

POP PSW

RET

DIP_S2: PUSH PSW

LDA 0A002H

OUT 80H

LDA 0A003H

CMA

OUT 00H

POP PSW

RET

DIP_S3: PUSH PSW

LDA 0A004H

OUT 80H

LDA 0A005H

CMA

OUT 00H

POP PSW

RET

DISP_T: PUSH PSW

LDA 0B000H

OUT 80H

LDA 0B001H

CMA

OUT 00H

POP PSW

RET

DELAY: PUSH PSW

PUSH H

LDA 0F000H

MOV H,A

LDA 0F001H

MOV L,A

MVI E,01H

MVI B,00H

loop: CALL MULPXG

CALL INPUT

DCX H

MOV A,L

ORA H

JNZ loop

POP H

POP PSW

RET

MULPXG: PUSH PSW

PUSH H

PUSH B

CALL DISP_S

CALL DE_MUX;

CALL DIP_S2

CALL DE_MUX;

Page 14: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

14

CALL DIP_S3

CALL DE_MUX;

CALL DISP_T

CALL DE_MUX;

POP B

POP H

POP PSW

RET

DE_MUX: PUSH PSW

PUSH B

MVI B,0FFH

lap: DCR B

JNZ lap

POP B

POP PSW

RET

STBLTY: PUSH PSW

PUSH B

PUSH D

MVI D, 020H

label: DCR D

MVI A,00H

OUT 80H

CMA

OUT 00H

JNZ label

POP D

POP B

POP PSW

RET

INPUT: MOV A,E

ORA A

JZ multiprsd

IN 0FFH

CPI 01H

CZ CASE1

CPI 02H

CZ CASE2

CPI 04H

CZ CASE3

CPI 08H

CZ CASE4

multiprsd: RET

CASE1: PUSH PSW

MVI D,01H

MVI E,00H

POP PSW

RET

CASE2: PUSH PSW

MVI D,02H

MVI E,00H

POP PSW

RET

CASE3: PUSH PSW

MVI D,03H

MVI E,00H

POP PSW

RET

CASE4: PUSH PSW

MVI D,04H

MVI E,00H

POP PSW

RET

ROTATE: PUSH PSW

PUSH D

CALL T_CHEK

RTATE: CALL M_UPDATE

MOV A,D

CPI 01

CZ UP

CPI 02

CZ RIGHT

CPI 03

CZ DOWN

CPI 04

CZ LEFT

POP D

POP PSW

RET

M_UPDATE: PUSH PSW

PUSH H

PUSH B

LXI H,0A002H

MOV A,M

STA 0A004H

INX H

MOV A,M

STA 0A005H

LXI H,0A000H

MOV A,M

STA 0A002H

INX H

MOV A,M

STA 0A003H

POP B

POP H

POP PSW

RET

UP: PUSH PSW

PUSH H

LXI H,0A001H

MOV A,M

ORA A

RAR

JC G_OVER

MOV M,A

POP H

POP PSW

Page 15: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

15

RET

DOWN: PUSH PSW

PUSH H

LXI H,0A001H

MOV A,M

ORA A

RAL

JC G_OVER

MOV M,A

POP H

POP PSW

RET

LEFT: PUSH PSW

PUSH H

LXI H,0A000H

MOV A,M

ORA A

RAR

JC G_OVER

MOV M,A

POP H

POP PSW

RET

RIGHT: PUSH PSW

PUSH H

LXI H,0A000H

MOV A,M

ORA A

RAL

JC G_OVER

MOV M,A

POP H

POP PSW

RET

T_CHEK: PUSH PSW

PUSH D

PUSH B

PUSH H

LXI H,0A000H

MOV D,M

INX H

MOV E,M

LXI H,0B000H

MOV A,M

CMP D

JNZ FAIL

INX H

MOV A,M

CMP E

JNZ FAIL

POP H

POP B

POP D

POP PSW

JMP L_UP

FAIL: POP H

POP B

POP D

POP PSW

RET

L_UP: PUSH PSW

PUSH H

PUSH D

INR C

CALL L_DISP

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL L_DISP

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

LDA 0F001H

SUI 014H

STA 0F001H

LXI H,0B100H

;TARGET POINT UPDATED

MOV A,C

RLC

ADD L

MOV L,A

MOV A,M

STA 0B000H

INX H

MOV A,M

STA 0B001H

POP D

POP H

POP PSW

JMP NEWLEVEL

L_DISP: PUSH PSW

PUSH B

PUSH H

MVI A,3CH

OUT 80H

MVI A,00H

loop2: RRC

ADI 80H

DCR C

JNZ loop2

CMA

OUT 00H

POP H

Page 16: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

16

POP B

POP PSW

RET

G_OVER: MVI A,0FFH

OUT 80H

CMA

OUT 00H

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL L_DISP

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

CALL DEL_1S

JMP INIT

DEL_1S: PUSH PSW

PUSH H

LXI H,1F00H

LOP_1S: DCX H

MOV A,H

ORA L

JNZ LOP_1S

POP H

POP PSW

RET

Page 17: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

17

SOFTWARE DEBUGGING

The assembler used was OshonSoft.

1. We first started with running the Sid-Sod code on our board to make

sure that our 8085, Address latch, Rom, control line decoder is

working properly.

2. After successfully testing Sid-Sod code, we moved to testing output

latches and led dot matrix by sending a code to light up a desired led

on the matrix.

3. After that, we checked the input buffer and switches by sending a

code to control the lighting up of led using a switch

4. We then wrote a code to move led’s in a dot matrix in a row using

switch control with desired delay.

5. We tested multiplexing after that.

6. Finally we collaborated all the steps and using 8085 simulator

debugger successfully completed the code.

Page 18: SNAKE MASTER - 8085 Projects · The main aim of this project is to design the game, ‘Snake Master’ using the 8085 microprocessor. The game is displayed on an 8X8 LED Matrix wherein

18

GANTT CHART AND CONCLUSION

Overall, it was an amazing learning experience. It was the very first time

we made a working project and thus learning a lot about the practical

aspect of a subject. It was difficult yet we are proud to have done it. We

made mistakes, learnt from it and found solutions to rectify them.

The proposed Gantt chart and the actual do reveal that we went behind

the schedule many a times but we managed it finally before the

deadline. To make this project a success, we worked till the night before

the submission of this project, taking help from teachers, seniors and

fellow batch mates whenever needed. Thanks to everyone..!


Recommended