-
Notifications
You must be signed in to change notification settings - Fork 0
/
QuizGame_template.asm
1890 lines (1383 loc) · 38.8 KB
/
QuizGame_template.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$NOLIST
$MODLP51
$LIST
CLK EQU 22118400 ; crystal frequency (Hz)
TIMER0_RATE0 EQU ((2048*2)+100)
TIMER0_RATE1 EQU ((2048*2)-100)
TIMER0_RELOAD0 EQU ((65536-(CLK/TIMER0_RATE0)))
TIMER0_RELOAD1 EQU ((65536-(CLK/TIMER0_RATE1)))
TIMER0_HIGH_FREQUENCY EQU 2600 ;frequency to compliment square wave to generate 1300hz signal
TIMER0_MEDIUM_FREQUENCY EQU 2000 ;to generate 1000hz signal
TIMER0_LOW_FREQUENCY EQU 1400 ;to generate 700hz signal
TIMER0_HIGH EQU (65536-(CLK/TIMER0_HIGH_FREQUENCY))
TIMER0_MEDIUM EQU (65536-(CLK/TIMER0_MEDIUM_FREQUENCY))
TIMER0_LOW EQU (65536-(CLK/TIMER0_LOW_FREQUENCY))
;65536 is the default overflow value
; so count clock cycles up to 65536 then overflow
unit_conversion_button equ P4.5
SOUND_OUT equ P1.1
START_BUTTON equ P1.2 ;CHANGE THESE
INC_BUTTON equ p1.2 ;THESE ARENT THE RIGHT BUTTONS
org 0000H
ljmp MyProgram
; Timer/Counter 0 overflow interrupt vector
org 0x000B
ljmp Timer0_ISR
; Timer/Counter 2 overflow interrupt vector
org 0x002B
ljmp Timer2_ISR
; These register definitions needed by 'math32.inc'
DSEG at 30H
x: ds 4
y: ds 4
bcd: ds 5
overflow_counter: ds 2
p1_points: ds 1
p2_points: ds 1
Qnum: ds 1
q_total: ds 1
qstep: ds 1
seed_num: ds 1
BSEG
mf: dbit 1 ;comparison flag for the 32-bit library
pf_flag: dbit 1
nf_flag: dbit 1 ;flags to choose which units to display
uf_flag: dbit 1
P1T: dbit 1
P1F: dbit 1
P2T: dbit 1
P2F: dbit 1
;flags indicating that questions were visited
question1_flag: dbit 1
question2_flag: dbit 1
question3_flag: dbit 1
question4_flag: dbit 1
question5_flag: dbit 1
question6_flag: dbit 1
question7_flag: dbit 1
question8_flag: dbit 1
$NOLIST
$include(math32.inc)
$LIST
cseg
; These 'equ' must match the hardware wiring
LCD_RS equ P3.2
;LCD_RW equ PX.X ; Not used in this code, connect the pin to GND
LCD_E equ P3.3
LCD_D4 equ P3.4
LCD_D5 equ P3.5
LCD_D6 equ P3.6
LCD_D7 equ P3.7
$NOLIST
$include(LCD_4bit.inc) ; A library of LCD related functions and utility macros
$LIST
; 1234567890123456 <- This helps determine the location of the counter
Initial_Message: db 'Capacitance:( )', 0
No_Signal_Str: db 'No signal ', 0
pf_string: db 'pf',0
nf_string: db 'nf',0
uf_string: db 'uf',0
p1_correct: db 'P1 Correct!', 0
p2_correct: db 'P2 Correct!', 0
p1_incorrect: db 'P1 Incorrect!', 0
p2_incorrect: db 'P2 Incorrect!', 0
clear_screen: db ' ', 0
point_display: db 'p1 p2 ',0
draw_string: db 'Its a draw!!!!!!!!',0
p1_winner_string: db 'Player 1 wins!!!',0
p2_winner_string: db 'Player 2 wins!!!',0
seed_prompt: db 'Seed RNG: ', 0
GAME_START: db 'Starts in: ', 0
GAME_GO: db 'GO! ', 0
clear_string: db ' ',0
question1_line1: db 'Is the sky blue?',0
question2_line1: db '9+10=21? ',0
question3_line1: db 'Canadas national',0
question3_line2: db 'sport is hockey?',0
question4_line1: db 'Heat increases ',0
question4_line2: db 'heart rate? ',0
question5_line1: db 'Do neutrinos ',0
question5_line2: db 'have mass? ',0
question6_line1: db 'Does GABA ',0
question6_line2: db 'excite neurons? ',0
question7_line1: db 'Can you overdose',0
question7_line2: db 'on coffee? ',0
question8_line1: db 'Are male cows ',0
question8_line2: db 'called Bison? ',0
question9_line1: db '',0
question9_line2: db '',0
;---------------------------------;
; RNG subroutines ;
;---------------------------------;
Seed:
Set_Cursor(1,1)
Send_constant_string(#seed_prompt)
Set_Cursor(2,1)
DISPLAY_BCD(seed_num)
;this must be initialized in the main initialization subroutine
;mov seed_num, #0
jb INC_BUTTON, DONT_INCRIMENT
Wait_Milli_Seconds(#50)
jb INC_BUTTON, DONT_INCRIMENT
INCRIMENT: jnb INC_BUTTON, INCRIMENT
inc seed_num
DONT_INCRIMENT:
jb START_BUTTON, DONT_START
Wait_Milli_Seconds(#50)
jb START_BUTTON, DONT_START
START: jnb START_BUTTON, START
ljmp Countdown
DONT_START:
;loop back awaiting input
ljmp Seed
qnum_update:
;this algorithim performs linear probing across the 7(prime number) questions and steps qnum forward by
;randomized number qstep until it lands on a question that has not been asked
mov a,qnum
add a,qstep
mov qnum,a
mov x+0,qnum
mov x+1,#0
mov x+2,#0
mov x+3,#0
mov y+0,#7
mov y+1,#0
mov y+2,#0
mov y+3,#0
clr mf
lcall x_gt_y
;mf stores bool value of (x>y)
jb mf,qnummod7
sjmp skip_qnummod7
qnummod7:
lcall sub32 ;now X stores qnum-7
skip_qnummod7:
mov qnum,x+0
;repeat this process if the qnum-7th flag is set
mov a,qnum
;if on question 1
cjne a,#1,ignore1
;if question 1 was already visited
jnb question1_flag,ignore1
;step forward again
ljmp qnum_update
ignore1:
;if on question 2
cjne a,#2,ignore2
;if question 2 was already visited
jnb question2_flag,ignore2
;step forward again
ljmp qnum_update
ignore2:
;if on question 3
cjne a,#3,ignore3
;if question 3 was already visited
jnb question3_flag,ignore3
;step forward again
ljmp qnum_update
ignore3:
;if on question 4
cjne a,#4,ignore4
;if question 1 was already visited
jnb question4_flag,ignore4
;step forward again
ljmp qnum_update
ignore4:
;if on question 5
cjne a,#5,ignore1
;if question 5 was already visited
jnb question5_flag,ignore5
;step forward again
ljmp qnum_update
ignore5:
;if on question 6
cjne a,#6,ignore6
;if question 6 was already visited
jnb question6_flag,ignore6
;step forward again
ljmp qnum_update
ignore6:
;if on question 7
cjne a,#7,ignore7
;if question 7 was already visited
jnb question7_flag,ignore7
;step forward again
ljmp qnum_update
ignore7:
;since this subroutine is being called in Qsel
ljmp Qsel
Countdown:
;A COUNTDOWN TO BE DISPLAYED AT THE START OF THE GAME
Set_Cursor(1,1)
send_constant_string(#GAME_START)
Set_Cursor(2,1)
DISPLAY_BCD(#3)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
DISPLAY_BCD(#2)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
DISPLAY_BCD(#1)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Set_Cursor(1,1)
send_constant_string(#GAME_GO)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
ljmp Qsel
Timer0_ISR:
cpl SOUND_OUT
reti
;---------------------------------;
; time delay subroutines ;
;---------------------------------;
;waits for the number of miliseconds in register 2
WaitR2ms:
push AR0
push AR1
loop3: mov R1, #45
loop2: mov R0, #166
loop1: djnz R0, loop1 ; 3 cycles->3*45.21123ns*166=22.51519us
djnz R1, loop2 ; 22.51519us*45=1.013ms
djnz R2, loop3 ; number of millisecons to wait passed in R2
pop AR1
pop AR0
ret
;waits for 22.5*R2 microseconds
WaitR2X22us:
push AR0
push AR1
L33: mov R1, #1
L22: mov R0, #166
L11: djnz R0, L11 ; 3 cycles->3*45.21123ns*166=22.51519us
djnz R1, L22 ; 22.51519us*22.1519us
djnz R2, L33 ; number of millisecons to wait passed in R2
pop AR1
pop AR0
ret
;---------------------------------;
; buzzer subroutines ;
;---------------------------------;
;INDIVIDUAL BUZZ SUBROUTINES WILL RUN FOR ABOUT 0.33S
;generate a 1300hz signal for 0.33 seconds
new_high_buzz:
clr TR0
mov RH0, #high(TIMER0_HIGH) ;how many clock cycles to interrupt at
mov RL0, #low(TIMER0_HIGH)
setb TR0 ;timer is on
;keep the timer running for 0.33 seconds
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#133)
clr TR0
ret
;generate 1000hz signal for 0.33s
new_medium_buzz:
clr TR0
mov RH0, #high(TIMER0_MEDIUM) ;how many clock cycles to interrupt at
mov RL0, #low(TIMER0_MEDIUM)
setb TR0 ;timer is on
;keep the timer running for 0.33 seconds
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#133)
clr TR0
ret
;generate 700hz signal for 0.33s
new_low_buzz:
clr TR0
mov RH0, #high(TIMER0_LOW) ;how many clock cycles to interrupt at
mov RL0, #low(TIMER0_LOW)
setb TR0 ;timer is on
;keep the timer running for 0.33 seconds
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#133)
clr TR0
ret
winning_buzz:
set_cursor(2,1)
send_constant_string(#point_display)
;display the actual score
set_cursor(2,5)
display_bcd(p1_points)
set_cursor(2,13)
display_bcd(p2_points)
;clear flags to not trigger next question
clr P1T
clr P1F
clr P2T
clr P2F
;GENERATE A LOW,MEDIUM,then HIGH buzz
;generate a low tone for 0.33s
clr TR0
mov RH0, #high(TIMER0_LOW) ;how many clock cycles to interrupt at
mov RL0, #low(TIMER0_LOW)
setb TR0 ;timer is on
;keep the timer running for 0.33 seconds
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#133)
clr TR0
;generate a medium tone for 0.33s
clr TR0
mov RH0, #high(TIMER0_MEDIUM) ;how many clock cycles to interrupt at
mov RL0, #low(TIMER0_MEDIUM)
setb TR0 ;timer is on
;keep the timer running for 0.33 seconds
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#133)
clr TR0
;generate a high tone for 0.33s
clr TR0
mov RH0, #high(TIMER0_HIGH) ;how many clock cycles to interrupt at
mov RL0, #low(TIMER0_HIGH)
setb TR0 ;timer is on
;keep the timer running for 0.33 seconds
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#133)
clr TR0
;ljmp new_low_buzz
;ljmp new_medium_buzz
;ljmp new_high_buzz
;wait for 3 more seconds so 15*200ms
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
ljmp Qsel
losing_buzz:
set_cursor(2,1)
send_constant_string(#point_display)
;display the actual score
set_cursor(2,5)
display_bcd(p1_points)
set_cursor(2,13)
display_bcd(p2_points)
;clear flags to not trigger next question
clr P1T
clr P1F
clr P2T
clr P2F
;GENERATE A HIGH,MEDIUM,then LOW buzz, this should take 1s
;generate a high tone for 0.33s
clr TR0
mov RH0, #high(TIMER0_HIGH) ;how many clock cycles to interrupt at
mov RL0, #low(TIMER0_HIGH)
setb TR0 ;timer is on
;keep the timer running for 0.33 seconds
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#133)
clr TR0
;generate a medium tone for 0.33s
clr TR0
mov RH0, #high(TIMER0_MEDIUM) ;how many clock cycles to interrupt at
mov RL0, #low(TIMER0_MEDIUM)
setb TR0 ;timer is on
;keep the timer running for 0.33 seconds
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#133)
clr TR0
;generate a low tone for 0.33s
clr TR0
mov RH0, #high(TIMER0_LOW) ;how many clock cycles to interrupt at
mov RL0, #low(TIMER0_LOW)
setb TR0 ;timer is on
;keep the timer running for 0.33 seconds
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#133)
clr TR0
;ljmp new_high_buzz
;ljmp new_medium_buzz
;ljmp new_low_buzz
;wait for 3 more seconds so 15*200ms
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
Wait_Milli_Seconds(#200)
ljmp Qsel
Timer2_ISR:
;lcall button_registering
clr TF2 ;no more overflow after we have gone into the ISR
push acc
inc overflow_counter+0 ; count one overflow
mov a, overflow_counter+0
jnz coal_miner
;if the code got hrere then oeverflow_counter+0 was 0 meaning that overflow_counter+1 must be incrimented
inc overflow_counter+1
coal_miner:;to skip over incrimenting bit 1 of overflow counter
pop acc
reti
; Sends 10-digit BCD number in bcd to the LCD
Display_10_digit_BCD:
Display_BCD(bcd+4)
Display_BCD(bcd+3)
Display_BCD(bcd+2)
Display_BCD(bcd+1)
Display_BCD(bcd+0)
ret
;Initializes timer/counter 2 as a 16-bit timer
InitTimer2:
mov T2CON, #0 ; Stop timer/counter. Set as timer (clock input is pin 22.1184MHz).
; Set the reload value on overflow to zero (just in case is not zero)
mov RCAP2H, #0
mov RCAP2L, #0
setb ET2
ret
button_registering:
;look for button press to change units
jb unit_conversion_button,dont_change_units_boogaloo
;debounce delay
Wait_Milli_Seconds(#50)
jb unit_conversion_button,dont_change_units_boogaloo
;wait for button release
benadryl: jnb unit_conversion_button, benadryl
;WHAT YOU WANT TO DO WHEN BUTTON IS PRESSED
dont_change_units_boogaloo:
ret
;---------------------------------;
; question subs ;
;---------------------------------;
question_1:
set_cursor(1,1)
Send_Constant_String(#question1_line1)
set_cursor(2,1)
send_constant_string(#clear_string)
;check flags to determine right answer
;player 1 gets a point if they say sky blue
jb P1T,p1_q1_point
sjmp avoid_p1_q1_point
p1_q1_point:
setb question1_flag
ljmp p1_right
avoid_p1_q1_point:
;player 2 gets a point if they say sky blue
jb P2T,p2_q1_point
sjmp avoid_p2_q1_point
p2_q1_point:
setb question1_flag
ljmp p2_right
avoid_p2_q1_point:
;player 1 loses a point if they say sky not blue
jb P1f,p1_q1_lose
sjmp avoid_p1_q1_lose
p1_q1_lose:
setb question1_flag
ljmp p1_wrong
avoid_p1_q1_lose:
;player 2 lose a point if they say sky not blue
jb P2F,p2_q1_lose
sjmp avoid_p2_q1_lose
p2_q1_lose:
setb question1_flag
ljmp p2_wrong
avoid_p2_q1_lose:
ljmp measure_caps ;look for any button presses
;keep looping awaiting answer
ljmp question_1
ret
question_2:
set_cursor(1,1)
Send_Constant_String(#question2_line1)
set_cursor(2,1)
send_constant_string(#clear_string)
;check flags to determine right answer
;player 1 lose a point if they say 9+10=21
jb p1t,p1_q2_lose
sjmp avoid_p1_q2_lose
p1_q2_lose:
setb question2_flag
ljmp p1_wrong
avoid_p1_q2_lose:
;player 2 lose a point if they say 9+10=21
jb p2t,p2_q2_lose
sjmp avoid_p2_q2_lose
p2_q2_lose:
setb question2_flag
ljmp p2_wrong
avoid_p2_q2_lose:
;player 1 gain a point if they say 9+10!=21
jb p1f,p1_q2_win
sjmp avoid_p1_q2_win
p1_q2_win:
setb question2_flag
ljmp p1_right
avoid_p1_q2_win:
;player 2 gain a point if they say 9+10!=21
jb p2f,p2_q2_win
sjmp avoid_p2_q2_win
p2_q2_win:
setb question2_flag
ljmp p2_right
avoid_p2_q2_win:
ljmp measure_caps ;look for any button presses
;keep looping awaiting answer
ljmp question_2
ret
question_3:
set_cursor(1,1)
Send_Constant_String(#question3_line1)
set_cursor(2,1)
Send_constant_string(#question3_line2)
;check flags to determine right answer
;canadas national sport is not hockey so players will gain a point for saying F and lose a point for saying T
jb p1t,p1_q3_lose
sjmp avoid_p1_q3_lose
p1_q3_lose:
setb question3_flag
ljmp p1_wrong
avoid_p1_q3_lose:
jb p2t,p2_q3_lose
sjmp avoid_p2_q3_lose
p2_q3_lose:
setb question3_flag
ljmp p2_wrong
avoid_p2_q3_lose:
jb p1f,p1_q3_win
sjmp avoid_p1_q3_win
p1_q3_win:
setb question3_flag
ljmp p1_right
avoid_p1_q3_win:
jb p2f,p2_q3_win
sjmp avoid_p2_q3_win
p2_q3_win:
setb question3_flag
ljmp p2_right
avoid_p2_q3_win:
ljmp measure_caps ;look for any button presses
;keep looping awaiting answer
ljmp question_3
ret
question_4:
set_cursor(1,1)
Send_Constant_String(#question4_line1)
set_cursor(2,1)
send_constant_string(#question4_line2)
;check flags to determine right answer
;player 1 gets a point if they say heat increases heart rate
jb p1t,p1_q4_point
sjmp avoid_p1_q4_point
p1_q4_point:
setb question4_flag
ljmp p1_right
avoid_p1_q4_point:
;player 2 gets a point if they say heat raises BPM
jb p2t,p2_q4_point
sjmp avoid_p2_q4_point
p2_q4_point:
setb question4_flag
ljmp p2_right
avoid_p2_q4_point:
;player 1 loses a point if they heat no raise BPM
jb p1f,p1_q4_lose
sjmp avoid_p1_q4_lose
p1_q4_lose:
setb question4_flag
ljmp p1_wrong
avoid_p1_q4_lose:
;player 2 lose a point if they say heat no raise BPM
jb p2f,p2_q4_lose
sjmp avoid_p2_q4_lose
p2_q4_lose:
setb question4_flag
ljmp p2_wrong
avoid_p2_q4_lose:
ljmp measure_caps ;look for any button presses
;keep looping awaiting answer
ljmp question_4
ret
question_5:
set_cursor(1,1)
Send_Constant_String(#question5_line1)
set_cursor(2,1)
send_constant_string(#question5_line2)
;check flags to determine right answer
;player 1 gets a point if they say neutrino have mass
jb p1t,p1_q5_point
sjmp avoid_p1_q5_point
p1_q5_point:
setb question5_flag
ljmp p1_right
avoid_p1_q5_point:
;player 2 gets a point if they say neutrino have mass
jb p2t,p2_q5_point
sjmp avoid_p2_q5_point
p2_q5_point:
setb question5_flag
ljmp p2_right
avoid_p2_q5_point:
;player 1 loses a point if they say neutrino massless
jb p1f,p1_q5_lose
sjmp avoid_p1_q5_lose
p1_q5_lose:
setb question5_flag
ljmp p1_wrong
avoid_p1_q5_lose:
;player 2 lose a point if they say neutrino massless
jb p2f,p2_q5_lose
sjmp avoid_p2_q5_lose
p2_q5_lose:
setb question5_flag
ljmp p2_wrong
avoid_p2_q5_lose:
ljmp measure_caps ;look for any button presses
;keep looping awaiting answer
ljmp question_5
ret
question_6:
set_cursor(1,1)
Send_Constant_String(#question6_line1)
set_cursor(2,1)
Send_constant_string(#question6_line2)
;check flags to determine right answer
;GABA inhibits neurons so players lose points for answering true
jb p1t,p1_q6_lose
sjmp avoid_p1_q6_lose
p1_q6_lose:
setb question6_flag
ljmp p1_wrong
avoid_p1_q6_lose:
jb p2t,p2_q6_lose
sjmp avoid_p2_q6_lose
p2_q6_lose:
setb question6_flag
ljmp p2_wrong
avoid_p2_q6_lose:
jb p1f,p1_q6_win
sjmp avoid_p1_q6_win
p1_q6_win:
setb question6_flag
ljmp p1_right
avoid_p1_q6_win:
jb p2f,p2_q6_win
sjmp avoid_p2_q6_win
p2_q6_win:
setb question6_flag
ljmp p2_right
avoid_p2_q6_win:
ljmp measure_caps ;look for any button presses
;keep looping awaiting answer
ljmp question_6
ret
question_7:
set_cursor(1,1)
Send_Constant_String(#question7_line1)
set_cursor(2,1)
send_constant_string(#question7_line2)
;check flags to determine right answer
;player gets a point if they say you can OD on coffee
jb p1t,p1_q7_point
sjmp avoid_p1_q7_point
p1_q7_point:
setb question7_flag
ljmp p1_right
avoid_p1_q7_point:
jb p2t,p2_q7_point
sjmp avoid_p2_q7_point
p2_q7_point:
setb question7_flag
ljmp p2_right
avoid_p2_q7_point:
jb p1f,p1_q7_lose
sjmp avoid_p1_q7_lose
p1_q7_lose:
setb question7_flag
ljmp p1_wrong
avoid_p1_q7_lose:
jb p2f,p2_q7_lose
sjmp avoid_p2_q7_lose
p2_q7_lose:
setb question7_flag
ljmp p2_wrong
avoid_p2_q7_lose:
ljmp measure_caps ;look for any button presses
;keep looping awaiting answer
ljmp question_7
ret
question_8:
set_cursor(1,1)
Send_Constant_String(#question8_line1)
set_cursor(2,1)
Send_constant_string(#question8_line2)
;check flags to determine right answer
;GABA inhibits neurons so players lose points for answering true
jb p1t,p1_q8_lose
sjmp avoid_p1_q8_lose
p1_q8_lose:
setb question8_flag
ljmp p1_wrong
avoid_p1_q8_lose:
jb p2t,p2_q8_lose
sjmp avoid_p2_q8_lose
p2_q8_lose:
setb question8_flag
ljmp p2_wrong
avoid_p2_q8_lose:
jb p1f,p1_q8_win
sjmp avoid_p1_q8_win
p1_q8_win:
setb question8_flag
ljmp p1_right
avoid_p1_q8_win:
jb p2f,p2_q8_win
sjmp avoid_p2_q8_win
p2_q8_win:
setb question8_flag
ljmp p2_right
avoid_p2_q8_win:
ljmp measure_caps ;look for any button presses
;keep looping awaiting answer
ljmp question_8
ret
winner: