mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-23 00:14:25 +00:00
130 lines
2.6 KiB
Plaintext
130 lines
2.6 KiB
Plaintext
;************ biosif.z8k **************************
|
||
;*
|
||
;* Assembly language interface for P-CP/M (tm) BIOS
|
||
;* ----- System-Independent -----
|
||
;*
|
||
;* 821013 S. Savitzky (Zilog) -- split into modules
|
||
;* 820913 S. Savitzky (Zilog) -- created.
|
||
;*
|
||
|
||
__text: .sect
|
||
|
||
;****************************************************
|
||
;*
|
||
;* NOTE
|
||
;* The C portion of the BIOS is non-segmented.
|
||
;*
|
||
;* This assembly-language module is assembled
|
||
;* non-segmented, and serves as the interface.
|
||
;*
|
||
;* Segmented operations are well-isolated, and
|
||
;* are either the same as their non-segmented
|
||
;* counterparts, or constructed using macros.
|
||
;* The resulting code looks a little odd.
|
||
;*
|
||
;****************************************************
|
||
|
||
.input "biosdefs.z8k"
|
||
|
||
|
||
;****************************************************
|
||
;*
|
||
;* Externals
|
||
;*
|
||
;****************************************************
|
||
|
||
.global _biosinit ;C portion init
|
||
.global _ldcpm ;Load the system into memory
|
||
|
||
.global _trapinit ;trap startup
|
||
|
||
.global _psap, _sysseg, _sysstk
|
||
|
||
;****************************************************
|
||
;*
|
||
;* Global declarations
|
||
;*
|
||
;****************************************************
|
||
|
||
.global bios ; initialization
|
||
.global _input ; input a byte
|
||
.global _output ; output a byte
|
||
|
||
;****************************************************
|
||
;*
|
||
;* Loader Bios Initialization and Entry Point
|
||
;*
|
||
;* This is where control comes after boot.
|
||
;*
|
||
;* We get here from bootstrap with:
|
||
;* segmented mode
|
||
;* valid stack pointer
|
||
;* valid PSA in RAM
|
||
;*
|
||
;****************************************************
|
||
|
||
bios:
|
||
|
||
; enter in segmented mode.
|
||
; Get system (PC) segment into r4
|
||
|
||
DI VI,NVI
|
||
calr kludge ; get PC segment on stack
|
||
kludge: popl rr4, @r14
|
||
|
||
; get PSAP into rr2.
|
||
|
||
ldctl r2, PSAPSEG
|
||
ldctl r3, PSAPOFF
|
||
|
||
; go non-segmented. save PSAP, system segment,
|
||
; system stack pointer (in system segment, please)
|
||
|
||
NONSEG
|
||
|
||
ldl _psap, rr2
|
||
ld _sysseg, r4
|
||
ld r14,_sysseg
|
||
ldl _sysstk, rr14
|
||
|
||
; set up traps, then enable interrupts
|
||
|
||
call _trapinit
|
||
EI VI,NVI
|
||
|
||
; set up C part of Bios
|
||
|
||
call _biosinit
|
||
|
||
; Turn control over to command processor
|
||
|
||
jp _ldcpm
|
||
|
||
;****************************************************
|
||
;*
|
||
;* I/O port operations
|
||
;*
|
||
;* int = input(port: int)
|
||
;* output (port, data: int)
|
||
;*
|
||
;****************************************************
|
||
|
||
_input:
|
||
ld r2,ARG1(r15)
|
||
subl rr6,rr6
|
||
inb rl7,@r2
|
||
ldb rl6,rl7
|
||
ret
|
||
|
||
|
||
_output:
|
||
ld r2,ARG1(r15)
|
||
ld r3,ARG2(r15)
|
||
outb @r2,rl3
|
||
ret
|
||
|
||
|
||
;*****************************************************
|
||
;*****************************************************
|
||
|
||
|