Files
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

156 lines
2.5 KiB
Plaintext

;************ syscall.z8s **************************
;*
;* System Call interface for P-CP/M (tm) BIOS
;*
;* 820927 S. Savitzky (Zilog) -- created.
;*
__text: .sect
;****************************************************
;*
;* NOTE
;* The following system call interface routines
;* are designed to be called from non-segmented
;* C programs.
;*
;* Addresses are passed as LONGs.
;*
;****************************************************
.input "biosdefs.z8k"
.global _xfer
.global _mem_cpy
.global _map_adr
.global _bios
.global _bdos
;****************************************************
;*
;* Context Switch Routine
;*
;* xfer(context)
;* long context;
;*
;* context is the physical (long) address of:
;* r0
;* ...
;* r13
;* r14 (normal r14)
;* r15 (normal r15)
;* ignored word
;* FCW (had better specify normal mode)
;* PC segment
;* PC offset
;*
;* The system stack pointer is not affected.
;*
;* Control never returns to the caller.
;*
;****************************************************
_xfer:
ldl rr6,ARG1(r15)
ldl rr4,#-2
subl rr2,rr2
sc #XFER_SC
ret
;****************************************************
;*
;* System/User Memory Access
;*
;* _mem_cpy( source, dest, length)
;* long source, dest, length;
;* _map_adr( addr, space) -> paddr
;* long addr; int space;
;*
;* _map_adr( addr, -1)
;* sets user segment # from addr.
;*
;* _map_adr( addr, -2)
;* transfer to context block at addr
;*
;* system call: mem_cpy
;* rr6: source
;* rr4: dest
;* rr2: length (0 < length <= 64K)
;* returns
;* registers unchanged
;*
;* system call: map_adr
;* rr6: logical addr
;* r5: space code
;* r4: ignored
;* rr2: 0
;* returns
;* rr6: physical addr
;*
;* space codes:
;* 0: caller data
;* 1: caller program
;* 2: system data
;* 3: system program
;* 4: TPA data
;* 5: TPA program
;*
;* x+256 return segmented instruction address,
;* not data access address
;*
;* FFFF set user-space segment from address
;*
;****************************************************
_mem_cpy: ;copy memory C subroutine
;===
ldl rr6,ARG1(r15)
ldl rr4,ARG3(r15)
ldl rr2,ARG5(r15)
sc #MEM_SC
ret
_map_adr: ;map address C subroutine
;===
ldl rr6,ARG1(r15)
ld r5, ARG3(r15)
subl rr2,rr2 ; 0 length says map
sc #MEM_SC
ret
;****************************************************
;*
;* long _bios(code, p1, p2)
;* long _bdos(code, p1)
;* int code;
;* long p1, p2;
;*
;* BIOS, BDOS access
;*
;****************************************************
_bios:
ld r3,ARG1(r15)
ldl rr4,ARG2(r15)
ldl rr6,ARG4(r15)
sc #BIOS_SC
ret
_bdos:
ld r5,ARG1(r15)
ldl rr6,ARG2(r15)
sc #BDOS_SC
ret