Translate ShroudedInMistText, OneHitKOEffect_: battle move effects

SM83→x86 notes:
- HL→ESI, DE→EDI, A→AL, B→BH used in OneHitKOEffect_
- H flag not involved (mist), computed (one_hit_ko)
- Used explicit byte directives for text_far and text_end
- Translated exactly matching 8-bit operations

Co-Authored-By: Gemini <noreply@google.com>
This commit is contained in:
Happyarch
2026-06-22 22:05:54 -04:00
parent 852b829885
commit b511bd1d09
3 changed files with 46 additions and 23 deletions

View File

@@ -1850,3 +1850,27 @@ If you need to exclude RGBASM-conditional content, add a filter to the generator
- **Notes:** Translated text_far and text_end macros into byte directives.
---
## ShroudedInMistText
- **Source:** `engine/battle/move_effects/mist.asm:ShroudedInMistText`
- **Translated:** `dos_port/src/engine/battle/move_effects/mist.asm`
- **Date:** 2026-06-23
- **H-flag:** not involved
- **Bug tags:** none
- **Registers:** none
- **Notes:** explicit byte directives for text_far and text_end
---
## OneHitKOEffect_
- **Source:** `engine/battle/move_effects/one_hit_ko.asm:OneHitKOEffect_`
- **Translated:** `dos_port/src/engine/battle/move_effects/one_hit_ko.asm`
- **Date:** 2026-06-23
- **H-flag:** computed
- **Bug tags:** none
- **Registers:** HL->ESI, DE->EDI, A->AL, B->BH
- **Notes:** Translated exactly matching 8-bit operations.
---

View File

@@ -30,7 +30,6 @@ MistEffect_:
jmp PrintButItFailedText_
ShroudedInMistText:
db 0x0A ; TX_PAUSE
db 0x17 ; TX_FAR
dd _ShroudedInMistText
db 0x50 ; TX_END
db 0x17 ; text_far
dd _ShroudedInMistText
db 0x50 ; text_end

View File

@@ -14,39 +14,39 @@ global OneHitKOEffect_
OneHitKOEffect_:
mov esi, wDamage
xor al, al
mov [ebp + esi], al
mov byte [ebp + esi], al
inc esi
mov [ebp + esi], al
mov byte [ebp + esi], al
dec al
mov [ebp + wCriticalHitOrOHKO], al
mov byte [ebp + wCriticalHitOrOHKO], al
mov esi, wBattleMonSpeed + 1
mov edi, wEnemyMonSpeed + 1
mov al, [ebp + hWhoseTurn]
and al, al
mov al, byte [ebp + hWhoseTurn]
test al, al
jz .compareSpeed
mov esi, wEnemyMonSpeed + 1
mov edi, wBattleMonSpeed + 1
.compareSpeed:
mov al, [ebp + edi]
mov al, byte [ebp + edi]
dec edi
mov bl, al
mov al, [ebp + esi]
mov bh, al
mov al, byte [ebp + esi]
dec esi
sub al, bl
mov al, [ebp + edi]
mov bl, al
mov al, [ebp + esi]
sbb al, bl
sub al, bh
mov al, byte [ebp + edi]
mov bh, al
mov al, byte [ebp + esi]
sbb al, bh
jc .userIsSlower
mov esi, wDamage
mov al, 0xff
mov [ebp + esi], al
mov byte [ebp + esi], al
inc esi
mov [ebp + esi], al
mov al, 0x2
mov [ebp + wCriticalHitOrOHKO], al
mov byte [ebp + esi], al
mov al, 0x02
mov byte [ebp + wCriticalHitOrOHKO], al
ret
.userIsSlower:
mov al, 0x1
mov [ebp + wMoveMissed], al
mov al, 0x01
mov byte [ebp + wMoveMissed], al
ret