۱۶-فروردین-۱۳۹۱, ۰۵:۲۱:۲۷
پیدا کردن بزرگ ترین عدد یک رقمی
کد:
DSEG SEGMENT 'DATA'
; add your data here!
CCCP LABEL BYTE
MAX DB 20
LEN DB ?
BUFFER DB 20 DUP('$'),'$'
KGB DB 'ENTER NUMBER:','$'
PPP DB 'MAX:=','$'
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 AH,09H
MOV DX,OFFSET KGB
INT 21H
MOV AH,0AH
LEA DX,CCCP
INT 21H
MOV CL,LEN
MOV CH,0
MOV SI,0
;MOV AL,BUFFER[SI]
K:
MOV BL,BUFFER[SI]
L:
INC SI
CMP BL,BUFFER[SI]
JL K
LOOP L
MOV AH,02H
MOV DL,0AH
INT 21H
MOV AH,02H
MOV DL,0DH
INT 21H
MOV AH,09H
LEA DX,PPP
INT 21H
MOV AH,02H
MOV DL,BL
INT 21H
MOV AX, 4C00h ; exit to operating system.
INT 21h
START ENDP
CSEG ENDS
END START ; set entry point.