|
|
@ -31,7 +31,7 @@ |
|
|
; avoid the problem where the code is overlaid during the loading of |
|
|
; avoid the problem where the code is overlaid during the loading of |
|
|
; the desired executable image. |
|
|
; the desired executable image. |
|
|
; |
|
|
; |
|
|
#INCLUDE "std.asm" ; standard RomWBW constants |
|
|
|
|
|
|
|
|
#include "std.asm" ; standard RomWBW constants |
|
|
; |
|
|
; |
|
|
#ifndef BOOT_DEFAULT |
|
|
#ifndef BOOT_DEFAULT |
|
|
#define BOOT_DEFAULT "H" |
|
|
#define BOOT_DEFAULT "H" |
|
|
@ -754,54 +754,15 @@ setcon: |
|
|
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 ; 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 = msw |
|
|
|
|
|
ld a,d ; check all four bytes |
|
|
|
|
|
cp (hl) ; against HL:BC |
|
|
|
|
|
inc hl ; exit to next table |
|
|
|
|
|
jr nz,mm1 ; entry on mismatch |
|
|
|
|
|
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 setspd |
|
|
|
|
|
; |
|
|
|
|
|
mm1: inc hl |
|
|
|
|
|
mm2: inc hl |
|
|
|
|
|
mm3: inc hl |
|
|
|
|
|
mm4: ex (sp),hl ; hl = count value, stack = tbl_baud, de = msw |
|
|
|
|
|
dec l |
|
|
|
|
|
ex (sp),hl ; hl = tbl_baud, stack= count |
|
|
|
|
|
ex de,hl ; hl = msw, de = tbl_baud |
|
|
|
|
|
jr nz,nextbaud |
|
|
|
|
|
; |
|
|
|
|
|
; Failed to match |
|
|
|
|
|
pop de |
|
|
|
|
|
jp err_invcmd |
|
|
|
|
|
; |
|
|
|
|
|
setspd: ld (newspeed),a ; save validated baud rate |
|
|
|
|
|
; |
|
|
|
|
|
ld hl,str_chspeed ; notify user |
|
|
|
|
|
call pstr ; to change |
|
|
|
|
|
call cin ; speed |
|
|
|
|
|
|
|
|
push de ; move char ptr |
|
|
|
|
|
pop ix ; ... to IX |
|
|
|
|
|
call getnum32 ; get 32-bit number |
|
|
|
|
|
jp c,err_invcmd ; handle overflow |
|
|
|
|
|
ld c,75 ; Constant for baud rate encode |
|
|
|
|
|
call encode ; encode into C:4-0 |
|
|
|
|
|
jp nz,err_invcmd ; handle encoding error |
|
|
|
|
|
ld a,c ; move encoded value to A |
|
|
|
|
|
ld (newspeed),a ; save validated baud rate |
|
|
; |
|
|
; |
|
|
; Get the current settings for chosen console |
|
|
; Get the current settings for chosen console |
|
|
ld b,BF_CIOQUERY ; BIOS serial device query |
|
|
ld b,BF_CIOQUERY ; BIOS serial device query |
|
|
@ -815,12 +776,18 @@ setspd: ld (newspeed),a ; save validated baud rate |
|
|
ld hl,newspeed ; and load in new |
|
|
ld hl,newspeed ; and load in new |
|
|
or (hl) ; baud rate |
|
|
or (hl) ; baud rate |
|
|
ld d,a |
|
|
ld d,a |
|
|
|
|
|
; |
|
|
|
|
|
ld hl,str_chspeed ; notify user |
|
|
|
|
|
call pstr ; to change speed |
|
|
|
|
|
call ldelay ; time for line to flush |
|
|
; |
|
|
; |
|
|
ld b,BF_CIOINIT ; BIOS serial init |
|
|
ld b,BF_CIOINIT ; BIOS serial init |
|
|
ld a,(newcon) ; get serial device unit |
|
|
ld a,(newcon) ; get serial device unit |
|
|
ld c,a ; ... into C |
|
|
ld c,a ; ... into C |
|
|
rst 08 ; call HBIOS |
|
|
rst 08 ; call HBIOS |
|
|
jp nz,err_invcmd ; handle error |
|
|
jp nz,err_invcmd ; handle error |
|
|
|
|
|
; |
|
|
|
|
|
call cin ; wait for char at new speed |
|
|
; |
|
|
; |
|
|
; Notify user, we're outta here.... |
|
|
; Notify user, we're outta here.... |
|
|
docon: ld hl,str_newcon ; new console msg |
|
|
docon: ld hl,str_newcon ; new console msg |
|
|
@ -842,90 +809,6 @@ docon: ld hl,str_newcon ; new console msg |
|
|
call pstr ; do it |
|
|
call pstr ; do it |
|
|
ret |
|
|
ret |
|
|
; |
|
|
; |
|
|
;======================================================================= |
|
|
|
|
|
; Get numeric chars at DE and convert to BCD number returned in HL:BC |
|
|
|
|
|
;======================================================================= |
|
|
|
|
|
; |
|
|
|
|
|
getbnum:ld bc,0 ; lsw |
|
|
|
|
|
ld hl,0 ; msw |
|
|
|
|
|
getbnum1: |
|
|
|
|
|
ld a,(de) ; get the active char |
|
|
|
|
|
cp '0' ; compare to ascii '0' |
|
|
|
|
|
jr c,getbnum2 ; abort if below |
|
|
|
|
|
cp '9' + 1 ; compare to ascii '9' |
|
|
|
|
|
jr nc,getbnum2 ; abort if above |
|
|
|
|
|
; |
|
|
|
|
|
sub '0' ; convert '0'-'9' to 0-9 |
|
|
|
|
|
; |
|
|
|
|
|
push de ; save char posn |
|
|
|
|
|
push hl ; save hl bcd |
|
|
|
|
|
; |
|
|
|
|
|
ld hl,tmpbcd ; rotate 1 nyble in A |
|
|
|
|
|
ld (hl),c ; through HL:BC |
|
|
|
|
|
rld |
|
|
|
|
|
ld c,(hl) |
|
|
|
|
|
ld (hl),b |
|
|
|
|
|
rld |
|
|
|
|
|
ld b,(hl) |
|
|
|
|
|
pop de ; get hl bcd |
|
|
|
|
|
ld (hl),e |
|
|
|
|
|
rld |
|
|
|
|
|
ld e,(hl) |
|
|
|
|
|
ld (hl),d |
|
|
|
|
|
rld |
|
|
|
|
|
ld d,(hl) |
|
|
|
|
|
ld h,d |
|
|
|
|
|
ld l,e |
|
|
|
|
|
; |
|
|
|
|
|
pop de ; get char posn |
|
|
|
|
|
inc de ; bump to next char |
|
|
|
|
|
jr getbnum1 ; loop |
|
|
|
|
|
; |
|
|
|
|
|
getbnum2: |
|
|
|
|
|
or a ; with flags set, CF is cleared |
|
|
|
|
|
ret |
|
|
|
|
|
; |
|
|
|
|
|
tmpbcd: .db 0 |
|
|
|
|
|
; |
|
|
|
|
|
#DEFINE PACK(a,b,c,d,e,f,g) \ |
|
|
|
|
|
#DEFCONT \ .db (16*('0'-'0'))+(a-'0')) |
|
|
|
|
|
#DEFCONT \ .db (16*(b-'0'))+(c-'0')) |
|
|
|
|
|
#DEFCONT \ .db (16*(d-'0'))+(e-'0')) |
|
|
|
|
|
#DEFCONT \ .db (16*(f-'0'))+(g-'0')) |
|
|
|
|
|
; |
|
|
|
|
|
tbl_baud: |
|
|
|
|
|
PACK('0','0','0','0','0','7','5') ; 75 0 > 0 |
|
|
|
|
|
PACK('0','0','0','0','1','5','0') ; 150 1 > 1 |
|
|
|
|
|
PACK('0','0','0','0','3','0','0') ; 300 3 > 2 |
|
|
|
|
|
PACK('0','0','0','0','6','0','0') ; 600 5 > 3 |
|
|
|
|
|
PACK('0','0','0','1','2','0','0') ; 1200 7 > 4 |
|
|
|
|
|
PACK('0','0','0','2','4','0','0') ; 2400 9 > 5 |
|
|
|
|
|
PACK('0','0','0','4','8','0','0') ; 4800 11 > 6 |
|
|
|
|
|
PACK('0','0','0','9','6','0','0') ; 9600 13 > 7 |
|
|
|
|
|
PACK('0','0','1','9','2','0','0') ; 19200 15 > 8 |
|
|
|
|
|
PACK('0','0','3','8','4','0','0') ; 38400 17 > 9 |
|
|
|
|
|
PACK('0','0','7','6','8','0','0') ; 76800 19 > 10 |
|
|
|
|
|
PACK('0','1','5','3','6','0','0') ; 153600 21 > 11 |
|
|
|
|
|
PACK('0','3','0','7','2','0','0') ; 307200 23 > 12 |
|
|
|
|
|
PACK('0','6','1','4','4','0','0') ; 614400 25 > 13 |
|
|
|
|
|
PACK('1','2','2','8','8','0','0') ; 1228800 27 > 14 |
|
|
|
|
|
PACK('2','4','5','7','6','0','0') ; 2457600 29 > 15 |
|
|
|
|
|
PACK('0','0','0','0','2','2','5') ; 225 2 > 16 |
|
|
|
|
|
PACK('0','0','0','0','4','5','0') ; 450 4 > 17 |
|
|
|
|
|
PACK('0','0','0','0','9','0','0') ; 900 6 > 18 |
|
|
|
|
|
PACK('0','0','0','1','8','0','0') ; 1800 8 > 19 |
|
|
|
|
|
PACK('0','0','0','3','6','0','0') ; 3600 10 > 20 |
|
|
|
|
|
PACK('0','0','0','7','2','0','0') ; 7200 12 > 21 |
|
|
|
|
|
PACK('0','0','1','4','4','0','0') ; 14400 14 > 22 |
|
|
|
|
|
PACK('0','0','2','8','8','0','0') ; 28800 16 > 23 |
|
|
|
|
|
PACK('0','0','5','7','6','0','0') ; 57600 18 > 24 |
|
|
|
|
|
PACK('0','1','1','5','2','0','0') ; 115200 20 > 25 |
|
|
|
|
|
PACK('0','2','3','0','4','0','0') ; 230400 22 > 26 |
|
|
|
|
|
PACK('0','4','6','0','8','0','0') ; 460800 24 > 27 |
|
|
|
|
|
PACK('0','9','2','1','6','0','0') ; 921600 26 > 28 |
|
|
|
|
|
PACK('1','8','4','3','2','0','0') ; 1843200 28 > 29 |
|
|
|
|
|
PACK('3','6','8','6','4','0','0') ; 3686400 30 > 30 |
|
|
|
|
|
PACK('7','3','7','2','8','0','0') ; 7372800 31 > 31 |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
; |
|
|
; |
|
|
; Set RomWBW HBIOS Diagnostic Level |
|
|
; Set RomWBW HBIOS Diagnostic Level |
|
|
@ -1514,10 +1397,13 @@ pvol1: |
|
|
nl2: |
|
|
nl2: |
|
|
call nl ; double newline |
|
|
call nl ; double newline |
|
|
nl: |
|
|
nl: |
|
|
|
|
|
push af |
|
|
ld a,cr ; cr |
|
|
ld a,cr ; cr |
|
|
call cout ; send it |
|
|
call cout ; send it |
|
|
ld a,lf ; lf |
|
|
ld a,lf ; lf |
|
|
jp cout ; send it and return |
|
|
|
|
|
|
|
|
call cout ; send it and return |
|
|
|
|
|
pop af |
|
|
|
|
|
ret |
|
|
; |
|
|
; |
|
|
; Print a dot on console |
|
|
; Print a dot on console |
|
|
; |
|
|
; |
|
|
@ -1929,6 +1815,110 @@ hexconv: |
|
|
daa |
|
|
daa |
|
|
ret |
|
|
ret |
|
|
; |
|
|
; |
|
|
|
|
|
#if (BIOS == BIOS_WBW) |
|
|
|
|
|
; |
|
|
|
|
|
; Get numeric chars and convert to 32-bit number returned in DE:HL |
|
|
|
|
|
; IX points to start of char buffer |
|
|
|
|
|
; Carry flag set on overflow |
|
|
|
|
|
; |
|
|
|
|
|
getnum32: |
|
|
|
|
|
ld de,0 ; Initialize DE:HL |
|
|
|
|
|
ld hl,0 ; ... to zero |
|
|
|
|
|
getnum32a: |
|
|
|
|
|
ld a,(ix) ; get the active char |
|
|
|
|
|
cp '0' ; compare to ascii '0' |
|
|
|
|
|
jr c,getnum32c ; abort if below |
|
|
|
|
|
cp '9' + 1 ; compare to ascii '9' |
|
|
|
|
|
jr nc,getnum32c ; abort if above |
|
|
|
|
|
; |
|
|
|
|
|
; valid digit, multiply DE:HL by 10 |
|
|
|
|
|
; X * 10 = (((x * 2 * 2) + x)) * 2 |
|
|
|
|
|
push de |
|
|
|
|
|
push hl |
|
|
|
|
|
; |
|
|
|
|
|
call getnum32e ; DE:HL *= 2 |
|
|
|
|
|
jr c,getnum32d ; if overflow, ret w/ CF & stack pop |
|
|
|
|
|
; |
|
|
|
|
|
call getnum32e ; DE:HL *= 2 |
|
|
|
|
|
jr c,getnum32d ; if overflow, ret w/ CF & stack pop |
|
|
|
|
|
; |
|
|
|
|
|
pop bc ; DE:HL += X |
|
|
|
|
|
add hl,bc |
|
|
|
|
|
ex de,hl |
|
|
|
|
|
pop bc |
|
|
|
|
|
adc hl,bc |
|
|
|
|
|
ex de,hl |
|
|
|
|
|
ret c ; if overflow, ret w/ CF |
|
|
|
|
|
; |
|
|
|
|
|
call getnum32e ; DE:HL *= 2 |
|
|
|
|
|
ret c ; if overflow, ret w/ CF |
|
|
|
|
|
; |
|
|
|
|
|
; now add in new digit |
|
|
|
|
|
ld a,(ix) ; get the active char |
|
|
|
|
|
sub '0' ; make it binary |
|
|
|
|
|
add a,l ; add to L, CF updated |
|
|
|
|
|
ld l,a ; back to L |
|
|
|
|
|
jr nc,getnum32b ; if no carry, done |
|
|
|
|
|
inc h ; otherwise, bump H |
|
|
|
|
|
jr nz,getnum32b ; if no overflow, done |
|
|
|
|
|
inc e ; otherwise, bump E |
|
|
|
|
|
jr nz,getnum32b ; if no overflow, done |
|
|
|
|
|
inc d ; otherwise, bump D |
|
|
|
|
|
jr nz,getnum32b ; if no overflow, done |
|
|
|
|
|
scf ; set carry flag to indicate overflow |
|
|
|
|
|
ret ; and return |
|
|
|
|
|
; |
|
|
|
|
|
getnum32b: |
|
|
|
|
|
inc ix ; bump to next char |
|
|
|
|
|
jr getnum32a ; loop |
|
|
|
|
|
; |
|
|
|
|
|
getnum32c: |
|
|
|
|
|
; successful completion |
|
|
|
|
|
xor a ; clear flags |
|
|
|
|
|
ret ; and return |
|
|
|
|
|
; |
|
|
|
|
|
getnum32d: |
|
|
|
|
|
; special overflow exit with stack fixup |
|
|
|
|
|
pop hl ; burn 2 |
|
|
|
|
|
pop hl ; ... stack entries |
|
|
|
|
|
ret ; and return |
|
|
|
|
|
; |
|
|
|
|
|
getnum32e: |
|
|
|
|
|
; DE:HL := DE:HL * 2 |
|
|
|
|
|
sla l |
|
|
|
|
|
rl h |
|
|
|
|
|
rl e |
|
|
|
|
|
rl d |
|
|
|
|
|
ret |
|
|
|
|
|
; |
|
|
|
|
|
; Integer divide DE:HL by C |
|
|
|
|
|
; result in DE:HL, remainder in A |
|
|
|
|
|
; clobbers F, B |
|
|
|
|
|
; |
|
|
|
|
|
div32x8: |
|
|
|
|
|
xor a |
|
|
|
|
|
ld b,32 |
|
|
|
|
|
div32x8a: |
|
|
|
|
|
add hl,hl |
|
|
|
|
|
rl e |
|
|
|
|
|
rl d |
|
|
|
|
|
rla |
|
|
|
|
|
cp c |
|
|
|
|
|
jr c,div32x8b |
|
|
|
|
|
sub c |
|
|
|
|
|
inc l |
|
|
|
|
|
div32x8b: |
|
|
|
|
|
djnz div32x8a |
|
|
|
|
|
ret |
|
|
|
|
|
; |
|
|
|
|
|
DIV32X8 .equ div32x8 |
|
|
|
|
|
; |
|
|
|
|
|
#include "encode.asm" ; baud rate encoding routine |
|
|
|
|
|
; |
|
|
|
|
|
encode .equ ENCODE |
|
|
|
|
|
; |
|
|
|
|
|
#endif |
|
|
|
|
|
; |
|
|
;======================================================================= |
|
|
;======================================================================= |
|
|
; Console character I/O helper routines (registers preserved) |
|
|
; Console character I/O helper routines (registers preserved) |
|
|
;======================================================================= |
|
|
;======================================================================= |
|
|
|