-
Notifications
You must be signed in to change notification settings - Fork 21
/
arm9.yml
12972 lines (11633 loc) · 383 KB
/
arm9.yml
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
arm9:
versions:
- EU
- NA
- JP
- EU-ITCM
- NA-ITCM
- JP-ITCM
address:
EU: 0x2000000
NA: 0x2000000
JP: 0x2000000
EU-ITCM: 0x1FF8000
NA-ITCM: 0x1FF8000
JP-ITCM: 0x1FF8000
length:
EU: 0xB7D38
NA: 0xB73F8
JP: 0xB8CB8
EU-ITCM: 0x4000
NA-ITCM: 0x4000
JP-ITCM: 0x4060
description: |-
The main ARM9 binary.
This is the main binary that gets loaded when the game is launched, and contains the core code that runs the game, low level facilities such as memory allocation, compression, other external dependencies (such as linked libraries), and the functions and tables necessary to load overlays and dispatch execution to them.
Speaking generally, this is the program run by the Nintendo DS's main ARM946E-S CPU, which handles all gameplay mechanisms and graphics rendering.
subregions:
- itcm.yml
- libs.yml
functions:
- name: Svc_SoftReset
address:
EU: 0x20001A4
NA: 0x2000566
JP: 0x2000154
description: Software interrupt.
- name: Svc_WaitByLoop
address:
EU: 0x20006B0
NA: 0x2000088
JP: 0x200073A
description: Software interrupt.
- name: Svc_CpuSet
address:
EU: 0x200079E
NA: 0x200078E
JP: 0x2000226
description: Software interrupt.
- name: _start
address:
EU: 0x2000800
NA: 0x2000800
JP: 0x2000800
description: |-
The entrypoint for the ARM9 CPU. This is like the "main" function for the ARM9 subsystem.
Once the entry function reaches the end, a constant containing the address to NitroMain is loaded into a register (r1), and a `bx` branch will jump to NitroMain.
No params.
- name: InitI_CpuClear32
address:
EU: 0x2000954
NA: 0x2000954
JP: 0x2000954
- name: MIi_UncompressBackward
address:
EU: 0x2000970
NA: 0x2000970
JP: 0x2000970
description: "Startup routine in the program's crt0 (https://en.wikipedia.org/wiki/Crt0)."
- name: do_autoload
address:
EU: 0x2000A1C
NA: 0x2000A1C
JP: 0x2000A1C
description: "Startup routine in the program's crt0 (https://en.wikipedia.org/wiki/Crt0)."
- name: StartAutoloadDoneCallback
address:
EU: 0x2000AAC
NA: 0x2000AAC
JP: 0x2000AAC
description: "Startup routine in the program's crt0 (https://en.wikipedia.org/wiki/Crt0)."
- name: init_cp15
address:
EU: 0x2000AB0
NA: 0x2000AB0
JP: 0x2000AB0
- name: OSi_ReferSymbol
address:
EU: 0x2000B9C
NA: 0x2000B9C
JP: 0x2000B9C
description: "Startup routine in the program's crt0 (https://en.wikipedia.org/wiki/Crt0)."
- name: NitroMain
address:
EU: 0x2000C6C
NA: 0x2000C6C
JP: 0x2000C6C
description: "Entrypoint into NitroSDK, the DS devkit library."
- name: InitMemAllocTable
address:
EU: 0x2000DE0
NA: 0x2000DE0
JP: 0x2000DE0
description: |-
Initializes MEMORY_ALLOCATION_TABLE.
Sets up the default memory arena, sets the default memory allocator parameters (calls SetMemAllocatorParams(0, 0)), and does some other stuff.
No params.
- name: SetMemAllocatorParams
address:
EU: 0x2000E70
NA: 0x2000E70
JP: 0x2000E70
description: |-
Sets global parameters for the memory allocator.
This includes MEMORY_ALLOCATION_ARENA_GETTERS and some other stuff.
Dungeon mode uses the default arena getters. Ground mode uses its own arena getters that return custom arenas for some flag values, which are defined in overlay 11 and set (by calling this function) at the start of GroundMainLoop. Note that the sound memory arena is provided explicitly to MemLocateSet in the sound code, so doesn't go through this path.
r0: GetAllocArena function pointer (GetAllocArenaDefault is used if null)
r1: GetFreeArena function pointer (GetFreeArenaDefault is used if null)
- name: GetAllocArenaDefault
address:
EU: 0x2000EC0
NA: 0x2000EC0
JP: 0x2000EC0
description: |-
The default function for retrieving the arena for memory allocations. This function always just returns the initial arena pointer.
r0: initial memory arena pointer, or null
r1: flags (see MemAlloc)
return: memory arena pointer, or null
- name: GetFreeArenaDefault
address:
EU: 0x2000EC4
NA: 0x2000EC4
JP: 0x2000EC4
description: |-
The default function for retrieving the arena for memory freeing. This function always just returns the initial arena pointer.
r0: initial memory arena pointer, or null
r1: pointer to free
return: memory arena pointer, or null
- name: InitMemArena
address:
EU: 0x2000EC8
NA: 0x2000EC8
JP: 0x2000EC8
description: |-
Initializes a new memory arena with the given specifications, and records it in the global MEMORY_ALLOCATION_TABLE.
r0: arena struct to be initialized
r1: memory region to be owned by the arena, as {pointer, length}
r2: pointer to block metadata array for the arena to use
r3: maximum number of blocks that the arena can hold
- name: MemAllocFlagsToBlockType
address:
EU: 0x2000F44
NA: 0x2000F44
JP: 0x2000F44
description: |-
Converts the internal alloc flags bitfield (struct mem_block field 0x4) to the block type bitfield (struct mem_block field 0x0).
r0: internal alloc flags
return: block type flags
- name: FindAvailableMemBlock
address:
EU: 0x2000F88
NA: 0x2000F88
JP: 0x2000F88
description: |-
Searches through the given memory arena for a block with enough free space.
Blocks are searched in reverse order. For object allocations (i.e., not arenas), the block with the smallest amount of free space that still suffices is returned. For arena allocations, the first satisfactory block found is returned.
r0: memory arena to search
r1: internal alloc flags
r2: amount of space needed, in bytes
return: index of the located block in the arena's block array, or -1 if nothing is available
- name: SplitMemBlock
address:
EU: 0x2001070
NA: 0x2001070
JP: 0x2001070
description: |-
Given a memory block at a given index, splits off another memory block of the specified size from the end.
Since blocks are stored in an array on the memory arena struct, this is essentially an insertion operation, plus some processing on the block being split and its child.
r0: memory arena
r1: block index
r2: internal alloc flags
r3: number of bytes to split off
stack[0]: user alloc flags (to assign to the new block)
return: the newly split-off memory block
- name: MemAlloc
address:
EU: 0x2001170
NA: 0x2001170
JP: 0x2001170
description: |-
Allocates some memory on the heap, returning a pointer to the starting address.
Memory allocation is done with region-based memory management. See MEMORY_ALLOCATION_TABLE for more information.
This function is just a wrapper around MemLocateSet.
r0: length in bytes
r1: flags (see the comment on struct mem_block::user_flags)
return: pointer
- name: MemFree
address:
EU: 0x2001188
NA: 0x2001188
JP: 0x2001188
description: |-
Frees heap-allocated memory.
This function is just a wrapper around MemLocateUnset.
r0: pointer
- name: MemArenaAlloc
address:
EU: 0x200119C
NA: 0x200119C
JP: 0x200119C
description: |-
Allocates some memory on the heap and creates a new global memory arena with it.
The actual allocation part works similarly to the normal MemAlloc.
r0: desired parent memory arena, or null
r1: length of the arena in bytes
r2: maximum number of blocks that the arena can hold
r3: flags (see MemAlloc)
return: memory arena pointer
- name: CreateMemArena
address:
EU: 0x2001280
NA: 0x2001280
JP: 0x2001280
description: |-
Creates a new memory arena within a given block of memory.
This is essentially a wrapper around InitMemArena, accounting for the space needed by the arena metadata.
r0: memory region in which to create the arena, as {pointer, length}
r1: maximum number of blocks that the arena can hold
return: memory arena pointer
- name: MemLocateSet
address:
EU: 0x2001390
NA: 0x2001390
JP: 0x2001390
description: |-
The implementation for MemAlloc.
At a high level, memory is allocated by choosing a memory arena, looking through blocks in the memory arena until a free one that's large enough is found, then splitting off a new memory block of the needed size.
This function is not fallible, i.e., it hangs the whole program on failure, so callers can assume it never fails.
The name for this function comes from the error message logged on failure, and it reflects what the function does: locate an available block of memory and set it up for the caller.
r0: desired memory arena for allocation, or null (MemAlloc passes null)
r1: length in bytes
r2: flags (see MemAlloc)
return: pointer to allocated memory
- name: MemLocateUnset
address:
EU: 0x2001638
NA: 0x2001638
JP: 0x2001638
description: |-
The implementation for MemFree.
At a high level, memory is freed by locating the pointer in its memory arena (searching block-by-block) and emptying the block so it's available for future allocations, and merging it with neighboring blocks if they're available.
r0: desired memory arena for freeing, or null (MemFree passes null)
r1: pointer to free
- name: RoundUpDiv256
address:
EU: 0x2001894
NA: 0x2001894
JP: 0x2001894
description: |-
Divide a number by 256 and round up to the nearest integer.
r0: number
return: number // 256
- name: UFixedPoint64CmpLt
address:
EU: 0x2001A30
NA: 0x2001A30
JP: 0x2001A30
description: |-
Compares two unsigned 64-bit fixed-point numbers (16 fraction bits) x and y.
r0: upper 32 bits of x
r1: lower 32 bits of x
r2: upper 32 bits of y
r3: lower 32 bits of y
return: x < y
- name: MultiplyByFixedPoint
address:
EU: 0x2001A54
NA: 0x2001A54
JP: 0x2001A54
description: |-
Multiply a signed integer x by a signed binary fixed-point multiplier (8 fraction bits).
r0: x
r1: multiplier
return: x * multiplier
- name: UMultiplyByFixedPoint
address:
EU: 0x2001B0C
NA: 0x2001B0C
JP: 0x2001B0C
description: |-
Multiplies an unsigned integer x by an unsigned binary fixed-point multiplier (8 fraction bits).
r0: x
r1: multiplier
return: x * multiplier
- name: IntToFixedPoint64
address:
EU: 0x2001C80
NA: 0x2001C80
JP: 0x2001C80
description: |-
Converts a signed integer to a 64-bit fixed-point number (16 fraction bits).
Note that this function appears to be bugged: it appears to try to sign-extend if the input is negative, but in a nonsensical way, checking the sign bit for a 16-bit signed integer, but then doing the sign extension as if the input were a 32-bit signed integer.
r0: [output] 64-bit fixed-point number
r1: 32-bit signed int
- name: FixedPoint64ToInt
address:
EU: 0x2001CB0
NA: 0x2001CB0
JP: 0x2001CB0
description: |-
Converts a 64-bit fixed-point number (16 fraction bits) to a signed integer.
r0: 64-bit fixed-point number
return: 32-bit signed
- name: FixedPoint32To64
address:
EU: 0x2001CD4
NA: 0x2001CD4
JP: 0x2001CD4
description: |-
Converts a 32-bit fixed-point number (8 fraction bits) to a 64-bit fixed point number (16 fraction bits). Sign-extends as necessary.
r0: [output] 64-bit fixed-point number
r1: 32-bit signed fixed-point number
- name: NegateFixedPoint64
address:
EU: 0x2001CF8
NA: 0x2001CF8
JP: 0x2001CF8
description: |-
Negates a 64-bit fixed-point number (16 fraction bits) in-place.
r0: 64-bit fixed-point number to negate
- name: FixedPoint64IsZero
address:
EU: 0x2001D28
NA: 0x2001D28
JP: 0x2001D28
description: |-
Checks whether a 64-bit fixed-point number (16 fraction bits) is zero.
r0: 64-bit fixed-point number
return: bool
- name: FixedPoint64IsNegative
address:
EU: 0x2001D50
NA: 0x2001D50
JP: 0x2001D50
description: |-
Checks whether a 64-bit fixed-point number (16 fraction bits) is negative.
r0: 64-bit fixed-point number
return: bool
- name: FixedPoint64CmpLt
address:
EU: 0x2001D68
NA: 0x2001D68
JP: 0x2001D68
description: |-
Compares two signed 64-bit fixed-point numbers (16 fraction bits) x and y.
r0: x
r1: y
return: x < y
- name: MultiplyFixedPoint64
address:
EU: 0x2001DF4
NA: 0x2001DF4
JP: 0x2001DF4
description: |-
Multiplies two signed 64-bit fixed-point numbers (16 fraction bits) x and y.
r0: [output] product (x * y)
r1: x
r2: y
- name: DivideFixedPoint64
address:
EU: 0x2001EC8
NA: 0x2001EC8
JP: 0x2001EC8
description: |-
Divides two signed 64-bit fixed-point numbers (16 fraction bits).
Returns the maximum positive value ((INT64_MAX >> 16) + (UINT16_MAX * 2^-16)) if the divisor is zero.
r0: [output] quotient (dividend / divisor)
r1: dividend
r2: divisor
- name: UMultiplyFixedPoint64
address:
EU: 0x2001FA0
NA: 0x2001FA0
JP: 0x2001FA0
description: |-
Multiplies two unsigned 64-bit fixed-point numbers (16 fraction bits) x and y.
r0: [output] product (x * y)
r1: x
r2: y
- name: UDivideFixedPoint64
address:
EU: 0x2002084
NA: 0x2002084
JP: 0x2002084
description: |-
Divides two unsigned 64-bit fixed-point numbers (16 fraction bits).
Returns the maximum positive value for a signed fixed-point number ((INT64_MAX >> 16) + (UINT16_MAX * 2^-16)) if the divisor is zero.
r0: [output] quotient (dividend / divisor)
r1: dividend
r2: divisor
- name: AddFixedPoint64
address:
EU: 0x20021C8
NA: 0x20021C8
JP: 0x20021C8
description: |-
Adds two 64-bit fixed-point numbers (16 fraction bits) x and y.
r0: [output] sum (x + y)
r1: x
r2: y
- name: ClampedLn
address:
EU: 0x20021F4
NA: 0x20021F4
JP: 0x20021F4
description: |-
The natural log function over the domain of [1, 2047]. The input is clamped to this domain.
r0: [output] ln(x)
r1: x
- name: GetRngSeed
address:
EU: 0x200222C
NA: 0x200222C
JP: 0x200222C
description: Get the current value of PRNG_SEQUENCE_NUM.
- name: SetRngSeed
address:
EU: 0x200223C
NA: 0x200223C
JP: 0x200223C
description: |-
Seed PRNG_SEQUENCE_NUM to a given value.
r0: seed
- name: Rand16Bit
address:
EU: 0x200224C
NA: 0x200224C
JP: 0x200224C
description: |-
Computes a pseudorandom 16-bit integer using the general-purpose PRNG.
Note that much of dungeon mode uses its own (slightly higher-quality) PRNG within overlay 29. See overlay29.yml for more information.
Random numbers are generated with a linear congruential generator (LCG), using a modulus of 2^16, a multiplier of 109, and an increment of 1021. I.e., the recurrence relation is `x = (109*x_prev + 1021) % 2^16`.
The LCG has a hard-coded seed of 13452 (0x348C), but can be seeded with a call to SetRngSeed.
return: pseudorandom int on the interval [0, 65535]
- name: RandInt
address:
EU: 0x2002274
NA: 0x2002274
JP: 0x2002274
description: |-
Compute a pseudorandom integer under a given maximum value using the general-purpose PRNG.
This function relies on a single call to Rand16Bit. Even though it takes a 32-bit integer as input, the number of unique outcomes is capped at 2^16.
r0: high
return: pseudorandom integer on the interval [0, high - 1]
- name: RandRange
address:
EU: 0x200228C
NA: 0x200228C
JP: 0x200228C
description: |-
Compute a pseudorandom value between two integers using the general-purpose PRNG.
This function relies on a single call to Rand16Bit. Even though it takes 32-bit integers as input, the number of unique outcomes is capped at 2^16.
r0: x
r1: y
return: pseudorandom integer on the interval [x, y - 1]
- name: Rand32Bit
address:
EU: 0x20022AC
NA: 0x20022AC
JP: 0x20022AC
description: |-
Computes a random 32-bit integer using the general-purpose PRNG. The upper and lower 16 bits are each generated with a separate call to Rand16Bit (so this function advances the PRNG twice).
return: pseudorandom int on the interval [0, 4294967295]
- name: RandIntSafe
address:
EU: 0x20022F8
NA: 0x20022F8
JP: 0x20022F8
description: |-
Same as RandInt, except explicitly masking out the upper 16 bits of the output from Rand16Bit (which should be zero anyway).
r0: high
return: pseudorandom integer on the interval [0, high - 1]
- name: RandRangeSafe
address:
EU: 0x2002318
NA: 0x2002318
JP: 0x2002318
description: |-
Like RandRange, except reordering the inputs as needed, and explicitly masking out the upper 16 bits of the output from Rand16Bit (which should be zero anyway).
r0: x
r1: y
return: pseudorandom integer on the interval [min(x, y), max(x, y) - 1]
- name: WaitForever
address:
EU: 0x2002438
NA: 0x2002438
JP: 0x2002438
description: |-
Sets some program state and calls WaitForInterrupt in an infinite loop.
This is called on fatal errors to hang the program indefinitely.
No params.
- name: InterruptMasterDisable
address:
EU: 0x20030CC
NA: 0x20030CC
JP: 0x20030CC
description: |-
Note: unverified, ported from Irdkwia's notes
return: previous state
- name: InterruptMasterEnable
address:
EU: 0x20030E4
NA: 0x20030E4
JP: 0x20030E4
description: |-
Note: unverified, ported from Irdkwia's notes
return: previous state
- name: InitMemAllocTableVeneer
address:
EU: 0x200321C
NA: 0x200321C
JP: 0x200321C
description: |-
Likely a linker-generated veneer for InitMemAllocTable.
See https://developer.arm.com/documentation/dui0474/k/image-structure-and-generation/linker-generated-veneers/what-is-a-veneer-
No params.
- name: ZInit8
address:
EU: 0x2003228
NA: 0x2003228
JP: 0x2003228
description: |-
Zeroes an 8-byte buffer.
r0: ptr
- name: PointsToZero
address:
EU: 0x2003238
NA: 0x2003238
JP: 0x2003238
description: |-
Checks whether a pointer points to zero.
r0: ptr
return: bool
- name: MemZero
address:
EU: 0x2003250
NA: 0x2003250
JP: 0x2003250
description: |-
Zeroes a buffer.
r0: ptr
r1: len
- name: MemZero16
address:
EU: 0x200326C
NA: 0x200326C
JP: 0x200326C
description: |-
Zeros a buffer of 16-bit values.
r0: ptr
r1: len (# bytes)
- name: MemZero32
address:
EU: 0x2003288
NA: 0x2003288
JP: 0x2003288
description: |-
Zeros a buffer of 32-bit values.
r0: ptr
r1: len (# bytes)
- name: MemsetSimple
address:
EU: 0x20032A4
NA: 0x20032A4
JP: 0x20032A4
description: |-
A simple implementation of the memset(3) C library function.
This function was probably manually implemented by the developers. See memset for what's probably the real libc function.
r0: ptr
r1: value
r2: len (# bytes)
- name: Memset32
address:
EU: 0x20032BC
NA: 0x20032BC
JP: 0x20032BC
description: |-
Fills a buffer of 32-bit values with a given value.
r0: ptr
r1: value
r2: len (# bytes)
- name: MemcpySimple
address:
EU: 0x20032D4
NA: 0x20032D4
JP: 0x20032D4
description: |-
A simple implementation of the memcpy(3) C library function.
This function was probably manually implemented by the developers. See memcpy for what's probably the real libc function.
This function copies from src to dst in backwards byte order, so this is safe to call for overlapping src and dst if src <= dst.
r0: dest
r1: src
r2: n
- name: Memcpy16
address:
EU: 0x20032F0
NA: 0x20032F0
JP: 0x20032F0
description: |-
Copies 16-bit values from one buffer to another.
r0: dest
r1: src
r2: n (# bytes)
- name: Memcpy32
address:
EU: 0x200330C
NA: 0x200330C
JP: 0x200330C
description: |-
Copies 32-bit values from one buffer to another.
r0: dest
r1: src
r2: n (# bytes)
- name: TaskProcBoot
address:
EU: 0x2003328
NA: 0x2003328
JP: 0x2003328
description: |-
Probably related to booting the game?
This function prints the debug message "task proc boot".
No params.
- name: EnableAllInterrupts
address:
EU: 0x2003608
NA: 0x2003608
JP: 0x2003608
description: |-
Sets the Interrupt Master Enable (IME) register to 1, which enables all CPU interrupts (if enabled in the Interrupt Enable (IE) register).
See https://problemkaputt.de/gbatek.htm#dsiomaps.
return: old value in the IME register
- name: GetTime
address:
EU: 0x20037B4
NA: 0x20037B4
JP: 0x20037B4
description: |-
Seems to get the current (system?) time as an IEEE 754 floating-point number.
return: current time (maybe in seconds?)
- name: DisableAllInterrupts
address:
EU: 0x2003824
NA: 0x2003824
JP: 0x2003824
description: |-
Sets the Interrupt Master Enable (IME) register to 0, which disables all CPU interrupts (even if enabled in the Interrupt Enable (IE) register).
See https://problemkaputt.de/gbatek.htm#dsiomaps.
return: old value in the IME register
- name: SoundResume
address:
EU: 0x2003CC4
NA: 0x2003CC4
JP: 0x2003CC4
description: |-
Probably resumes the sound player if paused?
This function prints the debug string "sound resume".
- name: CardPullOutWithStatus
address:
EU: 0x2003D2C
NA: 0x2003D2C
JP: 0x2003D2C
description: |-
Probably aborts the program with some status code? It seems to serve a similar purpose to the exit(3) function.
This function prints the debug string "card pull out %d" with the status code.
r0: status code
- name: CardPullOut
address:
EU: 0x2003D70
NA: 0x2003D70
JP: 0x2003D70
description: |-
Sets some global flag that probably triggers system exit?
This function prints the debug string "card pull out".
No params.
- name: CardBackupError
address:
EU: 0x2003D94
NA: 0x2003D94
JP: 0x2003D94
description: |-
Sets some global flag that maybe indicates a save error?
This function prints the debug string "card backup error".
No params.
- name: HaltProcessDisp
address:
EU: 0x2003DB8
NA: 0x2003DB8
JP: 0x2003DB8
description: |-
Maybe halts the process display?
This function prints the debug string "halt process disp %d" with the status code.
r0: status code
- name: OverlayIsLoaded
address:
EU: 0x2003ED0
NA: 0x2003ED0
JP: 0x2003ED0
description: |-
Checks if an overlay with a certain group ID is currently loaded.
See the LOADED_OVERLAY_GROUP_* data symbols or enum overlay_group_id in the C headers for a mapping between group ID and overlay number.
r0: group ID of the overlay to check. A group ID of 0 denotes no overlay, and the return value will always be true in this case.
return: bool
- name: LoadOverlay
address:
EU: 0x20040AC
NA: 0x20040AC
JP: 0x20040AC
description: |-
Loads an overlay from ROM by its group ID.
See the LOADED_OVERLAY_GROUP_* data symbols or enum overlay_group_id in the C headers for a mapping between group ID and overlay number.
r0: group ID of the overlay to load
- name: UnloadOverlay
address:
EU: 0x2004868
NA: 0x2004868
JP: 0x2004868
description: |-
Unloads an overlay from ROM by its group ID.
See the LOADED_OVERLAY_GROUP_* data symbols or enum overlay_group_id in the C headers for a mapping between group ID and overlay number.
r0: group ID of the overlay to unload
others: ?
- name: Rgb8ToRgb5
address:
EU: 0x2004FCC
NA: 0x2004FCC
JP: 0x2004FCC
description: |-
Transform the input rgb8 color to a rgb5 color
r0: pointer to target rgb5 (2 bytes, aligned to LSB)
r1: pointer to source rgb8
- name: EuclideanNorm
address:
EU:
- 0x2005050
- 0x20050B0
NA:
- 0x2005050
- 0x20050B0
JP:
- 0x2005050
- 0x20050B0
description: |-
Computes the Euclidean norm of a two-component integer array, sort of like hypotf(3).
r0: integer array [x, y]
return: sqrt(x*x + y*y)
- name: ClampComponentAbs
address:
EU: 0x2005110
NA: 0x2005110
JP: 0x2005110
description: |-
Clamps the absolute values in a two-component integer array.
Given an integer array [x, y] and a maximum absolute value M, clamps each element of the array to M such that the output array is [min(max(x, -M), M), min(max(y, -M), M)].
r0: 2-element integer array, will be mutated
r1: max absolute value
- name: GetHeldButtons
address:
EU: 0x20061EC
NA: 0x20061EC
JP: 0x20061EC
description: |-
Note: unverified, ported from Irdkwia's notes
r0: controller
r1: btn_ptr
return: any_activated
- name: GetPressedButtons
address:
EU: 0x200625C
NA: 0x200625C
JP: 0x200625C
description: |-
Note: unverified, ported from Irdkwia's notes
r0: controller
r1: btn_ptr
return: any_activated
- name: GetReleasedStylus
address:
EU: 0x2006C1C
NA: 0x2006C1C
JP: 0x2006C1C
description: |-
Note: unverified, ported from Irdkwia's notes
r0: stylus_ptr
return: any_activated
- name: KeyWaitInit
address:
EU: 0x2006DA4
NA: 0x2006DA4
JP: 0x2006DA4
description: |-
Implements (most of?) SPECIAL_PROC_KEY_WAIT_INIT (see ScriptSpecialProcessCall).
No params.
- name: DataTransferInit
aliases:
- FileRom_InitDataTransfer
address:
EU: 0x2008168
NA: 0x2008168
JP: 0x2008168
description: |-
Initializes data transfer mode to get data from the ROM cartridge.
No params.
- name: DataTransferStop
aliases:
- FileRom_StopDataTransfer
address:
EU: 0x2008194
NA: 0x2008194
JP: 0x2008194
description: |-
Finalizes data transfer from the ROM cartridge.
This function must always be called if DataTransferInit was called, or the game will crash.
No params.
- name: FileInitVeneer
aliases:
- FileRom_Veneer_FileInit
address:
EU: 0x2008204
NA: 0x2008204
JP: 0x2008204
description: |-
Likely a linker-generated veneer for FileInit.
See https://developer.arm.com/documentation/dui0474/k/image-structure-and-generation/linker-generated-veneers/what-is-a-veneer-
r0: file_stream pointer
- name: FileOpen
aliases:
- FileRom_HandleOpen
address:
EU: 0x2008210
NA: 0x2008210
JP: 0x2008210
description: |-
Opens a file from the ROM file system at the given path, sort of like C's fopen(3) library function.
r0: file_stream pointer
r1: file path string
- name: FileGetSize
address:
EU: 0x2008244
NA: 0x2008244
JP: 0x2008244
description: |-
Gets the size of an open file.
r0: file_stream pointer
return: file size
- name: FileRead
aliases:
- FileRom_HandleRead
address:
EU: 0x2008254
NA: 0x2008254
JP: 0x2008254
description: |-
Reads the contents of a file into the given buffer, and moves the file cursor accordingly.
Data transfer mode must have been initialized (with DataTransferInit) prior to calling this function. This function looks like it's doing something akin to calling read(2) or fread(3) in a loop until all the bytes have been successfully read.
Note: If code is running from IRQ mode, it appears that FileRead hangs the game. When the processor mode is forced into SYSTEM mode FileRead once again works, so it appears that ROM access only works in certain processor modes. Note that forcing the processor into a different mode is generally a bad idea and should be avoided as it will easily corrupt that processor mode's states.
r0: file_stream pointer
r1: [output] buffer
r2: number of bytes to read
return: number of bytes read
- name: FileSeek
aliases:
- FileRom_HandleSeek
address:
EU: 0x20082A8
NA: 0x20082A8
JP: 0x20082A8
description: |-
Sets a file stream's position indicator.