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
/
RSXMAKER.LZH
/
RSXTEM.ASM
< prev
Wrap
Assembly Source File
|
1991-01-15
|
4KB
|
157 lines
;++
; RSXTEM - RSXMAKER RSX Template
;
; Copyright (c) 1986 by AutoSoft Incorporated
;
; See RSXMAKER.DOC for information.
;
;--
;+
; RSX Header RFLAGS Flag bit definitions
;-
FIRST EQU 1 ; First RSX installed
LAST EQU 2 ; Last RSX installed
NOREMOV EQU 4 ; RSX may be removed
REINIT EQU 8 ; Re-initialize on subsequent installation requests
MULTI EQU 16 ; Install another copy on subsequent installs
OVRLAY EQU 32 ; Overlay CCP if first RSX installed
NOMORE EQU 64 ; No more RSX's may be installed
NORELO EQU 128 ; Do not relocate this RSX
RELINI EQU 256 ; Call INIT routine after relocation
;+
; RSX Header Section begins here
;-
ORG 100H ; Origin *must* be at 100H
;+
; Do not modify these 14 fields
;-
RSX: JMP RSTART ; Jump to real code (jumped to from 0005)
RSXRST: JMP RESET ; Reset handler
RINIT: JMP INIT ; Initialization code
RTERM: JMP TERM ; Termination code
RELST: JMP RSXCODE ; Start of relocatable code
DATAST: JMP RSXDATA ; Start of data section (copied as is)
RELEND: JMP RSXEND ; End of RSX code and data to be relocated
NXTWB: JMP $-$ ; WBOOT path (filled in by RSXMAKER)
NEXT: JMP $-$ ; BDOS path (filled in by RSXMAKER)
WBADR: DW $-$ ; Filled in by RSXMAKER
WBJMP: DW $-$ ; Filled in by RSXMAKER
RSIZE: DW RSXEND-RSX ; Size of RSX code and data
RSXID: DB 'AutoSoft' ; ID - Must be 'AutoSoft'
;+
; The next three fields may be modified by the RSX programmer
;-
RFLAGS: DW MULTI+REINIT ; RSX flags (combine with +)
RNAME: DB 'RSXTEM ' ; Name - must be 8 bytes - pad on rt w/spaces
RDESC: DB 'AutoSoft RSX Template',0 ; Description (null terminated)
;+
; RSX Code Section begins here
;-
RSXCODE EQU $ ; Executable code *only* between here
; and RSXDATA (no in-line prints allowed)
;+
; Initialization Routine (end with RET)
;-
INIT: ; This *must* be the label
MVI C,9 ; Just write a message to the console
LXI D,INITMSG ;
CALL NEXT ;
RET ; And return
;+
; Termination Routine (end with RET)
;-
TERM: ; This *must* be the label
MVI C,9 ; Just write a message to the console
LXI D,TERMMSG ;
CALL NEXT ;
RET ; And return
;+
; BDOS Intercept Routine (end with JMP NEXT or RET)
;-
RSTART: ; This *must* be the label
LXI H,0 ; Clear HL
DAD SP ; Get current stack pointer
SHLD USRSTK ; Save it
LXI SP,LOCSTK ; Switch to local stack
PUSH D ; Save environment
PUSH B ;
PUSH PSW ;
;********************************************************************
; Insert function-specific code here
;********************************************************************
POP PSW ; Restore environment
POP B ;
POP D ;
LHLD USRSTK ; And stack pointer
SPHL ;
JMP NEXT ; Pass control to next RSX
;+
; WBOOT Intercept Routine (end with JMP NXTWB)
;-
RESET: LXI SP,LOCSTK ; Local stack
MVI C,9 ; Write a message
LXI D,WBMSG ;
CALL NEXT ;
LHLD RFLAGS ; HL = flags word
MOV A,L ; Low byte
ANI FIRST ; First?
JZ NOT1ST ; If Z, no
MVI C,13 ; Disk system reset
CALL NEXT ; (you might want to comment this and the
; previous line out to speed up warm boots)
NOT1ST: MOV A,L ; Get flags
ANI LAST ; Last?
JZ NOTLST ; If Z, no
LXI H,RSX ; Else reload BDOS vector
SHLD 0006 ;
LHLD WBJMP ; HL -> WBOOT vector in BIOS jump table
SHLD 0001 ; Insert WBOOT vector
INX H ; Point past JMP
LXI D,RSXRST ; Our WB address
MOV M,E ; Copy it into BIOS jump table
INX H ;
MOV M,D ;
NOTLST: JMP NXTWB ; And pass control to next RSX (or CCP)
;+
; RSX Data Section
;-
RSXDATA EQU $ ; Data *must* start here - no data
; allowed before this point; no executable
; code beyond.
WBMSG: DB 13,10,'Template RSX active.$'
TERMMSG:
DB 'Template RSX terminated.',13,10,'$'
INITMSG:
DB 'Template RSX initialized.',13,10,'$'
DS 16 ; 16-byte stack
LOCSTK: ; Initial SP
USRSTK: DW 0 ; Caller's SP
RSXEND EQU $ ; No code or data allowed beyond this label