;;; Arachnus_Initialisation ;;;
08024290 (T)  push    r4-r7,r14
08024292 (T)  mov     r7,r8
08024294 (T)  push    r7
08024296 (T)  add     sp,-0Ch
08024298 (T)  ldr     r0,=EnemyOrientation      ;\
0802429A (T)  mov     r12,r0                    ;|
0802429C (T)  ldrh    r0,[r0]                   ;|
0802429E (T)  mov     r2,40h                    ;|
080242A0 (T)  mov     r4,0h                     ;} EnemyOrientation |= 40h (facing right)
080242A2 (T)  orr     r0,r2                     ;|
080242A4 (T)  mov     r1,r12                    ;|
080242A6 (T)  strh    r0,[r1]                   ;/
080242A8 (T)  ldr     r3,=82E4D4Ch              ;\
080242AA (T)  ldrb    r1,[r1,1Dh]               ;|
080242AC (T)  lsl     r0,r1,3h                  ;|
080242AE (T)  sub     r0,r0,r1                  ;|
080242B0 (T)  lsl     r0,r0,1h                  ;} Set EnemyHealth from enemy stats table
080242B2 (T)  add     r0,r0,r3                  ;|
080242B4 (T)  ldrh    r0,[r0]                   ;|
080242B6 (T)  mov     r1,r12                    ;|
080242B8 (T)  strh    r0,[r1,14h]               ;/
080242BA (T)  mov     r0,r12                    ;\
080242BC (T)  add     r0,25h                    ;|
080242BE (T)  mov     r3,2h                     ;} $Enemy25 = 2
080242C0 (T)  strb    r3,[r0]                   ;/
080242C2 (T)  add     r0,2h                     ;\
080242C4 (T)  strb    r2,[r0]                   ;} $Enemy27 = 40h
080242C6 (T)  add     r0,1h                     ;\
080242C8 (T)  strb    r4,[r0]                   ;} Clear $Enemy28
080242CA (T)  add     r0,1h                     ;\
080242CC (T)  strb    r2,[r0]                   ;} $Enemy29 = 40h
080242CE (T)  add     r1,2Eh                    ;\
080242D0 (T)  mov     r0,64h                    ;} EnemySpawnTimer = 100
080242D2 (T)  strb    r0,[r1]                   ;/
080242D4 (T)  mov     r2,r12                    ;\
080242D6 (T)  add     r2,24h                    ;|
080242D8 (T)  ldrb    r0,[r2]                   ;|
080242DA (T)  mov     r5,r12                    ;} If EnemyPose == 59h (start to be born):
080242DC (T)  cmp     r0,59h                    ;|
080242DE (T)  bne     8024314h                  ;/
080242E0 (T)  ldrh    r0,[r5,2h]                ;\
080242E2 (T)  add     r0,64h                    ;} EnemyYPosition += 100
080242E4 (T)  strh    r0,[r5,2h]                ;/
080242E6 (T)  mov     r0,r5                     ;\
080242E8 (T)  add     r0,21h                    ;} $Enemy21 = 2
080242EA (T)  strb    r3,[r0]                   ;/
080242EC (T)  mov     r1,r5                     ;\
080242EE (T)  add     r1,22h                    ;|
080242F0 (T)  mov     r0,4h                     ;} $Enemy22 = 4
080242F2 (T)  strb    r0,[r1]                   ;/
080242F4 (T)  ldrh    r1,[r5]                   ;\
080242F6 (T)  ldr     r0,=0F3FFh                ;|
080242F8 (T)  and     r0,r1                     ;} EnemyOrientation !|= C00h (shot and flaming)
080242FA (T)  strh    r0,[r5]                   ;/
080242FC (T)  mov     r0,5Ah                    ;\
080242FE (T)  strb    r0,[r2]                   ;} EnemyPose = 5Ah (be born)
08024300 (T)  mov     r0,2Ch                    ;\
08024302 (T)  strh    r0,[r5,6h]                ;} EnemyInvincibilityTimer = 44
08024304 (T)  b       8024318h
08024306      dw      00000h
08024308      dd      0030006BCh,0082E4D4Ch,00000F3FFh

08024314 (T)  mov     r0,8h                     ;\ Else (EnemyPose != 59h):
08024316 (T)  strb    r0,[r2]                   ;} EnemyPose = 8 (standing)

08024318 (T)  mov     r4,r5                     ;\
0802431A (T)  ldr     r0,=8302C44h              ;} EnemyGraphicPointer = 8302C44h
0802431C (T)  str     r0,[r4,18h]               ;/
0802431E (T)  mov     r0,0h                     ;\
08024320 (T)  mov     r8,r0                     ;|
08024322 (T)  mov     r1,r8                     ;} Clear EnemyAnimationCounter
08024324 (T)  strb    r1,[r4,1Ch]               ;/
08024326 (T)  mov     r0,r8                     ;\
08024328 (T)  strh    r0,[r4,16h]               ;} Clear EnemyAnimation
0802432A (T)  bl      802381Ch                  ; Execute subroutine Arachnus_SetHitboxStanding
0802432E (T)  ldrb    r1,[r4,1Eh]               ; r1 parameter = EnemySpritesetSlot
08024330 (T)  ldrb    r2,[r4,1Fh]               ; r2 parameter = EnemySpritesetGFXSlot
08024332 (T)  mov     r7,r4                     ;\
08024334 (T)  add     r7,23h                    ;} r3 parameter = EnemySlot
08024336 (T)  ldrb    r3,[r7]                   ;/
08024338 (T)  ldrh    r0,[r4,2h]                ;\
0802433A (T)  str     r0,[sp]                   ;} sp0 parameter = EnemyYPosition
0802433C (T)  ldrh    r0,[r4,4h]                ;\
0802433E (T)  str     r0,[sp,4h]                ;} sp4 parameter = EnemyXPosition
08024340 (T)  mov     r6,40h                    ;\
08024342 (T)  str     r6,[sp,8h]                ;} sp8 parameter = 40h
08024344 (T)  mov     r0,15h                    ; r0 parameter = 15h (Arachnus' shell)
08024346 (T)  bl      800FAE0h                  ; Execute subroutine Enemy_SpawnNewEnemy
0802434A (T)  lsl     r0,r0,18h                 ;\
0802434C (T)  lsr     r0,r0,18h                 ;|
0802434E (T)  cmp     r0,0FFh                   ;} If returned FFh, clear EnemyOrientation and return
08024350 (T)  beq     802439Eh                  ;/
08024352 (T)  mov     r1,r4                     ;\
08024354 (T)  add     r1,2Fh                    ;} $Enemy2F = returned
08024356 (T)  strb    r0,[r1]                   ;/
08024358 (T)  ldrb    r1,[r4,1Eh]               ;\
0802435A (T)  ldrb    r2,[r4,1Fh]               ;|
0802435C (T)  ldrb    r3,[r7]                   ;|
0802435E (T)  ldrh    r0,[r4,2h]                ;|
08024360 (T)  str     r0,[sp]                   ;} All parameters as above
08024362 (T)  ldrh    r0,[r4,4h]                ;|
08024364 (T)  str     r0,[sp,4h]                ;|
08024366 (T)  str     r6,[sp,8h]                ;/
08024368 (T)  mov     r0,17h                    ; Except r0 parameter = 17h (Arachnus' head)
0802436A (T)  bl      800FAE0h                  ; Execute subroutine Enemy_SpawnNewEnemy
0802436E (T)  lsl     r0,r0,18h                 ;\
08024370 (T)  lsr     r0,r0,18h                 ;|
08024372 (T)  cmp     r0,0FFh                   ;} If returned FFh:
08024374 (T)  bne     8024380h                  ;/
08024376 (T)  mov     r0,r8                     ;\
08024378 (T)  strh    r0,[r4]                   ;} Clear EnemyOrientation
0802437A (T)  b       80243C6h                  ; Return
0802437C      dd      008302C44h

08024380 (T)  ldrb    r1,[r4,1Eh]               ;\
08024382 (T)  ldrb    r2,[r4,1Fh]               ;|
08024384 (T)  ldrb    r3,[r7]                   ;|
08024386 (T)  ldrh    r0,[r4,2h]                ;|
08024388 (T)  str     r0,[sp]                   ;} All parameters as above
0802438A (T)  ldrh    r0,[r4,4h]                ;|
0802438C (T)  str     r0,[sp,4h]                ;|
0802438E (T)  str     r6,[sp,8h]                ;/
08024390 (T)  mov     r0,18h                    ; Except r0 parameter = 18h (Arachnus' front arm)
08024392 (T)  bl      800FAE0h                  ; Execute subroutine Enemy_SpawnNewEnemy
08024396 (T)  lsl     r0,r0,18h                 ;\
08024398 (T)  lsr     r0,r0,18h                 ;|
0802439A (T)  cmp     r0,0FFh                   ;} If returned FFh:
0802439C (T)  bne     80243A4h                  ;/

0802439E (T)  mov     r1,r8                     ;\
080243A0 (T)  strh    r1,[r4]                   ;} Clear EnemyOrientation
080243A2 (T)  b       80243C6h                  ; Return

080243A4 (T)  ldrb    r1,[r5,1Eh]               ;\
080243A6 (T)  ldrb    r2,[r5,1Fh]               ;|
080243A8 (T)  ldrb    r3,[r7]                   ;|
080243AA (T)  ldrh    r0,[r5,2h]                ;|
080243AC (T)  str     r0,[sp]                   ;} All parameters as above
080243AE (T)  ldrh    r0,[r5,4h]                ;|
080243B0 (T)  str     r0,[sp,4h]                ;|
080243B2 (T)  str     r6,[sp,8h]                ;/
080243B4 (T)  mov     r0,19h                    ; Except r0 parameter = 19h (Arachnus' bottom centre)
080243B6 (T)  bl      800FAE0h                  ; Execute subroutine Enemy_SpawnNewEnemy
080243BA (T)  lsl     r0,r0,18h                 ;\
080243BC (T)  lsr     r0,r0,18h                 ;|
080243BE (T)  cmp     r0,0FFh                   ;} If returned FFh:
080243C0 (T)  bne     80243C6h                  ;/
080243C2 (T)  mov     r0,r8                     ;\
080243C4 (T)  strh    r0,[r5]                   ;} Clear EnemyOrientation

080243C6 (T)  add     sp,0Ch
080243C8 (T)  pop     r3
080243CA (T)  mov     r8,r3
080243CC (T)  pop     r4-r7
080243CE (T)  pop     r0
080243D0 (T)  bx      r0