Sie sind auf Seite 1von 11

Lyceum of the Philippines University – Laguna

Makiling, Calamba City

The game of rock, papers, and scissors in assembly language

A Research Project Presented to the Faculty of Computer Studies

Lyceum of the Philippines University – Laguna

In Partial Fulfillment of the Requirements in

IT9 - COMPUTER PLATFORM TECHNOLOGIES

Submitted by:

Jan Dale Austria


Denzel Joseph Tolosa

Submitted to :
Prof. Isaac Morallo

May 2019
Lyceum of the Philippines University – Laguna
Makiling, Calamba City

TABLE OF CONTENTS

I. ABSTRACT
II. ACKNOWLEDGEMENT
III. INTRODUCTION
IV. OBJECTIVES
a. General Objective
The general objective of this research is to create a factorial
calculator in assembly language embedded in Java program.
b. Specific Objective
The study specifically aims to:
 Create a factorial program in assembly using functions in
C++

V. SYSTEM ARCHITECTURE
VI. ALGORITHM/FLOWCHART
VII. SCREEN OUTPUT
VIII. PROGRAM CODES
IX. SCOPE AND LIMITATION
X. CONCLUSION AND RECOMMENDATIONS
XI. REFERENCES/APPENDICES
Lyceum of the Philippines University – Laguna
Makiling, Calamba City

I Abstract

Title: The game of rock, papers, and scissors in assembly language

Researcher: Tolosa, Denzel Joseph


Austria, Jan Dale

School: Lyceum of the philppines

Year: 2019

In this research, it shows the programming skills and it show how to

program by putting some codes to run the program, we further investigate and

analyze the problem if the output in the program will shows a negative process,

And we fix or debug it immediately

II. Acknowledgement

We offer our regards and blessings to all those who supported us during the
completion of the projects.

We are very thankful to Parents for always supporting on what we do in order to


succeed and reach our goals.

We are heartily thankful to our professor Sir Isaac Morallo, whose


encouragement, guidance and support from the initial to the final level enabled
us to develop an understanding of the study.

We also would also like to thank the Lyceum College Students of Lyceum of the
Philippines for their cooperation and participation .

To all the people who had their participation in this research paper, We are very
thankful to all of you.
Lyceum of the Philippines University – Laguna
Makiling, Calamba City

III Introduction

We all know the game of the rock papers and scissors is on the program, it run
by using and putting some codes to program it, it can use by program like C++,
java or python, we can use assembly language to run the game, we can use
tasm for know and to see how it works by using assembly language and
assembly codes, we all know the assembly language is a low-level
programming language for microprocessors and other programmable devices. It
is not just a single language, but rather a group of languages. An assembly
language implements a symbolic representation of the machine code needed to
program a given CPU architecture.

An assembly language is the most basic programming language available for


any processor. With assembly language, a programmer works only with
operations that are implemented directly on the physical CPU. Assembly
languages generally lack high-level conveniences such as variables and
functions, and they are not portable between various families of processors.
They have the same structures and set of commands as machine language, but
allow a programmer to use names instead of numbers. This language is still
useful for programmers when speed is necessary or when they need to carry out
an operation that is not possible in high-level languages.

Each personal computer has a microprocessor that manages the computer's


arithmetical, logical, and control activities. each family of processors has its own
set of instructions for handling various operations such as getting input from
keyboard, displaying information on screen and performing various other jobs.
These set of instructions are called 'machine language instructions'. A processor
understands only machine language instructions, which are strings of 1's and
0's. However, machine language is too obscure and complex for using in
software development. So, the low-level assembly language is designed for a
specific family of processors that represents various instructions in symbolic
code and a more understandable form.
Assembly language is have a problem like long programs written in such
languages cannot be executed on small sized computers, also it takes lot of time
to code or write the program, as it is more complex in nature, difficult to
remember the syntax and lack of portability of program between computers of
different makes.
Lyceum of the Philippines University – Laguna
Makiling, Calamba City

IV Objectives

A) General objectives:
The general objectives of this research is to create a game of the rock
papers and scissors using assembly language language , we can use tasm to
run the program.

B) Specific objectives
The study specifically aims to:
 Create a game of rock papers and scissors in assembly
 Run it to tasm

V. System Architecture

VI. Algorithm and Flowchart

Algorithm:

Step 1: Initialize p1,p2


Step 2: Input [1] Rock [2]Paper, [3] Scissor
Step 3: Input P1 and P2
Step 4: If P1 Print Player 1 if P2 print Player 2
Step 5: If Player 1 is equal print player 1 and choose rock, if player 1 is equal to
2 choose paper, if player 1 is equal to 3 choose scissor
Step 6: If player 2 is equal print player 2 and choose rock, if player 2 is equal to
2 choose paper, if player 2 is equal to 3 choose scissor
Step 7: When the P1 and P2 is true Print “it’s a tie” if false P1 == 1 && P2 ==1,
P1 ==2&&P2==2,P1==3&&P2==3
Step 8: Player 1 wins if P1 == 1 && P2 ==3, P1 ==2&&P2==1,P1==3&&P2==3
Player 2 wins if P1 == 1 && P2 ==2, P1 ==2&&P2==3,P1==3&&P2==1
Step 9: End
Lyceum of the Philippines University – Laguna
Makiling, Calamba City

Flowchart
Lyceum of the Philippines University – Laguna
Makiling, Calamba City
Lyceum of the Philippines University – Laguna
Makiling, Calamba City

VII. Screen output

In the picture it shows the game, when you pick 1(rock) and your opponent pick
2(paper) your opponent is the winner because paper can destroy a rock, second
try, if you pic 2(paper) and your opponent pick number 3(scissors) your
opponent is the winner because scissors can destroy a paper, third try, if you
pick 1(rock) and your opponent pick 3 you are the winner because rock can
destroy a scissors, final round, if you pick 3 ( scissors) and your opponent pick
3( scissors) it will be same pick, and the game will try again because it the same
number.

VIII Programs codes

DOSSEG
.model SMALL
.stack 100h
.data

CR db 13,10,'$'
MSG db 'GAME Instruction: Rock=1, Paper= 2, Scissors= 3, $', 0
PL1 db 'Player 1: $', 0
PL2 db 'Player 2: $', 0
PL1_Win db 'Player 1 is the winner! $', 0
PL2_Win db 'Player 2 is the winner! $', 0
PLEQ db 'Player 1 and 2 = same pick! Try again $', 0
.code
Lyceum of the Philippines University – Laguna
Makiling, Calamba City

BEGIN: MOV AX, @data


MOV DS, AX
MOV ES, AX

MOV DX, OFFSET MSG ; Game Instruction


MOV AH, 09h
INT 21h

MOV DX, OFFSET CR ; print Carrier Return


MOV AH, 09h
INT 21h

MOV DX, OFFSET PL1 ; Prompt of player1


MOV AH, 09h
INT 21h

MOV AH,08 ; Function to read a char from keyboard (Input by


Player1)
INT 21h ; the char saved in AL
MOV AH,02 ; Function to display a char
MOV BL,AL ; Copy a saved char in AL to BL
MOV DL,AL ; Copy AL to DL to output it
INT 21h

MOV DX, OFFSET CR ; print Carrier Return


MOV AH, 09h
INT 21h

MOV DX, OFFSET PL2 ; Prompt of player2


MOV AH, 09h
INT 21h

MOV AH,08 ; Function to read a char from keyboard (Input by


Player2)
INT 21h ; the char saved in AL
MOV AH,02 ; Function to display a char
MOV BH,AL ; Copy a saved char in AL to BH
MOV DL,AL ; Copy AL to DL to output it
INT 21h

MOV DX, OFFSET CR ; print Carrier Return


MOV AH, 09h
INT 21h
Lyceum of the Philippines University – Laguna
Makiling, Calamba City

CMP BL, BH
JE EQUAL

;=======================================
CMP BL, '1'
JE EQ1
CMP BL, '2'
JE EQ2
CMP BL, '3'
JE EQ3

EQ1:
CMP BH, '2'
JE P2_Win
CMP BH, '3'
JE P1_Win

EQ2:
CMP BH, '1'
JE P1_Win
CMP BH, '3'
JE P2_Win

EQ3:
CMP BH, '1'
JE P2_Win
CMP BH, '2'
JE P1_Win

;=======================================

P1_Win: ;Player 1 is winner


MOV DX, OFFSET PL1_Win
MOV AH, 09h
INT 21h
JMP Final

EQUAL: ;Player 1 == Player 2


MOV DX, OFFSET PLEQ
MOV AH, 09h
INT 21h
JMP Final

P2_Win: ;Player 2 is winner


MOV DX, OFFSET PL2_Win
Lyceum of the Philippines University – Laguna
Makiling, Calamba City

MOV AH, 09h


INT 21h
JMP Final
;=======================================

Final:
MOV AH,4Ch ; Function to exit
MOV AL,00 ; Return 00
INT 21h

end BEGIN

IX. Scope and limitations

This study will focus on the research output in programming. Because it shows
how to program like using assembly language, and we use tasm application and
notepad c++ for input the code their

X. Conclusion and recommendation

After we run the program, we just noticed its hard in start when putting some
codes and we use to analyze how it will run easily, we can use assembly
language to run the program because it can easily to compile the program in
tasm

XI. References/appendices

https://www.techopedia.com/definition/3903/assembly-language

https://www.tutorialspoint.com/assembly_programming/assembly_introduction.ht
m

https://github.com/mehdibz/rock-paper-scissors

Das könnte Ihnen auch gefallen