home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
F
/
PMAUTOAE.COM
/
PMCHGMX.MAC
< prev
next >
Wrap
Text File
|
1979-11-30
|
7KB
|
420 lines
; PMarc Patching Utility
; For MSX-DOS & MSX-DOS2
; (time stamping)
;
; Copyright SO LONG(msx03633 & pcs30481)
;
; VERSION PMCHGMX.MAC Ver 1.03
; (This program)
; PMarc Ver 1.10 or newer than it
; PMahs Ver 1.10 or newer than it
; PMext Ver 1.13 or newer than it
;
BDOS EQU 0005H
SYSTEM MACRO CALL_NO
LD C,CALL_NO
CALL BDOS
ENDM
ASEG
.Z80
ORG 100H
; Start Patching
LD DE,MESSAGE_1
SYSTEM 09H ;_STROUT
LD DE,MESSAGE_2
SYSTEM 09H ;_STROUT
PATCH_1:
LD DE,PATCH_PMARC ; Patching PMarc.COM
SYSTEM 1AH ;_SETDTA
LD DE,MESSAGE_3
SYSTEM 09H ;_STROUT
LD DE,ARC_FCB
SYSTEM 0FH ;_FOPEN
OR A
JR Z,OPEN_1
LD DE,OPEN_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_2
OPEN_1: LD HL,0001H ;Record Size Set
LD (ARC_FCB+0EH),HL
LD HL,0000H ;Record Number Set
LD (ARC_FCB+23H),HL
LD HL,0010H
LD (ARC_FCB+21H),HL
LD HL,ARC_PATCH_LEN
LD DE,ARC_FCB
SYSTEM 26H ;_WRBLK
OR A
JR Z,ARC_MESSAGE
LD DE,WRITE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_2
ARC_MESSAGE:
LD DE,PATCH_MESSAGE
SYSTEM 1AH ;_SETDTA
LD HL,0000H ;Record Number Set
LD (ARC_FCB+23H),HL
LD HL,0082H
LD (ARC_FCB+21H),HL
LD HL,000BH
LD DE,ARC_FCB
SYSTEM 26H ;_WRBLK
OR A
JR Z,CLOSE_1
LD DE,WRITE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_2
CLOSE_1:
LD DE,ARC_FCB
SYSTEM 10H ;_FCLOSE
OR A
JR Z,PATCH_OK_1
LD DE,CLOSE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_2
PATCH_OK_1:
LD DE,PATCH_COMPLETE
SYSTEM 09H ;_STROUT
PATCH_2:
LD DE,PATCH_PMARC ; Patching PMahs.COM
SYSTEM 1AH ;_SETDTA
LD DE,MESSAGE_4
SYSTEM 09H ;_STROUT
LD DE,AHS_FCB
SYSTEM 0FH ;_FOPEN
OR A
JR Z,OPEN_2
LD DE,OPEN_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_3
OPEN_2: LD HL,0001H ;Record Size Set
LD (AHS_FCB+0EH),HL
LD HL,0000H ;Record Number Set
LD (AHS_FCB+23H),HL
LD HL,0010H
LD (AHS_FCB+21H),HL
LD HL,ARC_PATCH_LEN
LD DE,AHS_FCB
SYSTEM 26H ;_WRBLK
OR A
JR Z,AHS_MESSAGE
LD DE,WRITE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_3
AHS_MESSAGE:
LD DE,PATCH_MESSAGE
SYSTEM 1AH ;_SETDTA
LD HL,0000H ;Record Number Set
LD (AHS_FCB+23H),HL
LD HL,0082H
LD (AHS_FCB+21H),HL
LD HL,000BH
LD DE,AHS_FCB
SYSTEM 26H ;_WRBLK
OR A
JR Z,CLOSE_2
LD DE,WRITE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_3
CLOSE_2:
LD DE,AHS_FCB
SYSTEM 10H ;_FCLOSE
OR A
JR Z,PATCH_OK_2
LD DE,CLOSE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_3
PATCH_OK_2:
LD DE,PATCH_COMPLETE
SYSTEM 09H ;_STROUT
PATCH_3: ; Patching PMext.COM
LD DE,MESSAGE_5
SYSTEM 09H ;_STROUT
LD DE,PATCH_PMEXT1
SYSTEM 1AH ;_SETDTA
LD DE,EXT_FCB
SYSTEM 0FH ;_FOPEN
OR A
JR Z,OPEN_3
LD DE,OPEN_ERROR
SYSTEM 09H ;_STROUT
JP PATCH_END
OPEN_3: LD HL,0001H ;Record Size Set
LD (EXT_FCB+0EH),HL
AREA1: LD HL,0000H ;Record Number Set
LD (EXT_FCB+23H),HL
LD HL,0010H
LD (EXT_FCB+21H),HL
LD HL,EXT_PATCH_LEN1
LD DE,EXT_FCB
SYSTEM 26H ;_WRBLK
OR A
JR Z,AREA2
LD DE,WRITE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_END
AREA2: LD DE,PATCH_PMEXT2
SYSTEM 1AH ;_SETDTA
LD HL,0000H ;Record Number Set
LD (EXT_FCB+23H),HL
LD HL,00C0H
LD (EXT_FCB+21H),HL
LD HL,EXT_PATCH_LEN2
LD DE,EXT_FCB
SYSTEM 26H ;_WRBLK
OR A
JR Z,EXT_MESSAGE
LD DE,WRITE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_END
EXT_MESSAGE:
LD DE,PATCH_MESSAGE
SYSTEM 1AH ;_SETDTA
LD HL,0000H ;Record Number Set
LD (EXT_FCB+23H),HL
LD HL,0082H
LD (EXT_FCB+21H),HL
LD HL,000BH
LD DE,EXT_FCB
SYSTEM 26H ;_WRBLK
OR A
JR Z,CLOSE_3
LD DE,WRITE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_END
CLOSE_3:
LD DE,EXT_FCB
SYSTEM 10H ;_FCLOSE
OR A
JR Z,PATCH_OK_3
LD DE,CLOSE_ERROR
SYSTEM 09H ;_STROUT
JR PATCH_END
PATCH_OK_3:
LD DE,PATCH_COMPLETE
SYSTEM 09H ;_STROUT
PATCH_END:
LD DE,PROGRAM_END
SYSTEM 09H ;_STROUT
JP 0000H
MESSAGE_1: DB 0DH,0AH,"PMarc Patching Utility for MSX-DOS(2)$"
MESSAGE_2: DB 0DH,0AH," Ver 1.03 (C) SO LONG 1990$"
MESSAGE_3: DB 0DH,0AH,0AH,"Patching PMarc.COM$"
MESSAGE_4: DB 0DH,0AH,0AH,"Patching PMahs.COM$"
MESSAGE_5: DB 0DH,0AH,0AH,"Patching PMext.COM$"
OPEN_ERROR: DB 0DH,0AH,"File Not Found.$"
WRITE_ERROR: DB 0DH,0AH,"Write Error.$"
CLOSE_ERROR: DB 0DH,0AH,"Close Error.$"
PATCH_COMPLETE: DB 0DH,0AH,"Patching Complete.$"
PROGRAM_END: DB 0DH,0AH,0AH,"END",0DH,0AH,24H
PATCH_MESSAGE: DB "MSX-DOS(2)$"
; FCB AREA
ARC_FCB: DB 00H,"PMARC COM"
DS 19H,00H
AHS_FCB: DB 00H,"PMAHS COM"
DS 19H,00H
EXT_FCB: DB 00H,"PMEXT COM"
DS 19H,00H
; Patch for PMarc.COM & PMahs.COM
PATCH_PMARC:
.PHASE 0110H
PUSH HL
PUSH DE
SYSTEM 6FH ;_DOSVER
LD A,02H
CP B
JR Z,ARC_PATCH_DOS2
ARC_ASCIIZ:
POP DE
LD HL,0016H
ADD HL,DE
POP DE
LDI
LDI
DEC HL
DEC HL
DEC HL
DEC HL
LDI
LDI
OR A
RET
ARC_PATCH_DOS2:
POP HL
PUSH HL
LD DE,ARC_ASCIIZ
LD A,(HL)
OR A
JR Z,CURRENT_
ADD A,'@'
LD (DE),A
INC DE
LD A,':'
LD (DE),A
INC DE
CURRENT_:
LD B,08H
LOOP01: INC HL
LD A,(HL)
CP ' '
JR Z,ARC_EXT
LD (DE),A
INC DE
DJNZ LOOP01
ARC_EXT:
LD A,'.'
LD (DE),A
INC DE
LD BC,0008H
POP HL
ADD HL,BC
LD B,03H
LOOP02: INC HL
LD A,(HL)
CP ' '
JR Z,GET_TSTAMP
LD (DE),A
INC DE
DJNZ LOOP02
GET_TSTAMP:
XOR A
LD (DE),A
LD DE,ARC_ASCIIZ
SYSTEM 51H ;_FTIME
POP IX
LD (IX+00H),E
LD (IX+01H),D
LD (IX+02H),L
LD (IX+03H),H
OR A
RET
.DEPHASE
; Patch for PMext.COM
PATCH_PMEXT1:
.PHASE 0110H
PUSH HL
PUSH DE
SYSTEM 6FH ;_DOSVER
LD A,02H
CP B
JP NZ,01C1H
POP DE
PUSH DE
SYSTEM 10H ;_FCLOSE
POP HL
PUSH HL
LD DE,01C1H
LD A,(HL)
OR A
JR Z,CURRENT
ADD A,'@'
LD (DE),A
INC DE
LD A,':'
LD (DE),A
INC DE
CURRENT:LD B,08H
LOOP03: INC HL
LD A,(HL)
CP ' '
JR Z,EXT_EXT
LD (DE),A
INC DE
DJNZ LOOP03
EXT_EXT:
LD A,'.'
LD (DE),A
INC DE
LD BC,0008H
POP HL
ADD HL,BC
LD B,03H
LOOP04: INC HL
LD A,(HL)
CP ' '
JR Z,PUT_TSTAMP
LD (DE),A
INC DE
DJNZ LOOP04
PUT_TSTAMP:
XOR A
LD (DE),A
POP HL
LD C,(HL)
INC HL
LD B,(HL)
INC HL
LD E,(HL)
INC HL
LD D,(HL)
EX DE,HL
PUSH BC
POP IX
LD DE,01C1H
INC A
SYSTEM 51H ;_FTIME
POP HL
LD DE,0008H
ADD HL,DE
PUSH HL
RET
.DEPHASE
PATCH_PMEXT2:
.PHASE 01C0H
RET
POP DE
POP HL
EX DE,HL
LD BC,0016H
ADD HL,BC
EX DE,HL
LDI
LDI
DEC DE
DEC DE
DEC DE
DEC DE
LDI
LDI
RET
.DEPHASE
ARC_PATCH_LEN EQU PATCH_PMEXT1-PATCH_PMARC
EXT_PATCH_LEN1 EQU PATCH_PMEXT2-PATCH_PMEXT1
EXT_PATCH_LEN2 EQU $-PATCH_PMEXT2
END