Browse Source

Console Takeover Improvements, Issue #485

Thanks and credit to @skullandbones for pointing out multiple deficiencies in the console takeover algorithm.  In this commit:
- All char units are flushed when a new RomLdr prompt is emitted.
- Intervening non-space characters will now prevent console takeover.  Console takeover requires two consecutive space characters on the same character unit with no intervening non-space characters on the same unit or any intervening characters on an alternate unit.
pull/491/head v3.5.0-dev.102
Wayne Warthen 1 year ago
parent
commit
5544275e0d
  1. 61
      Source/HBIOS/romldr.asm
  2. 2
      Source/ver.inc
  3. 2
      Source/ver.lib

61
Source/HBIOS/romldr.asm

@ -413,16 +413,12 @@ prompt:
call dsky_l2on
#endif
;
; purge any garbage on the line
call delay ; wait for prompt to be sent
ld b,0 ; failsafe max iterations
purge:
call cst ; anything there?
jr z,wtkey ; if not, move on
call cin ; read and discard
djnz purge ; and loop till no more
call delay ; wait for prompt to be sent?
;
#if (BIOS == BIOS_WBW)
;
call flush ; flush all char units
;
#if (AUTOCON)
or $ff ; initial value
ld (conpend),a ; ... for conpoll routine
@ -459,6 +455,46 @@ clrbuf1:
ret
;
;=======================================================================
; Flush queued data from all character units
;=======================================================================
;
; Prior to starting to poll for a console takeover request, we clean
; out pending data from all character units. The active console
; is included.
;
#if (BIOS == BIOS_WBW)
;
flush:
ld a,(curcon) ; get active console unit
push af ; save it
ld c,0 ; char unit index
;
flush1:
ld b,0 ; loop max failsafe counter
ld a,c ; put char unit in A
ld (curcon),a ; and then make it cur con
;
flush2:
call cst ; char waiting?
jr z,flush3 ; all done, do next unit
call cin ; get and discard char
djnz flush2 ; loop max times
;
flush3:
inc c ; next char unit
ld a,(ciocnt) ; get char unit count
cp c ; unit > cnt?
jr c,flush_z ; done
jr flush1 ; otherwise, do next char unit
;
flush_z:
pop af ; recover active console unit
ld (curcon),a ; and reset to original value
ret ; done
;
#endif
;
;=======================================================================
; Poll character units for console takeover request
;=======================================================================
;
@ -490,8 +526,15 @@ conpoll1:
jr z,conpoll2 ; if no char, move on
call cin ; get char
cp ' ' ; space char?
jr nz,conpoll2 ; if not, move on
jr z,conpoll1a ; if so, handle it
;
; something other than a <space> was received, clear
; the pending console
or $ff ; idle value
ld (conpend),a ; save it
jr conpoll2 ; continue checking
;
conpoll1a:
; a <space> char was typed. check to see if we just saw a
; <space> from this same unit.
ld a,(conpend) ; pending con unit to A

2
Source/ver.inc

@ -2,7 +2,7 @@
#DEFINE RMN 5
#DEFINE RUP 0
#DEFINE RTP 0
#DEFINE BIOSVER "3.5.0-dev.101"
#DEFINE BIOSVER "3.5.0-dev.102"
#define rmj RMJ
#define rmn RMN
#define rup RUP

2
Source/ver.lib

@ -3,5 +3,5 @@ rmn equ 5
rup equ 0
rtp equ 0
biosver macro
db "3.5.0-dev.101"
db "3.5.0-dev.102"
endm

Loading…
Cancel
Save