This is the code for the damage creation. The value of $8356,x (damage) is in X at the beginning:

Code: Select all

```
.C:a2ae 8A TXA ; X => A
.C:a2af 48 PHA
.C:a2b0 A2 05 LDX #$05 ; 05 => X
.C:a2b2 4A LSR A ; move A bitwise right
.C:a2b3 CA DEX ; X = X -1
.C:a2b4 D0 FC BNE $A2B2
.C:a2b6 85 48 STA $48 ; A => $48
.C:a2b8 68 PLA
.C:a2b9 29 1F AND #$1F ; 1F AND A
.C:a2bb 85 49 STA $49 ; A => $49
.C:a2bd A9 00 LDA #$00 ; 00 => A
.C:a2bf 85 45 STA $45 ; A => $45
.C:a2c1 85 46 STA $46 ; A => $46
.C:a2c3 A0 4F LDY #$4F ; 4F => Y
.C:a2c5 B1 9B LDA ($9B),Y ; ($9B),Y => A
.C:a2c7 18 CLC
.C:a2c8 65 AA ADC $AA ; add $AA to A
.C:a2ca 85 3B STA $3B ; A => $3B
.C:a2cc A4 49 LDY $49 ; $49 => Y
.C:a2ce 20 90 08 JSR $0890 ; jsr => $0890
.C:a2d1 A6 48 LDX $48 ; $48 => X
.C:a2d3 A5 5B LDA $5B ; $5B => A
.C:a2d5 3D 32 AB AND $AB32,X ; $AB32,X AND A
.C:a2d8 18 CLC
.C:a2d9 69 01 ADC #$01 ; add 01 to A
.C:a2db 65 45 ADC $45 ; add $45 to A
.C:a2dd 90 02 BCC $A2E1
.C:a2df E6 46 INC $46 ; $46 = $46 +1
.C:a2e1 85 45 STA $45 ; A => $45
.C:a2e3 88 DEY ; Y = Y -1
.C:a2e4 10 E8 BPL $A2CE
.C:a2e6 A5 45 LDA $45 ; $45 => A
.C:a2e8 18 CLC
.C:a2e9 69 00 ADC #$00 ; add 00 to A
.C:a2eb 90 02 BCC $A2EF
.C:a2ed E6 46 INC $46 ; $46 = $46 +1
.C:a2ef 18 CLC
.C:a2f0 65 41 ADC $41 ; add $41 to A
.C:a2f2 85 45 STA $45 ; A => $45
.C:a2f4 A5 46 LDA $46 ; $46 => A
.C:a2f6 69 00 ADC #$00 ; add 00 to A
.C:a2f8 85 46 STA $46 ; A => $46
.C:a2fa A6 DC LDX $DC ; $DC => X
.C:a2fc BD 87 02 LDA $0287,X ; $0287,X => A
.C:a2ff 18 CLC
.C:a300 65 45 ADC $45 ; add $45 to A
.C:a302 85 45 STA $45 ; A => $45
.C:a304 A5 46 LDA $46 ; $46 => A
.C:a306 69 00 ADC #$00 ; add 00 to A
.C:a308 85 46 STA $46 ; A => $46
.C:a30a BD 8E 02 LDA $028E,X ; $028E,X => A
.C:a30d F0 19 BEQ $A328
.C:a30f A8 TAY ; A => Y
.C:a310 20 90 08 JSR $0890 ; jsr => $0890
.C:a313 A5 5A LDA $5A ; $5A => A
.C:a315 29 07 AND #$07 ; 07 AND A
.C:a317 18 CLC
.C:a318 69 01 ADC #$01 ; add 01 to A
.C:a31a 18 CLC
.C:a31b 65 45 ADC $45 ; add $45 to A
.C:a31d 85 45 STA $45 ; A => $45
.C:a31f A5 46 LDA $46 ; $46 => A
.C:a321 69 00 ADC #$00 ; add 00 to A
.C:a323 85 46 STA $46 ; A => $46
.C:a325 88 DEY ; Y = Y -1
.C:a326 D0 E8 BNE $A310
.C:a328 A5 45 LDA $45 ; $45 => A
.C:a32a 38 SEC
.C:a32b E5 DF SBC $DF ; substract $DF from A
.C:a32d 85 45 STA $45 ; A => $45
.C:a32f B0 0E BCS $A33F
.C:a331 A5 46 LDA $46 ; $46 => A
.C:a333 E9 00 SBC #$00 ; substract 00 from A
.C:a335 85 46 STA $46 ; A => $46
.C:a337 B0 06 BCS $A33F
.C:a339 A9 00 LDA #$00 ; 00 => A
.C:a33b 85 45 STA $45 ; A => $45
.C:a33d 85 46 STA $46 ; A => $46
.C:a33f C6 3B DEC $3B ; $3B = $3B -1
.C:a341 30 03 BMI $A346
.C:a343 4C CC A2 JMP $A2CC ; jump => $A2CC
```

$3B is # of attacks

rest should be clear