Browse Source

More CP/M 3 Refinements

pull/54/head
Wayne Warthen 6 years ago
parent
commit
2430231dc1
  1. 19
      Source/CPM3/bioskrnl.asm
  2. 37
      Source/CPM3/boot.z80
  3. 65
      Source/CPM3/move.z80

19
Source/CPM3/bioskrnl.asm

@ -188,25 +188,6 @@ set$jumps:
sta 0 ! sta 5 ; set up jumps in page zero
lxi h,?wboot ! shld 1 ; BIOS warm start entry
lhld @MXTPA ! shld 6 ; BDOS system call entry
; xor a
; ld hl,40h
; ld b,10h
;set$jumps1:
; ld (hl),a
; inc hl
; djnz set$jumps1
; Clear reserved area in page zero
xra a
lxi h,40h
mvi b,10h
set$jumps1:
mov m,a
inx h
dcr b
jnz set$jumps1
ret

37
Source/CPM3/boot.z80

@ -24,44 +24,46 @@ tpa$bank equ 0
?init:
call ?mvinit
call cinit ; char device init
ld hl,signon$msg ; signon message
call ?pmsg ; print it
; Clear reserved area in page zero
xor a
ld hl,40h
ld b,10h
init$1:
ld (hl),a
inc hl
djnz init$1
if banked
; clone page zero from bank 0 to additional banks
; Clone page zero from bank 0 to additional banks
ld b,2 ; last bank
ld c,0 ; src bank
init$0:
init$2:
push bc ; save bank id's
call init$1 ; copy page zero
pop bc ; restore bank id's
djnz init$0 ; loop till done
jr init$2
init$1:
call ?xmove ; set src/dest banks
ld bc,0100h ; size is one page
ld hl,0 ; dest adr is 0
ld de,0 ; src adr is 0
call ?move ; do it
ret
pop bc ; restore bank id's
djnz init$2 ; loop till done
endif
init$2:
; get boot disk unit and save it
call cinit ; char device init
ld hl,signon$msg ; signon message
call ?pmsg ; print it
; Get boot disk unit and save it
ld bc,0F8E0h ; HBIOS func: get boot info
rst 08 ; do it, D := boot unit
ld a,d ; move to A
ld (@bootdu),a ; save it
call dinit
ret
cinit:
; Setup CON: I/O vector based on HBIOS console device
ld b,0FAh ; HBIOS Peek Function
@ -238,7 +240,6 @@ addhla:
inc h
ret
cseg ; boot loading most be done from resident memory
; This version of the boot loader loads the CCP from a file

65
Source/CPM3/move.z80

@ -7,9 +7,9 @@
extrn @cbnk
?mvinit:
ld bc,0F8F2H ; HBIOS GET BNKINFO
ld bc,0F8F2h ; HBIOS GET BNKINFO
;rst 08 ; D: BIOS Bank, E: User Bank
call 0FFF0H
call 0FFF0h ; D: BIOS Bank, E: User Bank
ld a,d
ld (@hbbio),a
ld a,e
@ -17,8 +17,8 @@
ret
?xmove:
ld (movbnk),bc ; save source & dest banks
or 0FFH ; flag interbank move type
ld (movbnks),bc ; save source & dest banks
or 0FFh ; flag interbank move type
ld (movtyp),a ; save it
ret
@ -39,77 +39,60 @@ xbnkmov:
; Interbank move
xor a ; zero
ld (movtyp),a ; clear move type flag
push de
push hl
push bc
pop hl
ld a,(srcbnk)
call ?bnkxlt
ld e,a
ld (0FFE4h),a
ld a,(dstbnk)
call ?bnkxlt
ld d,a
ld b,0F4H ; SETCPY
;rst 08
call 0FFF0H
pop hl
pop de
ld (0FFE7h),a
ex de,hl ; swap address regs for call
ld b,0F5H ; BNKCPY
;rst 08
call 0FFF0H
call 0FFF6h ; HBIOS BNKCPY
ex de,hl ; next addresses in same regs
;ld ix,9999H
;halt
ret
?bank:
call ?bnkxlt ; xlat to HBIOS bank id
jp 0FFF3H ; do it and return
jp 0FFF3h ; do it and return
;
; Convert from CPM3 bank id to HBIOS bank id.
; CPM3 wants TPA for it's bank 0, so that is special
; case mapping to HBIOS BID_USR (8EH). Otherwise, we index
; down below BID_HBIOS (8DH). So CPM3 bank usage grows
; case mapping to HBIOS BID_USR (8Eh). Otherwise, we index
; down below BID_HBIOS (8Dh). So CPM3 bank usage grows
; downward.
;
; CPM3 HBIOS
; ------------- -------------------
; COMMON 8FH - BID_COM
; 0 - OS/BUFS 8EH - BID_USR
; 8DH - BID_BIOS
; 1 - TPA 8CH - BID_AUX
; 2 - BUFS 8BH - BID_AUX-1
; 3 - BUFS 8AH - BID_AUX-2
; CPM3 HBIOS Typical
; ------------ -------------- -------
; COMMON BID_COM 8Fh
; 0: OS/BUFS BID_USR 8Eh
; BID_BIOS 8Dh
; 1: TPA BID_AUX 8Ch
; 2: BUFS BID_AUX-1 8Bh
; 3: BUFS BID_AUX-2 8Ah
; ...
;
; N.B., Below BID_AUX is considered RAM disk bank. Need to
; make sure RAM disk is kept small enough to stay below
; banks used for OS buffers.
;
; @hbbio & @hbusr are dynamically updated during init
; to adjust for real size of RAM in system
;
?bnkxlt:
;ld ix,5555H
;halt
;cp 2
;jr c,xxx
;ld ix,6666H
;halt
;xxx:
or a
jr z,bank0
neg ; 2 -> -2
add a,08DH ; 8DH - 2 = 8BH
add a,8Dh ; 8Dh - 2 = 8Bh
@hbbio equ $ - 1 ; BID_BIOS
ret
bank0:
ld a,08EH ; 0 -> 8EH
ld a,8Eh ; 0 -> 8Eh
@hbusr equ $ - 1 ; BID_USR
ret
movtyp db 0 ; non-zero for interbank move
movbnk:
movbnks:
srcbnk db 0
dstbnk db 0

Loading…
Cancel
Save