http://ahitech.livejournal.com/ ([identity profile] ahitech.livejournal.com) wrote in [personal profile] hitech 2013-09-27 05:01 pm (UTC)

Копия нужна всегда, ибо всегда возвращается.

section .text
global _start
_start:

; ++a
mov ax, a
inc ax
mov a, ax

; b++
mov ax, b
mov bx, ax
inc bx
mov b, bx
; По конвенции, возвращаемое значение всегда в регистре ax

mov ax, 4C00h ; Выход
int 21h

section .data
a dw 1
b dw 1

Налицо одна лишняя инструкция. И то я использую mov bx, ax вместо mov bx, b, как можно было бы сделать, и чьё быстродействие примерно в 300 раз хуже.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting