|
|
@ -493,22 +493,66 @@ setcon: |
|
|
pop de |
|
|
pop de |
|
|
jp nc,err_nocon ; handle invalid unit |
|
|
jp nc,err_nocon ; handle invalid unit |
|
|
ld (newcon),a ; save validated console |
|
|
ld (newcon),a ; save validated console |
|
|
#if (1) |
|
|
|
|
|
;---------------------------------------; text board rate |
|
|
|
|
|
|
|
|
; |
|
|
; Get baud rate |
|
|
; Get baud rate |
|
|
call findws |
|
|
call findws |
|
|
call skipws ; skip whitespace |
|
|
call skipws ; skip whitespace |
|
|
call isnum ; do we have a number? |
|
|
call isnum ; do we have a number? |
|
|
jp nz,docon ; if no we don't change baudrate |
|
|
jp nz,docon ; if no we don't change baudrate |
|
|
|
|
|
|
|
|
call getbnum |
|
|
|
|
|
|
|
|
|
|
|
ex de,hl |
|
|
|
|
|
call prthex32 |
|
|
|
|
|
call prthexword |
|
|
|
|
|
|
|
|
|
|
|
ld a,17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call getbnum ; return in HL:BC |
|
|
|
|
|
; |
|
|
|
|
|
ld e,32 ; search baud rate table |
|
|
|
|
|
push de ; for a matching entry |
|
|
|
|
|
ld de,tbl_baud |
|
|
|
|
|
nextbaud: |
|
|
|
|
|
ex de,hl ; hl = tbl_baud, de = msb |
|
|
|
|
|
ld a,d |
|
|
|
|
|
cp (hl) |
|
|
|
|
|
inc hl |
|
|
|
|
|
jr nz,mm1 |
|
|
|
|
|
ld a,e |
|
|
|
|
|
cp (hl) |
|
|
|
|
|
inc hl |
|
|
|
|
|
jr nz,mm2 |
|
|
|
|
|
ld a,b |
|
|
|
|
|
cp (hl) |
|
|
|
|
|
inc hl |
|
|
|
|
|
jr nz,mm3 |
|
|
|
|
|
ld a,c |
|
|
|
|
|
cp (hl) |
|
|
|
|
|
inc hl |
|
|
|
|
|
jr nz,mm4 |
|
|
|
|
|
; |
|
|
|
|
|
; we have a match |
|
|
|
|
|
pop de ; get our count value |
|
|
|
|
|
ld a,32 |
|
|
|
|
|
sub e |
|
|
|
|
|
jr s_exit |
|
|
|
|
|
; |
|
|
|
|
|
mm1: inc hl |
|
|
|
|
|
mm2: inc hl |
|
|
|
|
|
mm3: inc hl |
|
|
|
|
|
mm4: ex (sp),hl ; hl= count value, stack= tbl_baud, de=msb |
|
|
|
|
|
dec l |
|
|
|
|
|
ex (sp),hl ; hl=tbl_baud, stack= count |
|
|
|
|
|
ex de,hl ; hl = msb, de = tbl_baud |
|
|
|
|
|
jr nz,nextbaud |
|
|
|
|
|
; |
|
|
|
|
|
; Failed to match |
|
|
|
|
|
pop de |
|
|
|
|
|
jp err_invcmd |
|
|
|
|
|
; |
|
|
|
|
|
s_exit: cp 32 ; handle invalid |
|
|
|
|
|
jp nc,err_invcmd ; baud rate |
|
|
|
|
|
bit 0,a |
|
|
|
|
|
jr z,iseven ; convert sequential |
|
|
|
|
|
inc a ; baud rate code to |
|
|
|
|
|
srl a ; encoded baud rate |
|
|
|
|
|
jr setspd ; 13=9600 |
|
|
|
|
|
iseven: dec a ; 15=19200 |
|
|
|
|
|
srl a ; 17=38400 |
|
|
|
|
|
add a,16 ; 20=115200 |
|
|
|
|
|
; |
|
|
setspd: ld (newspeed),a ; save validated baud rate |
|
|
setspd: ld (newspeed),a ; save validated baud rate |
|
|
; |
|
|
; |
|
|
ld hl,str_chspeed ; notify user |
|
|
ld hl,str_chspeed ; notify user |
|
|
@ -552,155 +596,66 @@ docon: ld hl,str_newcon ; new console msg |
|
|
ld hl,str_banner ; display boot banner |
|
|
ld hl,str_banner ; display boot banner |
|
|
call pstr ; do it |
|
|
call pstr ; do it |
|
|
ret |
|
|
ret |
|
|
|
|
|
|
|
|
; get big number in c:de:hl |
|
|
|
|
|
; |
|
|
; |
|
|
; Get numeric chars at DE and convert to number returned in HL:DE:BC |
|
|
|
|
|
; Carry flag set on overflow |
|
|
|
|
|
|
|
|
;======================================================================= |
|
|
|
|
|
; Get numeric chars at DE and convert to BCD number returned in HL:BC |
|
|
|
|
|
;======================================================================= |
|
|
; |
|
|
; |
|
|
|
|
|
|
|
|
tmpbcd: .db 0 |
|
|
|
|
|
|
|
|
|
|
|
getbnum:push de ; cmd posn |
|
|
|
|
|
ld bc,0 ; lsb |
|
|
|
|
|
ld de,0 |
|
|
|
|
|
|
|
|
getbnum:ld bc,0 ; lsb |
|
|
ld hl,0 ; msb |
|
|
ld hl,0 ; msb |
|
|
getbnum1: |
|
|
getbnum1: |
|
|
ex (sp),hl |
|
|
|
|
|
ld a,(hl) ; get the active char |
|
|
|
|
|
ex (sp),hl |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ld a,(de) ; get the active char |
|
|
cp '0' ; compare to ascii '0' |
|
|
cp '0' ; compare to ascii '0' |
|
|
jr c,getbnum2 ; abort if below |
|
|
jr c,getbnum2 ; abort if below |
|
|
cp '9' + 1 ; compare to ascii '9' |
|
|
cp '9' + 1 ; compare to ascii '9' |
|
|
jr nc,getbnum2 ; abort if above |
|
|
jr nc,getbnum2 ; abort if above |
|
|
; |
|
|
; |
|
|
sub '0' ; convert '0'-'9' to 0-9 |
|
|
sub '0' ; convert '0'-'9' to 0-9 |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
push de ; save char posn |
|
|
push hl ; save hl bcd |
|
|
push hl ; save hl bcd |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
ld hl,tmpbcd |
|
|
ld hl,tmpbcd |
|
|
|
|
|
|
|
|
ld (hl),c |
|
|
ld (hl),c |
|
|
rld |
|
|
rld |
|
|
ld c,(hl) |
|
|
ld c,(hl) |
|
|
|
|
|
|
|
|
ld (hl),b |
|
|
ld (hl),b |
|
|
rld |
|
|
rld |
|
|
ld b,(hl) |
|
|
ld b,(hl) |
|
|
|
|
|
|
|
|
ld (hl),e |
|
|
|
|
|
rld |
|
|
|
|
|
ld e,(hl) |
|
|
|
|
|
|
|
|
|
|
|
ld (hl),d |
|
|
|
|
|
rld |
|
|
|
|
|
ld d,(hl) |
|
|
|
|
|
|
|
|
|
|
|
ex de,hl ; hl= de bcd, de=tmpbcd |
|
|
|
|
|
ex (sp),hl ; hl= hl bcd, stack = de bcd |
|
|
|
|
|
ex de,hl ; hl= tmpbcd, de=hl bcd |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pop de ; get hl bcd |
|
|
ld (hl),e |
|
|
ld (hl),e |
|
|
rld |
|
|
rld |
|
|
ld e,(hl) |
|
|
ld e,(hl) |
|
|
|
|
|
|
|
|
ld (hl),d |
|
|
ld (hl),d |
|
|
rld |
|
|
rld |
|
|
ld d,(hl) |
|
|
ld d,(hl) |
|
|
|
|
|
|
|
|
ex de,hl ; hl= hl bcd |
|
|
|
|
|
pop de ; de= de bcd |
|
|
|
|
|
|
|
|
|
|
|
ex (sp),hl |
|
|
|
|
|
inc hl ; bump to next char |
|
|
|
|
|
ex (sp),hl |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ld h,d |
|
|
|
|
|
ld l,e |
|
|
|
|
|
; |
|
|
|
|
|
pop de ; get char posn |
|
|
|
|
|
inc de ; bump to next char |
|
|
jr getbnum1 ; loop |
|
|
jr getbnum1 ; loop |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
getbnum2: |
|
|
getbnum2: |
|
|
pop af ; dump char posn |
|
|
|
|
|
or a ; with flags set, CF is cleared |
|
|
or a ; with flags set, CF is cleared |
|
|
ret |
|
|
ret |
|
|
|
|
|
|
|
|
#else |
|
|
|
|
|
;---------------------------------------; code baud rate |
|
|
|
|
|
; Get baud rate |
|
|
|
|
|
call findws |
|
|
|
|
|
call skipws ; skip whitespace |
|
|
|
|
|
call isnum ; do we have a number? |
|
|
|
|
|
jp nz,docon ; if no we don't change baudrate |
|
|
|
|
|
call getnum ; parse a number |
|
|
|
|
|
jp c,err_invcmd ; handle overflow error |
|
|
|
|
|
; |
|
|
|
|
|
cp 32 ; handle invalid |
|
|
|
|
|
jp nc,err_invcmd ; baud rate |
|
|
|
|
|
bit 0,a |
|
|
|
|
|
jr z,iseven ; convert sequential |
|
|
|
|
|
inc a ; baud rate code to |
|
|
|
|
|
srl a ; encoded baud rate |
|
|
|
|
|
jr setspd ; 13=9600 |
|
|
|
|
|
iseven: dec a ; 15=19200 |
|
|
|
|
|
srl a ; 17=38400 |
|
|
|
|
|
add a,16 ; 20=115200 |
|
|
|
|
|
setspd: ld (newspeed),a ; save validated baud rate |
|
|
|
|
|
; |
|
|
|
|
|
ld hl,str_chspeed ; notify user |
|
|
|
|
|
call pstr ; to change |
|
|
|
|
|
call cin ; speed |
|
|
|
|
|
; |
|
|
; |
|
|
; Get the current settings for chosen console |
|
|
|
|
|
ld b,BF_CIOQUERY ; BIOS serial device query |
|
|
|
|
|
ld a,(newcon) ; get device unit num |
|
|
|
|
|
ld c,a ; ... and put in C |
|
|
|
|
|
rst 08 ; call H/UBIOS, DE := line characteristics |
|
|
|
|
|
jp nz,err_invcmd ; abort on error |
|
|
|
|
|
; |
|
|
|
|
|
ld a,d ; mask off current |
|
|
|
|
|
and $11100000 ; baud rate |
|
|
|
|
|
ld hl,newspeed ; and load in new |
|
|
|
|
|
or (hl) ; baud rate |
|
|
|
|
|
ld d,a |
|
|
|
|
|
; |
|
|
|
|
|
ld b,BF_CIOINIT ; BIOS serial init |
|
|
|
|
|
ld a,(newcon) ; get serial device unit |
|
|
|
|
|
ld c,a ; ... into C |
|
|
|
|
|
rst 08 ; call HBIOS |
|
|
|
|
|
jp nz,err_invcmd ; handle error |
|
|
|
|
|
; |
|
|
|
|
|
; Notify user, we're outta here.... |
|
|
|
|
|
docon: ld hl,str_newcon ; new console msg |
|
|
|
|
|
call pstr ; print string on cur console |
|
|
|
|
|
ld a,(newcon) ; restore new console unit |
|
|
|
|
|
call prtdecb ; print unit num |
|
|
|
|
|
; |
|
|
|
|
|
; Set console unit |
|
|
|
|
|
ld b,BF_SYSPOKE ; HBIOS func: POKE |
|
|
|
|
|
ld d,BID_BIOS ; BIOS bank |
|
|
|
|
|
ld e,a ; Char unit value |
|
|
|
|
|
ld hl,HCB_LOC + HCB_CONDEV ; Con unit num in HCB |
|
|
|
|
|
rst 08 ; do it |
|
|
|
|
|
|
|
|
tmpbcd: .db 0 |
|
|
; |
|
|
; |
|
|
; Display loader prompt on new console |
|
|
|
|
|
call nl2 ; formatting |
|
|
|
|
|
ld hl,str_banner ; display boot banner |
|
|
|
|
|
call pstr ; do it |
|
|
|
|
|
ret |
|
|
|
|
|
; done |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#DEFINE LW(a,b,c,d,e,f,g) \ |
|
|
#DEFINE LW(a,b,c,d,e,f,g) \ |
|
|
#DEFCONT \ .db (16*('0'-'0'))+(a-'0')) |
|
|
#DEFCONT \ .db (16*('0'-'0'))+(a-'0')) |
|
|
#DEFCONT \ .db (16*(b-'0'))+(c-'0')) |
|
|
#DEFCONT \ .db (16*(b-'0'))+(c-'0')) |
|
|
#DEFCONT \ .db (16*(d-'0'))+(e-'0')) |
|
|
#DEFCONT \ .db (16*(d-'0'))+(e-'0')) |
|
|
#DEFCONT \ .db (16*(f-'0'))+(g-'0')) |
|
|
#DEFCONT \ .db (16*(f-'0'))+(g-'0')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
tbl_baud: |
|
|
LW('0','0','0','0','0','7','5') |
|
|
LW('0','0','0','0','0','7','5') |
|
|
LW('0','0','0','0','1','5','0') |
|
|
LW('0','0','0','0','1','5','0') |
|
|
LW('0','0','0','0','2','2','5') |
|
|
LW('0','0','0','0','2','2','5') |
|
|
LW('0','0','0','0','3','0','0') |
|
|
LW('0','0','0','0','3','0','0') |
|
|
|
|
|
LW('0','0','0','0','4','5','0') |
|
|
LW('0','0','0','0','6','0','0') |
|
|
LW('0','0','0','0','6','0','0') |
|
|
|
|
|
LW('0','0','0','0','9','0','0') |
|
|
LW('0','0','0','1','2','0','0') |
|
|
LW('0','0','0','1','2','0','0') |
|
|
LW('0','0','0','1','8','0','0') |
|
|
LW('0','0','0','1','8','0','0') |
|
|
LW('0','0','0','2','4','0','0') |
|
|
LW('0','0','0','2','4','0','0') |
|
|
@ -708,14 +663,12 @@ docon: ld hl,str_newcon ; new console msg |
|
|
LW('0','0','0','4','8','0','0') |
|
|
LW('0','0','0','4','8','0','0') |
|
|
LW('0','0','0','7','2','0','0') |
|
|
LW('0','0','0','7','2','0','0') |
|
|
LW('0','0','0','9','6','0','0') |
|
|
LW('0','0','0','9','6','0','0') |
|
|
|
|
|
|
|
|
LW('0','0','1','4','4','0','0') |
|
|
LW('0','0','1','4','4','0','0') |
|
|
LW('0','0','1','9','2','0','0') |
|
|
LW('0','0','1','9','2','0','0') |
|
|
LW('0','0','2','8','8','0','0') |
|
|
LW('0','0','2','8','8','0','0') |
|
|
LW('0','0','3','8','4','0','0') |
|
|
LW('0','0','3','8','4','0','0') |
|
|
LW('0','0','5','7','6','0','0') |
|
|
LW('0','0','5','7','6','0','0') |
|
|
LW('0','0','7','6','8','0','0') |
|
|
LW('0','0','7','6','8','0','0') |
|
|
|
|
|
|
|
|
LW('0','1','1','5','2','0','0') |
|
|
LW('0','1','1','5','2','0','0') |
|
|
LW('0','1','5','3','6','0','0') |
|
|
LW('0','1','5','3','6','0','0') |
|
|
LW('0','2','3','0','4','0','0') |
|
|
LW('0','2','3','0','4','0','0') |
|
|
@ -728,39 +681,7 @@ docon: ld hl,str_newcon ; new console msg |
|
|
LW('2','4','5','7','6','0','0') |
|
|
LW('2','4','5','7','6','0','0') |
|
|
LW('3','6','8','6','4','0','0') |
|
|
LW('3','6','8','6','4','0','0') |
|
|
LW('7','3','7','2','8','0','0') |
|
|
LW('7','3','7','2','8','0','0') |
|
|
|
|
|
|
|
|
.db "7","5"+80h |
|
|
|
|
|
.db "15","0"+80h |
|
|
|
|
|
.db "22","5"+80h |
|
|
|
|
|
.db "30","0"+80h |
|
|
|
|
|
.db "60","0"+80h |
|
|
|
|
|
.db "90","0"+80h |
|
|
|
|
|
.db "120","0"+80h |
|
|
|
|
|
.db "180","0"+80h |
|
|
|
|
|
.db "240","0"+80h |
|
|
|
|
|
.db "360","0"+80h |
|
|
|
|
|
.db "480","0"+80h |
|
|
|
|
|
.db "720","0"+80h |
|
|
|
|
|
.db "960","0"+80h |
|
|
|
|
|
.db "1440","0"+80h |
|
|
|
|
|
.db "1920","0"+80h |
|
|
|
|
|
.db "2880","0"+80h |
|
|
|
|
|
.db "3840","0"+80h |
|
|
|
|
|
.db "5760","0"+80h |
|
|
|
|
|
.db "7680","0"+80h |
|
|
|
|
|
.db "11520","0"+80h |
|
|
|
|
|
.db "15360","0"+80h |
|
|
|
|
|
.db "23040","0"+80h |
|
|
|
|
|
.db "30720","0"+80h |
|
|
|
|
|
.db "46080","0"+80h |
|
|
|
|
|
.db "61440","0"+80h |
|
|
|
|
|
.db "92160","0"+80h |
|
|
|
|
|
.db "122800","0"+80h |
|
|
|
|
|
.db "184320","0"+80h |
|
|
|
|
|
.db "245760","0"+80h |
|
|
|
|
|
.db "368640","0"+80h |
|
|
|
|
|
.db "737280","0"+80h |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
;------|----------|------|----------|------|----------|------|----------| |
|
|
;------|----------|------|----------|------|----------|------|----------| |
|
|
; 0 | 75 | 8 | 1800 | 16 | 28800 | 24 | 460800 | |
|
|
; 0 | 75 | 8 | 1800 | 16 | 28800 | 24 | 460800 | |
|
|
; 1 | 150 | 9 | 2400 | 17 | 38400 | 25 | 614400 | |
|
|
; 1 | 150 | 9 | 2400 | 17 | 38400 | 25 | 614400 | |
|
|
@ -771,7 +692,6 @@ docon: ld hl,str_newcon ; new console msg |
|
|
; 6 | 900 | 14 | 14400 | 22 | 230400 | 30 | 3686400 | |
|
|
; 6 | 900 | 14 | 14400 | 22 | 230400 | 30 | 3686400 | |
|
|
; 7 | 1200 | 15 | 19200 | 23 | 307200 | 31 | 7372800 | |
|
|
; 7 | 1200 | 15 | 19200 | 23 | 307200 | 31 | 7372800 | |
|
|
;------------------------------------------------------------------------ |
|
|
;------------------------------------------------------------------------ |
|
|
|
|
|
|
|
|
; |
|
|
; |
|
|
#endif |
|
|
#endif |
|
|
; |
|
|
; |
|
|
|