Compare commits

..

4 Commits

Author SHA1 Message Date
boykovra
c761928096 rename fill blk 2024-06-21 09:44:35 +03:00
boykovra
a51105ada8 rename fill blk 2024-06-21 09:41:26 +03:00
boykovra
e65941e2c9 v0.8beta1 support for DSS v1.70+ introduced 2024-06-20 21:49:03 +03:00
boykovra
92de2bbbb1 v0.8beta1 support for DSS v1.70+ introduced 2024-06-20 21:46:59 +03:00
4 changed files with 55 additions and 23 deletions

View File

@ -5,5 +5,7 @@ Source codes for PKUNZIP utility (version 0.7) for Sprinter computer.
Utility created by Aleksey Gavrilenko 09.02.2002, Procedure deflate by Michail Kondratyev Utility created by Aleksey Gavrilenko 09.02.2002, Procedure deflate by Michail Kondratyev
Disassemble by Romychs and Ghidra at 10.06.2024. * 10.06.2024 - Disassemble by Romychs and Ghidra.
* v0.8beta1 - Support for DSS v1.70+ - Current directory support.

View File

@ -205,6 +205,7 @@ _CH_DIR
; A - код ошибки, если CF=1 ; A - код ошибки, если CF=1
_CURDIR _CURDIR
PUSH DE PUSH DE
LD DE, CUR_DIR
EX HL,DE EX HL,DE
LD BC, CUR_DIR_SIZE LD BC, CUR_DIR_SIZE
LDIR LDIR

View File

@ -25,7 +25,7 @@ ZIP_FILE
ZIP_FILE_END ZIP_FILE_END
CMD_LINE1 CMD_LINE1
DB 20, " C:\\FOLDER\\ FILE.ZIP", 0 DB 10, " FILE.ZIP", 0
CMD_LINE2 CMD_LINE2
DB 19, " C:\\FOLDER\\FILE.ZIP", 0 DB 19, " C:\\FOLDER\\FILE.ZIP", 0

View File

@ -1,13 +1,16 @@
; ==================================================== ; ====================================================
; PKUNZIP utility for Sprinter version 0.7 ; PKUNZIP utility for Sprinter version 0.8
; Created by Aleksey Gavrilenko 09.02.2002 ; Created by Aleksey Gavrilenko 09.02.2002
; Procedure deflate by Michail Kondratyev ; Procedure deflate by Michail Kondratyev
; ----------------------------------------------------
; Version 0.8 by Romychs, for DSS v1.70,
; + support for current dir
; ==================================================== ; ====================================================
; Set to 1 to turn debug ON with DeZog VSCode plugin ; Set to 1 to turn debug ON with DeZog VSCode plugin
; Set to 0 to compile .EXE ; Set to 0 to compile .EXE
DEBUG EQU 0 DEBUG EQU 0
EXE_VERSION EQU 0 EXE_VERSION EQU 1
SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
@ -88,7 +91,7 @@ STACK_TOP
; ==================================================== ; ====================================================
START START
IF DEBUG == 1 IF DEBUG == 1
LD IX,CMD_LINE2 LD IX,CMD_LINE1
ENDIF ENDIF
PUSH IX ; IX ptr to cmd line PUSH IX ; IX ptr to cmd line
POP HL POP HL
@ -99,31 +102,51 @@ START
LD DE,PATH_OUTPUT LD DE,PATH_OUTPUT
CALL GET_CMD_PARAM CALL GET_CMD_PARAM
JR NC,IS_SEC_PAR JR NC,IS_SEC_PAR
LD HL,PATH_INPUT ; In and out is same ; Set output dir to current dir
LD DE,PATH_OUTPUT LD C, DSS_CURDIR
LD BC,256 LD HL,PATH_OUTPUT
LDIR RST DSS
JP NC, START_L1
JP ERR_FILE_OP
IS_SEC_PAR IS_SEC_PAR
; split path and file name ; split path and file name
LD HL,PATH_OUTPUT LD HL,PATH_OUTPUT
CALL SPLIT_PATH_FILE CALL SPLIT_PATH_FILE
JR START_L1 JR START_L1
; Out start message and usage message, then exit to DSS
INVALID_CMDLINE INVALID_CMDLINE
LD HL,START_MESSAGE ; "PKUNZIP utility for Sprinter LD HL,MSG_START
LD C,DSS_PCHARS
RST DSS
LD HL,MSG_USAGE
LD C,DSS_PCHARS LD C,DSS_PCHARS
RST DSS RST DSS
LD BC,DSS_EXIT LD BC,DSS_EXIT
RST DSS RST DSS
START_L1 START_L1
LD A,(PATH_INPUT) ; ToDo: No parameters, It is already checked before? LD A,(PATH_INPUT) ; ToDo: No parameters, It is already checked before?
AND A AND A
JR Z,INVALID_CMDLINE JR Z,INVALID_CMDLINE
LD HL,START_MESSAGE ; "PKUNZIP utility for Sprinter LD HL,MSG_START ; "PKUNZIP utility for Sprinter
LD C,DSS_PCHARS LD C,DSS_PCHARS
RST DSS RST DSS
LD HL,PATH_INPUT LD HL,PATH_INPUT
CALL SPLIT_PATH_FILE ; get zip file path and name from first cmd line parameter CALL SPLIT_PATH_FILE ; get zip file path and name from first cmd line parameter
JP C,ERR_FILE_OP JP C,ERR_FILE_OP
; if input path is empty, get current dir
LD A,(PATH_INPUT)
AND A
JP NZ,INP_P_NE
LD C, DSS_CURDIR
LD HL,PATH_INPUT
RST DSS
INP_P_NE
LD HL,MSG_INP_PATH ; "Input path:" LD HL,MSG_INP_PATH ; "Input path:"
LD C,DSS_PCHARS LD C,DSS_PCHARS
RST DSS RST DSS
@ -639,10 +662,13 @@ EOS_FOUND
AND A AND A
JR NZ,BKSL_FOUND JR NZ,BKSL_FOUND
POP HL POP HL
PUSH HL
; copy 13 symbols of filepath to FILE_SPEC. 'filename.zip',0 ; copy 13 symbols of filepath to FILE_SPEC. 'filename.zip',0
LD BC,13 LD BC,13
LD DE,FILE_SPEC LD DE,FILE_SPEC
LDIR LDIR
POP HL
LD (HL),0 ; Mark path as empty
AND A ; CF=0 AND A ; CF=0
RET RET
BKSL_FOUND BKSL_FOUND
@ -760,10 +786,14 @@ LH_UCOMP_SIZE_L:
LH_UCOMP_SIZE_H: LH_UCOMP_SIZE_H:
DW 0 DW 0
START_MESSAGE: MSG_START
DB "PKUNZIP utility for Sprinter version 0.7\r\n" DB "UNZIP utility for Sprinter v0.8.beta1\r\n"
DB "Created by Aleksey Gavrilenko 09.02.2002\r\n" DB "Created by Aleksey Gavrilenko 09.02.2002\r\n"
DB "Procedure deflate by Michail Kondratyev\r\n\r\n", 0 DB "Procedure deflate by Michail Kondratyev\r\n"
DB "Patched by Romych at 20.06.2024 for DSS v1.70+ support.\r\n\r\n", 0
MSG_USAGE
DB "Usage:\r\n unzip.exe <filepath.zip> [<out_dir>]\r\n\r\n",0
MSG_INP_PATH: MSG_INP_PATH:
DB "Input path:", 0 DB "Input path:", 0
@ -775,10 +805,10 @@ MSG_EOL
DB "\r\n", 0 DB "\r\n", 0
MSG_DEPAC_COMPLT: MSG_DEPAC_COMPLT:
DB "\r\nDepaking complited\r\n\n",0 DB "\r\nUnpacking complited\r\n\n",0
MSG_DEPAC_FILE: MSG_DEPAC_FILE:
DB "Depaking file: ", 0 DB "Unpacking file: ", 0
MSG_ERR_CRC: MSG_ERR_CRC:
DB " Error CRC!", 0 DB " Error CRC!", 0
@ -826,25 +856,25 @@ MSG_FWRONG_FM
DB "Wrong file manipulator!\r\n", 0 DB "Wrong file manipulator!\r\n", 0
MSG_NO_SPACE_FM MSG_NO_SPACE_FM
DB "Not space for file manipulator!\r\n", 0 DB "No space for file manipulator!\r\n", 0
MSG_FILE_EXISTS2 MSG_FILE_EXISTS2
DB "File exist!\r\n", 0 DB "File exist!\r\n", 0
MSG_RDONLY MSG_RDONLY
DB "Read only!\r\n", 0 DB "File read only!\r\n", 0
MSG_ERR_ROOT MSG_ERR_ROOT
DB "Error ROOT!\r\n", 0 DB "Root overflow!\r\n", 0
MSG_NO_SPACE MSG_NO_SPACE
DB "No space!\r\n", 0 DB "Not free space!\r\n", 0
MSG_PATH_EXISTS MSG_PATH_EXISTS
DB "Path exists!\r\n", 0 DB "Path exists!\r\n", 0
MSG_WRONG_NAME MSG_WRONG_NAME
DB "Wrong name!\r\n", 0 DB "Invalid filename!\r\n", 0
MSG_FATAL_ERR MSG_FATAL_ERR
DB "Fatal error!\r\n", 0 DB "Fatal error!\r\n", 0
@ -1292,7 +1322,7 @@ WR_4000
LD A,(SAVE_P0) LD A,(SAVE_P0)
OUT (PAGE0),A OUT (PAGE0),A
; Write DC bytes from (HL) to A file handler ; Write DC bytes from (HL) to A file handler
LD DE,0x4000 LD DE,0x4000 ; bytes to write
LD HL,PAGE3_ADDR LD HL,PAGE3_ADDR
LD C,DSS_WRITE LD C,DSS_WRITE
LD A,(FH_OUT) LD A,(FH_OUT)
@ -1351,7 +1381,6 @@ LH_EXTRA_LEN_L
LH_EXTRA_LEN_H LH_EXTRA_LEN_H
DB 0 DB 0
LH_FILENAME LH_FILENAME
DS 1024, 0 DS 1024, 0
;PAGE3_ADDR ;PAGE3_ADDR