Advertisement
Guest User

Untitled

a guest
Mar 19th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @ Skills:
  2. @ 0 - None
  3. @ 1 - Intuition
  4. @ 2 - Concordant Roots
  5. @ 3 - Arcane Advance
  6.  
  7. .thumb
  8. .org 0x00
  9.     Begin:
  10.         push    {r0-r6}
  11.  
  12.     FindUnit:                          
  13.         ldr     r3, StatScreenStruct        @r3 points to char struct (stat screen)
  14.         ldr     r3, [r3, #0x0C]             @goes 0c into stat screen struct, loads the word there; r3 points to char struct in memory
  15.         ldr     r3, [r3]                    @loads the word there; r3 points to the character's entry in the table in the rom
  16.         ldrb    r3, [r3, #0x04]             @r3 now contains character number
  17.  
  18.     CheckIfHasSkillsEntry:
  19.         ldr     r6, SkillTable              @load pointer to skill table
  20.         @add    r6, #0x04
  21.  
  22.         Jump1:
  23.                 ldrb    r5, [r6]            @load unit #
  24.                 cmp     r5, #0x00           @end of table
  25.                 beq     DrawAffinity        @if no skills, skip to DrawAffinity
  26.                 cmp     r3, r5              @if the unit has skills defined
  27.                 beq     GetSkills           @then get skills
  28.                 @else
  29.                 add     r6, #0x03           @next entry!
  30.                 b       Jump1
  31.  
  32.     GetSkills:                              @r3 is current unit, r6 is pointer to that unit's entry in skill table
  33.         ldrb    r5, [r6, #0x01]             @load first skill to r5
  34.         ldrb    r6, [r6, #0x02]             @load second skill to r6
  35.  
  36.     DecideWhichSkillsToDraw:
  37.         @add    r6, #0x04                   @load skills to r4 and r5, r4 empty -> affin, r5 empty -> draw 1 icon, else -> continue
  38.         cmp     r5, #0x00
  39.         beq     DrawAffinity
  40.         cmp     r6, #0x00
  41.         beq     DrawFirstIcon
  42.         @else continue to draw second, then draw first
  43.  
  44.     DrawSecondIcon:
  45.         mov     r2, #0x10
  46.  
  47.         @sub    r6, #0x01
  48.         @mov    r1, #0x20
  49.         @mul    r6, r6, r1
  50.         lsl     r6, #0x07                   @r6 has skill #
  51.  
  52.         ldr     r1, Skill2Top
  53.         ldr     r0, SkillIconsPointer
  54.         add     r0, r0, r6                  @choose icon properly
  55.  
  56.         @push   {r0}
  57.         ldr     r3, CPUFastSet
  58.         bl      Goto_r3
  59.         @pop    {r0}
  60.  
  61.         ldr     r1, Skill2Bottom
  62.         add     r0, r0, #0x40               @advance to bottom part
  63.  
  64.         ldr     r3, CPUFastSet
  65.         bl      Goto_r3
  66.  
  67.         mov     r0, #0x00
  68.         mov     r1, #0x00
  69.         ldr     r2, OAMTable1
  70.         mov     r3, #0x00
  71.         ldr     r4, OAMWriteRoutine
  72.         bl      Goto_r4
  73.        
  74.  
  75.     DrawFirstIcon:
  76.         mov     r2, #0x10
  77.  
  78.         @sub    r5, #0x01
  79.         @mov    r1, #0x20
  80.         @mul    r5r5, r1  
  81.         lsl     r5, #0x07              
  82.  
  83.         ldr     r1, Skill1Top
  84.         ldr     r0, SkillIconsPointer
  85.         add     r0, r0, r5                  @choose icon properly
  86.  
  87.         @push   {r0}
  88.         ldr     r3, CPUFastSet
  89.         bl      Goto_r3
  90.         @pop    {r0}
  91.  
  92.         ldr     r1, Skill1Bottom
  93.         add     r0, r0, #0x40               @advance to bottom part
  94.  
  95.         ldr     r3, CPUFastSet
  96.         bl      Goto_r3
  97.  
  98.         mov     r0, #0x00
  99.         mov     r1, #0x00
  100.         ldr     r2, OAMTable2
  101.         mov     r3, #0x00
  102.         ldr     r4, OAMWriteRoutine
  103.         bl      Goto_r4
  104.  
  105.     DrawAffinity:
  106.         @should be done i think...
  107.  
  108.     End:
  109.         pop     {r0-r6}
  110.  
  111.     OriginalFunctions:
  112.         str     r0, [sp]
  113.         ldr     r0, [r1, #0x04]
  114.         ldrb    r0, [r0, $0x14]
  115.         lsl     r0, r0, #0x18
  116.  
  117.     Return:
  118.         ldr     r2, ReturnLocation
  119.         bx      r2
  120.  
  121.     Goto_r3:
  122.         bx      r3
  123.  
  124.     Goto_r4:
  125.         bx      r4
  126.  
  127. .align 2
  128.     Skill1OAMTable:
  129.         .short  0x0001    @ Don't touch this
  130.         .short  0x0058    @ the last two digits modify y position ; attr0
  131.         .short  0x20C4    @ first two digits are size, I wouldn't edit it, last two modify x position ; attr1
  132.         .short  0x400B    @ first two digits are palette, others are tile ; attr2
  133.         .short  0x0000    @ leave blank ; attr3
  134.  
  135.     Skill2OAMTable:
  136.         .short  0x0001    @ Don't touch this
  137.         .short  0x0058    @ the last two digits modify y position ; attr0
  138.         .short  0x20DA    @ first two digits are size, I wouldn't edit it, last two modify x position ; attr1
  139.         .short  0x400D    @ first two digits are palette, others are tile ; attr2
  140.         .short  0x0000    @ leave blank ; attr3
  141.  
  142.     ReturnLocation:
  143.         .long   0x80871FC+1
  144.     @BG0Buffer:
  145.     @   .long   0x2022CA8
  146.     CPUFastSet:
  147.         .long   0x080D1675
  148.     StatScreenStruct:
  149.         .long   0x2003BFC
  150.     Skill1Top:
  151.         .long   0x6010160
  152.     Skill1Bottom:
  153.         .long   0x6010560
  154.     Skill2Top:
  155.         .long   0x60101A0
  156.     Skill2Bottom:
  157.         .long   0x60105A0
  158.     SkillTable:
  159.         .long   0x8B2E000
  160.     OAMTable1:
  161.         .long   0x8B2E500
  162.     OAMTable2:
  163.         .long   0x8B2F000
  164.     OAMWriteRoutine:
  165.         .long   0x8002BB8+1
  166.     SkillIconsPointer:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement