From d5936b7fb53e16d18621ebc0ae062fb3aff886cd Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Mon, 28 Aug 2017 17:15:28 -0700 Subject: [PATCH] Minor App Updates Improve handling of UNA in XModem and MODE commands. --- Source/Apps/Mode.asm | 56 +++++++++++------------ Source/Apps/XM125/xmdm125.asm | 2 +- Source/Apps/XM125/xmhb.180 | 86 +++++++++++++++++++++++++++-------- 3 files changed, 96 insertions(+), 48 deletions(-) diff --git a/Source/Apps/Mode.asm b/Source/Apps/Mode.asm index 38729d64..c9fa6383 100644 --- a/Source/Apps/Mode.asm +++ b/Source/Apps/Mode.asm @@ -29,6 +29,7 @@ ; ; Change Log: ; 2017-08-16 [WBW] Initial release +; 2017-08-28 [WBW] Handle UNACPM ;_______________________________________________________________________________ ; ; ToDo: @@ -44,7 +45,7 @@ stksiz .equ $40 ; Working stack size restart .equ $0000 ; CP/M restart vector bdos .equ $0005 ; BDOS invocation vector ; -stamp .equ $40 ; loc of RomWBW CBIOS zero page stamp +ident .equ $FFFE ; loc of RomWBW HBIOS ident ptr ; rmj .equ 2 ; intended CBIOS version - major rmn .equ 8 ; intended CBIOS version - minor @@ -85,28 +86,11 @@ exit: ; clean up and return to command processor ; Initialization ; init: -; ; locate start of cbios (function jump table) ld hl,(restart+1) ; load address of CP/M restart vector ld de,-3 ; adjustment for start of table add hl,de ; HL now has start of table ld (bioloc),hl ; save it -; - ; get location of config data and verify integrity - ld hl,stamp ; HL := adr or RomWBW zero page stamp - ld a,(hl) ; get first byte of RomWBW marker - cp 'W' ; match? - jp nz,errinv ; abort with invalid config block - inc hl ; next byte (marker byte 2) - ld a,(hl) ; load it - cp ~'W' ; match? - jp nz,errinv ; abort with invalid config block - inc hl ; next byte (major/minor version) - ld a,(hl) ; load it - cp rmj << 4 | rmn ; match? - jp nz,errver ; abort with invalid os version - inc hl ; bump past - inc hl ; ... version info ; ; check for UNA (UBIOS) ld a,($FFFD) ; fixed location of UNA API vector @@ -120,22 +104,38 @@ init: ld a,(hl) ; get next byte cp $E5 ; second byte of UNA push ix instruction jr nz,initwbw ; if not, not UNA +; + ; UNA initialization ld hl,unamod ; point to UNA mode flag ld (hl),$FF ; set UNA mode flag ld a,$FF ; assume max units for UNA - ld a,2 ; *debug* ld (comcnt),a ; ... and save it jr initx ; UNA init done ; initwbw: - ; get count of serial units + ; get location of config data and verify integrity + ld hl,(ident) ; HL := adr or RomWBW HBIOS ident + ld a,(hl) ; get first byte of RomWBW marker + cp 'W' ; match? + jp nz,errinv ; abort with invalid config block + inc hl ; next byte (marker byte 2) + ld a,(hl) ; load it + cp ~'W' ; match? + jp nz,errinv ; abort with invalid config block + inc hl ; next byte (major/minor version) + ld a,(hl) ; load it + cp rmj << 4 | rmn ; match? + jp nz,errver ; abort with invalid os version +; + ; RomWBW initialization ld b,bf_sysget ; BIOS SYSGET function ld c,$00 ; CIOCNT subfunction rst 08 ; E := serial device unit count ld a,e ; count to A ld (comcnt),a ; save it ; -initx: ; initialization complete +initx + ; initialization complete xor a ; signal success ret ; return ; @@ -215,8 +215,6 @@ comset1: jr nc,comset1a ; ... to handle empty ; call getnum32 ; get baud rate into DE:HL - ;call crlf ; *debug* - ;call prthex32 ; *debug* jp c,errcfg ; Handle error ld c,75 ; Constant for baud rate encode call encode ; encode into C:4-0 @@ -944,11 +942,11 @@ errprm: ; command parameter error (syntax) ld de,msgprm jr err ; -errinv: ; invalid CBIOS, zp signature not found +errinv: ; invalid HBIOS, signature not found ld de,msginv jr err ; -errver: ; CBIOS version is not as expected +errver: ; unsupported HBIOS version ld de,msgver jr err ; @@ -1018,18 +1016,18 @@ stack .equ $ ; stack top ; Messages ; indent .db " ",0 -msgban1 .db "MODE v1.0 for RomWBW CP/M 2.2, 22-Aug-2017",0 +msgban1 .db "MODE v1.1, 28-Aug-2017",0 msghb .db " [HBIOS]",0 msgub .db " [UBIOS]",0 -msgban2 .db "Copyright 2017, Wayne Warthen, GNU GPL v3",0 +msgban2 .db "Copyright (C) 2017, Wayne Warthen, GNU GPL v3",0 msguse .db "Usage: MODE COM: [[,[,[,]]]] [/P]",13,10 .db " ex. MODE /? (display version and usage)",13,10 .db " MODE (display config of all serial ports)",13,10 .db " MODE COM0: (display serial unit 0 config)",13,10 .db " MODE COM1: 9600,N,8,1 (set serial unit 1 config)",0 msgprm .db "Parameter error (MODE /? for usage)",0 -msginv .db "Unexpected CBIOS (signature missing)",0 -msgver .db "Unexpected CBIOS version",0 +msginv .db "Invalid BIOS (signature missing)",0 +msgver .db "Unexpected HBIOS version",0 msgdev .db "Invalid device name",0 msgnum .db "Unit or slice number invalid",0 msgunt .db "Invalid device unit number specified",0 diff --git a/Source/Apps/XM125/xmdm125.asm b/Source/Apps/XM125/xmdm125.asm index b2931990..1e375bc8 100644 --- a/Source/Apps/XM125/xmdm125.asm +++ b/Source/Apps/XM125/xmdm125.asm @@ -328,7 +328,7 @@ MAXMIN EQU 60 ; Minutes for maximum file transfer time. ; Length of external patch program. If over 128 bytes, get/set size ; LARGEIO EQU YES ; Yes, if modem patch area over 128 bytes -LARSIZE EQU 100H ; If 'LARGEIO' set patch area size (bytes) here +LARSIZE EQU 180H ; If 'LARGEIO' set patch area size (bytes) here ; ;======================================================================= ; diff --git a/Source/Apps/XM125/xmhb.180 b/Source/Apps/XM125/xmhb.180 index 189ab276..cc94eac3 100644 --- a/Source/Apps/XM125/xmhb.180 +++ b/Source/Apps/XM125/xmhb.180 @@ -21,6 +21,8 @@ ERRDET EQU NO ; detect parity/framing/overrun errs ; BASE EQU 100H ; start of cp/m normal program area ; +BDOS EQU 00005H ; BDOS function dispatch vector +; ;======================================================================= ; ; Jump table: The jump table must be in exactly the same sequence as the @@ -59,22 +61,33 @@ CONOUT EQU 0 ; not used ; entries as appropriate. ; MINIT: +; + ; Announce + LD DE,RBC ; RetroBrew Computers + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; ; Get system type - LD D,2 - LD E,2 - MLT DE - BIT 2,E ; bit 2 wil be set if mlt happend - LD HL,U_JPTBL ; assume Z80 (UART) - LD A,10 ; assume 10MHz CPU in case of Z80 - JR Z,MINIT2 ; yes, Z80, do vector copy - LD HL,A_JPTBL ; otherwise Z180 (ASCI) - LD A,20 ; assume 20MHz CPU in case of Z180 + LD DE,00202H ; D := 2, E := 2 + MLT DE ; DE := D * E == 4 + BIT 2,E ; Bit 2 wil be set if mlt happend + LD HL,U_JPTBL ; Assume Z80 (UART) + LD DE,UART ; UART port notification string + JR Z,MINIT2 ; Yes, Z80, do vector copy + LD HL,A_JPTBL ; Otherwise Z180 (ASCI) + LD DE,ASCI ; ASCI port notification string ; MINIT2: + ; Display port notification string + PUSH HL ; Save HL + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + POP HL ; Recover HL +; ; Copy real vectors into active jump table - LD DE,JPTBL - LD BC,7 * 3 ; copy 7 3-byte entries - LDIR + LD DE,JPTBL ; Real jump table is destination + LD BC,7 * 3 ; Copy 7 3-byte entries + LDIR ; Do the copy ; ; Check for UNA (UBIOS) LD A,(0FFFDH) ; fixed location of UNA API vector @@ -89,7 +102,12 @@ MINIT2: CP 0E5H ; second byte of UNA push ix instruction JR NZ,MINIT3 ; if not, not UNA ; - ; Get CPU speed from UNA + ; Display UNA notification string + LD DE,UBIOS ; BIOS notification string + LD C,9 ; BDOS string display function + CALL BDOS +; + ; Get CPU speed from UNA and return LD C,0F8H ; UNA BIOS Get PHI function RST 08 ; Returns speed in Hz in DE:HL LD A,E ; Hack to get approx speed in MHz @@ -98,15 +116,47 @@ MINIT2: SRL A ; ... SRL A ; ... INC A ; Fix up for value truncation - RET ; done + RET ; Done ; MINIT3: - ; Not UNA, use HBIOS for CPU speed lookup + ; Not UNA, try RomwBW HBIOS for CPU speed lookup + LD HL,(0FFFEH) ; HL := HBIOS ident location + LD A,'W' ; First byte of ident + CP (HL) ; Compare + JR NZ,MINIT4 ; Not HBIOS + INC HL ; Next byte of ident + LD A,~'W' ; Second byte of ident + CP (HL) ; Compare + JR NZ,MINIT4 ; Not HBIOS +; + ; Display RomWBW notification string + LD DE,HBIOS ; BIOS notification string + LD C,9 ; BDOS string display function + CALL BDOS ; Do it +; + ; Get CPU speed from RomWBW HBIOS and return LD B,0F8H ; HBIOS SYSGET function 0xF8 LD C,0F0H ; CPUINFO subfunction 0xF0 - RST 08 ; do it, L := CPU speed in MHz - LD A,L ; move it to A - RET ; done + RST 08 ; Do it, L := CPU speed in MHz + LD A,L ; Move it to A + RET ; Done +; +MINIT4: + ; Neither UNA nor RomWBW + LD DE,BIOERR ; BIOS error message + LD C,9 ; BDOS string display function + CALL BDOS ; Do it + JP 0 ; Bail out! +; +RBC DB "RBC, 28-Aug-2017, $" +; +UART DB "UART0$" +ASCI DB "ASCI0$" +; +UBIOS DB " [UNA]", 13, 10, "$" +HBIOS DB " [WBW]", 13, 10, "$" +; +BIOERR DB 13, 10, 13, 10, "*** Unknown BIOS ***", 13, 10, "$" ; ;----------------------------------------------------------------------- ;