FSM – על זומבים ומפלצות ספגטי מעופפות

עמוד

ברוכים הבאים לאתר תחרויות קודגורו! פורומים אקסטרים FSM – על זומבים ומפלצות ספגטי מעופפות

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

    החלק הזה מאוד מבלבל, תוכל להסביר מה הוא עושה?

    lea di,[si+@end-@loop-0c00h+4h]

    lea sp,[si-800h+4h]

    mov si,0a5f3h ; 0a5f3h = opcode of rep movsw

    push sp ; protection from int 87h

    push si

    push sp

    pop sp

    mov bx,-0c00h

    mov dx,-800h+2h

    mov bp,-400h+4h

    mov ax,0815eh ; ax is a clock

    mov si,4h

    mov cx,200h-2h

    #77991
    FSM
    משתתף

    This is the initialization part. After this part the survivor will jump to the main loop, which is pointed by sp.

    The main loop contains of 2 bytes: F3 A5
    which is:

    rep
    movsw

    At the end of this code the values of the registers are:
    sp – pointer to the loop
    di – the destination of the "movsw", which is a bit more than (sp – 400h)
    si – the source of the "movsw", which is in the beginning of the survivor's private memory
    cx – the length of the loop: 1feh iterations

    During the loop, the code from @loop…@end is copied upon the running code, and will run right when the loop ends.
    In that code, the survivor changes location, and therefore changes the registers: sp, di, si, cx. The offsets of these registers are saved in dx, bx, bp respectively.

    The last register is ax, which holds a clock. When the countdown gets to zero, the slaves are being slaughtered.

    I hope it was helpfull.

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