; dhae_marker32.asm - FASM binding of the Dhaedalida RabbitStart/RabbitEnd
; virtualization markers for 32-bit x86 (PE32). The x64 binding is the sibling
; dhae_marker.asm (format MS64 COFF).
;
; A separate file rather than an IFDEF arm because `format MS COFF` must be the
; very first directive in the source - before any conditional could be evaluated
; from it - so one file genuinely cannot carry both output formats.
;
; 32-bit x86 has no 64-bit immediate, so the magic cannot be hidden inside a
; `mov reg, imm64` the way the x64 binding does. It is emitted as inline DATA
; and jumped over:
;
;     EB 08                       jmp short $+10   -> the ret below
;     01 54 76 DE C0 E5 1A D1     DHAE_SIG_RABBITSTART, little-endian
;     C3                          ret              <- the jump target
;
; The 8 magic bytes therefore sit at offset +2, exactly where the x64 binding
; puts them, well inside the scanner's 16-byte window. The db values MUST equal
; DHAE_SIG_RABBITSTART / DHAE_SIG_RABBITEND in sdk/dhae_marker_sig.h.
;
; The leading underscore is not decoration for its own sake: i386 COFF decorates
; a __cdecl symbol that way, so `_RabbitStart` is the name an MSVC-x86 C caller
; emits. A bare ret is correct because the markers take no arguments - there is
; nothing for a callee-cleanup convention to pop.
;
; Build:
;     fasm dhae_marker32.asm dhae_marker32.obj
; then link dhae_marker32.obj into your PE32 program and declare in C:
;     void RabbitStart(void); void RabbitEnd(void);
; (or just #include "dhae_sdk.h").
;
; For a pure-FASM PE32 of your own, drop the two labels into your `.text` and
; `public` them there instead of assembling this as a separate object.

format MS COFF

section '.text' code readable executable

public _RabbitStart
public _RabbitEnd
public _BearStart
public _BearEnd

align 16
_RabbitStart:
    db 0EBh, 008h                                       ; jmp short $+10
    db 001h, 054h, 076h, 0DEh, 0C0h, 0E5h, 01Ah, 0D1h   ; DHAE_SIG_RABBITSTART
    db 0C3h                                             ; ret

align 16
_RabbitEnd:
    db 0EBh, 008h                                       ; jmp short $+10
    db 002h, 054h, 076h, 0DEh, 0C0h, 0E5h, 01Ah, 0D1h   ; DHAE_SIG_RABBITEND
    db 0C3h                                             ; ret

align 16
_BearStart:
    db 0EBh, 008h                                       ; jmp short $+10
    db 005h, 054h, 076h, 0DEh, 0C0h, 0E5h, 01Ah, 0D1h   ; DHAE_SIG_BEARSTART
    db 0C3h                                             ; ret

align 16
_BearEnd:
    db 0EBh, 008h                                       ; jmp short $+10
    db 006h, 054h, 076h, 0DEh, 0C0h, 0E5h, 01Ah, 0D1h   ; DHAE_SIG_BEAREND
    db 0C3h                                             ; ret
