串操作程序设计 HLJU
计算 (X (Y*Z-100))/W 其中:X, Y, Z, 均为十六位有符号数,其存储形式如下, X DW -13 Y DW 30 Z DW 24 W DW 50
代码语言:javascript复制DATAS SEGMENT
STRBUF DB 10 DUP(?)
DATAS ENDS
STACKS SEGMENT
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
MOV CX,10
MOV DI,0
REST: MOV AH,01H
INT 21H
MOV STRBUF[DI],AL
INC DI
LOOP REST
MOV CX,10
MOV AL,'&'
MOV DI,0
CONT: CMP AL,STRBUF[DI]
JNZ NEXT
MOV STRBUF[DI],' '
MOV DH,0
mov ax,DI
mov dh,ax
ADD DH,49
NEXT: INC DI
LOOP CONT
MOV CX,10
MOV DI,0
AGAIN:MOV DL,STRBUF[DI]
MOV AH,02H
INT 21H
INC DI
LOOP AGAIN
MOV AH,02H
MOV DL,DH
INT 21H
MOV AH,4CH
INT 21H
CODES ENDS
END START