Assembler|corewars8086 Engine!

Discussion in 'Programmer's Corner' started by dimah4x, Jan 9, 2014.

  1. dimah4x

    Thread Starter New Member

    Jan 9, 2014
    9
    0
    i need some help with an assembler code that runs in the corewars8086 engine
    so basically there are 2 interrupts that can be used once per round so i wanted to know if i can use someone can help me build a code that does the same thing as the interrupt so i can use it more then once
    by the way its ASM8086

    so these are interrupts 0x86 and 0x87 (hexadecimal)
    0x86 takes 256 bits from the di to the es and puts inside them illegal values like 0cccch
    normaly to use the interrupt the code will go like this :

    Code ( (Unknown Language)):
    1.  
    2. push cs
    3. pop es                     ; set es as the code segment (main memory map)
    4.  
    5.  
    6. xor di,di                       ; di is our offset, xoring it with himself
    7.                                   ; will set him to zero
    8.  
    9.  
    10. mov ax, 0cccch              ; set invalid opcodes in ax.
    11.  
    12.  
    13. mov dx, ax                     ; ... and copy it to dx
    14.  
    15. int 86h                          ; execute interrupt 0x86.
    16.  
    the sorted writing in the memory is AL then AH then DL then DH

    about 0x87 it searches for a combination of 4 bytes (for example 01234h) on a 64kb segment
    and replaces the value of them with an illegal value like 0cch or with a jump commands (jmp)

    for example to run the 0x87:

    Code ( (Unknown Language)):
    1.  
    2. push cs
    3.  
    4.  
    5. pop es                 ; set es as the code segment(main memory map)
    6.  
    7. xor di,di                        ; di is our offset, xoring it with himself
    8.                                   ; will set him to zero
    9. mov ax, 04187h             ; ax:dx is the byte string to find.
    10.  
    11. mov dx, 08820h
    12.  
    13. mov cx, 0cccch             ; cx:bx is the byte string to replace with.
    14.  
    15. mov bx,cx
    16.  
    17. int 87h                         ; execute interrupt 0x87.
    18.  
    if any one could help me i would be glad since i really need this
    thanks in advance! :)
     
Loading...