007Ninja

עמוד
מוצגות 2 תגובות – 1 עד 2 (מתוך 2 סה״כ)
  • מאת
    תגובות
  • #76957
    Spiritus
    משתתף

    Our survivor code:(compiles with nasm)

    ;007Ninja1

    %define jumpOff 0x800

    @code:

    mov [si], word 0x1000
    mov cx, cs
    mov es, cx
    mov bl, 0xEA
    mov ch, 00
    mov [si], ax
    and ax, 0x0FFF
    mov bh, al
    mov cl, ah
    add cl, 0xE0 ;to get proper address in seg 200
    mov ax, 0xFEEB
    int 0x87

    call @here
    @here:

    pop ax
    mov dx, ss
    mov es, dx
    mov si, ax
    add si, @Shurikan-@here
    mov cx, (@end-@Shurikan+1)/2
    rep movsw

    mov ds, dx

    mov dx, cs
    mov ss, dx

    sub ax, 0x1700+@here-@code
    and al, 0x7
    sub al, 0x8
    mov dl, al
    mov bh, ah ;store ah
    mul dh ;multiplies al by ch(=0x10 from line 29(mov cx, cs=0x1000))
    mov dh, 0x0F ;we want ch to be 0x0F, which is 0x10-1
    mov ah, bh ;restore ah
    mov sp, ax
    mov al, 0xA3 ;movsw – 2
    xor bh, bh ;bl is 0xEA, from line 10
    mov [bx], ax
    mov [bx+2], dx
    mov di, ax
    sub sp, 0x100-0xA3-jumpOff ;movsw – 2

    mov es, dx

    xor si, si

    mov ax, 0xCCCC
    mov dx, ax

    sub di, 0x200
    int 0x86
    int 0x86

    mov ax, 0x1FFF ;call far [bx]
    stosw
    dec di

    mov bp, jumpOff
    call far [bx]

    @Shurikan:
    movsw
    movsw
    mov cl, (@ShuEnd-@ShuMid)/2
    rep movsw
    @ShuMid:
    sub [bx], bp
    mov di, [bx]
    movsw
    dec di
    xor si, si
    call far [bx]
    @ShuEnd:
    call far [bx]
    @end:

    ;007Ninja2

    %define opNum (jumpOff/4+shu1Num-shu2Num)/2
    %define shu1Num 15
    %define shu2Num 25
    %define jumpOff 0x800
    %define shootOff0 0x27D0
    %define startOff0 ((opNum*(shootOff0-0x4)) % 0x10000)
    %define shootOffd 0x160
    %define startOffd (opNum*shootOffd)

    @code:
    mov es, [si]
    mov ax, 0xCC3D
    mov dx, 0x75CC
    mov bx, 0xFEEB
    int 0x87

    xchg ax, [si]
    mov bx, ax
    and bx, 0x0FFF
    call @here

    @zombStart:
    mov si, word 0x0000
    @putSI:
    mov ax, word jumpOff+0x800
    @putAX:
    mov cl, 18
    @a:
    loop @a
    jmp @start

    @here:
    pop si
    mov [bx], byte 0xEA ;jmp far …
    mov [bx+1], si
    mov [bx+3], word 0x1000
    add [si+(@putSI-@zombStart)-2], si
    add [si+(@putAX-@zombStart)-2], ax
    mov [bx+1], word 0xCCCC
    @start:
    mov dx, ss
    mov es, dx
    add si, @Shurikan-@zombStart
    xor di, di
    mov cx, (@end-@Shurikan+1)/2
    rep movsw

    mov ds, dx

    mov cx, cs
    mov ss, cx

    sub ax, 0x500
    and al, 7
    sub al, 8
    mov ch, 0x0F
    mov cl, al
    shl al, 1
    shl al, 1
    shl al, 1
    shl al, 1
    mov sp, ax
    mov al, 0xA5-(@end-@ShuEnd) ;movsw
    mov bx, 0x100
    mov [bx], ax
    mov [bx+2], cx
    mov di, ax
    sub sp, 0x100-0xA5+startOff0 ;movsw

    mov es, cx

    xor si, si

    mov ax, 0xCCCC
    mov dx, ax

    int 0x86
    int 0x86
    sub di, 0x200

    mov ax, 0xD401 ;add sp, dx
    stosw
    mov ax, 0x1FFF ;call far [bx]
    stosw
    sub di, byte 3

    mov ax, startOff0+jumpOff-0x4
    mov dx, shootOff0

    mov bp, jumpOff

    xor cx, cx

    call far [bx]

    @Shurikan:
    movsw
    movsw
    mov cl, (@ShuEnd-@ShuMid)/2
    rep movsw
    @ShuMid:
    sub [bx], bp
    add ax, startOffd
    sub sp, ax
    add dx, shootOffd
    mov di, [bx]
    movsw
    movsw
    sub di, byte 3
    xor si, si
    call far [bx]
    @ShuEnd: ;this – ShuMid must be even
    add sp, dx
    call far [bx]
    @end:

    We expect others to send their codes as well^^

    #78376
    Spiritus
    משתתף

    Sorry, wrong version^^

    ;007Ninja1

    %define jumpOff 0x800

    @code:

    mov [si], word 0x1000
    mov cx, cs
    mov es, cx
    mov bl, 0xEA
    mov ch, 00
    mov [si], ax
    and ax, 0x0FFF
    mov bh, al
    mov cl, ah
    add cl, 0xE0 ;to get proper address in seg 200
    mov ax, 0xFEEB
    int 0x87

    call @here
    @here:

    pop ax
    mov dx, ss
    mov es, dx
    mov si, ax
    add si, @Shurikan-@here
    mov cx, (@end-@Shurikan+1)/2
    rep movsw

    mov ds, dx

    mov cx, cs
    mov ss, cx

    sub ax, 0x1700+@here-@code
    and al, 0x7     
    sub al, 0x8
    mov ch, 0x0F
    mov cl, al
    shl al, 1
    shl al, 1
    shl al, 1
    shl al, 1
    mov sp, ax
    mov al, 0xA3 ;movsw – 2
    mov bx, 0x100
    mov [bx], ax
    mov [bx+2], cx
    mov di, ax
    sub sp, 0x100-0xA3 ;movsw – 2

    mov es, cx

    xor si, si

    mov ax, 0xCCCC
    mov dx, 0xCCCC
    std
    int 0x86
    int 0x86
    cld
    add di, 0x200

    mov ax, 0x1FFF ;call far [bx]
    stosw
    dec di

    mov bp, jumpOff
    add sp, bp
    xor cx, cx
    call far [bx]

    @Shurikan:
    movsw
    movsw
    mov cl, (@ShuEnd-@ShuMid)/2
    rep movsw
    @ShuMid:
    sub [bx], bp
    mov di, [bx]
    movsw
    dec di
    xor si, si
    call far [bx]
    @ShuEnd:
    call far [bx]
    @end:

    ;007Ninja2

    %define opNum (jumpOff/4+shu1Num-shu2Num)/2
    %define shu1Num 15
    %define shu2Num 25
    %define jumpOff 0x800
    %define shootOff0 0x27D0
    %define startOff0 ((opNum*(shootOff0-0x4)) % 0x10000)
    %define shootOffd 0x160
    %define startOffd (opNum*shootOffd)

    @code:
    mov es, [si]
    mov ax, 0xCC3D
    mov dx, 0x75CC
    mov bx, 0xFEEB
    int 0x87

    xchg ax, [si]
    mov bx, ax
    and bx, 0x0FFF
    call @here

    @zombStart:
    mov si, word 0x0000
    @putSI:
    mov ax, word jumpOff+0x800
    @putAX:
    mov cx, 17
    @a:
    loop @a
    jmp @start

    @here:
    pop si
    mov [bx], byte 0xEA ;jmp far …
    mov [bx+1], si
    mov [bx+3], word 0x1000
    add [si+(@putSI-@zombStart)-2], si
    add [si+(@putAX-@zombStart)-2], ax
    mov [bx+1], word 0xCCCC
    @start:
    mov dx, ss
    mov es, dx
    add si, @Shurikan-@zombStart
    xor di, di
    mov cx, (@end-@Shurikan+1)/2
    rep movsw

    mov ds, dx

    mov cx, cs
    mov ss, cx

    sub ax, 0x500
    and al, 7
    sub al, 8
    mov ch, 0x0F
    mov cl, al
    shl al, 1
    shl al, 1
    shl al, 1
    shl al, 1
    mov sp, ax
    mov al, 0xA5-(@end-@ShuEnd) ;movsw
    mov bx, 0x100
    mov [bx], ax
    mov [bx+2], cx
    mov di, ax
    sub sp, 0x100-0xA5+startOff0 ;movsw

    mov es, cx

    xor si, si

    mov ax, 0xCCCC
    mov dx, 0xCCCC
    int 0x86
    int 0x86
    sub di, 0x200

    mov ax, 0xD401 ;add sp, dx
    stosw
    mov ax, 0x1FFF ;call far [bx]
    stosw
    sub di, byte 3

    mov ax, startOff0+jumpOff-0x4
    mov dx, shootOff0

    mov bp, jumpOff

    xor cx, cx

    call far [bx]

    @Shurikan:
    movsw
    movsw
    mov cl, (@ShuEnd-@ShuMid)/2
    rep movsw
    @ShuMid:
    sub [bx], bp
    add ax, startOffd
    sub sp, ax
    add dx, shootOffd
    mov di, [bx]
    movsw
    movsw
    sub di, byte 3
    xor si, si
    call far [bx]
    @ShuEnd: ;this – ShuMid must be even
    add sp, dx
    call far [bx]
    @end:

מוצגות 2 תגובות – 1 עד 2 (מתוך 2 סה״כ)
  • יש להתחבר למערכת על מנת להגיב.