Browse Source

Fix Auto CRT Console Switch on CP/M 3

pull/110/head
Wayne Warthen 6 years ago
parent
commit
663a532967
  1. 8
      Source/CPM3/biosldr.z80
  2. 9
      Source/CPM3/boot.z80

8
Source/CPM3/biosldr.z80

@ -162,12 +162,12 @@ const:
ld a,82H
halt
conin:
ld bc,0000H ; unit 0, func 0 = CIN
ld bc,0080H ; unit 80h (console), func 0 = CIN
call 0FFF0H
conout:
ld e,c ; output character in E
ld bc,0100H ; unit 0, func 1 = COUT
ld bc,0180H ; unit 80h (console), func 1 = COUT
;rst 08 ; do it
call 0FFF0H
ret ; return
@ -310,7 +310,7 @@ xmove:
cin:
; input character from console via hbios
ld c,0D0H ; console unit to c
ld c,080H ; console unit to c
ld b,00H ; hbios func: input char
call 0FFF0H ; hbios reads character
ld a,e ; move character to a for return
@ -319,7 +319,7 @@ cin:
cout:
; output character to console via hbios
ld e,a ; output char to e
ld c,0D0H ; console unit to c
ld c,080H ; console unit to c
ld b,01H ; hbios func: output char
call 0FFF0H ; hbios outputs character
ret

9
Source/CPM3/boot.z80

@ -13,6 +13,7 @@
extrn @dtbl,@ctbl
extrn @date,@hour,@min,@sec
extrn @srch1
extrn @hbbio
extrn addhla, bcd2bin, bin2bcd
extrn cout, phex8, phex16, crlf, crlf2
@ -73,7 +74,8 @@ init$2:
cinit:
; Setup CON: I/O vector based on HBIOS console device
ld b,0FAh ; HBIOS Peek Function
ld d,0 ; Bank 0 has HCB
ld a,(@hbbio) ; HBIOS bank id
ld d,a ; ... goes in D
ld hl,112h ; Offset 112h is current console device
rst 08 ; Call HBIOS, value in E
push de ; save console unit value
@ -94,16 +96,19 @@ cinit$1:
rst 08 ; do it, count in E
ld a,e ; device count to accum
pop de ; recover console unit num to E
push af ; save device count
cp 2 ; check for 2+ char devices
jr c,cinit$3 ; if not, skip aux assignment
ld a,e ; console unit num to A
or a ; check for zero
ld hl,4000h ; assume aux on second char device
jr nz,cinit$2 ; if console on unit 0, assumption good
jr z,cinit$2 ; if console on unit 0, assumption good
ld hl,8000h ; otherwise, aux goes to first char device
cinit$2:
ld (@aivec),hl ; assign to aux input
ld (@aovec),hl ; assign to aux output
cinit$3:
pop af ; recover device count
; Truncate char table based on actual num of char devices
rlca ; A still has char device count
rlca ; * 8 for ctbl entry size

Loading…
Cancel
Save