-
Notifications
You must be signed in to change notification settings - Fork 0
/
YOURCODE.ASM
5895 lines (5340 loc) · 121 KB
/
YOURCODE.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
.feature force_range
.import BOSDROP, DROPEXS, BOSROB, STAR, GRABLOW, GRAB1, QUIKBALL, FLIT, BALL1
.import HOLDON, BRIZTHNG, BRIZBLOW
.import WIZBLOW, WIZBUL1, GRENTWRL
.import BOMBEXPL, DRIP2, DRIP1, MAPICON, SELECT1, SPGATE
.import KEY, SUCTION, FOOD, BRASSKNU, TORCH, BOOMER1, HART, HTNTS, PYRSPAL
.import TEMPSPAL, TPAL1, JUNGSPAL, JPAL1, DUNGSPAL, DUPAL1, CITYSPAL, CPAL1
.import WINDSPAL, WINDPAL
.import BOX, TNT2
.import BOOMTHRO, FREEMAN, KEYGATE, SHOOT1, BOMB1, DAGSPIN, WIZFLY
.import GRNKICK, GRNWLK, GRNCAPE4, GRNHURT, GRNCAPE1, BRD4, BRDATAK, BRDWALK
.import BRD5, BRD4, BRD3, BRD2, BRD1, EAGATTAK, EAGFLAP, SWRDATAK, SWRDWALK
.import SWRDMAN4, SWRDMAN3, SWRDMAN2, SWRDMAN1, SWRDHURT, KNIFWLK, KNIFATAK
.import JUMPKN1, JUMPKN2, JUMPKN3, JUMPKN4, JUMPKN5, JUMPKN6, MONGHIT, MONGWLK
.import MONG1, MONG2, MONG3, MONG4, MONG5, MONG6, ARRWIN1, ARRWIN2, ARRWIN4, ARRWIN5
.import ARRWIN3, ARROWA, ARRATAK, ARRWALK, RFLSHOOT, RFLSWING, RFLWALK
.import RFLMAN1, RFLMAN2, RFLMAN3, RFLMAN4, DUMMY
.import FORBLOW, FORK, GOOPS, BRIKSMAL, BRIKFALL
.import ARROW1, ARROW2, ARROW3, ARROW4, ARROW, ARROWGO
.import NINJA1, NINJA2, NINJA3, NINJA5, NINJA6, NINJA7, NINATAK, NINWLK
.import BIGWIZ3, BIGWZFLY, TEDS, TED1, TED2, TEDHURT
.import SKEL1, SKEL2, SKELATAK, SLKWALKS, SKELWLK2, SKELWLK3, SKELHURT
.import MAPX, HSHIELD, HCLIMB, HDUCKSX, HTHROWS, HKICK, HRUN, HERO2, HERO1A
.import HHURTX, HERO3
;****************** SPECIAL FLAGS AND RAM USAGE ******************
;COMMON DATA RAM IS USED AS FOLLOWS IN THIS GAME (LEE MAJORS GAME)
;
;0,1 = PLACE TO SAVE REGISTER DURING AN INT. BE SURE TO LOCK OTHERS OUT
; WITH AN INSTRUCTIONS COMMAND.
;2 = LEVEL WE ARE ON IN THE PYRAMID
;3 = DELAY TIME ON ROCKETS
;4 = COUNT OF TORCHES
;5 = COUNT OF BOOMERRANGS
;6 = COUNT OF SHIELDS
;7 = COUNT SUCTION CUPS
;8 = COUNT KEYS
;9 = COUNT BRASS KNUCKLES
;10= STATUS SELECTOR
;11= MAP ICON
;12= COUNT DOWN OF TORCH ENTITY
;13-14 = UNUSED
;15=MUSIC MAKER
;16 = AMOUNT OF DYNAMITE THE HERO HAS.
;17 = USED TO MAKE A CHEAT MODE PASSWORD.
;18 = USED TO DECIDE WHICH DEMO SCREEN TO SHOW
;19 = TRUE IF THIS WORLD HAS CLIFFS THAT FALL TO AN ENTITIES DEATH.
; PRECIPICE JUMPERS CHECK THIS AND WON'T MAKE DARING JUMPS.
;20 = SET AT WORLD START TO -1 SIGNAL THAT WE SHOULDN'T INTERRUPT THE
; THEME SONG YET. FIRST TIME THE MUSIC GETS TO PLAY THROUGH
; WE WILL RESET IT SO ENEMY THEMES CAN INTERRUPT. AN INTERMEDIATE
; STATE OF 1 IS USED TO SIGNAL WE DID INDEED GET TO START IT ONCE.
;21 = HERO'S HEALTH FROM PREVIOUS WORLD. USED TO CONTINUE WITH SAME HEALTH
; IN THE NEXT WORLD.
;22 = HEALTH OF SPECIAL ENTITY IN A GIVEN WORLD SUCH AS A SORCERER
;23 = WORLD TO CONTINUE IN. -1 IF NEW GAME.
;24 = PASSED TO THE STATUS MAP TO SIGNAL THE WORLD TO SHOW WITH X.
;25 = DELAY BEFORE JUMPING ACROSS A PRECIPICE
;26 = DELAY BEFORE JUMPING DOWN FROM A PERCH
;27 = FREEZE TIME WHEN AN ENTITY IS THROWN
;28 = FREEZE TIME WHEN AN ENTITY IS HURT.
;29 = DELAY BEFORE ATTACK IF ENTITY MAD OR DYING
;30 = DELAY BEFORE ATTACK IF ENTITY IS NOT MAD OR DYING
;31 = SUPER SOLID CHAR VALUE (VALUE TO USE AT START OF JUMP TO TURN SOLID OFF
;
;REMEMBER THAT THE DELAY TIMES ABOVE ARE ADDED TO THE CODE PROCESSING OVERHEAD
;FOR THE MODE IN QUESTION. IN SOME CASES ITS DESIRABLE TO SET THESE TO 0
;WHICH IS THE MINIMUM.
;
;*************************HERO CODE *******************
; FOR THE HERO THE BEHAVIOR BITS ARE USED AS FOLLOWS:
; OPTION1 MEANS YOU ARE ON A LADDER
; FAST MEANS YOU ARE USING THE SUCTION CUPS
; WEAK IS USED FOR SUCTION CUP MODE
; STATE RAM IS USED TO SAVE AND RESTORE THE HERO'S REGISTER
HEROINFO:
.word HERO3 ;WAKEUP
.word HWAKEUP
.byte $40,-1
.byte 0,0
.byte 0,0
.word HHURTX ;HERO HURT BY ATTACK
.word HHURT
.byte $40,-1
.byte 0,0
.byte 0,0
.word HERO1A ;FALLING
.word HFALL
.byte $00,-1
.byte 0,0
.byte 0,0
.word -1 ;WORLD COMMAND
.word HCOMMAND
.byte $13,-1
.byte 0,0
.byte 0,0
.word -1 ;JUMPING
.word HJUMP
.byte $00,-1
.byte 0,0
.byte 0,0
.word -1 ;ATTACKING. NO ANIMATION, IT SELECTS WHICH.
.word HATTACK
.byte $40,-1
.byte $56,$11
.byte $11,$01
.word -1 ;DUCKING. WE DON'T HAVE ONE, BUT USE IT FOR
.word HSELECT ;SELECT.
.byte $40,-1
.byte 0,0
.byte 0,0
.word HERO2 ;STANDING
.word HSTAND
.byte $40,-1
.byte 0,0
.byte 0,0
.word HRUN ;WALKING
.word HWALK
.byte $23,-1
.byte 0,0
.byte 0,0
PPUNCH: .word HKICK ;POWER PUNCH
.word HMIDDLE
.byte $40,1
.byte $56,$24 ;DOES 7 DAMAGE AND THROWS ENEMY BACK+PNTS
.byte $11,$01
WPUNCH: .word HKICK ;WEAK PUNCH
.word HMIDDLE
.byte $40,1
.byte $56,$11
.byte $11,$01
HTHROW: .word HTHROWS ;DUCKING. WE DON'T HAVE ONE, BUT USE IT FOR
.word -1 ;SELECT.
.byte $40,-1
.byte 0,0
.byte 0,0
HDIE: .word HDUCKSX ;LOST 1 HERO
.word -1
.byte 0,-1
.byte 0,0
.byte 0,0
ONLADDER:
.word HCLIMB
.word -1
.byte $13,-1
.byte 0,0
.byte 0,0
SUCTHORZ:
.word HCLIMB
.word -1
.byte 0,-1
.byte 0,0
.byte 0,0
HBALL: .word HDUCKSX ;HERO HURT REAL BAD
.word -1
.byte 0,-1
.byte 0,0
.byte 0,0
SHIELD: .word HSHIELD ;HERO'S SHIELD
.word SHCOUNT
.byte 0,0
.byte $40,$15
.byte $42,$00
SHCOUNT:
.byte TARGET
.word ALL^HERO0
.byte SOLIDSTATE,OFF
.byte LINK,0,0,ID
.word HEROID
.byte SETCOUNTER,255
SHC10: .byte REARM
.byte ABOVECOUNT
.word SHC10
.byte 1
.byte DIE,0
HWAKEUP: ;HERO WAKEUP MOVEMENT LIST
.byte INSTRUCTIONS,$8F
.byte ACTIVE
.word SAFEDIE
.byte ID
.word HEROID ;DON'T MAKE A PHANTOM HERO (FOR WARP ZONE)
MK4: .byte SOUNDBUSY
.word HWA10
.byte ON,ON,DONTCARE,ON
MK5: .byte RANDOM ;RANDOMLY PICK WHICH THEME TO PLAY
.word MK20
.byte 127
.byte SOUND
.word TEMPTHEME,TEMPMELODY,0,0 ;THEN MAIN THEME
.byte SKIP
.word HWA10
MK20:
.byte SOUND
.word DTHEME0,DTHEME1,0,0
HWA10: .byte JOYSTICK,0
.byte ZEROJOYX,ZEROJOYY
.byte IDENTIFY
.word HERO0
.byte LOAD,21
.byte SETHEALTH,REGISTER ;GET THE HEALTH FOR THE HERO
.byte SETSELECT,EDUCK ;SET SELECT TO DUCK MODE
.byte IFBEHAVIOR
.word SUC5
.byte FAST ;SUCTION CUPS ARE ON. GO USE THEM
NEWTIME:
.byte CREATE,WORLDGUYID,255,192,0 ;LAUNCH THE WORLD CONFIGURER
.byte ACTIVATE,EWALK
;WHILE WALKING, PRESSING THE ATTACK BUTTON (B) WILL SPEED UP THE
;RUN IF NO ENEMY IN RANGE. THEN IF B IS RELEASED, WE WILL SLOW BACK
;DOWN. BUT IF WHILE B IS DOWN AN ENEMY COMES INTO SIGHT, WE KNEE ATTACK
;IT.
HWALK: ;HERO WALKING MOVEMENT LIST
.byte INSTRUCTIONS,10
.byte TARGET
.word BULLET1|BULLET0|DEADLY|KILLER|HARMLESS|BENIGN|HELPER|ENEMY
.byte FACE,JOYDIR|DOWN
.byte RESETBEHAVIOR,OPTION1|FAST
.byte ENTITYBITS,$9A ;FIX HIS CONTROL BITS
.byte GRAVITY,-1
.byte FRICTION,DEF_XFRICT,DEF_YFRICT ;RESTORE FRICTION
.byte MOMLIMIT,60,DEF_YLIM ;ASSUME FAST SPEED RESTORED
.byte BUTTON
.word HW5
.byte B_BUTTON ;IF B PRESSED, DON'T RESET SPEED
.byte MOMLIMIT,36,-1 ;PUT BACK NORMAL RUNNING SPEED IF NO B
HW5: .byte INSTRUCTIONS,6
.byte WHOSLINKED
.byte EQUAL ;LOCK UP IF WEIRD ENTITY STUCK TO YOU
.word STUCKHERO
.word 51
.byte WHOSLINKED
.byte EQUAL ;CHECK IF SHIELD ON
.word SHIELDON
.word 59
.byte ENABLE,ALL^DUCKING ;ENABLE ALL BUT DUCKING
.byte SKIP
.word HW6
SHIELDON:
.byte DISABLE,HURTING ;DISABLE HURTING IF SHIELD LINKED TO YOU
HW6: .byte ADDJOYX
.byte INSTRUCTIONS,4
.byte SPEED
.word HW10
.byte 7,-1 ;IF SPEED BELOW MOVING, DON'T RESET COUNTER
.byte SETCOUNTER,6 ;RESET COUNTER TO CHECK WHEN STANDING STILL
.byte BUTTON
.word HW30
.byte B_BUTTON ;IF B PRESSED, DON'T RESET SPEED
.byte MOMLIMIT,36,-1 ;PUT BACK NORMAL RUNNING SPEED IF NO B
HW10: .byte COUNT
.word HW20
.byte 1 ;GO TO STAND MODE IF STILL FOR 1/2 SECONDS
.byte ADDJOYX
.byte YVISUAL
.word HW5
.byte 200 ;IF OUR FEET GO BELOW 200, WE ARE DEAD
.byte SKIP
.word HH20
;SHARED ENTRY POINT TO GO INTO STAND MODE
HW20: .byte ACTIVATE,ESTAND
HW30: .byte MOMLIMIT,60,-1 ;IF B DOWN, INCREASE SPEED
.byte SKIP ;(IDEAL IS 64 TO 48)
.word HW5
;THE GHOST HAS GRABBED THE HERO. WAIT TILL IT LETS GO.
STUCKHERO:
.byte DISABLE,ALL
.byte ENABLE,HURTING
.byte ZEROJOYX,ZEROJOYY ;DON'T LET KEYBOARD STUFF BUILD UP
.byte WHOSLINKED
.byte NOTEQUAL ;LOCK UP IF WEIRD ENTITY STUCK TO YOU
.word UNSTUCK
.word 51
.byte YVISUAL
.word STUCKHERO
.byte 200
.byte SKIP
.word HH20
UNSTUCK:
.byte ACTIVATE,EWALK
HHURT: ;HERO HURT MOVEMENT LIST
.byte INSTRUCTIONS,7
.byte ATTACKER
.word GRABBED
.byte 47
.byte FETCHREG,DEF_SOLID
.byte SOLIDSTATE,REGISTER ;RESTORE SOLID VALUE
.byte SOLIDSTATE,SAFE ;CATCH GETTING HURT IN A JUMP
.byte GRAVITY,-1
.byte FETCHREG,DAMAGE ;SEE HOW MUCH DAMAGE
.byte ATTACK
.word DYNBLAST
.byte 4 ;DYNAMITE ATTACK?
.byte DAMAGE ;APPLY HEALTH DAMAGE
.byte INSTRUCTIONS,3
.byte LOWNOISE
.word BUMPSND
.byte ATTACK ;SEE IF THROWBACK ATTACK (0)
.word HH10
.byte 1 ;IF SO, ALWAYS GO THROW HIM BACK.
.byte INSTRUCTIONS,6
.byte FETCHREG,HEALTH ;GET OUR HEALTH LEVEL
.byte ANDREG,3,0 ;GET LOW 2 BITS
.byte EQUAL
.word HH10
.word 0 ;IF LOW 2 BITS ZERO, THROW HIM BACK
.byte THROWBACK,24,0 ;OTHERWISE, WE ALWAYS SKID A BIT
.byte DELAY,6
.byte CREATE,STATGUYID,255,192,0 ;LAUNCH THE STATUS BAR UPDATER
.byte ACTIVATE,EWALK
GRABBED:.byte LINK,0,0,ID ;LINK TO GRABBY THING
.word 47
GRAB10: .byte ACTIVE ;CHECK IF STILL GRABBED
.word GRAB10
.byte ID
.word 47
.byte SETMOM,0,0
.byte UNLINK
.byte SEQUENCE
.word GRABEXPLODE
.byte DELAY,7
.byte SEQUENCE
.word DUMB
.byte DELAY,30
.byte GOTO,-1,194 ;FORCE USING WIPEOUT
.byte SKIP ;DIE IF NOT GRABBED ANYMORE
.word HH22
;HERO GOT HURT BY DYNAMITE. IT JUST THROWS HIM UP, ITS A STUNT HE CAN USE.
DYNBLAST:
.byte INSTRUCTIONS,$87
.byte DISABLE,ALL
.byte SEQUENCE
.word HBALL
.byte ADDMOM,0,-96
.byte GRAVITY,0
.byte SOLIDSTATE,OFF
.byte DELAY,8
.byte GRAVITY,-1
.byte ACTIVATE,EFALL
;LOW BITS OF HERO HEALTH ARE 0. SEE IF THE HERO IS DEAD.
HH10: .byte INSTRUCTIONS,$85
.byte THROWBACK,96,-96
.byte MOMLIMIT,36,-1 ;PUT BACK NORMAL X SPEED
.byte XVISUAL ;CATCH AGAINST RIGHT OF SCREEN
.word HH11
.byte 248
.byte SETMOM,-36,-96 ;IF THAT CASE, THROW OTHER WAY TO
.byte SETMOM,-36,-96 ;PREVENT GETTING STUCK
HH11: .byte XVISUAL
.word HH16
.byte 16
HH13: .byte ASSESS
.word HH20 ;IF DEAD, DO THE DEATH BLINK
.byte 0
.byte CREATE,STATGUYID,255,192,0 ;LAUNCH THE STATUS BAR UPDATER
.byte DELAY,6
.byte ACTIVATE,EWALK
HH16: .byte SETMOM,36,-96 ;CATCH STUCK AGAINST LEFT EDGE
.byte SETMOM,36,-96
.byte SKIP
.word HH13
;HERO IS DEAD. ALL HERO ROUTINES MUST GO HERE WHEN DEAD. IF HE DIED
;ON SOLID GROUND AND DIDN'T FALL TO HIS DEATH, HE'S JUST RELAUNCHED WITH
;FRESH HEALTH. IF HE DIED FROM A FALL, HE MUST GO BACK TO THE WORLD START.
HH20: .byte IDENTIFY
.word 0 ;MAKE THE ENEMIES LEAVE HIM ALONE
.byte DISABLE,-1 ;DISABLE ALL INTERRUPTS. SHARED ENTRY POINT.
.byte SETMOM,0,0 ;FREEZE HIM
.byte SEQUENCE
.word HDIE ;IF DEAD, SHOW THE BLINKING DEAD HERO
HH21: .byte YVISUAL ;IF FALLEN, THEN DISAPPEAR
.word HH22
.byte 192
.byte SEQUENCE
.word DUMB
HH22: .byte FACE,CURRENT
.byte SETREG,20,0
.byte STORE,21 ;RESTORE THE HERO'S HEALTH IF MORE HEROS
.byte SOUND ;HERO DEATH MUSIC
.word DEATHRIFF,0,0,0
.byte DELAY,75
HH23: .byte ADDHEROS,OURJOY,-1 ;DECREMENT HERO COUNT
.byte GETHEROS,OURJOY ;GET THE COUNT
.byte EQUAL
.word HH50
.word 0 ;IF NONE LEFT, GAME OVER
.byte YVISUAL
.word HH30
.byte 192 ;IF NOT DEAD FROM A FALL, JUST RELAUNCH.
.byte FETCHREG,WORLD
.byte SKIP
.word XWIPEOUT ;REQUEST THIS WORLD AGAIN
HH30:
.byte ACTIVATE,EWAKE ;AND PUT HIM BACK
;NO MORE HEROS, GAME OVER.
HH50: .byte SETREG,-1,0
.byte STORE,24
.byte WORLD,-1 ;IF NONE LEFT, GAME OVER REQUEST
.byte ENABLE,HURTING
HFALL: ;HERO FALLING MOVEMENT LIST
.byte INSTRUCTIONS,11
.byte FETCHREG,DEF_SOLID
.byte SOLIDSTATE,REGISTER ;RESTORE SOLID VALUE
.byte SOLIDSTATE,SAFE ;NEED CONDITIONAL SOLID CAUSE JUMP GOES
;HERE WHEN DONE AND WE HAVE TO TURN IT ON
;AFTER WE RE-INIT.
.byte ENABLE,ALL^DUCKING
.byte RESETBEHAVIOR,OPTION1|FAST ;RESET CLIMB, CUPS
.byte ENTITYBITS,$9A ;FIX HIS CONTROL BITS FROM CUPS
.byte GRAVITY,-1
.byte FRICTION,DEF_XFRICT,DEF_YFRICT ;RESTORE FROM SUCTION CUPS
.byte MOMLIMIT,60,DEF_YLIM ;ASSUME FAST SPEED RESTORED
.byte BUTTON
.word HF5
.byte B_BUTTON ;IF B PRESSED, DON'T RESET SPEED
.byte MOMLIMIT,36,-1 ;PUT BACK NORMAL RUNNING SPEED IF NO B
HF5:
.byte ADDJOYX
.byte STANDING
.word HF10
.byte YVISUAL
.word HF5
.byte 200 ;IF OUR FEET GO BELOW 200, WE ARE DEAD
.byte SKIP
.word HH20 ;FALL UNTIL HIT SOLID OR UNTIL WE DIE
HF10: .byte ACTIVATE,EWALK ;THEN WALK
HSELECT: ;SELECT KEY
.byte INSTRUCTIONS,5
.byte STORE,STATE ;SAVE OUR REGISTER FOR RESUME
HSE5: .byte INSTRUCTIONS,8
.byte ZEROJOYX,ZEROJOYY
.byte BUTTON
.word HSE10
.byte RIGHT ;IF RIGHT, ITS SELECT ITEM (GO RIGHT)
.byte BUTTON
.word HSE20
.byte LEFT ;IF LEFT, ITS SELECT ITEM (GO LEFT)
.byte BUTTON
.word HSE40
.byte UP|DOWN ;IF UP OR DOWN, ITS USE ITEM.
;SELECT WAS PRESSED, BUT NO ARROW KEYS. MAKE IT SAFE TO STAY HERE BY
;INSURING SOLID AND GRAVITY AND HURTING ARE ENABLED. THEN WAIT TILL
;SELECT IS RELEASE OR UNTIL THE PLAYER PRESSES AN ARROW KEY. IF WE
;ARE ON A LADDER, WE DON'T RESTORE GRAVITY.
.byte FETCHREG,DEF_SOLID
.byte SOLIDSTATE,REGISTER ;RESTORE SOLID VALUE
.byte SOLIDSTATE,SAFE
.byte IFBEHAVIOR
.word HSE9
.byte OPTION1
.byte GRAVITY,-1 ;RESTORE GRAVITY UNLESS ON LADDER
HSE9: .byte ENABLE,ALL^DUCKING
.byte BUTTON
.word HSE5
.byte SELECT
;SELECT IS NO LONGER PRESSED.
HSE9A: .byte ENABLE,ALL^DUCKING ;SOME ENTRY POINTS DISABLE INTS AGAIN
.byte TESTFLAG
.byte ACTIVATE,EWALK
;RIGHT ARROW WITH SELECT
HSE10: .byte INSTRUCTIONS,5
.byte LOAD,10
.byte ADD,1,0
.byte LIMIT,7,0
.byte STORE,10
.byte SKIP
.word HSE30
;LEFT ARROW WITH SELECT
HSE20: .byte INSTRUCTIONS,5
.byte LOAD,10
.byte EQUAL
.word HSE30
.word 0
.byte ADD
.word -1
.byte STORE,10
HSE30: .byte DELAY,5
.byte SKIP
.word HSE5
;UP OR DOWN WITH SELECT
HSE40: .byte DISABLE,ALL ;DON'T LET SOMETHING IMPORTANT GET INTERRUPTED
.byte LOAD,10 ;GET WHAT WE HAVE SELECTED
.byte LIMIT
.word 7
.byte TABLE
.word ITSDYN ;DYNAMITE
.word ITSSHIELD
.word ITSMAP
.word ITSBOOMER
.word ITSSUCT
.word ITSKNUCKS
.word ITSTORCH
.word ITSKEY
ITSDYN:
.byte INSTRUCTIONS,$85
.byte LOAD,16 ;GET HOW MANY MAGICS
.byte NOTEQUAL
.word HSL10
.word 0 ;IF NONE, IGNORE REQUEST
.byte LOAD,STATE
.byte RESUME
HSL10: .byte ADD,-1,-1 ;LOWER COUNT, WE ARE GOING TO THROW ONE
.byte STORE,16
.byte INSTRUCTIONS,6
.byte FETCHREG,DEF_SOLID
.byte SOLIDSTATE,REGISTER
.byte SOLIDSTATE,SAFE
.byte GRAVITY,-1
.byte SEQUENCE
.word HTHROW
.byte BUTTON
.word HSL30
.byte DOWN
.byte SPAWN,MAGICGUYID,16,0,1
.byte SKIP
.word HSL40
HSL30: .byte SPAWN,MAGICGUYID,16,0,2
HSL40: .byte DELAY,10
.byte SKIP
.word HSE5
ITSSHIELD:
.byte INSTRUCTIONS,6
.byte LOAD,6
.byte EQUAL
.word HSE9A
.word 0
.byte ADD
.word -1
.byte STORE,6
.byte CREATE,10,96,128,0
.byte SKIP
.word BOO30
ITSMAP:
.byte LOAD,11
.byte EQUAL
.word HSE9A
.word 0
.byte FETCHREG,WORLD
.byte STORE,24
.byte STATREQUEST,89
.byte SETSTATPAL,0,$00,$00,$00,$00,$00,$00,$00,$00
.byte SETSTATPAL,1,$00,$00,$00,$00,$00,$00,$00,$00
.byte FILLVID,1,0,$41,STATVID,64
.byte FILLVID,3,0,$41,STATVID,64
.byte HURT,0,ID
.word FIREDUMMY
.byte SKIP
.word BOO30
STATGUY:.word MAPX ;STATUS BAR MONITOR
.word STATCODE
.byte 0,-1
.byte 0,0
.byte 0,0
STATCODE:
.byte INSTRUCTIONS,$8A
.byte GRAVITY,0
.byte JOYSTICK,0
.byte LOAD,24
.byte REGINDEX
.word MAPPERX
.byte GOTO,REGISTER,-1
.byte LOAD,24
.byte REGINDEX
.word MAPPERY
.byte GOTO,-1,REGISTER ;POSITION THE Y
STAT10: .byte BUTTON
.word STAT20
.byte B_BUTTON|A_BUTTON
.byte SKIP
.word STAT10
STAT20: .byte ZEROJOYX,ZEROJOYY
.byte ENDREQUEST
MAPPERX:
.byte 255,144,192,192,240,208,240,56,24,208 ;0-9
.byte 160,160,160,24,24,144,88,176,56,144 ;10-19
.byte 40,176,40,176,240,192,240,72,72,224 ;20-29
.byte 176,192,176,40,40,160,88,192,24,144 ;30-39
.byte 24,168,160,224,224,88,40,240,192,192 ;40-49
.byte 56,56,240,72,208,88,208,24,16,160 ;50-59
.byte 208,208,104,88,255,192,72,72,240,56 ;60-69
.byte 224,24,224,40,168,176,184,192,200,208 ;70-79
.byte 216,224,144,240,192,88,72,8 ;80-89
MAPPERY:
.byte 192,24,24,40,72,56,24,176,40,128 ;0-9
.byte 144,160,128,24,128,176,128,72,40,144 ;10-19
.byte 144,88,72,40,88,56,40,176,40,128 ;20-29
.byte 144,160,128,24,128,176,144,72,56,160 ;30-39
.byte 144,88,40,88,40,176,40,128,144,128 ;40-49
.byte 24,128,160,144,72,56,144,160,128,56 ;50-59
.byte 88,40,176,40,192,112,24,128,144,144 ;60-69
.byte 72,72,144,160,8,8,8,8,8,8 ;70-79
.byte 8,8,40,8,88,160,8,40 ;80-89
ITSBOOMER:
BOO10: .byte INSTRUCTIONS,$88
.byte LOAD,5
.byte EQUAL
.word HSE9A ;UPDATES STATUS BAR
.word 0
.byte INSTRUCTIONS,6
.byte FETCHREG,DEF_SOLID
.byte SOLIDSTATE,REGISTER
.byte SOLIDSTATE,SAFE
.byte GRAVITY,-1
.byte SEQUENCE
.word HTHROW
.byte NOTBUTTON
.word BOO30
.byte DOWN|UP
.byte INSTRUCTIONS,4
.byte SPAWN,BOOMCHUCK,20,0,0
.byte LOAD,5
.byte ADD
.word -1
.byte STORE,5
BOO30: .byte CREATE,STATGUYID,255,192,0
.byte SKIP
.word HSE9A
ITSSUCT:
.byte LOAD,7
.byte EQUAL
.word HSE9A
.word 0
.byte IFBEHAVIOR
.word SUC30
.byte FAST
.byte SETBEHAVIOR,FAST
.byte ADD,1,0 ;TURN SUCTION ON
.byte CREATE,STATGUYID,255,192,0
SUC5: .byte INSTRUCTIONS,5
.byte GRAVITY,0
.byte ENABLE,ALL^DUCKING
.byte SEQUENCE
.word ONLADDER
.byte SETBEHAVIOR,WEAK ;WHEN SET, WE ARE NOT ANIMATING
.byte MOMLIMIT,8,24
.byte ENTITYBITS,$BB ;CONSTANT FRICTION, HEAD TOPS OUT
.byte FRICTION,16,16 ;GIVE SOME FRICTION
SUC6:
.byte ADDJOYX,ADDJOYY
.byte SPEED
.word SUC20
.byte 7,-1 ;IF NOT MOVING ON X AXIS, ONLADDER IS IMAGE
.byte IFNBEHAVIOR
.word SUC6
.byte WEAK ;SO IF WE ARE MOVING, IS SUCTHORZ ACTIVE?
.byte SEQUENCE
.word SUCTHORZ
.byte RESETBEHAVIOR,WEAK ;IF NOT, GET IT AND RESET WEAK
.byte SKIP
.word SUC6
;WE ARE NOT MOVING ON THE X AXIS SO THE PICTURE ONLADDER MUST BE
;ACTIVE AND BEHAVIOR WEAK SET.
SUC20: .byte IFBEHAVIOR
.word SUC6
.byte WEAK ;SO IF WE ARE MOVING, IS SUCTHORZ ACTIVE?
.byte SEQUENCE
.word ONLADDER
.byte SETBEHAVIOR,WEAK ;IF NOT, GET IT AND RESET WEAK
.byte SKIP
.word SUC6
SUC30: .byte LOAD,7 ;TURN SUCTION OFF
.byte CREATE,STATGUYID,255,192,0
.byte ACTIVATE,EFALL
ITSKNUCKS:
.byte SKIP ;KNUCKS ARE ALWAYS ON
.word HSE9A
ITSTORCH:
.byte LOAD,4
.byte EQUAL
.word HSE9A
.word 0
.byte CREATE,FIREDUMMY,255,192,60
.byte ADD
.word -1
.byte STORE,4
.byte SKIP
.word BOO30
ITSKEY: .byte INSTRUCTIONS,5
.byte DISABLE,ALL
.byte LOAD,8
.byte EQUAL
.word HSE9A
.word 0
.byte ACTIVE
.word KY10
.byte ID
.word 39
.byte SKIP
.word HSE9A
KY10: .byte INSTRUCTIONS,4
.byte ADD
.word -1
.byte HURT,$18,ID
.word 39
.byte STORE,8
.byte SKIP
.word BOO30
SHOWJUMP:
.word HERO3 ;JUMPING
.word -1
.byte $00,-1
.byte 0,0
.byte 0,0
HJUMP: ;HERO JUMPING MOVEMENT LIST
.byte INSTRUCTIONS,6
.byte IFBEHAVIOR
.word HC45
.byte FAST
.byte STANDING
.word HJ0
.byte FLOOR
.word HJ5
.byte 5 ;IF NOT STANDING, JUST A PREMATURE PRESS?
;FORGIVE THE PLAYER IF SO.
.byte RESUME ;DON'T JUMP IF NOT STANDING
;SPECIAL MODE THAT ALLOWS THE PLAYER TO HIT THE JUMP BUTTON BEFORE THE HERO
;LANDS. IF HE KEEPS IT DOWN, WE WILL HONOR IT WHEN WE LAND. BUT IF
;ITS RELEASED WE WON'T DO IT.
HJ5: .byte ADDJOYX
.byte STANDING ;GIVE THE HERO A SMALL TIME TO EITHER
.word HJ0 ;FIND SOLID OR IF TIMEOUT, GO TO STAND MODE
.byte NOTBUTTON
.word HF5
.byte A_BUTTON ;IF NOT STILL DOWN, END
.byte ADDJOYX
.byte STANDING
.word HJ0
.byte NOTBUTTON
.word HF5
.byte A_BUTTON ;IF NOT STILL DOWN, END
.byte ADDJOYX
.byte STANDING
.word HJ0
.byte NOTBUTTON
.word HF5
.byte A_BUTTON ;IF NOT STILL DOWN, END
.byte ADDJOYX
.byte STANDING
.word HJ0
.byte NOTBUTTON
.word HF5
.byte A_BUTTON ;IF NOT STILL DOWN, END
.byte ADDJOYX
.byte STANDING
.word HJ0
.byte SKIP
.word HF5
HJ0: .byte INSTRUCTIONS,7
.byte ENABLE,ALL^DUCKING^JUMPING ;ENABLE SOME INTERRUPTS AGAIN
.byte BUTTON
.word HDOWN ;IF DOWN + JUMP THEN JUMP DOWN.
.byte DOWN
.byte SEQUENCE
.word SHOWJUMP
.byte SETCOUNTER,5 ;SET MAX TIMES THROUGH LOOP
.byte LOAD,31
.byte SOLIDSTATE,REGISTER
.byte SETMOM,-1,-72 ;UPWARDS WITH MAX SPEED AT START
HJ10:
.byte BUTTON
.word HJ15
.byte A_BUTTON ;IF A BUTTON STILL DOWN, CONTINUE
.byte ADDMOM,0,48 ;CANCEL SOME UPWARDS TRAVEL WHEN ENDING
.byte ACTIVATE,EFALL ;GO TO FALL MODE WHEN DONE JUMPING
HJ15:
.byte ADDJOYX ;USE JOYSTICK X MOMENTUM IF CONTINUING
.byte COUNT
.word HJ20 ;WHEN COUNTER RUNS OUT, LEAVE JUMP MODE
.byte 1
.byte ADDMOM,0,-28 ;OTHERWISE, JUST CANCEL GRAVITY
.byte SKIP
.word HJ10
;WE DID A FULL HEIGHT JUMP.
HJ20: .byte SETMOM,-1,-72
HJ30: .byte ACTIVATE,EFALL
;THE HERO WANTED TO JUMP BUT HE PUSHED DOWN. IF WE ARE ABOVE THE VERY
;BOTTOM WE WILL ALLOW HIM TO JUMP DOWN.
HDOWN: .byte YVISUAL
.word HDN10
.byte 154
HDN5: .byte RESUME ;DON'T ALLOW JUMP DOWN IF TOO LOW
HDN10: .byte BUTTON
.word HDN5
.byte LEFT|RIGHT ;DON'T GET A JUMP DOWN CAUSE THEY PRESS HARD
.byte SEQUENCE
.word SHOWJUMP
.byte INSTRUCTIONS,3
.byte LOAD,31
.byte SOLIDSTATE,REGISTER
.byte SETMOM,-1,-32 ;UPWARDS 4 PIXELS
.byte ADDJOYX
.byte ADDJOYX
.byte ADDJOYX
.byte ADDJOYX
.byte ADDJOYX
.byte ADDJOYX
.byte ADDJOYX ;GIVE ENOUGH TIME TO JUST MAKE IT DOWN
.byte ACTIVATE,EFALL
HATTACK: ;HERO ATTACKING MOVEMENT LIST
.byte INSTRUCTIONS,10
.byte IFBEHAVIOR
.word HC45
.byte FAST
.byte ENABLE,HURTING|JUMPING ;DON'T LET HIM BE INVULNERABLE
; .byte GETCOLUMN
; .byte SHOWREG,3,6,STATVID
; .byte FETCHREG,YVISUAL
; .byte CDIVIDE,8
; .byte SHOWREG,3,12,STATVID
; .byte FETCHREG,WORLD
; .byte SHOWREG,3,18,STATVID
.byte LOAD,9
.byte NOTEQUAL ;MUST BE STANDING FOR ATTACK
.word AA10
.word 1
.byte SEQUENCE
.word PPUNCH ;DO POWERPUNCH
AA10: .byte SEQUENCE
.word WPUNCH ;DO WEAK PUNCH
HMIDDLE:
.byte INSTRUCTIONS,3
.byte FETCHREG,DEF_SOLID
.byte SOLIDSTATE,REGISTER ;RESTORE SOLID VALUE
.byte SOLIDSTATE,SAFE ;HERO'S KICK
.byte ENABLE,ALL^ATTACKING^DUCKING ;ENABLE ALL BUT ATTACKING.
.byte FINISH
.byte ACTIVATE,EWALK
HSTAND: ;HERO STANDING MOVEMENT LIST
.byte ENABLE,ALL^DUCKING
HST10:
.byte ADDJOYX ;APPLY JOYSTICK MOMENTUM WHILE STANDING
.byte SPEED
.word HST20 ;IF SPEED LESS THAN 8, KEEP STANDING
.byte 7,-1
.byte ACTIVATE,EWALK ;GO INTO WALK MODE IF MOMENTUM >7 (MOVING)
HST20:
.byte ADDJOYX
.byte YVISUAL
.word HST10
.byte 200 ;IF OUR FEET GO BELOW 200, WE ARE DEAD
.byte SKIP
.word HH20
;HERE'S THE HERO'S WORLD COMMAND LOGIC.
HCOMMAND: ;WORLD COMMAND.
.byte INSTRUCTIONS,10
.byte STORE,0,SWAP,STORE,1 ;SAVE WORD REGISTER
.byte WORLDCMD
.word HC60
.byte CLIMB
.byte STANDING
.word HC39
.byte RESUME
HC39: .byte WORLDCMD
.word HC50
.byte DOOR
HC40: .byte BLOAD,1,SWAP,BLOAD,0
HC45: .byte RESUME ;SHARED WITH MECHMOVE ROBOT
HC50: .byte INSTRUCTIONS,10
.byte ACTIVE
.word HW20 ;CANT GO IN IF ROCK GATE BARRIER THERE
.byte ID
.word 17
.byte ACTIVE
.word HW20 ;CAN'T GO IN IF METAL GATE (LOCKED)
.byte ID
.word 39
.byte FETCHREG,PARAM2
.byte LIMIT
.word 200
.byte WORLDGOTO
.word DOORBASE
.byte FETCHREG,DEF_SOLID
.byte SOLIDSTATE,REGISTER
.byte SOLIDSTATE,SAFE
.byte SKIP
.word NEWTIME
HC60: .byte ENABLE,HURTING|SELECTING
.byte IFBEHAVIOR
.word HC70
.byte OPTION1 ;IF ALREADY ON LADDER ITS A SEPARATE THING
.byte INSTRUCTIONS,7
.byte BUTTON
.word HC65
.byte UP ;ALWAYS GO ON LADDER IF UP PRESSED
.byte STANDING
.word HC40 ;IF STANDING, ONLY UP WORKS
.byte NOTBUTTON
.word HC40
.byte DOWN
;WE WANT TO GO ONTO THE LADDER. EITHER UP WAS PRESSED OR WE WEREN'T STANDING
;AND DOWN WAS PRESSED.
HC65: .byte INSTRUCTIONS,8
.byte FETCHREG,DEF_SOLID
.byte SOLIDSTATE,REGISTER ;RESTORE SOLID VALUE
.byte SOLIDSTATE,SAFE
.byte SETBEHAVIOR,OPTION1 ;SIGNAL THAT WE ARE ON A LADDER
.byte SEQUENCE
.word ONLADDER
.byte GRAVITY,0 ;NO GRAVITY, WE ARE ON A LADDER
.byte SETMOM,0,0
.byte ENABLE,TESTING
.byte TESTFLAG ;SEE IF STILL ON LADDER
.byte ACTIVATE,EFALL ;IF NOT, FALL DOWN
;WE ARE ALREADY ON A LADDER