📄 5.asm
字号:
stack segment stack 'stack'
dw 32 dup(?)
stack ends
data segment
InPut db 255,0,255 dup(?)
PLUS db 255 dup(?)
MINUS db 255 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 Input
mov ah,10
int 21H
mov bx,offset Input + 2
mov cl,Input[1]
mov ch,0
mov SI,0 ;+
mov DI,0 ;-
;dl for Plus,dh for Minus
mov dx,0
AGAIN:
mov al,[bx]
CMP al,'-'
JNZ ZHENG
FU:
mov al,[bx]
CMP cx,0
JZ MYEND
DEC cx
mov Minus[DI],al
INC DI
INC bx
CMP byte ptr [bx],','
JNZ FU
Dec cx
mov byte ptr Minus[DI],','
INC DI
INC bx
JMP AGAIN
ZHENG:
mov al,[bx]
CMP cx,0
JZ MYEND
DEC cx
mov Plus[SI],al
INC SI
INC bx
CMP byte ptr [bx],','
JNZ ZHENG
Dec cx
mov byte ptr Plus[SI],','
INC SI
INC bx
JMP AGAIN
MYEND:
; DEC SI
DEC DI
mov Plus[SI],'$'
mov Minus[DI],'$'
mov dl,00AH
mov ah,2
int 21H
mov dx,offset Plus
mov ah,9
int 21H
mov dl,00AH
mov ah,2
int 21H
mov dx,offset Minus
mov ah,9
int 21H
ret
begin endp
code ends
end begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -