8.asm
来自「华工电信系汇编习题的编程实现」· 汇编 代码 · 共 63 行
ASM
63 行
stack segment stack 'stack'
dw 32 dup(?)
stack ends
data segment
DecIn db 11,0,11 dup (?)
data ends
code segment
begin proc far
assume ss:stack,cs:code,ds:data
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov dx,offset DecIn
mov ah,10
int 21H
mov dl,00AH
mov ah,2
int 21H
mov cl,DecIn[1]
mov ch,0
Dec cx
mov SI,offset DecIn + 2
mov ax,0
OUTSIDE:
mov bx,cx
mov DI,SI
INSIDE:
mov al,[SI]
INC SI
CMP al,[SI]
JNS NEXT
XCHG al,[SI]
XCHG al,[SI-1]
NEXT:
Dec bx
CMP bx,0
JNZ INSIDE
mov SI,DI
LOOP OUTSIDE
mov bl,DecIn[1]
add bl,offset DecIn
add bl,2
mov bh,0
mov byte ptr [bx],'$'
mov dx,offset DecIn + 2
mov ah,9
int 21H
ret
begin endp
code ends
end begin
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?