-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemory.txt
1090 lines (1022 loc) · 35.7 KB
/
memory.txt
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
Full memory map of MoG.
c000
d000
e000
e000 state
e001 substate
e002 seen at T4E24h, sound related
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6: Related to sound IDs with 0x80 bit set
bit 7
e003
InterruptBottomHalf tick counter.
Stops counting when switching rooms.
Increments more rapidly during F1.
0x4277@0: Loaded, incremented, stored.
0x42BA@0: Loaded, rotated right.
0x4DE8@0: Loaded, randomized with xor and R.
0x6298@1: Loaded, low nybble tested.
0x68A2@1: Loaded, bit 3 tested.
0x68C6@1: Loaded, bit 3 tested.
0x68ED@1: Loaded, bit 3 tested.
0x6ADC@1: Loaded, bit 0 tested.
0x9075@2: Loaded, bit 0 tested.
0x81F6@5: Used
0x8942@5: Loaded, anded with 0x3f (lower 6 bits)
0xB86D
e005: Skip interrupt bottom half if true.
0x4121@0: Loaded, tested for being zero/non-zero.
e006: Lock for preventing simultaneous stuff, in interrupt hook.
e008: "pressed_controls"
Almost the same as 0xE009 (="active_controls"), except a bit is only 1 for 1 VDP tick.
e009: "active_controls"
&0x01 (bit 0): Pressed key up
&0x02 (bit 1): Pressed key down
&0x04 (bit 2): Pressed key left
&0x08 (bit 3): Pressed key right
&0x10 (bit 4): Pressed space
&0x20 (bit 5): Pressed M
CTRL, L, F1, F2 aren't in here. Seems purely related to controlling
Popolon/Aphrodite.
Some combinations of keys are off:
1 2 4 8
UP DOWN LEFT RIGHT Expected Actual Remark
No Yes Yes Yes 0x0E 0x0C No down key registered
(Some) code references:
0xa392 (page 1+2+3)
0x4c6b (page 1+2+3)
0x4C75: "read_controls": keyboard and joystick are read
0x4C68: "store_controls": write state of controls to 0xE009
e00d:
bit 0: Sound related. set: muted?paused?Don't play sounds? T4E2Dh
bit 1:
bit 2:
bit 3:
bit 4:
bit 5:
bit 6:
bit 7:
e00e: Involved in building Konami logo line by line
e00f: Involved in building Konami logo line by line
e01a
When moving to next room:
1: Set Y position to 0xB9. Far down. Happens when exiting upwards/north.
2: Set Y position to 0x28. Far up. Happens when exiting downwards/south.
3: Set X position to 0xF7. Far right. Happens when exiting left/west.
4: Set X position to 0x10. Far left. Happens when exiting right/east.
0x5FCC@0: Loaded
e01d: Seen at 0x5C9E
e01e: Seen at 0x5CA8: current sound id? No!
e01f
Set to 1 upon climbing the ladder to world 1.
Set to 2 when returning from world 1 to castle.
0x5FC3@0: Loaded
e021: Seen at 0x5CB0
e041: Current world (1==castle, 2==world 1, etc.)
e042: Current room
e04e: "itemscreen_selected_weapon"
During the F1 screen, the player can select a weapon.
This byte is used to determine the correct value for
0xe510 ("active weapon").
0: Wrap around needed
1: Arrow
2: Ceramic Arrow
3: Fire
4: Rolling Fire
5: Mine
6: Magnifying Glass
7: Wrap around needed
0x67F4 == handle_itemscreen_controls(), this routine
uses/sets/computes 0xE04E.
e052: Current vitality of Aphrodite?
e053: Maximum vitality possible for Aphrodite. Multiple of 8.
e056: Current vitality of Popolon?
e057: Maximum vitality possible for Popolon. Multiple of 8.
e058:
When F1 is pressed:
0: Aphrodite is dead and not choosable
1: Aphrodite is alive and choosable
During gameplay:
0: ?
1: ?Aphrodite is still alive?
e059:
When F1 is pressed:
0: Popolon is dead and not choosable
1: Popolon is alive and choosable
During gameplay:-
0: ?
1: ?Popolon is still alive?
e063-e06c: World bits/items
bit 0 / 0x01: world is open
bit 1 / 0x02: great key
bit 2 / 0x04: Beaten boss
bit 3 / 0x08: ?unused?
bit 4 / 0x10: map
bit 5 / 0x20: holy water
bit 6 / 0x40: cape
bit 7 / 0x80: magical rod
e063: World 1
e064: World 2
e065: World 3
e066: World 4
e067: World 5
e068: World 6
e069: World 7
e06a: World 8
e06b: World 9
e06c: World 10
e06d: World 10 Activator
e06e: World 10 location
0: Middle tower
1: Right tower
2: Left tower
3: At start
e06f:
Would have been 0xe070 if Konami used 0 based instead of
1 based.
Seen at:
0x5D92 (page 0)
0x681A (page 0)
0x6832 (page 0
e070-e099: item inventory (see items.txt for individual item addresses)
e097: active shield (0 means no shield; 3 means gold)
e0a2:
0x9D88@789: Set to 1. Near disappearing wall code.
e0b0-e0c7:
byte 0:
0: Timer expired?
1: Timer expired and in correct room/draw ladder upon re-entering room?
2: Timer not yet expired?
byte 1: Timer for reappearing disappeared ladder. Counts down to 0x00, possible statically from 0x3C (=60, intended as 60 seconds?). Steps down every 0x20 (test: and 0x1F) beats of counter 0xE604. Takes about 75 seconds to countdown 40 ticks.
e0b0-e0b1: (ID 01) room 0x0d
e0b2-e0b3: (ID 02) room 0x13
e0b4-e0b5: (ID 03) room 0x15
e0b6-e0b7: (ID 04) room 0x3c
e0b8-e0b9: (ID 05) room 0x46
e0ba-e0bb: (ID 06) room 0x49
e0bc-e0bd: (ID 07) room 0x56
e0be-e0bf: (ID 08) room 0x66
e0c0-e0c1: (ID 09) room 0x6a
e0c2-e0c3: (ID 0A) room 0x74
e0c4-e0c5: (ID 0B) room 0x7c
e0c6-e0c7: (ID 0C) room 0x85
e0d0:
Coordinates of where to start climbing downwards when re-entering from world to castle.
0x6015@1: Loaded.
e0d2:
0: no boss fight
1: before gas clouds appear, high pitched sound
2: Gas clouds
3: ?
4: ?
0x4988@0: Stored, together with 0xe0d3. Fixed value 0x01 (see 0x4983@0).
0x56FE@0: Seen
0x9ACE@123: Loaded
e0d3:
Boss fight related
0x4988@0: Stored, together with 0xe0d2.
0x7F57@123: HL, value goes to 0xE700.
e0d4: seen at 0x4BC6
?world key is visible?
e100-e10b:
Sound execution/code refs
Castle GrtKey Lad2Wld World1
e100-e101: 0x610B 0x610B 0x610B 0x610B
e102-e103: 0x6112 0x6112 0x6112 0x6112
e104-e105: 0x6119 0x6098 0x6098 0x6119
e106-e107 (shadow channel A?):
seen at 0x4F4E
vase: "A5 64" (0x64A5)
landing: "A5 64" (0x64A5)
e108-e109 (shadow channel B?):
seen at 0x60A0
e10a-e10b (shadow channel C?):
seen at 0x6099
0x4FFD: Set to 0x6104
e10c/e127/e142/e15d/e178/e193 (typically addressed via IX register):
0xE10C - 0xE126: Channel A
0xE127 - 0xE141: Channel B
0xE142 - 0xE15C: Channel C
0xE15D - 0xE177: Channel D (seen at 0x64A5)
0xE178 - 0xE192: Channel E (seen at 0x50A1, 0x649E)
0xE193 - 0xE1AD: Channel F (seen at 0x5000)
+00,+01 e10c,e10d / 0xe127,0xe128 / 0xe142,0xe143:
Pointer to "opcode" (usually tone or octave setting).
0x7F40: Start of Channel A for pressed space to begin game.
0x805C: Start of Channel B for main castle tune.
0x81EB: End of Channel B for main castle tune.
?Governed by 0x61A2 (page D)?
?Governed by 0x6191 (page D) for pressed space tune?
*pointer >= 0xd0: special (see 0x619A)
*pointer >= 0xc0: special (see 0x61A7)
?Else *pointer is duration of note? (without duration factor and *e1c5)
+02 e10e: bits
Whole byte is set at:
0x4E96 During ldir, in which it is set to 0x01. Initialisation code.
0x63D4 Set to the value of register A.
0: Unset: play a sample instead of a note. Opcode 0xE8 is important. Uses IX[8] to select the correct sample table.
0x6136: Tested
0x61E0: Tested
1: POSSIBLY UNUSED BIT
2: POSSIBLY UNUSED BIT
3: POSSIBLY UNUSED BIT
4: POSSIBLY UNUSED BIT
5:
0x612C: Set
0x6159: Tested
0x616F: Tested
0x61DC: Cleared
0x6491: Tested. Set: don't write frequency to PSG.
6: Increment frequency divider by 1 (so decreased frequency).
0x6247: Tested
If set: Increment frequency divider by 1 (inc DE).
0x6402: Set, because current opcode is 0xE7.
7: 1: End of sound definition (0xFF seen)
0x6174: Tested
0x6188: Set
0x62A8: Cleared (page 13)
+03, e10f:
?Duration factor?
0x06: Seen in main castle theme
+04 e110:
0x625B: increase volume
Seen at 0x6382 (page 0xD)
+05 e111:
Seen at 0x61B1, 0x61EA, 0x638D
+06 e112:
Seen at 0x6394
+07 e113: Octave
+08 e114: Sample table to select
0x627F: 0x01: HL -> 0x65A7
0x6283: 0x02: HL -> 0x65BF
0x6287: 0x03: HL -> 0x65D7
0x628B: 0x04: HL -> 0x65EF
0x628F: 0x05: HL -> 0x6607
0x6291: 0x00 or >= 0x06: HL -> 0x661F
+09 e115:
Number of VDP ticks left for the current note.
Counts down to zero.
0x61CA: Set
+0a e116:
Volume (0x00-0x0F), or 0x1y
Value 0x10 (bit 4) is a special case in the PSG:
0: Nothing special, just the volume as expected.
1: The volume will vary in proportion to the
envelope shape defined by PSG register 13.
bit 4: Seen at 0x6578 (page 13)
bit 4: Seen at 0x64EF (page 13)
+0b e117: ?decrement volume if true?
Seen at 0x6147
Seen at 0x61ED
+0c,0d e118,e119 / e133,134 / e14e,e14f / e167,e168 / e184,e185:
Pointer into sample. (Backup copy of HL register.)
Main castle theme channel A: 0x7204
Main castle theme channel B:
0x7271 (mainly)
0x6663
0x6667
0x6669
0x666B
0x666D
0x666F
0x6671
0x6673
0x6675
0x6677
0x6679
0x667B
0x667D
0x667F
0x6681
0x6683
0x6685
0x6687
0x6689
0x668B
0x668D
0x668F
0x6691
Main castle theme channel C:
0x6EE5
0x6637
0x663C (noise?)
0x663D
0x6642
0x6647 (noise?)
+0e e11a/e135/e150:
0x62AE: Set to hardcoded 1. (During switch to sample mode.)
0x64B0: Decremented
0x6581: Set to sample opcode
+0f e11b/e136/e151: 0x01 all the time?
0x6584: Set to sample opcode
+10 e11c/e137/e152:
Seen at 0x6361
+11 e11d/e138/e153/e16e/e189:
Active value of sample/sound loop counter.
Associated melody opcode: 0xFE
+12,13 e11e,e11f:
Sound opcode 0xED: "call"
Sound opcode 0xEE: "return"
IX[12]+IX[13] is the address to return to.
+14 e120: MSB of frequency divider value (4 bit) "note"
+15 e121: LSB of frequency divider value (8 bit) "note"
+16 e122: ?Vibrato?
0x63A8: Set to 0xEC by sound opcode 0xEC.
During intro: both 0xEC and 0xED. Seems to increase+decrease frequency divider.
0x6244: set to fixed 0xEC (1110 1100)
0x640B: set to fixed 0xEC (1110 1100)
0x6457: incremented
0: decrease frequency? Just testing for odd/even?
0x6449: Tested
+17 e123: Seen at 0x6410,0x645D
low nybble: increase frequency divisor (=decrease frequency)
0x623C: Read.
0x6410: Set to sample opcode byte.
+18 e124:
Cleared at 0x6239
Seen at 0x6467
+19 e125:
0x00: Increase frequency divider (in vibrato mode)
0xFF: Decrease frequency divider (in vibrato mode)
Flip occurs at 0x647D
+1a e126/e141/: play sample if 0?
0x6181: Set to 1.
0x650F: Volume related
e15d-e177: seen at 0x4F39
e169-e170:
0x404C@0: Very very early in the ROM.
0x4F47@0: vase: "7D 7C" (0x7C7D) - pointer to sound definition?
e16a:
0x404E@0: Very very early in the ROM.
e184:
0x50AC-50AF: Set to 0x22
e1ae: PSG channel selector/picker/chooser.
0x00: Operate on channel A (PSG register 0+1, frequency divider registers for channel A)
0x01: Operate on channel B (PSG register 2+3, frequency divider registers for channel B)
0x02: Operate on channel C (PSG register 4+5, frequency divider registers for channel C)
e1af: Sound related
Possibly indicates which channel is handled currently.
0x00: During pauze
Seen at 0x6051
0x01: Seen at 0x6071 (page D).
Not observed with ram_watch (?too short?).
Noticed when YOMAR was typed in world 1, written at 0x6071
0x02: Twitchy during ram_watch
0x03: Most of the time
0x04: Noise?
0x05: Seen at 0x4FF7
Seen at 0x6434 where it is a loop counter for rotating 0x7f
0: 0x7F => 0xFE (1111 1110) ?PSG reg7, i.e. enable channel A?
1: 0x7F => 0xFD (1111 1101) ?PSG reg7, i.e. enable channel B?
2: 0x7F => 0xFB (1111 1011) ?PSG reg7, i.e. enable channel C?
3: 0x7F => 0xF7 (1111 0111)
4: 0x7F => 0xEF (1110 1111)
5: 0x7F => 0xDF (1101 1111)
6: 0x7F => 0xBF (1011 1111)
7: 0x7F => 0x7F (0111 1111)
e1b0:
0x4F18
0x5076: Tested for being zero.
0x607E: Set to 0.
0x6125: Tested for being zero.
e1b1:
Input for PSG register 7 (selecting tone or noise).
Used in interrupt hook as first action.
,---------- PSG I/O port B, must be 1
|,--------- PSG I/O port A, must be 0
|| ,------- 1 == disable noise for channel C
|| |,------ 1 == disable noise for channel B
|| ||,----- 1 == disable noise for channel A
|| ||| ,--- 1 == disable tone for channel C
|| ||| |,-- 1 == disable tone for channel B
|| ||| ||,- 1 == disable tone for channel A
0xB8 == 10 111 000: noise xxx, tone ABC - during main theme
0xBC == 10 111 100: noise xxx, tone ABx - T4DEFh (inside some sort of init routine)
0xBE == 10 111 110: noise xxx, tone Axx - during pauze
0xBF == 10 111 111: noise xxx, tone xxx - SILENCE (0x5078)
0x9C == 10 011 100: noise xxC, tone ABx - during main theme
0x1B == 00 011 011: noise xxC, tone xxC - Seen at 0x507F ("or bitmask")
0x502F: Value copied from 0xE1B5
0x506F: Value copied to 0xE1BC
e1b2:
bit 0: ?use shadow channel at 0xe10a, shadow channel C?
bit 1: ?use shadow channel at 0xe108, shadow channel B?
0x4E09 : Whole byte: Initialized to 0.
0x4EDF-0x4F91: Bit 1: Cleared.
0x4F89-0x4F8C: Bit 0: Set.
0x5018-0x501D: Bit 0: Cleared.
0x5064-0x5069: Bit 1: Set.
0x5069:
0x50B3: Loaded for a test of bit 1.
0x50B9: specific code for if bit 1 is set.
0x600D-0x6012: Bit 0: Tested. !Very early in SoundHandling()!
0x6015-0x6017: Bit 1: Tested. !Very early in SoundHandling()!
e1b3:
0x4F97: Set to same value as in 0xE1C0
e1b4:
0x4F9D: Value copied from 0xE1C1
0x5029: Value copied to 0xE1C1
e1b5:
0x4FA3: Value copied from 0xE1B1
0x502F: Value copied to 0xE1B1
e1b6:
0x4FA9: Set to same value as in 0xE1C2
0x5032: Loaded
e1b7: Value for PSG register 0 (channel A, frequency divider, LSB)
e1b8: Value for PSG register 1 (channel A, frequency divider, MSB)
e1b9: Value for PSG register 8 (channel A, volume)
e1ba: Value for PSG register 9 (channel B, volume)
e1bb: Value for PSG register 0xa (channel C, volume)
e1bc:
0x506F: Value copied from 0xE1B1
e1bd: Value of PSG register 0 (channel A, frequency divider, LSB)
0x5084-0x5088: Value read from PSG
e1be: Value of PSG register 1 (channel A, frequency divider, MSB)
0x508B-0x5090: Value read from PSG
e1bf: Value of PSG register 0 (channel A, volume)
0x5093-5098: Value read from PSG
e1c0:
0x4DF3: Initialized to 0.
0x4EE8: Initialized to 0.
0x5023: Value copied from 0xE1B3
0x6049: Set to value of register A, possibly volume related
0x601A: ?
e1c1: Volume booster?
0x4DF6: Initialized to 0.
0x4EEB: Initialized to 0.
0x5029: Value copied from 0xE1B4
0x5103: Compared with 0xFB
0x6028: Value 0xF0 is special: mute channel. Perhaps to
help determine if volume is still 4 bits (since 5th bit
is special: vary volume by envelope).
0x6258: Loaded.
0x6506: Volume related test
e1c2:
0x4DF9: Initialized to 0.
0x4EF3: Initialized to 7.
0x5035: *(0xE1C2) = *(0xE1B6)
0x643F: ?
Wanted value for PSG reg 7? Enable noise/tone, inverse logic.
e1c3:
0: Most of the time.
1: Seen when hitting space to begin game.
Because of opcode 0xE6 at 0x7F40 (start of channel A).
Because of opcode 0xE6 at 0x8036 (start of channel B).
Because of opcode 0xE6 at 0x81F0 (start of channel C).
1: Seen when entering a world, during "World N !!"
Because of opcode 0xE6 at 0x856B (start of channel A).
Because of opcode 0xE6 at 0x8577 (start of channel B).
Because of opcode 0xE6 at 0x8585 (start of channel C).
0x4E0C (page 0): set to 0
0x4EEE (page 0): set to 0
0x4F13 (page 0): read value
0x63F5: set to 1
0x63FC: set to 0
e1c4: seen at 0x6040
e1c5: Frequency divider table number
0: use standard frequency divider table 0x62D0@DEF, starts at C.
1: use pitched up frequency divider table 0x62E8@DEF, starts at D#. 3 pitches up compared to base.
2: use pitched up frequency divider table 0x6300@DEF, starts at F#. 6 pitches up compared to base.
0x4DFF: Initialized to 0.
seen at 0xBCBD (page 0x3, stored/computed)
seen at 0x61B1 (page 13)
0xBCBD@123: Stored
e1c6:
0x4DFC: Initialized to 0.
0x615E: ?
0x6266: Volume related
e1c7: ?last/previous/current sound?
0x00: quiet?
0x81: after entering "YOMAR" in world 1 in boss room (flickering screen).
0x82: at entering world 1 (going up the ladder in the castle)
0x82:
at leaving world 1 (going down the ladder in the castle)
Entering a shrine
Leaving a shrine
0x83:
special: explicit compare at 0x4e7b
when fairy appears
0x84: boss is defeated?
0x85: at pickup of great key in castle
0x86: at start of story
0x87: after space pressed when game says "push space key"
0x88: in castle (also during demo, also after leaving a world)
0x89: touched fairy
0x8A: in world 1
0x8B: victory sound?
0x8C: ominous sound
0x8D: Inside shrine
0x8E: at start of screen: "World 1 !!"
0x8F: at entering boss room in world 1
0x90: when YOMAR is about to appear (gas clouds)
0x91: ctrl pressed? bible?
0x92: ?
0x93: ?
0x94: When Popolon/Aphrodite dies
0x95: Game over
e1c9:
0x5015: Initialized to 0.
0x6164: ?
0x6270: volume related
e4a0-e4ff: vertical elevator info; 06 records:
0 elevator id
1 current room
2 flags: bit 1: down(0) or up(1) bit 2: ?
3 current room index
4 0
5 current position Y
6 0
7 current position X
8 dX per frame (all 0)
9 dY per frame (all 2)
a -
b -
c top limit room
d top limit position
e bottom limit room
f bottom limit position
e500:
0: Player is doing none of the below.
1: Player is jumping (both rise and fall).
2: Player is falling (but not because of a jump).
3: Player is climbing a ladder.
4: Player is hit (by spikes, bat, bamboo, whatever).
5: Player dies.
6: Player is hit by Frost Demon (world 2); player shakes.
7: Player is going through a door using a key.
No other possibilies, as can be concluded from 0xA131.
e501:
0: Playing as/with Aphrodite
1: Playing as/with Popolon
e502:
Direct redrawing when poking. Sprite index?
It seemed bits at first, but when combining bits to,
say, 0x0a (8+2), we see Popolon dying. So probably not
bits after all.
0x00: Player has feet together, facing right
0x01: Player has feet apart (walking), facing right
0x02: Player has feet together, facing left
0x03: Player has feet apart (walking), facing left
0x04: Player has feet off ground (jumping), facing right
0x05: Player has feet off ground (jumping), facing left
0x06: Player has feet off ground (jumping), facing right, swinging sword
0x07: Player has feet off ground (jumping), facing left, swinging sword
0x08: Player has feet apart, facing right, swinging sword
0x09: Player has feet apart, facing left, swinging sword
0x0A: Player is hit, facing right
0x0B: Player is dying, facing right
0x0C: Player is hit, facing left
0x0D: Player is dying, facing left
0x0E: Player is facing wall (climbing up), left foot down
0x0F: Player is facing wall (climbing up), right foot down
0x10: Player is facing you (climbing down), right foot down
0x11: Player is facing you (climbing down), left foot down
0x12: Player is hit, no face, "facing" right
0x13: Player is dying, no face, "facing" right
0x14: ?Just some pixels?
0x15: ?Just some pixels?
0x16: ?Fireball going to right, trail type 1?
0x17: ?Fireball going to right, trail type 2?
0x18: Apparently same as 0x11
0x19: Apparently same as 0x10
e503:
0x00: Player is facing right
0x01: Player is facing left
0x02: Player is climbing a ladder
e504:
0x00: No boots?
0x40: Traversing ladder with boots?
0x80: Traversing ladder with boots?
0xC0: Traversing ladder with boots?
e505: Y. Height (of player's feet), measured in pixels
0x00: Top of screen, body and legs aren't visible.
0x20: On top of highest brick wall.
0x27: Climbing ladder up, changing to above room, lower half still on stairs/ladder.
0xB8: On lowest brick wall.
0xC2: Falling to the room below.
e507: X. X position of player.
0x0E: Player leaves to the room to the left.
0x10: Player just entered from the room to the left.
0xF7: Player just entered from the room to the right.
0xF9: Player leaves to the room to the right.
e508: Has something to do with traversing ladders.
e509: Has something to do with jumping.
0x00: ?Jump started? @0x29A?
0x01: ?Inc @0xa412 (pages 1+2+3)?
0x02: ?Inc @0xa412 (pages 1+2+3)? Feet already in the air, legs apart
0x03: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of a wall (1 character)
0x04: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 2 characters
0x05: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 2.5 characters
0x06: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 3.0 characters
0x07: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 4.0 characters
0x08: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 4.5 characters
0x09: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 5.0 characters
0x0A: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 5.0 characters
0x0B: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 5.5 characters
0x0C: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 5.5 characters
0x0D: ?Inc @0xa412 (pages 1+2+3)? Jumped the size of 6.0 characters
...
0x18: ?Jump ended for Aphrodite?
0x0B: ?Jump ended for Popolon (lowest jump possible)?
0x18: ?Jump ended for Aphrodite?
0x1A: ?Jump ended for Popolon (highest jump possible)?
e50a: Quite similar to e509, slightly different in values.
e50b: Starts counting when on a ladder.
e50c:
00: Not on ladder? Don't increment counter e50b?
01: On ladder, climbing up
02: On ladder, climbing down
e50e:
0xA2DE: Loaded, inside code about jumping.
0xA2E4: Table with 4 pointers; i.e. range is [0..3]
0: ?Must determine which key is pressed?
1: Neither left key nor right key is pressed. (Or both pressed.)
2: Right key is pressed.
3: Left key is pressed.
e510: Active weapon
0: No weapon active
1: Arrow
2: Ceramic Arrow
3: Fire
4: Rolling Fire
5: Mine
6: Magnifying Glass
e511: Player in water
0: Player not in water
1: Player in water
0x4F27: Compared to 1.
0x6378 (page 4/5/6): Tested for being zero.
0x8422 (page 4/5/6): Tested for being zero.
0xA117 (page 1/2/3): Tested for being zero.
0xA1E5 (page 1/2/3): Tested for being zero.
0xA229 (page 1/2/3): Tested for being zero.
0xA370 (page 1/2/3): Tested for being zero.
0xA428 (page 1/2/3): Tested for being zero.
0xA4B0 (page 1/2/3): Tested for being zero.
0xB005 (page 1/2/3): Value copied to 0xF030.
0xB00C (page 1/2/3): Set to 0. Player is not in water.
0xB05A (page 1/2/3): Set to 1 or 2. Player is in water.
0xB078 (page 1/2/3): Decremented?!
e514:
0xB396@3: Set
e516: Has something to do with disappearing ladder on which side the player is facing.
e518: Invulnerable
Found in /usr/share/openmsx/scripts/_trainerdefs.tcl
e519:
0xB020 (page 1/2/3): Bit 3 tested.
0xB054 (page 1/2/3): Bit 3 is set. Walking on water because of oar?
e525: Has something to do with disappearing ladder. Used the ladder?
e526:
0xB89A@123: rock related?
e52a:
0xB04E (page 1/2/3): Set to 1. Walking on water because of oar?
e52b:
0xA30D: Related to 0xEC12
e52d:
0xA313: Related to 0xEC10
e52e:
00: No arrow pressed?
01: Up arrow pressed? Seems extra special because of jumping?
02: Down arrow pressed?
04: Left arrow pressed?
08: Right arrow pressed?
0xA8F0 (pages 1+2+3): Stored
e532:
(Some) code references:
0xA8F7 (pages 1+2+3)
e533:
(Some) code references:
0xA8F2 (pages 1+2+3)
e536:
Multiple uses:
DaggerState (for room 0x2B)
SabreState (for room 0x18)
VaseState (for room 0x28)
Meaning as DaggerState:
0: initial
1: Pressed right
2: Pressed down
3: Pressed left
4: Pressed up, appears
Meaning as SabreState:
0: initial
1: Sabre appears (after killing all bats, and beaten world 6 boss)
Meaning as VaseState:
0: initial
1: Faced right and flung sword 1 time
2: Faced right and flung sword 2 times
3: Faced right and flung sword 3 times
4: Faced left and flung sword 1 time
5: Faced left and flung sword 2 times
6: Faced left and flung sword 3 times
7: Jumped 1 time
8: Jumped 2 times
9: Jumped 3 times (vase appears)
e537:
0: not jumping
1: jumping
Seems to be 1 shorter than 0xe1b0 and far shorter than 0xe500
vase related? Seen at 0x9FFB (pages 1+2+3)
e538:
0: Sword not flinging
1: Sword flinging (changes back to 0 even if space is still pressed)
e539:
0: Vase is not visible (room 0x28)
1: Vase should become visible (room 0x28). Set to 1 at 0xA04B, after seeing VaseState==9.
e604: Counter. Starts counting from 0x00 upwards, upon entering a room.
e608: seen at 0xB869
e60c-e60d: address of some info about current room; 1 bit each.
e60e+e60f:
0x9D8D@789: Loaded, bit fiddling. Inside appearing ladder code.
0xB871@123: Loaded, stored back. After shattering a rock.
e610: is this room in the special list? (all killall rooms seem to be, plus some more.)
e611: flag: 1 = all enemies need to be killed. 0 = no killall specials.
e612: some room property set up during room enter (to 0 if room not in list from 60ee, 1 if it is on the list).
e613: enemy counter during room setup, to index bits (for show/hide) in *e60c.
e614: some room property based on table (2 bits per room) at ba2e. Can be 0, 1 or 2.
e61b:
0x586E@0: Set to 1. Inside LoadMoreBossPatterns().
0x5874@0: Loaded, compared to 0. Inside LoadMoreBossPatterns().
0x5884@0: Loaded, compared to 8. Inside LoadBossPatterns().
0x58A0@0: Loaded, compared to 7. Inside LoadBossPatterns().
0x58AE@0: Loaded, incremented.
0x58C7@0: Loaded, compared to 0x2c (44).
0x58CF@0: Set to 0.
0x8321@2: Set to 1.
0x832C@2: Loaded, compared to 0.
e61c: ?Sabre visible/appeared in sabre room?
e61e: ?Touched fairy?
e620: number of enemies in this room
e621: used during enemy setup
e622: number of enemies to kill before special happens, or 0.
e623: Rock iterator? Start at 7/8 and count down to 0?
e624: some enemy property set during setup (again for each enemy?)
e625: set to 80 if *e097 > 0 and correct enemy type is in room, otherwise set to 0 correct type taken from lists, see code at 659b @456
e635: maximum allowed number of enemies in this room
e636: something about enemies.
e648-e64b: exits from this room: down, up, left, right
e648: Down
e649: Up
e65a: Left
e65b: Right
e650-e670: appearing enemies
e650: falling+bouncing grey boulders appear in this room. Code at 61e4@4: hardcoded to castle rooms 03, 47, 71, 72.
e653: exploding fireballs appear in this room. Code at 6205@4: hardcoded to castle rooms 90,91,92,93; world 8 rooms 0f, 10, 11, 12, 13; world 9 rooms 03, 04, 05; world 10 rooms 02, 03.
e659: jumping fish appear in this room. Code at 6239@4: hardcoded to castle rooms 89, 8a, 8b, 8c.
e65c: crawlers appear in this room. Code at 6249@4: hardcoded to castle rooms 0a, 11, 1c, 38, 49, 7a, 83, 84, 50; world 4 rooms 0a, 0c; world 6 room 08.
e65f: seahorse demons appear in this room. Code at 6291@4: hardcoded to world 5 rooms 07, 08, 09, 0a.
e662: vertical blobs appear in this room. Code at 62a4@4: hardcoded to castle rooms 66, 5e, 5f.
e665: falling (non bouncing) grey boulders appear in this room: hardcoded to castle rooms 2f, 3b; world 8 rooms 02, 0e.
e668+e669+e66a: flocking birds. code at 61a8@4: hardcoded to world 6 rooms 02(5), 03(a), 04(5), 07(a), 08(a), 11(a), 12(5)
e668: 1 if flocking birds appear in this room.
e669: number of birds (5 or a)
e66a: ? (initialized to 0010)
e670: Seen at 0x68F4 (page 1/2/3
e680: god id of shrine in this room
e688: marker(?) for world door
e68c: world door state (closed; opening; open)
e68d-e68e: related to opening world door (T9A1Dh)
e690: god id of shrine you're standing in
e691: shopping substate?
e692: position of selector in shop
e693: T90BCh (page 1/2/3)
e694: T90B2h (page 1/2/3)
e6a1:
0x9EF6@798 Stored, where a ladder appears.
e6c2, e6c3: enemy types of first two enemies killed on this screen (initially 0)
e6c4, e6c5: number of those types killed respectively
e6c6: item drop rate category
0xB575 (page 4/5/6) set. Possible values: 0, 1, 2, 3
0x6A77 (page 4/5/6) loaded.
e6c7: enemy type that is being killed
e700:
Index for table at 0x7F97 (page 1/2/3), 1 based. (So 0x7F98 is we make it 0 based.)
0xB9D2:
Index for jump/switch table
e702:
0xB9BC@123: Loaded
e70a:
0xBA04@123: Loaded
e710:
Boss hit points left before destroyed.
Initial values:
Without Holy Water With Holy Water
World 1 0x18 (24) 0x0C (12)
Related to e700.
e71d: Sound related.
e740: item id that is in current room
e742-e743: Y and X position of item, not a screenbuffer location
like e744-e745. Example for vase:
Y=0x88 (@0xe742)
X=0x80 (@0xe743)
(Some) code references:
0x5DBD (page 0)
0x5DBF (page 0)
e744-e745:
Appear location for world 10 door.
Appear location of vase (and probably for all items), in
screenbuffer. Top left. For example vase: 0xEF30
e800-?e99f?: on screen enemy info; 20 byte each
00 enemy type
01 initial 0
Fairy Dust:
0x01 Fairy Dust is floating
0x03 Fairy Dust is floating
0x04 Fairy Dust was converted to Fairy. ?T824Dh?
02 Flags. Bit 7: active. Initial f0 (normal) or f8 (killall)
03 enemy number, if bits in *e60c are used for this enemy (room?).
04 initial 00
05 Y
06 initial 00
07 X
08 initial 00
09 bit 7: set for sprite, clear for characters. bit 6: set for boss? initial from edata[0]
0a sprite name (for sprite) or boss pattern for character enemies. initial from edata[1]
0b sprite color; initial from edata[2] edata is 67b6 + 5 * *e635 ?! (should be etype...)
0c ? from f012
0d ? from f013
0e ? from f014
0f ? from f015
10 hitpoints left initial from from edata[3] (bat: 01); ff is special
11 ? initial from from edata[4] (bat: 69)
12+13 for character enemies: screen address (in ed00) for first character
14 initial 00
15 initial 00
16 initial 00
17 initial 00
18 initial 00
19 initial 00
1a initial 00
1b initial 00
1c initial 00
1d initial 00
1e initial 00
1f initial 00
eaa2: Y coordinate of trap wall
eaa3: X coordinate of trap wall
eac0: Disappearing walls
0: Walls won't be drawn, i.e. player can walk to boss room.
1: Walls will be drawn, i.e. passage is blocked.
0x735F@123: Loaded, used for whether to draw
0x9E08@789: Stored, when last enemy is killed.
eac2-eac3:
Address of where to start drawing walls which can disappear.
World 1, room 0x0c: 0xED80
eb00-?
Backing store?
0x7978 Seen DE == 0xEB00
ec00-ec07: Disappearing ladder.
room 0d room 13 room 15 room 3c room 46 room 49 room 56 room 66 room 6a room 74 room 7c room 85 room 88
ec00: non zero if disappearing ladder 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D
ec01: Y 40 80 60 40 80 40 80 60 60 60 40 80 60
ec02: X B0 A0 80 50 30 30 60 E0 70 20 A0 B0 30
ec03: height (counted from top) 07 07 03 07 07 0F 07 07 07 07 0B 07 0B
ec04: ? 40 40 20 40 40 80 40 40 40 40 60 40 60
ec05+ec06: screen buffer address EE16 EF14 EE90 EE0A EF06 EE06 EF0C EE9C EE8E EE84 EE14 EF16 EE86
ec07: 00: hasn't disappeared, 01: disappeared 00 00 00 00 00 00 00 00 00 00 00 00 00
ec08-ec0b: Appearing ladder stuff
W1R0A W2R07 W2R0E W3R0C W3R0F W4R0F W5R10 W6R0B W6R08 W7R12 W8R05 W9R02
ec08 1=Appear 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01
ec09 Height 0x03 0x03 0x03 0x03 0x03 0x03 0x03 0x03 !0x04! 0x03 0x03 0x03
ec0a+ec0b Screen buffer address 0xEE15 0xED8F 0xEE19 0xED8F 0xED82 0xED8F 0xED8F 0xED8F 0xEF9C 0xEF10 0xED8F 0xED82
0x796D@1: Loaded, checked for non-zero.
0x9EE9@789: Stored, set to 1.
ec10:
Seen at 0xA310
ec12:
0x5FE5@0: Loaded, bit 0 tested.
Seen at 0xA308
ec20-ec2f: horizontal elevator info
00: enabled
01: room number (always the current room)
02: 0
03: elevator id
04: 0
05: current Y (does not change)
06: 0
07: current X; initial is minimum
08: Y step per frame (always 0)
09: X step per frame (02 or fe)
0a: -
0b: -
0c: 0
0d: minimum X
0e: 0
0f: maximum X
ec30: Rock attributes?
#1 / #2 / #3 / #4 / #5 / #6 / #7 / #8
ec30/ec38/ec40/ec48/ec50/ec58/ec60/ec68 IX[0]
ec31/ec39/ec41/ec49/ec51/ec59/ec61/ec69 IX[1]
ec32/ec3a/ec42/ec4a/ec52/ec5a/ec62/ec6a IX[2] Y position
ec33/ec3b/ec43/ec4b/ec53/ec5b/ec63/ec6b IX[3] X position
ec34/ec3c/ec44/ec4c/ec54/ec5c/ec64/ec6c IX[4]
ec35/ec3d/ec45/ec4d/ec55/ec5d/ec65/ec6d IX[5]
ec36/ec3e/ec46/ec4e/ec56/ec5e/ec66/ec6e IX[6] Hits still needed to destroy the rock.
ec37/ec3f/ec47/ec4f/ec57/ec5f/ec67/ec6f IX[7]
ec80-ecff: sprite attribute buffer.
ec88: seen at 0x68EA (page 1/2/3)
eca0: seen at 0xB873
ed00-efff: screen buffer, 0x20 (32) bytes per row, 16 rows.
ed00-ed1f Line 0x0 Popolon Aphrodite Arrows
ed20-ed3f Line 0x1 Vitality
ed40-ed5f Line 0x2 Experience
ed60-ed7f Line 0x3 Castle / World N
ed80-ed9f Line 0x4 Line 0 of world/castle
eda0-edbf Line 0x5 Line 1 of world/castle
edc0-eddf Line 0x6 Line 2 of world/castle
ede0-edff Line 0x7 Line 3 of world/castle
ee00-ee1f Line 0x8 Line 4 of world/castle
ee20-ee3f Line 0x9 Line 5 of world/castle
ee40-ee5f Line 0xA Line 6 of world/castle
ee60-ee7f Line 0xB Line 7 of world/castle
ee80-ee9f Line 0xC Line 8 of world/castle
eea0-eebf Line 0xD Line 9 of world/castle
eec0-eedf Line 0xE Line A of world/castle
eee0-eeff Line 0xF Line B of world/castle
ef00-ef1f Line 0x8 Line C of world/castle
ef20-ef3f Line 0x9 Line D of world/castle