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
/
BEEHIVE
/
UTILITYS
/
C10CPM.ARC
/
CPM.Z80
< prev
next >
Wrap
Text File
|
1990-07-21
|
4KB
|
134 lines
; CPM program for the Cromemco C-10 running CDOS vers 3.07
; written by Brett and John Hunter.
;
; Version :- 1.01
; 02/06/86
DEST: EQU 0E100H ;Destination
CDOS: EQU 0005H
WARMBT: EQU 0000H
NEWCDOS:EQU 0E1H ; New CDOS bottom
CDOSC: EQU 0E409H ; CDOS call routiner
CDOSB: EQU 0E418H ; CDOS warm boot routine
CDOSR: EQU CDOSB-1 ; CDOS 'RET' address (it happens to be the thing
; just before the warm boot routine)
CDOSJA: EQU 0ECBFH ; Address of .abrtad
WBOOT: EQU 0E503H ; Location 0000-0003h jump
LF: EQU 0AH
CR: EQU 0DH
ORG 100H
BEGIN: LD DE,MESSAGE ;print the messasge 'CP/M overlay...'
LD C,09 ;
CALL CDOS ;
LD C,97H ;do a 151 cdos system call to reset
LD E,NEWCDOS ;the new bottom of cdos at NEWCDOS
CALL CDOS ;
LD A,195 ;Putting a JP MODS at 10H (setting it
LD (10H),A ;up for the RST 10)
LD HL,MODS ;
LD (11H),HL ;
LD A,215 ;jump location. And now changing the
LD (CDOSR),A ;RET in cdos for a RST 10.
MOVEUP: LD BC,PEND-START+1 ;number of bytes to move
LD HL,DEST+PEND-START+1;end of moved code
LD DE,SOURCE+PEND-START;end of source code
MVLP: LD A,(DE) ;get byte
DEC HL ;bump pointers
LD (HL),A ;new home
DEC DE
DEC BC ;bump byte count
LD A,B ;check if zero
OR C
JP NZ,MVLP ;if not, do some more
SOURCE: EQU $
OFFSET: EQU DEST-SOURCE
START: EQU $+OFFSET
JP FIRSTJ ;Change the jump table to redivert a system
JP CDOSB ;call
JP FIRSTJ
FIRSTJ: EQU $+OFFSET
LD (STCAL),BC ;stores the system call
JP CDOSC
MODS: EQU $+OFFSET
LD (TEMP),HL ;fixs the stack, because of RST instead of
POP HL ;the normal RET
LD HL,(TEMP)
JP PUSHER ;saves all registers: it has just returned
MOD2: EQU $+OFFSET
LD BC,(STCAL) ;from the system call.
LD A,C
CP 15
JP Z,M18 ; if 15,16,17,18 or 22 then goto M18
CP 16
JP Z,M18
CP 17
JP Z,M18
CP 18
JP Z,M18
CP 22
JP Z,M18
CP 27 ; if 27 then goto M27
JP Z,M27
POP AF
POP HL
POP DE
POP BC
RET ;returns to user program
M18: EQU $+OFFSET
POP AF ; if A <> FF then A := A and 03
CP 255
JP Z,POPER+1
AND 03
JP POPER+1
M27: EQU $+OFFSET
POP AF ; pops them but in a different order
POP BC ; as so to make the allocation map
POP DE ; address be return in the HL instead
POP HL ; of the BC.
RET
PUSHER: EQU $+OFFSET
PUSH BC
PUSH DE
PUSH HL
PUSH AF
JP MOD2
POPER: EQU $+OFFSET
POP AF
POP HL
POP DE
POP BC
RET
STCAL: EQU $+OFFSET
DEFW 0
TEMP: EQU $+OFFSET
DEFW 0
EXTRA: EQU $+OFFSET
DEFW 0,0,0,0 ;spares in case
PEND: EQU $+OFFSET
JP WARMBT
MESSAGE DEFB 'CP/M OVERLAY for the CROMEMCO C-10. Vers 1.01',cr,lf
DEFB 'Copyrighted by Brett and John Hunter.',cr,lf,'$'
END BEGIN