기금넷 공식사이트 - 경제 뉴스 - 고득점을 얻으려면 두 개의 어셈블리 언어 프로그램이 하나로 병합되고, 하나는 다른 하나의 서브루틴입니다.

고득점을 얻으려면 두 개의 어셈블리 언어 프로그램이 하나로 병합되고, 하나는 다른 하나의 서브루틴입니다.

; 시도해 보세요:

cs: code, ds: data 가정

데이터 세그먼트

msg1 db 'Before sort:$'

crlf db 0dh, 0ah, '$'

msg2 db '정렬 후: $'

----------- ----------

BUFSIZE DB 50; 최대 50자까지 입력할 수 있습니다.

ACTLEN DB ? ;The actual number of characters typed.

CHARS DB 50 DUP(20H) ;The actual characters typed are stored from this point on.

data ends

;-- ----------

코드 세그먼트

시작:

mov ax , 데이터

mov ds, ax

mov dx, 오프셋 msg1

mov ah, 9

int 21h

MOV DX, OFFSET BUFSIZE; Enter the starting offset address of the buffer to send DX

MOV AH, 0AH

INT 21H; Enter a string and send 이를 버퍼에 보냅니다.

p>

/p>

MOV BX, DX는 문자열의 첫 번째 주소를 BX로 보냅니다.

ADD BX, CX get; 문자열의 마지막 주소.

MOV BYTE PTR [BX] , '$' ; 문자열 끝에 $ 삽입

문자열 표시 기능.

; 입력된 문자열을 표시합니다.

ok:

mov dx, offset crlf

mov ah, 9

int 21h

mov dx, 오프셋 msg2

mov ah, 9

int 21h

--- -------

MOV CX, 15

mov si, 오프셋 문자

s :

푸시 cx

mov di, si

inc di

s1 :

mov al, [시]

cmp al, [di]

jb jx

xchg al, [di]

mov [si], al

jx:

inc di

루프 s1

inc si

pop cx

루프 s

;------------

mov 바이트 ptr [si 1], 24h

mov dx, 오프셋 문자

mov ah, 9

int 21h

mov ah, 4ch

int 21h

코드 끝

끝 시작