Skip to content

Instantly share code, notes, and snippets.

@majioa
Created January 23, 2013 12:07
Show Gist options
  • Save majioa/4604881 to your computer and use it in GitHub Desktop.
Save majioa/4604881 to your computer and use it in GitHub Desktop.
The code adds a comment into old DOS created zip-archive.
ASSUME CS:CGR,DS:CGR
CGR GROUP COD,DAT
COD SEGMENT BYTE
ORG 100H
ZIPCOMM proc
LEA SI,C_
CALL WW
MOV SI,80H
MOV AH,'/'
CALL READ_FILE_STRING
JC RFSE
LODSB
CMP CX,2
JNE FQE
PUSH SI
XCHG SI,DX
MOV AX,3D01H
INT 21H
JC FE
MOV BX,AX
MOV AX,4202H
XOR CX,CX
DEC CX
MOV DX,CX
DEC DX
INT 21H
JC FE
POP SI
PUSH BX
CALL NEXT_FILE
LEA DX,BUF_
PUSH DX;?
XOR AX,AX
DEC AX
CALL LOAD_FILE
JC FE
MOV DS:[LEN_COMM_],CX
POP DX;?
POP BX
ADD CX,2
SUB DX,2
CALL WRITE_FILE
JC FE
MOV AH,3EH
INT 21H
JC FE
LEA SI,OK
E1:
CALL WW
E:
MOV AX,4C00H
INT 21H
RFSE:
LEA SI,H
JMP SHORT E1
FQE:
CMP CX,2
JB FQE1
LEA SI,FQEMAX
JMP SHORT E1
FQE1:
LEA SI,FQEMIN
CALL WW
LEA SI,H
JMP SHORT E1
FE:
CALL PRINT_IO_ERRORS
JMP SHORT E
NEXT_FILE PROC
LODSB
OR AL,AL
JNZ NEXT_FILE
RET
ENDP
INCLUDE ..\..\LIBRARY\FILE\READFSTR.LIB
INCLUDE ..\..\LIBRARY\FILE\IO.LIB
INCLUDE ..\..\LIBRARY\TEXT\WW.LIB
INCLUDE ..\..\LIBRARY\FILE\IOERRORS.LIB
endp
ENDS
DAT SEGMENT BYTE
C_ DB 'Zip comment creater 1.0 betta by Pavel Skrylev',0DH,0AH,0
FQEMAX DB 'Very many files',0DH,0AH,0
FQEMIN DB 'Need two files',0DH,0AH,0
H DB ' USAGE: zipcomm.com <zipfile> <commentfile>',0DH,0AH,0
OK DB 'Archiv updated',0DH,0AH,0
LEN_COMM_ DW 0
BUF_:
ENDS
END ZIPCOMM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment