Assembly Language Simon Says game the random number is now displayed on the the
ID: 3732134 • Letter: A
Question
Assembly Language
Simon Says game the random number is now displayed on the the dual seven display (see problem four above) in hexadecimal. The user should then enter then the number displayed in binary via the switches on the switch light box. The program should allow the user a limited amount of time to enter the number. After each correct entry the program should display another random binary number on the the dual seven display and decrease the amount of time the user has to enter the next number. If the user is timed out before the correct number is entered, the program should alert the user of the error by sounding the buzzer, and restarting the game.
Explanation / Answer
Following code might help you to write your own code...
org 0x00
ljmp start
delay:
mov r3,#0x08
mov r4,#0x0
mov r5,#0x0
loop:
djnz r5, loop
djnz r4, loop
djnz r3, loop
RET
start:
mov P0,#0xFF
s1:
mov r1 , #0x00
s2:
mov a,r1
inc r1
mov dpl,#TBL
movc a ,@a+dptr
mov P0,a
lcall delay
cjne r1,#0x10,s2
ljmp s1
TBL: DB 0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.