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
/
SIMTEL
/
CPMUG
/
CPMUG049.ARK
/
FILTER.Z80
< prev
next >
Wrap
Text File
|
1984-04-29
|
3KB
|
160 lines
;********************************************************
;* *
;* CODE TO IMPLEMENT THE *
;* ESSENTIAL CDOS CALLS *
;* WHICH WILL ALLOW MOST *
;* CROMEMCO SOFTWARE TO *
;* RUN UNDER CP/M *
;* *
;********************************************************
;
; From Dr. Dobbs, January 1980
;
; by J. Warner, coded by Bill Bolton
;
; This program is uaed by making it part of the
;memory image of a Cromemco program. When it gets control
;it boosts the function code filter into place at the top
;of the TPA and then moves the original program down to
;100H and jumps to it.
;
BDOS EQU 0005H
DUMMY EQU 0000H
IGOR EQU DUMMY
;
; Measure the CP/M TPA size. Adjust the addresses in
;the function code of the function code filter for
;installation at the top of the TPA. Then change the jumps
;at 5,6 & 7 to route BDOS calls through the filter. Block
;move the filter to the top of the TPA.
;
;
ORG 100H
LD HL,(6) ;GET BDOS ENTRY
LD (CPM1+1),HL ;INSTALL
LD (CPM2+1),HL
DEC H ;MAKE ROOM FOR FILTER
LD L,0
LD (6),HL ;INSTALL FILTER ADDRESS
EX DE,HL
LD HL,(1) ;GET WARM BOOT ADDRESS,
INC HL ;IN BIOS JUMP TABLE
INC HL
INC HL ;CSTAT ADDRESS
LD (CSTAT+1),HL ;INSTALL
INC HL ;BUMP 3 TIMES TO FIND,
INC HL ;CONIN
INC HL
LD (GBYTE+1),HL ;INSTALL
LD HL,NAME-FILTER ;CALCULATE RELATIVE,
ADD HL,DE ;SUBROUTINE ADDRESS
LD (NAM1+1),HL
LD (NAM2+1),HL
LD HL,FILTER
LD BC,END-FILTER
LDIR ;INSTAL FILTER
;
;
; The filter just installed contains a one use
;routine to move the *.COM file on top of this stuff
;and into position. First put the stack between CP/M
;and the filter
;
;
LD DE,(6) ;GET FILTER ADDRESS
LD IX,MOVE-FILTER
ADD IX,DE
LD HL,MOVE-FILTER+80H
ADD HL,DE
LD SP,HL
LD DE,MESG
LD C,9
CALL BDOS
JP (IX)
;
MESG: DEFW 0D0AH
DEFM 'CDOS FILTER LOADED'
DEFW 0D0AH
DEFW 0D0AH
DEFB '$'
;
;
; PART 3
;
;
FILTER: PUSH AF
LD A,C
CP 02H
JR NZ,NOTWR
CPM1: CALL DUMMY
POP AF
RET
;
NOTWR: POP AF
LD A,C
CP 0BH
CSTAT: JP Z,DUMMY
ADD A,A
CPM2: JP NC,DUMMY
GBYTE: JP Z,DUMMY
LD A,86H
CP C
JP NZ,IGOR
;
; FORMAT STRING TO FCB - 86H
;
PUSH DE
LD B,(HL)
INC HL
LD A,(HL)
CP ':'
JR NZ,NOCOL
INC HL
LD A,7
AND B
JR FIRST
NOCOL: DEC HL
XOR A
FIRST: LD (DE),A
INC DE
LD B,8
NAM1: CALL DUMMY
LD A,'.'
CP (HL)
JR NZ,EXT
INC HL
EXT: LD B,3
NAM2: CALL DUMMY
XOR A
LD (DE),A
POP DE
RET
;
NAME: LD A,(HL)
CP 21H
JR C,FILL
INC HL
CP '.'
JR Z,FILL
CP 60H
JR C,NAME1
SUB 20H
NAME1: LD (DE),A
INC DE
DJNZ NAME
RET
;
FILL: LD A,20H
LD (DE),A
INC DE
DJNZ FILL
RET
;
MOVE: LD HL,200H
LD BC,(6)
DEC B
LD DE,100H
LDIR
JP 100H
END: EQU $
END