MOV CX,N ; 字节数
CALL LOAD ; 从 "input1.dat"中读取数据
; **** BEGIN ****
LEA SI,SOURCE
LEA DI,RESULT
CLD
L0: LODSB
CMP AL,0
JE QUIT
CMP AL,ESC_CODE
je expand
;J__ EXPAND
stosb
;___________________
JMP L0
EXPAND: lodsb
;___________________ ; 解压
XOR CX, CX
mov cl, al
lodsb
rep stosb
;___________________
;___________________
;___________________
;___________________
JMP L0
QUIT:
STOSB ; STORE THE ’00H’
; **** END ****
LEA DX,RESULT ; 结果数据区首址
LEA SI,NAME1 ; 结果文件名起始地址
MOV CX,N ; 字节数
CALL SAVE ; 保存结果到"output1.dat"文件中
RET
START ENDP
CODE ENDS
END START
input1.dat 内容如下:
41 1B 03 42 65 1B 19 42 43 1B 03 44 45 1B 23 48
49 4A 4C 1B 0C 47 1B 0E 4D 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
output1.dat 内容应当如下:
41 42 42 42 65 42 42 42 42 42 42 42 42 42 42 42
42 42 42 42 42 42 42 42 42 42 42 42 42 42 43 44
44 44 45 48 48 48 48 48 48 48 48 48 48 48 48 48
48 48 48 48 48 48 48 48 48 48 48 48 48 48 48 48
48 48 48 48 48 48 49 4A 4C 47 47 47 47 47 47 47
47 47 47 47 47 4D 4D 4D 4D 4D 4D 4D 4D 4D 4D 4D
4D 4D 4D 00