۱۶-فروردین-۱۳۹۱, ۰۵:۲۷:۴۸
کد:
DSEG SEGMENT 'DATA'
X DB 'A','B','C','D','E','F','G','H','I','J'
; add your data here!
DSEG ENDS
SSEG SEGMENT STACK 'STACK'
db 256 DUP(0)
SSEG ENDS
CSEG SEGMENT 'CODE'
START PROC FAR
; set segment registers:
MOV AX, DSEG
MOV DS, AX
MOV ES, AX
; add your code here
MOV SI,0
MOV DI,9
MOV CX,5
L:
MOV BL,X[DI]
MOV AL,X[SI]
MOV X[DI],AL
MOV X[SI],BL
INC SI
DEC DI
LOOP L
MOV AX, 4C00h ; exit to operating system.
INT 21h
START ENDP
CSEG ENDS
END START ; set entry point.
جا به جا کردن محتوای دو آرایه با یک دیگر.
کد:
DSEG SEGMENT 'DATA'
; add your data here!
KGB DB 'A','B','C','D','E'
ZED DB 'F','G','H','I','J'
DSEG ENDS
SSEG SEGMENT STACK 'STACK'
db 256 DUP(0)
SSEG ENDS
CSEG SEGMENT 'CODE'
START PROC FAR
; set segment registers:
MOV AX, DSEG
MOV DS, AX
MOV ES, AX
; add your code here
MOV SI,0
MOV cx,5
L:
MOV AL,KGB[Si]
MOV bl,ZED[SI]
MOV ZED[Si],al
mov KGB[si],bl
inc SI
LOOP L
MOV AX, 4C00h ; exit to operating system.
INT 21h
START ENDP
CSEG ENDS
END START ; set entry point.