2
Most read
4
Most read
13
Most read
SUBMITTED BY-
Team #NoFrazzle
1. Md Sanzidul Islam 151-15-
5223
2. Farhan Tawsif Chowdhury 151-15-
4705
3. Nazmul Ahsan 151-15-
4668
4. Md. Mahbubur Rahman 151-15-
4761
5. Sadia Sultana Sharmin Mousumi 151-
15-5191
SUBMITTED TO-
Ms. Bashira Akter
Anima
Lecturer, Dep. Of CSE,
Daffodil International
UniversityDate of Submission: 18th
December, 2016
PROJECT REPORT ON “TRICKY MATH PUZZLE”
COURSE: MICROPROCESSOR &ASSEMBLY
LANGUAGE
COURSE CODE: CSE 231
Abstract & Hints:
The purposeof this projectis to design and build a math puzzlegame that will
give user the experience of solving various tricky math puzzlethrough gaming.
This was achieved through severalsteps. In background, weused programming
language Assembly. Instructions likeconditions, loops, call procedure& various
types of registers and their uses, whatwe learned throughoutour courses.
What is assembly language?
An assembly languageis a programming language that can be used to directly tell
the computer what to do. An assembly language is almostexactly like
the machine language that a computer can understand, except that it uses words
in place of numbers. A computer cannot really understand an assembly program
directly. However, it can easily change the programinto machine code by
replacing the words of the programwith the numbers that they stand for. A
programthat does that is called an assembler. Programs written in assembly
language are usually made of instructions, which are small tasks that the
computer performs when it is running the program. They are called instructions
because the programmer uses them to instruct the computer whatto do. The part
of the computer that follows the instructions is the processor. Theassembly
language of a computer is a low-level language, which means that it can only be
used to do the simple tasks that a computer can understand directly. In order to
performmore complex tasks, onemust tell the computer each of the simple tasks
that are part of the complex task. For example, a computer does not understand
how to printa sentence on its screen. Instead, a programwritten in assembly
must tell it how to do all of the small steps that are involved in printing the
sentence.
Strengthof assembly language:
1. The symbolic programming of Assembly Languageis easier to understand
and saves a lot of time and effortof the programmer.
2. Itis easier to correct errors and modify programinstructions.
3. Assembly Languagehas the sameefficiency of execution as the machine
level language. Because this is one-to-onetranslator between assembly
language programand its corresponding machinelanguage program.
Disadvantages of assembly language:
1. One of the major disadvantages is that assembly language is machine
dependent. A programwritten for one computer might not run in other
computers with different hardwareconfiguration.
Project Description&Demo:
When we startthe game “Tricky Math Puzzle” we will have a POP-Up window
showing this menu.
The firstthree options in this menu is our game segments.
If you chooseoption 1. you will get enter into math teaser game segment. In math
teaser segment we put somediscretional tricky mathematical question as like
puzzle.
Something like this,
Here we have multiple choice option. Herethe correctanswer is number two (2).
So you have to input number two (2) fromyour key board. Thus you will get your
correctanswer and your point one (1) which we will be regarded for each correct
answer.
Whether you give the right or the wrong answer you will automatically have the
next puzzleafter answering previous one. Becauseof we are in the developing
state of our game so we justput five puzzles into firsttwo segments. Farther
puzzlewill be coming soon. When you will be able to answer all this five question
you will get all the points and encouraged to go into our next segment which is
sequence and assumption.
This is the choice number two on the game menu. In this segment the gamer will
have to face some sortof sequentially math puzzle.
So here this is the sample of a question. You have to give your assumption to
complete the sequence. So we can see this is a Fibonacci series and complete the
sequence the answer will be number three (3) and you will have your point.
The third or final segment of our game is the mostinteresting one. Here we test
our player assumption skill.
You will be asked to guess and input 3 digits. In programlogic unit it automatically
generate 3 randomdigits and compare/match with your imputed digits. If 1 digit
will match, you will get 100$.If 2 digitwill match, you will get 1000$. If 3 digit will
match, you will get 10000$.Herewecan see 1 digit will match and he/she get
100$. If anyonecan play again you press 1.
If the gamer need any help he justhaveto get into choice 4 for help like how to
operate this game, how to operate this menu and how to play this game whatI
justmention above. If you wantto exit you justpress 5.
The Work Flow:
Tricky math puzzle project report
Background of Project:
Conditional execution in assembly language is accomplished by severallooping
and branching instructions. Theseinstructions can change the flow of control in a
program. Conditionalexecution is observed in two scenarios −
SN Conditional Instructions
1 Unconditional jump
This is performed by the JMP instruction. Conditional execution often
involves a transfer of control to the address of an instruction that does
not follow the currently executing instruction. Transfer of control may
be forward, to execute a new set of instructions or backward, to re-
execute the samesteps.
2 Conditional jump
This is performed by a set of jump instructions j<condition> (i.e. JNZ, JE,
JG etc.) depending upon the condition. The conditional instructions
transfer the control by breaking the sequential flow and they do it by
changing the offsetvalue in IP.
Let us discuss theCMP instruction beforediscussing the conditional instructions.
CMP Instruction:
The CMP instruction compares two operands. Itis generally used in conditional
execution. This instruction basically subtracts oneoperand fromthe other for
comparing whether the operands are equal or not. Itdoes not disturb the
destination or sourceoperands. Itis used along with the conditional jump
instruction for decision making.
Syntax
CMP destination, source
CMP compares two numeric data fields. The destination operand could be either
in register or in memory. The sourceoperand could be a constant (immediate)
data, register or memory.
JMP Instructions:
The JMP (Jump)instruction causes an unconditional transfer of control
(unconditional jump). Such an instruction transfers the flow of execution by
changing the instruction pointer register. There are several different opcodes that
performa jump; depending on whether the processor is in real mode or
protected mode, and an overrideinstruction is used, the instructions may take 16-
bit, 32-bit, or segment: offsetpointers.
The syntax is,
JMP destination
Where destination is usually a label in the samesegment as the JMP itself. JMP
can be used to get around the range restriction of a conditional jump.
Conditional Jump:
If somespecified condition is satisfied in conditional jump, the controlflow is
transferred to a target instruction. There are numerous conditional jump
instructions depending upon the condition and data.
For an example,
CMP AL, BL
JE EQUAL
CMP AL, BH
JE EQUAL
CMP AL, CL
JE EQUAL
NON_EQUAL: ...
EQUAL:...
Use of CMP and JMP instruction in our project:
MOV AH,1 ; MENU CHOICE
INT21H
MOV CHOOSE,AL
CMP AL,'1'
JE MATH_TEASER
CMP AL,'2'
JE SEQUENCES
CMP AL,'3'
JE ASSUME_SKILL
CMP AL,'4'
JE HELP
CMP AL,'5'
JE EXIT
Loop Instructions:
A loop is a sequence of instructions that is repeated. The number of times to
repeat may be known in advance, or it may depend on conditions.
FORLOOP:
This is a loop structurein which the loop statements are repeated a known
number of times (a count-controlled loop). In pseudocodes,
FORloop_ counttimes DO
Statements
END_FOR
The LOOP instruction can be used to implement a FOR loop. Ithas
the form,
LOOP destination_ label
WHILELOOP:
This loop depends on a condition. In pseudocode,
WHILEcondition DO
Statements
END WHILE
REPEAT LOOP:
Another conditional loop is the REPEAT LOOP. In pseudocode,
REPEAT
Statements
UNTIL condition
Use of Loop instructions in our project:
MOV CX,3
MOV BL,'0‘
AGAIN:
MOV AH,1
INT21H
CMP AL,RANDOMNUM1
JE MATCH
CMP AL, RANDOMNUM2
JE MATCH
CMP AL, RANDOMNUM3
JE MATCH
LOOP AGAIN
JMP RESULT
MATCH:
INC BL
LOOP AGAIN
RESULT:
Procedures:
Procedures or subroutines are very important in assembly language, as the
assembly language programs tend to be large in size. Procedures are identified
by a name. Following this name, the body of the procedure is described which
performs a well-defined job. End of the procedure is indicated by a return
statement.
Following is the syntax to define a procedure −
proc_name:
procedurebody
...
ret
The procedureis called fromanother function by using the CALL instruction. The
CALL instruction should havethe name of the called procedureas an argument as
shown below −
CALL proc_name
The called procedurereturns the controlto the calling procedureby using the RET
instruction.
Use of CALL PROC in our project:
NEW_LINEPROC ; NEW LINEPRINTPROCEDURE
MOV AH,2
MOV DL,0AH
INT21H
MOV DL,0DH
INT21H
RET
………………………………………….
CALL NEW_LINE
INT10h:
INT10h, INT10H or INT16 is shorthand for BIOS interruptcall 10hex, the 17th
interrupt vector in an x86-based computer system. TheBIOS typically sets up a
real mode interrupt handler at this vector that provides video services. Such
services include setting the video mode, character and string output, and graphics
primitives (reading and writing pixels in graphics mode).
To use this call, load AH with the number of the desired sub function, load other
required parameters in other registers, and make the call. INT10h is slow, so
many programs bypass this BIOS routineand access the display hardwaredirectly.
Setting the video mode, which is done infrequently, can be accomplished by using
the BIOS, whiledrawing graphics on the screen in a game needs to be done
quickly, so direct access to video RAM is moreappropriate than making a BIOS call
for every pixel.
Function:
Scroll up window AH=06h AL = lines to scroll(0 = clear, CH, CL, DH, DL are
used),
BH = Background Color and Foreground color. BH = 43h, means that background
color is red and foreground color is cyan. Refer the BIOS color attributes
CH = Upper row number, CL = Left column number, DH = Lower row number, DL =
Right column number.
Clear screen procedure:
CLRSCR PROC ; CLEAR SCREEN PROCEDURE
MOV AX,0600H ;06 TO SCROLL & 00 FORFULL CLEAR SCREEN
MOV BH,07H ;ATTRIBUTE0 FORBACKGROUND AND 7 FOR FOREGROUND
MOV CX,0000H ;STARTING COORDINATES
MOV DX,184FH ;ENDING COORDINATES
INT10H ;FOR VIDEO DISPLAY
RET
Function of INT1Ah:
1Ah Real Time Clock Services
AH Description
00h Read RTC
01h Set RTC
02h Read RTC Time
03h Set RTC Time
04h Read RTC Date
05h Set RTC Date
06h Set RTC Alarm
07h Reset RTC Alarm
Random no generate procedureusing 00h:
RANDOMPROC ; GENERATE A RANDOMNO USING THE SYSTEMTIME
MOV AH, 00h ; INTERRRUPTS TO GET SYSTEM TIME
INT1AH ; CX:DX NOW HOLD NUMBER OF CLOCK TICKS SINCE
MIDNIGHT
MOV AX, DX
XOR DX, DX
MOV CX, 10
DIV CX ; HERE DX CONTAINS THEREMINDEROF THE DIVISIONFROM
0 TO 9
ADD DL,'0' ; TO ASCII FROM'0'TO '9'
MOV BL,DL
RET
Project showing/ Interface:
Tricky math puzzleis a game made by assembly language. We made it with a
lucrative interface as wecould. Actually, assembly language doesn’t give as
opportunities as any other high level languages. After all, our game had very user
friendly interface wethink. In addition-
 For being in assembly languageits procedureis so speedy.
 Though it is a small project, but we tried to make it bug free. And we also
confidently say that is has no bug in our game!
 It’s an interesting game, no doubt! Is has three segments full of
enjoyment.
 Itcan be said a brain game. We tried to make it logical so that one can
stormhis/ her brain through our game.
Future Planning:
Actually, wemade it in very shorttime. Though we full filled all of our
expectations, we have somefuture plan about our game. We may develop it by
any other high level language like C++/Java or with Unity. The features may have
in our next version like bellow-
 A significant partof gaming is its graphics quality. So, we musthave a
lucrative graphicalinterface.
 Now artificial interface is a hot cake in gaming world. We will try to add AI
features in our next version.
 We may add many more segments and events in our game.
 We may develop morestages and will update everything day by day.
------- Thank you! -------

More Related Content

PPTX
Math Puzzle Game By Assembly Language
PDF
Programming
PPTX
Algorithms and flow charts
PPTX
PDF
The Programming Process
PPTX
Algorithms
PDF
Modular programming in qbasic
PPTX
Unit 1. Problem Solving with Computer
Math Puzzle Game By Assembly Language
Programming
Algorithms and flow charts
The Programming Process
Algorithms
Modular programming in qbasic
Unit 1. Problem Solving with Computer

What's hot (20)

PPTX
Introduction to Programming and QBasic Tutorial
PPTX
Introduction to QBASIC programming and basics
PPT
Introduction to qbasic
PDF
POLITEKNIK MALAYSIA
PPTX
Programming Fundamentals
DOC
Program concep sequential statements
PPTX
Programming in c
PPTX
Qbasic tutorial
PPT
Problem solving using Computer
PPT
Introduction to problem solving in c++
PPT
Program design and problem solving techniques
PDF
Problem Solving Techniques and Introduction to C
PPT
Fundamental Programming Lect 1
PPTX
Mcs lec2
PPTX
QBASIC: A Tool For Modern Programming
PPTX
The Knowledge of QBasic
PPT
Fundamentals of Programming Chapter 2
PDF
10th class computer science notes in english by cstechz
PPTX
Cp 111 lecture 2
PPTX
Computer programing 111 lecture 2
Introduction to Programming and QBasic Tutorial
Introduction to QBASIC programming and basics
Introduction to qbasic
POLITEKNIK MALAYSIA
Programming Fundamentals
Program concep sequential statements
Programming in c
Qbasic tutorial
Problem solving using Computer
Introduction to problem solving in c++
Program design and problem solving techniques
Problem Solving Techniques and Introduction to C
Fundamental Programming Lect 1
Mcs lec2
QBASIC: A Tool For Modern Programming
The Knowledge of QBasic
Fundamentals of Programming Chapter 2
10th class computer science notes in english by cstechz
Cp 111 lecture 2
Computer programing 111 lecture 2
Ad

Viewers also liked (20)

PPSX
Maths puzzle
PPTX
Ganit Week by Warda Grade X
PPT
Muscular system
PPT
Math tricks
DOC
Tricky math shortcut
PPT
DNA Function and Structure Notes
PPT
MATH MAGIC
PPT
Introduction to Python Language and Data Types
PPTX
Coaxial cable
PPT
Sinusoidal oscillators
PPT
Protein Synthesis Notes
PPSX
Vedic math
PPT
Math magic, tricky math
PPTX
Biology Form 5 Chapter 2 - Locomotion & support : 2.1 Part 2
PPTX
RHEUMATOID ARTHRITIS BY DR BASHIR AHMED DAR ASSOCIATE PROFESSOR MEDICINE SOPO...
PPTX
Rheumatoid Arthritis Power Point
PPTX
Human Skeletal System
PPT
Rheumatoid arthritis
PPT
Psychometric Assessment
PPT
Human skeletal system - Movement and Locomotion
Maths puzzle
Ganit Week by Warda Grade X
Muscular system
Math tricks
Tricky math shortcut
DNA Function and Structure Notes
MATH MAGIC
Introduction to Python Language and Data Types
Coaxial cable
Sinusoidal oscillators
Protein Synthesis Notes
Vedic math
Math magic, tricky math
Biology Form 5 Chapter 2 - Locomotion & support : 2.1 Part 2
RHEUMATOID ARTHRITIS BY DR BASHIR AHMED DAR ASSOCIATE PROFESSOR MEDICINE SOPO...
Rheumatoid Arthritis Power Point
Human Skeletal System
Rheumatoid arthritis
Psychometric Assessment
Human skeletal system - Movement and Locomotion
Ad

Similar to Tricky math puzzle project report (20)

PPT
UNIT 1: Problem Solving Using Computer
PDF
265 ge8151 problem solving and python programming - 2 marks with answers
PPTX
Introduction to problem solving Techniques
PDF
4 coding from algorithms
PPTX
UNIT-1.pptx python for engineering first year students
PDF
L1. Basic Programming Concepts.pdf
PDF
program-control-instruction.pdf
PDF
Introduction to computer science ch3 programming
PPTX
asic computer is an electronic device that can receive, store, process, and o...
PPT
Problem Solving Techniques
PPT
ES-CH5.ppt
PPTX
What is algorithm
PPTX
Fundamentals of Programming Lecture #1.pptx
PDF
Fundamental of Information Technology - UNIT 6
PPTX
Assembly Language Programming
PPTX
Algorithm and flowchart
PDF
Introduction to Computer Programming
DOCX
NIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docx
PPT
Lect 3-4 Zaheer Abbas
UNIT 1: Problem Solving Using Computer
265 ge8151 problem solving and python programming - 2 marks with answers
Introduction to problem solving Techniques
4 coding from algorithms
UNIT-1.pptx python for engineering first year students
L1. Basic Programming Concepts.pdf
program-control-instruction.pdf
Introduction to computer science ch3 programming
asic computer is an electronic device that can receive, store, process, and o...
Problem Solving Techniques
ES-CH5.ppt
What is algorithm
Fundamentals of Programming Lecture #1.pptx
Fundamental of Information Technology - UNIT 6
Assembly Language Programming
Algorithm and flowchart
Introduction to Computer Programming
NIE2206 Electronic LogbookNamexxxStudent IDUxxxTe.docx
Lect 3-4 Zaheer Abbas

More from Sanzid Kawsar (7)

PPTX
Introduction to Research
PDF
Data Mining Techniques
PPTX
A* (aster) Search Algorithm
PPTX
Research on an Open-Source Software Platform for Autonomous Driving Systems
PPTX
Natural Language processing
DOCX
Report on Phylogenetic tree
PPTX
Phylogenetic tree
Introduction to Research
Data Mining Techniques
A* (aster) Search Algorithm
Research on an Open-Source Software Platform for Autonomous Driving Systems
Natural Language processing
Report on Phylogenetic tree
Phylogenetic tree

Recently uploaded (20)

PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PPTX
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
PDF
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
DOC
T Pandian CV Madurai pandi kokkaf illaya
PDF
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
PPTX
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PPTX
Feature types and data preprocessing steps
PPTX
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
PDF
Design of Material Handling Equipment Lecture Note
PDF
Java Basics-Introduction and program control
PPTX
Petroleum Refining & Petrochemicals.pptx
PDF
MLpara ingenieira CIVIL, meca Y AMBIENTAL
PDF
Soil Improvement Techniques Note - Rabbi
PPTX
PRASUNET_20240614003_231416_0000[1].pptx
PPTX
Principal presentation for NAAC (1).pptx
PDF
First part_B-Image Processing - 1 of 2).pdf
PPTX
mechattonicsand iotwith sensor and actuator
PPT
Chapter 1 - Introduction to Manufacturing Technology_2.ppt
PPTX
ai_satellite_crop_management_20250815030350.pptx
August 2025 - Top 10 Read Articles in Network Security & Its Applications
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
T Pandian CV Madurai pandi kokkaf illaya
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Feature types and data preprocessing steps
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
Design of Material Handling Equipment Lecture Note
Java Basics-Introduction and program control
Petroleum Refining & Petrochemicals.pptx
MLpara ingenieira CIVIL, meca Y AMBIENTAL
Soil Improvement Techniques Note - Rabbi
PRASUNET_20240614003_231416_0000[1].pptx
Principal presentation for NAAC (1).pptx
First part_B-Image Processing - 1 of 2).pdf
mechattonicsand iotwith sensor and actuator
Chapter 1 - Introduction to Manufacturing Technology_2.ppt
ai_satellite_crop_management_20250815030350.pptx

Tricky math puzzle project report

  • 1. SUBMITTED BY- Team #NoFrazzle 1. Md Sanzidul Islam 151-15- 5223 2. Farhan Tawsif Chowdhury 151-15- 4705 3. Nazmul Ahsan 151-15- 4668 4. Md. Mahbubur Rahman 151-15- 4761 5. Sadia Sultana Sharmin Mousumi 151- 15-5191 SUBMITTED TO- Ms. Bashira Akter Anima Lecturer, Dep. Of CSE, Daffodil International UniversityDate of Submission: 18th December, 2016 PROJECT REPORT ON “TRICKY MATH PUZZLE” COURSE: MICROPROCESSOR &ASSEMBLY LANGUAGE COURSE CODE: CSE 231
  • 2. Abstract & Hints: The purposeof this projectis to design and build a math puzzlegame that will give user the experience of solving various tricky math puzzlethrough gaming. This was achieved through severalsteps. In background, weused programming language Assembly. Instructions likeconditions, loops, call procedure& various types of registers and their uses, whatwe learned throughoutour courses. What is assembly language? An assembly languageis a programming language that can be used to directly tell the computer what to do. An assembly language is almostexactly like the machine language that a computer can understand, except that it uses words in place of numbers. A computer cannot really understand an assembly program directly. However, it can easily change the programinto machine code by replacing the words of the programwith the numbers that they stand for. A programthat does that is called an assembler. Programs written in assembly language are usually made of instructions, which are small tasks that the computer performs when it is running the program. They are called instructions because the programmer uses them to instruct the computer whatto do. The part of the computer that follows the instructions is the processor. Theassembly language of a computer is a low-level language, which means that it can only be used to do the simple tasks that a computer can understand directly. In order to performmore complex tasks, onemust tell the computer each of the simple tasks that are part of the complex task. For example, a computer does not understand how to printa sentence on its screen. Instead, a programwritten in assembly must tell it how to do all of the small steps that are involved in printing the sentence. Strengthof assembly language:
  • 3. 1. The symbolic programming of Assembly Languageis easier to understand and saves a lot of time and effortof the programmer. 2. Itis easier to correct errors and modify programinstructions. 3. Assembly Languagehas the sameefficiency of execution as the machine level language. Because this is one-to-onetranslator between assembly language programand its corresponding machinelanguage program. Disadvantages of assembly language: 1. One of the major disadvantages is that assembly language is machine dependent. A programwritten for one computer might not run in other computers with different hardwareconfiguration. Project Description&Demo: When we startthe game “Tricky Math Puzzle” we will have a POP-Up window showing this menu. The firstthree options in this menu is our game segments.
  • 4. If you chooseoption 1. you will get enter into math teaser game segment. In math teaser segment we put somediscretional tricky mathematical question as like puzzle. Something like this, Here we have multiple choice option. Herethe correctanswer is number two (2). So you have to input number two (2) fromyour key board. Thus you will get your correctanswer and your point one (1) which we will be regarded for each correct answer. Whether you give the right or the wrong answer you will automatically have the next puzzleafter answering previous one. Becauseof we are in the developing state of our game so we justput five puzzles into firsttwo segments. Farther puzzlewill be coming soon. When you will be able to answer all this five question you will get all the points and encouraged to go into our next segment which is sequence and assumption. This is the choice number two on the game menu. In this segment the gamer will have to face some sortof sequentially math puzzle.
  • 5. So here this is the sample of a question. You have to give your assumption to complete the sequence. So we can see this is a Fibonacci series and complete the sequence the answer will be number three (3) and you will have your point. The third or final segment of our game is the mostinteresting one. Here we test our player assumption skill. You will be asked to guess and input 3 digits. In programlogic unit it automatically generate 3 randomdigits and compare/match with your imputed digits. If 1 digit will match, you will get 100$.If 2 digitwill match, you will get 1000$. If 3 digit will match, you will get 10000$.Herewecan see 1 digit will match and he/she get 100$. If anyonecan play again you press 1. If the gamer need any help he justhaveto get into choice 4 for help like how to operate this game, how to operate this menu and how to play this game whatI justmention above. If you wantto exit you justpress 5.
  • 8. Background of Project: Conditional execution in assembly language is accomplished by severallooping and branching instructions. Theseinstructions can change the flow of control in a program. Conditionalexecution is observed in two scenarios − SN Conditional Instructions 1 Unconditional jump This is performed by the JMP instruction. Conditional execution often involves a transfer of control to the address of an instruction that does not follow the currently executing instruction. Transfer of control may be forward, to execute a new set of instructions or backward, to re- execute the samesteps.
  • 9. 2 Conditional jump This is performed by a set of jump instructions j<condition> (i.e. JNZ, JE, JG etc.) depending upon the condition. The conditional instructions transfer the control by breaking the sequential flow and they do it by changing the offsetvalue in IP. Let us discuss theCMP instruction beforediscussing the conditional instructions. CMP Instruction: The CMP instruction compares two operands. Itis generally used in conditional execution. This instruction basically subtracts oneoperand fromthe other for comparing whether the operands are equal or not. Itdoes not disturb the destination or sourceoperands. Itis used along with the conditional jump instruction for decision making. Syntax CMP destination, source CMP compares two numeric data fields. The destination operand could be either in register or in memory. The sourceoperand could be a constant (immediate) data, register or memory. JMP Instructions: The JMP (Jump)instruction causes an unconditional transfer of control (unconditional jump). Such an instruction transfers the flow of execution by changing the instruction pointer register. There are several different opcodes that performa jump; depending on whether the processor is in real mode or protected mode, and an overrideinstruction is used, the instructions may take 16- bit, 32-bit, or segment: offsetpointers. The syntax is,
  • 10. JMP destination Where destination is usually a label in the samesegment as the JMP itself. JMP can be used to get around the range restriction of a conditional jump. Conditional Jump: If somespecified condition is satisfied in conditional jump, the controlflow is transferred to a target instruction. There are numerous conditional jump instructions depending upon the condition and data. For an example, CMP AL, BL JE EQUAL CMP AL, BH JE EQUAL CMP AL, CL JE EQUAL NON_EQUAL: ... EQUAL:... Use of CMP and JMP instruction in our project: MOV AH,1 ; MENU CHOICE INT21H MOV CHOOSE,AL CMP AL,'1' JE MATH_TEASER
  • 11. CMP AL,'2' JE SEQUENCES CMP AL,'3' JE ASSUME_SKILL CMP AL,'4' JE HELP CMP AL,'5' JE EXIT Loop Instructions: A loop is a sequence of instructions that is repeated. The number of times to repeat may be known in advance, or it may depend on conditions. FORLOOP: This is a loop structurein which the loop statements are repeated a known number of times (a count-controlled loop). In pseudocodes, FORloop_ counttimes DO Statements END_FOR The LOOP instruction can be used to implement a FOR loop. Ithas the form, LOOP destination_ label WHILELOOP: This loop depends on a condition. In pseudocode, WHILEcondition DO
  • 12. Statements END WHILE REPEAT LOOP: Another conditional loop is the REPEAT LOOP. In pseudocode, REPEAT Statements UNTIL condition Use of Loop instructions in our project: MOV CX,3 MOV BL,'0‘ AGAIN: MOV AH,1 INT21H CMP AL,RANDOMNUM1 JE MATCH CMP AL, RANDOMNUM2 JE MATCH CMP AL, RANDOMNUM3 JE MATCH LOOP AGAIN JMP RESULT MATCH: INC BL
  • 13. LOOP AGAIN RESULT: Procedures: Procedures or subroutines are very important in assembly language, as the assembly language programs tend to be large in size. Procedures are identified by a name. Following this name, the body of the procedure is described which performs a well-defined job. End of the procedure is indicated by a return statement. Following is the syntax to define a procedure − proc_name: procedurebody ... ret The procedureis called fromanother function by using the CALL instruction. The CALL instruction should havethe name of the called procedureas an argument as shown below − CALL proc_name The called procedurereturns the controlto the calling procedureby using the RET instruction. Use of CALL PROC in our project: NEW_LINEPROC ; NEW LINEPRINTPROCEDURE MOV AH,2 MOV DL,0AH
  • 14. INT21H MOV DL,0DH INT21H RET …………………………………………. CALL NEW_LINE INT10h: INT10h, INT10H or INT16 is shorthand for BIOS interruptcall 10hex, the 17th interrupt vector in an x86-based computer system. TheBIOS typically sets up a real mode interrupt handler at this vector that provides video services. Such services include setting the video mode, character and string output, and graphics primitives (reading and writing pixels in graphics mode). To use this call, load AH with the number of the desired sub function, load other required parameters in other registers, and make the call. INT10h is slow, so many programs bypass this BIOS routineand access the display hardwaredirectly. Setting the video mode, which is done infrequently, can be accomplished by using the BIOS, whiledrawing graphics on the screen in a game needs to be done quickly, so direct access to video RAM is moreappropriate than making a BIOS call for every pixel. Function: Scroll up window AH=06h AL = lines to scroll(0 = clear, CH, CL, DH, DL are used), BH = Background Color and Foreground color. BH = 43h, means that background color is red and foreground color is cyan. Refer the BIOS color attributes
  • 15. CH = Upper row number, CL = Left column number, DH = Lower row number, DL = Right column number. Clear screen procedure: CLRSCR PROC ; CLEAR SCREEN PROCEDURE MOV AX,0600H ;06 TO SCROLL & 00 FORFULL CLEAR SCREEN MOV BH,07H ;ATTRIBUTE0 FORBACKGROUND AND 7 FOR FOREGROUND MOV CX,0000H ;STARTING COORDINATES MOV DX,184FH ;ENDING COORDINATES INT10H ;FOR VIDEO DISPLAY RET Function of INT1Ah: 1Ah Real Time Clock Services AH Description 00h Read RTC 01h Set RTC 02h Read RTC Time 03h Set RTC Time 04h Read RTC Date 05h Set RTC Date 06h Set RTC Alarm 07h Reset RTC Alarm
  • 16. Random no generate procedureusing 00h: RANDOMPROC ; GENERATE A RANDOMNO USING THE SYSTEMTIME MOV AH, 00h ; INTERRRUPTS TO GET SYSTEM TIME INT1AH ; CX:DX NOW HOLD NUMBER OF CLOCK TICKS SINCE MIDNIGHT MOV AX, DX XOR DX, DX MOV CX, 10 DIV CX ; HERE DX CONTAINS THEREMINDEROF THE DIVISIONFROM 0 TO 9 ADD DL,'0' ; TO ASCII FROM'0'TO '9' MOV BL,DL RET Project showing/ Interface: Tricky math puzzleis a game made by assembly language. We made it with a lucrative interface as wecould. Actually, assembly language doesn’t give as opportunities as any other high level languages. After all, our game had very user friendly interface wethink. In addition-  For being in assembly languageits procedureis so speedy.
  • 17.  Though it is a small project, but we tried to make it bug free. And we also confidently say that is has no bug in our game!  It’s an interesting game, no doubt! Is has three segments full of enjoyment.  Itcan be said a brain game. We tried to make it logical so that one can stormhis/ her brain through our game. Future Planning: Actually, wemade it in very shorttime. Though we full filled all of our expectations, we have somefuture plan about our game. We may develop it by any other high level language like C++/Java or with Unity. The features may have in our next version like bellow-  A significant partof gaming is its graphics quality. So, we musthave a lucrative graphicalinterface.  Now artificial interface is a hot cake in gaming world. We will try to add AI features in our next version.  We may add many more segments and events in our game.  We may develop morestages and will update everything day by day. ------- Thank you! -------