[Copyright 1999,2002 Frank Durda IV, All Rights Reserved. Mirroring of any material on this page in any form is expressly prohibited. The official web site for this material is: http://nemesis.lonestar.org Contact this address for use clearances: clearance at nemesis.lonestar.org Comments and queries to this address: web_software_2011 at nemesis.lonestar.org]
MISOSYS EDAS-4.3 04/19/99 01:22:03 SETCOM - LS-DOS 6.2 Page 00001
00001 ;LBSETCOM/ASM - Set RS232 Parameters
00003 ;
00004 ; Data area offsets
00005 ;
0004 00006 OFFSET EQU 4
0004 00007 MSMASK EQU OFFSET+0
0005 00008 UCIMAGE EQU OFFSET+1
0006 00009 BAUDRT EQU OFFSET+2
0007 00010 BRK EQU OFFSET+3
00011 ;
00012 ; Default settings
00013 ;
0000 00014 DEFMS EQU 000H
00A5 00015 DEFUC EQU 0A5H
0055 00016 DEFBA EQU 055H
0003 00017 DEFBR EQU 003H
00018 ;
00019 ; ASCII/init equivalences
00020 ;
0002 00021 _INIT EQU 02H ;Ctl value to init driver
0003 00022 _ETX EQU 03H
000D 00023 _CR EQU 0DH
000A 00024 _LF EQU 0AH
0027 00025 _APOS EQU 27H
002C 00026 PAR_ERR EQU 44 ;Parameter Error
00027 ;
00028 ; @PARAM evaluation types
00029 ;
0040 00030 FLAG EQU 01000000B
0010 00031 ABB EQU 00010000B
0080 00032 NUM EQU 10000000B
0020 00033 STR EQU 00100000B
00034 ;
0000 00035 *GET SVCMAC:3 ;SVC Macro equivalents
00036 ;SVCMAC/ASM - LS-DOS Version VI
00037 *LIST OFF
00429 *LIST ON
00431 ;
2400 00432 ORG 2400H
00433 ;
2400 00434 BEGIN EQU $
2400 ED730B24 00435 LD (SAVESP+1),SP ;Save entry stack
2404 CD3A24 00436 CALL PGRM ;Perform operations
00437 ;
00438 ; Set up exit condition
00439 ;
2407 210000 00440 $EXIT LD HL,0 ;No errors
240A 310000 00441 SAVESP LD SP,$-$ ;P/u original SP
240D 00442 @@CKBRKC ;Clear
240D+3E6A 00443 LD A,106
240F+EF 00444 RST 40
2410 C9 00445 RET
00446 ;
00447 ; Abort program
00448 ;
2411 21FFFF 00449 $ABORT LD HL,-1 ;Init error return
2414 18F4 00450 JR SAVESP ;Exit program
00451 ;
00452 ; Display char in C
00453 ;
2416 00454 $DSP @@DSP ;Display
2416+3E02 00455 LD A,2
2418+EF 00456 RST 40
2419 C8 00457 RET Z ;Return if NO error
241A 1804 00458 JR IOERR ; else error
00459 ;
00460 ; Display text @ (HL)
00461 ;
241C 00462 $DSPLY @@DSPLY ;Display
00463 IFEQ 00H,1
00464 LD HL,
00465 ENDIF
241C+3E0A 00466 LD A,10
241E+EF 00467 RST 40
241F C8 00468 RET Z ;Return if NO error
00469 ;
00470 ; I/O error, display what
00471 ;
2420 6F 00472 IOERR LD L,A ;Save error code
2421 F6C0 00473 OR 0C0H ;Set return+short message
2423 4F 00474 LD C,A ;Pass error code
2424 00475 @@ERROR ;Display error
2424+3E1A 00476 LD A,26
2426+EF 00477 RST 40
00478 ;
2427 2600 00479 ERROR$ LD H,0 ;Set exit code
2429 18DF 00480 JR SAVESP ;Terminate program
00481 ;
242B 21E126 00482 BADMOD LD HL,BADDCB ;'COM/DVR not installed'
242E 00483 @@LOGOT ;Log error
00484 IFEQ 00H,1
00485 LD HL,
00486 ENDIF
242E+3E0C 00487 LD A,12
2430+EF 00488 RST 40
2431 2E08 00489 LD L,8 ;'device not available'
2433 18F2 00490 JR ERROR$ ;Return error in HL
00491 ;
00492 ; Parameter error
00493 ;
2435 3E2C 00494 PRMERR LD A,PAR_ERR ;"Parameter Error"
2437 C32024 00495 JP IOERR ;Abort
00496 ;
00497 ; PGRM - Set up RS-232 Parameters
00498 ;
243A 00499 PGRM EQU $
00500 ;
00501 IF @MOD4
243A E5 00502 PUSH HL ;Save command line pntr
243B 11DD26 00503 LD DE,MDNAME ;$CL name header
243E 00504 @@GTMOD ;Find module header
243E+3E53 00505 LD A,83
2440+EF 00506 RST 40
2441 20E8 00507 JR NZ,BADMOD ;Exit if not found
2443 D5 00508 PUSH DE ;Pass pointer to IX
2444 DDE1 00509 POP IX ;IX=>next byte after
2446 E1 00510 POP HL ;Rcvr cmdline ptr
00511 ENDIF
00512 ;
00513 ; Check if any parameters entered
00514 ;
2447 2B 00515 DEC HL ;Setup for immed INC
2448 23 00516 SPLP INC HL ;Bump to next char
2449 7E 00517 LD A,(HL) ;Fetch input char
244A FE20 00518 CP ' ' ;Space?
244C 28FA 00519 JR Z,SPLP ;Ignore if space
244E FE28 00520 CP '(' ;Param marker?
2450 C2E229 00521 JP NZ,SHOW ;No, show settings
00522 ;
2453 110728 00523 LD DE,PRMTBL$ ;Parameter table
2456 00524 @@PARAM ;Evaluate user input
2456+3E11 00525 LD A,17
2458+EF 00526 RST 40
2459 C23524 00527 JP NZ,PRMERR ;Go if parameter error
00528 ;
00529 IF @MOD2
00530 LD A,(PORTP) ;Get port param
00531 OR A ;Anything input?
00532 LD DE,MDNAME1 ;$CL
00533 JR Z,PORTF ;Go default
00534 LD BC,(PORTD) ;Get port value
00535 INC B ;Test msb
00536 DEC B
00537 JR NZ,PRMERR ;Param error if >256
00538 LD A,C ;Get lsb
00539 OR A ;0?
00540 JR Z,PRMERR ;Go if yes
00541 DEC A ;1?
00542 JR Z,PORTF ;Yes, $CL
00543 DEC A ;2?
00544 JR NZ,PRMERR ;Param error if not
00545 LD DE,MDNAME2 ;$CM
00546 PORTF @@GTMOD ;Locate it
00547 JR NZ,BADMOD ;Go if not found
00548 PUSH DE ;Else pass to IX
00549 POP IX ;IX => block
00550 ENDIF
00551 ;
00552 ; Check if DEFAULT param entered
00553 ;
245C ED5B6627 00554 LD DE,(DFPARM) ;Check D parm
2460 7A 00555 LD A,D
2461 B3 00556 OR E
2462 C4CC26 00557 CALL NZ,DEFALT ;Go if Default parm used
00558 ;
2465 ED5B4C27 00559 LD DE,(QPARM) ;Query parm used?
2469 7A 00560 LD A,D ;Check input
246A B3 00561 OR E
246B CA2025 00562 JP Z,CKPARM ;Check input if not query
00563 ;
00564 ; Prompt user for input not entered on command line
00565 ;
00566 ; Fetch BAUD
00567 ;
246E 213825 00568 ASKBAUD LD HL,DMSG2 ;BAUD param display
2471 111A28 00569 LD DE,BTYP ;BAUD param
2474 CD5026 00570 CALL GETIT ;Get user input
2477 300B 00571 JR NC,ASKWORD ;Continue on ENTER
2479 CDC229 00572 CALL CKBAUD ;Test response for valid
247C 2806 00573 JR Z,ASKWORD ;Move on if valid entry
247E AF 00574 BADBAUD XOR A ; else clear
247F 321F28 00575 LD (BRESP),A ; for re-try
2482 18EA 00576 JR ASKBAUD ;Bad entry - retry
00577 ;
00578 ; Fetch WORD
00579 ;
2484 216625 00580 ASKWORD LD HL,DMSG3 ;WORD display
2487 112228 00581 LD DE,WTYP ;Param type
248A CD5026 00582 CALL GETIT ;Get user input
248D 3011 00583 JR NC,ASKSTOP ;Nil input, leave it
248F 3A5027 00584 LD A,(WORDP) ;Fetch input
2492 FE05 00585 CP 5 ;<5?
2494 3804 00586 JR C,BADWORD ;Bad entry
2496 FE09 00587 CP 8+1 ;>8?
2498 3806 00588 JR C,ASKSTOP ;Go if OK
249A AF 00589 BADWORD XOR A ;Clear param
249B 322728 00590 LD (WRESP),A ;Load flag
249E 18E4 00591 JR ASKWORD ;Re-try
00592 ;
00593 ; Fetch STOP
00594 ;
24A0 217F25 00595 ASKSTOP LD HL,DMSG4 ;STOP
24A3 112A28 00596 LD DE,STYP ;=>type byte
24A6 CD5026 00597 CALL GETIT ;Get user input
24A9 3014 00598 JR NC,ASKPAR ;Nil input, leave it
24AB 3A5227 00599 LD A,(STOPP) ;Chk range
24AE B7 00600 OR A ;0?
24AF 2804 00601 JR Z,BADSTOP ;Invalid if yes
24B1 FE03 00602 CP 2+1 ;>2?
24B3 380A 00603 JR C,ASKPAR ;Go if OK
24B5 AF 00604 BADSTOP XOR A ;Load zero
24B6 322F28 00605 LD (SRESP),A ;Clear input param
24B9 18E5 00606 JR ASKSTOP ;Ask again
00607 ;
00608 ; Fetch PARITY
00609 ;
24BB AF 00610 BADPAR XOR A ;Load zero
24BC 323928 00611 LD (PRESP),A ;Clear response byte
24BF 219125 00612 ASKPAR LD HL,DMSG5 ;PARITY display driver
24C2 113228 00613 LD DE,PTYP ;Param type
24C5 CD5026 00614 CALL GETIT ;Get user input
24C8 3017 00615 JR NC,ASKBRK ;Nil input, leave
00616 ;
00617 ; Check if user entered 'O' or 'E' or ON/OFF
00618 ;
24CA 3A3928 00619 LD A,(PRESP) ;Get response byte
24CD ED5B5427 00620 LD DE,(PARITYP) ;Get param pointer
24D1 CB77 00621 BIT 6,A ;Switch?
24D3 200C 00622 JR NZ,ASKBRK ;Yes, continue
00623 ;
00624 ; Check for ODD/EVEN input
00625 ;
24D5 1A 00626 LD A,(DE) ;Get input
24D6 CDB929 00627 CALL UCASE ;Make upper case
24D9 FE45 00628 CP 'E' ;Even?
24DB 2804 00629 JR Z,ASKBRK ;Continue if yes
24DD FE4F 00630 CP 'O' ;Odd?
24DF 20DA 00631 JR NZ,BADPAR ;Invalid, re-prompt
00632 ;
00633 ; Fetch BREAK
00634 ;
24E1 21B025 00635 ASKBRK LD HL,DMSG6 ;Display driver
24E4 110828 00636 LD DE,BRTYP ;Param type
24E7 CD5026 00637 CALL GETIT ;Get user input
00638 ;
00639 ; Fetch DTR
00640 ;
24EA 21CB25 00641 ASKDTR LD HL,DMSG8 ;Display driver
24ED 114B28 00642 LD DE,DTYP ;Param type
24F0 CD5026 00643 CALL GETIT ;Get user input
00644 ;
00645 ; Fetch RTS
00646 ;
24F3 21D725 00647 ASKRTS LD HL,DMSG9 ;Display driver
24F6 115228 00648 LD DE,RTYP ;Param type
24F9 CD5026 00649 CALL GETIT ;Get user input
00650 ;
00651 ; Fetch RI
00652 ;
24FC 21F225 00653 ASKRI LD HL,DMSG11 ;Display driver
24FF 115928 00654 LD DE,RITYP ;Param type
2502 CD5026 00655 CALL GETIT ;Get user input
00656 ;
00657 ; Fetch DSR
00658 ;
2505 21F925 00659 ASKDSR LD HL,DMSG12 ;Display driver
2508 116528 00660 LD DE,DSTYP ;Param type
250B CD5026 00661 CALL GETIT ;Get user input
00662 ;
00663 ; Fetch CD
00664 ;
250E 210026 00665 ASKCD LD HL,DMSG13 ;Display driver
2511 115F28 00666 LD DE,CDTYP ;Param type
2514 CD5026 00667 CALL GETIT ;Get user input
00668 ;
00669 ; Fetch CTS
00670 ;
2517 210726 00671 ASKCTS LD HL,DMSG14 ;Display driver
251A 116C28 00672 LD DE,CTTYP ;Param type
251D CD5026 00673 CALL GETIT ;Get user input
00674 ;
00675 ; Check params and issue INIT to device
00676 ;
2520 CD7F28 00677 CKPARM CALL SETPARAM ;Check entered params
2523 DD5E00 00678 LD E,(IX+0) ;Pickup DCB address lsb
2526 DD5601 00679 LD D,(IX+1) ;Pickup DCB address msb
2529 0E02 00680 LD C,_INIT ;Init code
252B 00681 @@CTL ;Setup channel for values
252B+3E05 00682 LD A,5
252D+EF 00683 RST 40
252E C9 00684 RET ;Completed
00685 ;
00686 ; Display drivers for text
00687 ;
252F 216C27 00688 DMSG1 LD HL,MSG1 ;RS232 params:
2532 CD1C24 00689 CALL $DSPLY ;Display and return
2535 360A 00690 LD (HL),_LF ;Set for next time
2537 C9 00691 RET
00692 ;
2538 218027 00693 DMSG2 LD HL,MSG2 ;BAUD=
253B CD1C24 00694 CALL $DSPLY ;Display
253E DD7E06 00695 LD A,(IX+BAUDRT) ;Get baud rate
2541 E60F 00696 AND 0FH ;Low 4 bits only
2543 87 00697 ADD A,A ;*2
2544 21FA26 00698 LD HL,BAUDTBL ;Baud lookup table
2547 85 00699 ADD A,L ;Add to lsb table
2548 6F 00700 LD L,A ;Update lsb table
2549 3001 00701 JR NC,$+3 ;Go if no page cross
254B 24 00702 INC H ; else bump page
254C 7E 00703 LD A,(HL) ;Get LSB baud
254D 23 00704 INC HL ;Bump table pointer
254E 66 00705 LD H,(HL) ;Get MSB baud
254F 6F 00706 LD L,A ;HL = baud rate
2550 11F727 00707 LD DE,MSG20 ;Text to load
2553 00708 @@HEXDEC ;Convert to decimal
2553+3E61 00709 LD A,97
2555+EF 00710 RST 40
2556 3E03 00711 LD A,_ETX ;End text char
2558 12 00712 LD (DE),A ;Terminate text
00713 ;
00714 ; Strip leading zeroes from display
00715 ;
2559 21F727 00716 LD HL,MSG20 ;Text loaded
255C 3E20 00717 LD A,' ' ;Test char
255E BE 00718 STRIP1 CP (HL) ;Leading zero?
255F 23 00719 INC HL ;Bump pointer
2560 28FC 00720 JR Z,STRIP1 ;Go till non-zero found
2562 2B 00721 DEC HL ;Adjust pointer
2563 C31C24 00722 JP $DSPLY ;Display remainder
00723 ;
2566 218627 00724 DMSG3 LD HL,MSG3 ;WORD=
2569 CD1C24 00725 CALL $DSPLY ;Display header
256C DD7E05 00726 LD A,(IX+UCIMAGE) ;Get data
256F 07 00727 RLCA ;Align to low bits
2570 07 00728 RLCA
2571 07 00729 RLCA
2572 E603 00730 AND 3 ;2 bits only
2574 EA7925 00731 JP PE,$+5 ;Go if set
2577 EE03 00732 XOR 3 ;Else reverse 6/7
2579 C635 00733 ADD A,5+'0' ;Correct + ASCII
257B 4F 00734 LD C,A ;Pass character
257C C31624 00735 JP $DSP ;Display and return
00736 ;
257F 218C27 00737 DMSG4 LD HL,MSG4 ;STOP=
2582 CD1C24 00738 CALL $DSPLY ;Display header
2585 0E31 00739 LD C,'1' ;Set one bit
2587 DDCB0566 00740 BIT 4,(IX+UCIMAGE) ;Get data
258B 2801 00741 JR Z,$+3 ;Go if one stop
258D 0C 00742 INC C ;Else bump to '2'
258E C31624 00743 JP $DSP ;Display and return
00744 ;
2591 219227 00745 DMSG5 LD HL,MSG5 ;PARITY=
2594 CD1C24 00746 CALL $DSPLY ;Display
2597 21E327 00747 LD HL,MSG16 ;OFF
259A DDCB055E 00748 BIT 3,(IX+UCIMAGE) ;Is off?
259E C21C24 00749 JP NZ,$DSPLY ;Yes, go
25A1 21E727 00750 LD HL,MSG17 ;ODD
25A4 DDCB057E 00751 BIT 7,(IX+UCIMAGE) ;Is odd?
25A8 2803 00752 JR Z,$+5 ;Go if yes
25AA 21EB27 00753 LD HL,MSG18 ;EVEN
25AD C31C24 00754 JP $DSPLY ;Display and return
00755 ;
25B0 219A27 00756 DMSG6 LD HL,MSG6 ;BREAK=
25B3 CD1C24 00757 CALL $DSPLY ;Display header
25B6 DD4E07 00758 LD C,(IX+BRK) ;Get break char
25B9 21FF27 00759 LD HL,MSG21A ;Text to load
25BC 00760 @@HEX8 ;Convert to ASCII
25BC+3E62 00761 LD A,98
25BE+EF 00762 RST 40
25BF 21FD27 00763 LD HL,MSG21 ;Text start
25C2 C31C24 00764 JP $DSPLY ;Display and return
00765 ;
25C5 21A127 00766 DMSG7 LD HL,MSG7 ;Input:
25C8 C31C24 00767 JP $DSPLY ;Display and return
00768 ;
25CB 21B327 00769 DMSG8 LD HL,MSG8 ;DTR=
25CE CD1C24 00770 CALL $DSPLY ;Display
25D1 DDCB054E 00771 BIT 1,(IX+UCIMAGE) ;Is on?
25D5 180A 00772 JR DMSG89 ;Display
00773 ;
25D7 21B827 00774 DMSG9 LD HL,MSG9 ;RTS=
25DA CD1C24 00775 CALL $DSPLY ;Display header
25DD DDCB0546 00776 BIT 0,(IX+UCIMAGE) ;Is on?
00777 ;
25E1 21E027 00778 DMSG89 LD HL,MSG15 ;ON?
25E4 2803 00779 JR Z,$+5 ;Go if yes
25E6 21E327 00780 LD HL,MSG16 ;OFF
25E9 C31C24 00781 JP $DSPLY ;Display and return
00782 ;
25EC 21BD27 00783 DMSG10 LD HL,MSG10 ;Output:
25EF C31C24 00784 JP $DSPLY ;Display and return
00785 ;
25F2 21CE27 00786 DMSG11 LD HL,MSG11 ;RI=
25F5 3E11 00787 LD A,00010001B ;Enable bits
25F7 1813 00788 JR DMSG0 ;Go common
00789 ;
25F9 21D227 00790 DMSG12 LD HL,MSG12 ;DSR=
25FC 3E44 00791 LD A,01000100B ;Enable bits
25FE 180C 00792 JR DMSG0 ;Go common
00793 ;
2600 21D727 00794 DMSG13 LD HL,MSG13 ;CD=
2603 3E22 00795 LD A,00100010B ;Enable bits
2605 1805 00796 JR DMSG0 ;Go common
00797 ;
2607 21DB27 00798 DMSG14 LD HL,MSG14 ;CTS=
260A 3E88 00799 LD A,10001000B ;Enable bits
00800 ;
260C F5 00801 DMSG0 PUSH AF ;Save bits
260D CD1C24 00802 CALL $DSPLY ;Display prefix
2610 F1 00803 POP AF ;Restore
2611 DDA604 00804 AND (IX+MSMASK) ;And with mask
2614 21F027 00805 LD HL,MSG19 ;IGNORE
2617 2809 00806 JR Z,DMSG0X ;Go if yes
2619 21E027 00807 LD HL,MSG15 ;ON
261C E22226 00808 JP PO,DMSG0X ;Go if yes
261F 21E327 00809 LD HL,MSG16 ;OFF
2622 C31C24 00810 DMSG0X JP $DSPLY ;Display and return
00811 ;
2625 210328 00812 DMSG22 LD HL,MSG22 ;CR
2628 C31C24 00813 JP $DSPLY ;Display and return
00814 ;
262B 210428 00815 DMSG23 LD HL,MSG23 ;', '
262E C31C24 00816 JP $DSPLY ;Display and return
00817 ;
00818 ; Display entire parameter set
00819 ;
2631 FDE5 00820 DSPALL PUSH IY ;Save
2633 FD211A27 00821 LD IY,DSPTBL ;Display table
2637 FD6E00 00822 DSPSET LD L,(IY+0) ;Get lsb vector
263A FD6601 00823 LD H,(IY+1) ;Get msb vector
263D 7C 00824 LD A,H ;Check for term
263E B5 00825 OR L ;HL = 0000?
263F 280C 00826 JR Z,DSPDONE ;Yes, go
2641 E5 00827 PUSH HL ;Save address
2642 214726 00828 LD HL,DSPRET ;Return vector
2645 E3 00829 EX (SP),HL ;Leave return, get vector
2646 E9 00830 JP (HL) ;Display
2647 FD23 00831 DSPRET INC IY ;Bump table
2649 FD23 00832 INC IY ;2 byte entries
264B 18EA 00833 JR DSPSET ;Continue
264D FDE1 00834 DSPDONE POP IY ;Restore
264F C9 00835 RET ;Display complete
00836 ;
00837 ; QUERYing for parameter
00838 ;
2650 E5 00839 GETIT PUSH HL ;Save display driver
2651 D5 00840 PUSH DE ;Save type byte
2652 EB 00841 EX DE,HL ;Type byte to HL
2653 CD6326 00842 CALL CKRSP ;Check if response enterd
2656 D1 00843 POP DE ;Restore type byte
2657 E1 00844 POP HL ;Restore prompt
2658 C0 00845 RET NZ ;Already have this one
00846 ;
00847 ; Setup for prompt display
00848 ;
2659 E5 00849 PUSH HL ;Save for repeat prompt
265A D5 00850 PUSH DE
265B CD7426 00851 CALL GETRSP ;Get user response
265E D1 00852 POP DE ;Restore data
265F E1 00853 POP HL
2660 20EE 00854 JR NZ,GETIT ;Invalid, ask again
2662 C9 00855 RET ; else param loaded
00856 ;
00857 ; Check if correct response entered
00858 ;
2663 22A026 00859 CKRSP LD (TTYP),HL ;Save type position
00860 ;
2666 3E0F 00861 MVUP LD A,0FH ;Low 4 bits for length
2668 4E 00862 LD C,(HL) ;Get type byte
2669 A1 00863 AND C ;Fetch length
266A 23 00864 UP INC HL ;Bump pointer
266B 3D 00865 DEC A ;Less length
266C 20FC 00866 JR NZ,UP ;Go for length
266E 23 00867 INC HL ;Bump to next
266F 7E 00868 LD A,(HL) ;Get response byte
2670 E6E0 00869 AND NUM!FLAG!STR ;Response type bits
2672 A1 00870 AND C ;Compare to entered
2673 C9 00871 RET ;Return with status
00872 ;
00873 ; Query on, param not entered, prompt for it
00874 ;
2674 E5 00875 GETRSP PUSH HL ;Save driver address
2675 217A26 00876 LD HL,GETRSPR ;Return vector
2678 E3 00877 EX (SP),HL ;Leave get display driver
2679 E9 00878 JP (HL) ;Display prompt
00879 ;
267A 0604 00880 GETRSPR LD B,4 ;Command get cursor
267C 00881 @@VDCTL ;Fetch cursor
267C+3E0F 00882 LD A,15
267E+EF 00883 RST 40
267F 2E14 00884 LD L,20 ;Column to position to
2681 0603 00885 LD B,3 ;Command put cursor
2683 00886 @@VDCTL ;Setup new cursor
2683+3E0F 00887 LD A,15
2685+EF 00888 RST 40
2686 21F726 00889 LD HL,PROMPT ;Prompt text
2689 CD1C24 00890 CALL $DSPLY ;Display prompt
268C AF 00891 XOR A ;Load zero
268D 32E829 00892 LD (FRESP),A ;Clear response byte
00893 ;
2690 21EF29 00894 LD HL,INBUF ;Key input buffer
2693 01000A 00895 LD BC,10<8+0 ;Max input length
2696 00896 @@KEYIN ;Get user input
2696+3E09 00897 LD A,9
2698+EF 00898 RST 40
2699 DA1124 00899 JP C,$ABORT ;Terminate on BREAK
00900 ;
00901 ; Evaluate user input
00902 ;
269C 04 00903 INC B ;Check if nil input
269D 05 00904 DEC B ;B=0?
269E C8 00905 RET Z ;No input, go
00906 ;
269F 210000 00907 LD HL,0 ;Get param pointer
26A0 00908 TTYP EQU $-2
26A2 7E 00909 LD A,(HL) ;Get response type
26A3 E6F0 00910 AND 0F0H ; attribute only
26A5 F601 00911 OR 1 ;Single byte char
26A7 32E629 00912 LD (FTYP),A ;Pass to new block
00913 ;
26AA 21EC29 00914 LD HL,FSTR ;Set command pointer
26AD 11E529 00915 LD DE,PTBL2 ;Mini-param table
26B0 00916 @@PARAM ;Evaluate input
26B0+3E11 00917 LD A,17
26B2+EF 00918 RST 40
26B3 C0 00919 RET NZ ;Invalid, go
00920 ;
26B4 2AA026 00921 LD HL,(TTYP) ;Get response pointer
26B7 CD6626 00922 CALL MVUP ;Move to response byte
26BA 3AE829 00923 LD A,(FRESP) ;Get input response
26BD 77 00924 LD (HL),A ; to param block
26BE 23 00925 INC HL ;Bump to word pointer
26BF CDB429 00926 CALL GETHL ;Get pointer
26C2 ED4B6A27 00927 LD BC,(FPARM) ;Get temp param
26C6 71 00928 LD (HL),C ;Load into param block
26C7 23 00929 INC HL ;Bump pointer
26C8 70 00930 LD (HL),B ;New param loaded
26C9 AF 00931 XOR A ;Set NO error
26CA 37 00932 SCF ;Carry = input
26CB C9 00933 RET ;Done
00934 ;
00935 ; Init default settings
00936 ;
26CC DD360400 00937 DEFALT LD (IX+MSMASK),DEFMS
26D0 DD3605A5 00938 LD (IX+UCIMAGE),DEFUC
26D4 DD360655 00939 LD (IX+BAUDRT),DEFBA
26D8 DD360703 00940 LD (IX+BRK),DEFBR
26DC C9 00941 RET
00942 ;
00943 ; Text area
00944 ;
00945 IF @MOD4
26DD 24 00946 MDNAME DB '$CL'
43 4C
26E0 03 00947 DB _ETX
00948 ENDIF
00949 ;
00950 IF @MOD2
00951 MDNAME1 DB '$CL'
00952 DB _ETX
00953 MDNAME2 DB '$CM'
00954 DB _ETX
00955 ENDIF
00956 ;
26E1 43 00957 BADDCB DB 'COM/DVR not installed'
4F 4D 2F 44 56 52 20 6E
6F 74 20 69 6E 73 74 61
6C 6C 65 64
26F6 0D 00958 DB _CR
00959 ;
26F7 3F 00960 PROMPT DB '? '
20
26F9 03 00961 DB _ETX
00962 ;
00963 ; Valid baud rate lookup table
00964 ;
26FA 3200 00965 BAUDTBL DW 50,75,110,135,150,300,600,1200,1800
4B00 6E00 8700 9600 2C01 5802 B004 0807
270C D007 00966 DW 2000,2400,3600,4800,7200,9600,19200
6009 100E C012 201C 8025 004B
00967 ;
00968 ; Display driver lookup table
00969 ;
271A 2F25 00970 DSPTBL DW DMSG1 ;'RS232 params: '
271C 3825 00971 DW DMSG2 ;'BAUD='
271E 2B26 00972 DW DMSG23 ;', '
2720 6625 00973 DW DMSG3 ;'WORD='
2722 2B26 00974 DW DMSG23 ;', '
2724 7F25 00975 DW DMSG4 ;'STOP='
2726 2B26 00976 DW DMSG23 ;', '
2728 9125 00977 DW DMSG5 ;'PARITY='
272A 2B26 00978 DW DMSG23 ;', '
272C B025 00979 DW DMSG6 ;'BREAK='
00980 ;
272E C525 00981 DW DMSG7 ;'output: '
2730 CB25 00982 DW DMSG8 ;'DTR='
2732 2B26 00983 DW DMSG23 ;', '
2734 D725 00984 DW DMSG9 ;'RTS='
00985 ;
2736 EC25 00986 DW DMSG10 ;'input: '
2738 F225 00987 DW DMSG11 ;'RI='
273A 2B26 00988 DW DMSG23 ;', '
273C F925 00989 DW DMSG12 ;'DSR='
273E 2B26 00990 DW DMSG23 ;', '
2740 0026 00991 DW DMSG13 ;'CD='
2742 2B26 00992 DW DMSG23 ;', '
2744 0726 00993 DW DMSG14 ;'CTS='
2746 2526 00994 DW DMSG22 ;_cr
2748 0000 00995 DW 0 ;Terminator
00996 ;
00997 ; Parameter pointer table
00998 ;
274A 0000 00999 BREAKP DW 0
274C 0000 01000 QPARM DW 0
274E 0000 01001 BAUDP DW 0
2750 0000 01002 WORDP DW 0
2752 0000 01003 STOPP DW 0
2754 0000 01004 PARITYP DW 0
2756 0000 01005 EVENP DW 0
2758 0000 01006 ODDP DW 0
275A 0000 01007 DTRP DW 0
275C 0000 01008 RTSP DW 0
275E 0000 01009 RIP DW 0
2760 0000 01010 CDP DW 0
2762 0000 01011 DSRP DW 0
2764 0000 01012 CTSP DW 0
2766 0000 01013 DFPARM DW 0
2768 0000 01014 PORTD DW 0
276A 0000 01015 FPARM DW 0
01016 ;
276C 00 01017 MSG1 DB 0 ;Will be LF after 1st DSP
276D 52 01018 DB 'RS232'
53 32 33 32
01019 IF @MOD2
01020 MSG1A DB 'A'
01021 ENDIF
2772 20 01022 DB ' parameters: '
70 61 72 61 6D 65 74 65
72 73 3A 20
277F 03 01023 DB _ETX
01024 ;
2780 42 01025 MSG2 DB 'Baud='
61 75 64 3D
2785 03 01026 DB _ETX
01027 ;
2786 57 01028 MSG3 DB 'Word='
6F 72 64 3D
278B 03 01029 DB _ETX
01030 ;
278C 53 01031 MSG4 DB 'Stop='
74 6F 70 3D
2791 03 01032 DB _ETX
01033 ;
2792 50 01034 MSG5 DB 'Parity='
61 72 69 74 79 3D
2799 03 01035 DB _ETX
01036 ;
279A 42 01037 MSG6 DB 'Break='
72 65 61 6B 3D
27A0 03 01038 DB _ETX
01039 ;
27A1 0A 01040 MSG7 DB _LF
27A2 4F 01041 DB 'Output control: '
75 74 70 75 74 20 63 6F
6E 74 72 6F 6C 3A 20
27B2 03 01042 DB _ETX
01043 ;
27B3 44 01044 MSG8 DB 'DTR='
54 52 3D
27B7 03 01045 DB _ETX
01046 ;
27B8 52 01047 MSG9 DB 'RTS='
54 53 3D
27BC 03 01048 DB _ETX
01049 ;
27BD 0A 01050 MSG10 DB _LF
27BE 49 01051 DB 'Input control: '
6E 70 75 74 20 63 6F 6E
74 72 6F 6C 3A 20
27CD 03 01052 DB _ETX
01053 ;
27CE 52 01054 MSG11 DB 'RI='
49 3D
27D1 03 01055 DB _ETX
01056 ;
27D2 44 01057 MSG12 DB 'DSR='
53 52 3D
27D6 03 01058 DB _ETX
01059 ;
27D7 43 01060 MSG13 DB 'CD='
44 3D
27DA 03 01061 DB _ETX
01062 ;
27DB 43 01063 MSG14 DB 'CTS='
54 53 3D
27DF 03 01064 DB _ETX
01065 ;
27E0 4F 01066 MSG15 DB 'ON'
4E
27E2 03 01067 DB _ETX
01068 ;
27E3 4F 01069 MSG16 DB 'OFF'
46 46
27E6 03 01070 DB _ETX
01071 ;
27E7 4F 01072 MSG17 DB 'ODD'
44 44
27EA 03 01073 DB _ETX
01074 ;
27EB 45 01075 MSG18 DB 'EVEN'
56 45 4E
27EF 03 01076 DB _ETX
01077 ;
27F0 49 01078 MSG19 DB 'IGNORE'
47 4E 4F 52 45
27F6 03 01079 DB _ETX
01080 ;
27F7 30 01081 MSG20 DB '00000'
30 30 30 30
27FC 03 01082 DB _ETX
01083 ;
27FD 58 01084 MSG21 DB 'X',_APOS
27
27FF 30 01085 MSG21A DB '00',_APOS
30 27
2802 03 01086 DB _ETX
01087 ;
2803 0D 01088 MSG22 DB _CR
01089 ;
2804 2C 01090 MSG23 DB ', '
20
2806 03 01091 DB _ETX
01092 ;
01093 ; Parameter evaluation table
01094 ;
2807 80 01095 PRMTBL$ DB 80H ;Extended param
01096 ;
2808 C5 01097 BRTYP DB 5!FLAG!NUM
2809 42 01098 DB 'BREAK'
52 45 41 4B
280E 00 01099 BRRESP DB 0
280F 4A27 01100 DW BREAKP
01101 ;
2811 55 01102 DB 5!ABB!FLAG
2812 51 01103 DB 'QUERY'
55 45 52 59
2817 00 01104 QRESP DB 0
2818 4C27 01105 DW QPARM
01106 ;
281A 94 01107 BTYP DB 4!ABB!NUM
281B 42 01108 DB 'BAUD'
41 55 44
281F 00 01109 BRESP DB 0
2820 4E27 01110 DW BAUDP
01111 ;
2822 94 01112 WTYP DB 4!ABB!NUM
2823 57 01113 DB 'WORD'
4F 52 44
2827 00 01114 WRESP DB 0
2828 5027 01115 DW WORDP
01116 ;
282A 94 01117 STYP DB 4!ABB!NUM
282B 53 01118 DB 'STOP'
54 4F 50
282F 00 01119 SRESP DB 0
2830 5227 01120 DW STOPP
01121 ;
2832 76 01122 PTYP DB 6!ABB!FLAG!STR
2833 50 01123 DB 'PARITY'
41 52 49 54 59
2839 00 01124 PRESP DB 0
283A 5427 01125 DW PARITYP
01126 ;
283C 54 01127 ETYP DB 4!ABB!FLAG
283D 45 01128 DB 'EVEN'
56 45 4E
2841 00 01129 ERESP DB 0
2842 5627 01130 DW EVENP
01131 ;
2844 53 01132 OTYP DB 3!ABB!FLAG
2845 4F 01133 DB 'ODD'
44 44
2848 00 01134 ORESP DB 0
2849 5827 01135 DW ODDP
01136 ;
284B 43 01137 DTYP DB 3!FLAG
284C 44 01138 DB 'DTR'
54 52
284F 00 01139 DTRESP DB 0
2850 5A27 01140 DW DTRP
01141 ;
2852 43 01142 RTYP DB 3!FLAG
2853 52 01143 DB 'RTS'
54 53
2856 00 01144 RTRESP DB 0
2857 5C27 01145 DW RTSP
01146 ;
2859 42 01147 RITYP DB 2!FLAG
285A 52 01148 DB 'RI'
49
285C 00 01149 RIRESP DB 0
285D 5E27 01150 DW RIP
01151 ;
285F 42 01152 CDTYP DB 2!FLAG
2860 43 01153 DB 'CD'
44
2862 00 01154 CDRESP DB 0
2863 6027 01155 DW CDP
01156 ;
2865 43 01157 DSTYP DB 3!FLAG
2866 44 01158 DB 'DSR'
53 52
2869 00 01159 DSRESP DB 0
286A 6227 01160 DW DSRP
01161 ;
286C 43 01162 CTTYP DB 3!FLAG
286D 43 01163 DB 'CTS'
54 53
2870 00 01164 CTRESP DB 0
2871 6427 01165 DW CTSP
01166 ;
2873 57 01167 DB 7!ABB!FLAG
2874 44 01168 DB 'DEFAULT'
45 46 41 55 4C 54
287B 00 01169 DB 0
287C 6627 01170 DW DFPARM
01171 ;
01172 IF @MOD2
01173 DB 4!NUM
01174 DB 'PORT'
01175 PORTP DB 0
01176 DW PORTD
01177 ENDIF
01178 ;
287E 00 01179 DB 0 ;List terminator
01180 ;
01181 ; Evaluate and setup user parameters
01182 ;
01183 SETPARAM
287F 213524 01184 LD HL,PRMERR ;Param error exit vector
2882 E5 01185 PUSH HL ;Leave for quick exits
01186 ;
01187 ; Evaluate BAUD
01188 ;
2883 3A1F28 01189 SETBAUD LD A,(BRESP) ;Get baud response
2886 B7 01190 OR A ;Anything?
2887 2807 01191 JR Z,SETWORD ;Nope, go
2889 CDC229 01192 CALL CKBAUD ;Get baud setting
288C C0 01193 RET NZ ;Go if error
288D DD7706 01194 LD (IX+BAUDRT),A ; else save new baud
01195 ;
01196 ; Evaluate WORD
01197 ;
2890 DD4E05 01198 SETWORD LD C,(IX+UCIMAGE) ;P/u current setings
2893 3A2728 01199 LD A,(WRESP) ;Get word response
2896 B7 01200 OR A ;Anything?
2897 281C 01201 JR Z,SETSTOP ;Nope, continue
2899 ED5B5027 01202 LD DE,(WORDP) ;Get parameter
289D 14 01203 INC D ;Check msb
289E 15 01204 DEC D ;D<>0?
289F C0 01205 RET NZ ;>256?
28A0 7B 01206 LD A,E ;Get lsb
28A1 D605 01207 SUB 5 ;Adjust 0 relative
28A3 D8 01208 RET C ;Go if out of range
28A4 FE04 01209 CP 4 ;5-8?
28A6 D0 01210 RET NC ;Out of range
28A7 B7 01211 OR A ;Clear carry, set PV
28A8 EAAD28 01212 JP PE,$+5 ;Go if 5/8
28AB EE03 01213 XOR 3 ;Change 6=>7=>6
28AD 0F 01214 RRCA ;Align to bits 6/5
28AE 0F 01215 RRCA
28AF 0F 01216 RRCA
28B0 0660 01217 LD B,01100000B ;For bit setup
28B2 CDAB29 01218 CALL SETBITS ;Setup in C register
01219 ;
01220 ; Evaluate STOP
01221 ;
28B5 3A2F28 01222 SETSTOP LD A,(SRESP) ;Get response byte
28B8 B7 01223 OR A ;Anything?
28B9 2817 01224 JR Z,SETPAR ;Nope, continue
28BB ED5B5227 01225 LD DE,(STOPP) ;Get input
28BF 14 01226 INC D ;Check for out of range
28C0 15 01227 DEC D ;D<>0?
28C1 C0 01228 RET NZ ;>256
28C2 7B 01229 LD A,E ;Get lsb
28C3 B7 01230 OR A ;0?
28C4 C8 01231 RET Z ;Invalid if not
28C5 FE03 01232 CP 3 ;1/2?
28C7 D0 01233 RET NC ;Invalid
28C8 3D 01234 DEC A ;Change 1|2 to 0|1
28C9 07 01235 RLCA ;Align result
28CA 07 01236 RLCA
28CB 07 01237 RLCA
28CC 07 01238 RLCA
28CD 0610 01239 LD B,00010000B ;Init mask
28CF CDAB29 01240 CALL SETBITS ;Setup in C register
01241 ;
01242 ; Evaluate PARITY
01243 ;
28D2 3A3928 01244 SETPAR LD A,(PRESP) ;Get parity response
28D5 B7 01245 OR A ;Any input?
28D6 2825 01246 JR Z,SETPEO ;Nope, check EVEN|ODD
01247 ;
01248 ; Check if response was string or switch
01249 ;
28D8 ED5B5427 01250 LD DE,(PARITYP) ;Get user pointer
28DC CB77 01251 BIT 6,A ;Switch?
28DE 2015 01252 JR NZ,SETPOF ;Yes, set ON/OFF
01253 ;
01254 ; Response was string, check 'E'|'O'
01255 ;
28E0 1A 01256 LD A,(DE) ;Get input
28E1 CDB929 01257 CALL UCASE ;Make upper case
28E4 FE4F 01258 CP 'O' ;Odd?
28E6 2807 01259 JR Z,SETPO ;Yes, go
28E8 FE45 01260 CP 'E' ;Even?
28EA C0 01261 RET NZ ;Neither, invalid
28EB CBF9 01262 SETPE SET 7,C ;Set EVEN parity
28ED 1802 01263 JR SETPAEO ;Continue
28EF CBB9 01264 SETPO RES 7,C ;Set ODD parity
28F1 CB99 01265 SETPAEO RES 3,C ;Set ON parity
28F3 182C 01266 JR SETBRK ;Continue
01267 ;
01268 ; Response was switch, check ON|OFF
01269 ;
28F5 7A 01270 SETPOF LD A,D ;Check input
28F6 B3 01271 OR E ;=0000?
28F7 CBD9 01272 SET 3,C ;Set OFF
28F9 2826 01273 JR Z,SETBRK ;Continue if yes
28FB CB99 01274 RES 3,C ;Set ON
01275 ;
01276 ; Check for ODD|EVEN params
01277 ;
28FD 3A4828 01278 SETPEO LD A,(ORESP) ;Get odd response
2900 B7 01279 OR A ;Anything?
2901 280C 01280 JR Z,SETPAE ;Nope, check EVEN
2903 ED5B5827 01281 LD DE,(ODDP) ;Get user input
2907 7A 01282 LD A,D ;Check for nil
2908 B3 01283 OR E ;DE=0000?
2909 CBF9 01284 SET 7,C ;ODD=off?
290B 2802 01285 JR Z,SETPAE ;Go if yes
290D CBB9 01286 RES 7,C ;ODD=on
01287 ;
290F 3A4128 01288 SETPAE LD A,(ERESP) ;Get even response
2912 B7 01289 OR A ;Anything?
2913 280C 01290 JR Z,SETBRK ;Nope, continue
2915 ED5B5627 01291 LD DE,(EVENP) ;Get param
2919 7A 01292 LD A,D ;Check for nil
291A B3 01293 OR E ;DE=0000?
291B CBB9 01294 RES 7,C ;EVEN=off?
291D 2802 01295 JR Z,SETBRK ;Go if yes
291F CBF9 01296 SET 7,C ;EVEN=on
01297 ;
01298 ; Evaluate BREAK
01299 ;
2921 3A0E28 01300 SETBRK LD A,(BRRESP) ;Get user response
2924 B7 01301 OR A ;Anything?
2925 2818 01302 JR Z,SETDTR ;Nope, continue
2927 ED5B4A27 01303 LD DE,(BREAKP) ;Get user input
292B CB77 01304 BIT 6,A ;Switch?
292D 2005 01305 JR NZ,SETBOF ;Yes, check ON|OFF
01306 ;
01307 ; Value entered, check if in range
01308 ;
292F 14 01309 INC D ;Check msb
2930 15 01310 DEC D ;D<>0?
2931 C0 01311 RET NZ ;>256?
2932 1808 01312 JR UPDBRK ;Continue
01313 ;
01314 ; Switch entered, check if on/off
01315 ;
2934 7A 01316 SETBOF LD A,D ;Get input
2935 B3 01317 OR E ;DE=0000?
2936 1E80 01318 LD E,80H ;Default
2938 2802 01319 JR Z,UPDBRK ;Go if off
293A 1E03 01320 LD E,03H ;Default
293C DD7307 01321 UPDBRK LD (IX+BRK),E ;Update data
01322 ;
01323 ; Evaluate DTR
01324 ;
293F 3A4F28 01325 SETDTR LD A,(DTRESP) ;Get user response byte
2942 B7 01326 OR A ;Anything?
2943 280C 01327 JR Z,SETRTS ;Continue if not
2945 ED5B5A27 01328 LD DE,(DTRP) ;Get user param
2949 7A 01329 LD A,D ;Check if anything
294A B3 01330 OR E ;DE=0000?
294B CBC9 01331 SET 1,C ;Set OFF
294D 2802 01332 JR Z,SETRTS ;Go if yes
294F CB89 01333 RES 1,C ;Set ON
01334 ;
01335 ; Evaluate RTS
01336 ;
2951 3A5628 01337 SETRTS LD A,(RTRESP) ;Get user response byte
2954 B7 01338 OR A ;Anything?
2955 280C 01339 JR Z,UPDCI ;Continue if not
2957 ED5B5C27 01340 LD DE,(RTSP) ;Get user param
295B 7A 01341 LD A,D ;Check if 0
295C B3 01342 OR E ;DE=0000?
295D CBC1 01343 SET 0,C ;Set OFF
295F 2802 01344 JR Z,UPDCI ;Go if yes
2961 CB81 01345 RES 0,C ;Set ON
2963 CBD1 01346 UPDCI SET 2,C ;Enable transmit
2965 DD7105 01347 LD (IX+UCIMAGE),C ;Update new data
01348 ;
01349 ; Evaluate RI
01350 ;
2968 215C28 01351 SETRI LD HL,RIRESP ;Response byte
296B 0E01 01352 LD C,00000001B ;Bit to set
296D CD8A29 01353 CALL SETIT ;Setup data
01354 ;
01355 ; Evaluate DSR
01356 ;
2970 216928 01357 SETDSR LD HL,DSRESP ;Response byte
2973 0E04 01358 LD C,00000100B ;Bit mask
2975 CD8A29 01359 CALL SETIT ;Setup data
01360 ;
01361 ; Evaluate CD
01362 ;
2978 216228 01363 SETCD LD HL,CDRESP ;Response byte
297B 0E02 01364 LD C,00000010B ;Bit mask
297D CD8A29 01365 CALL SETIT ;Setup data
01366 ;
01367 ; Evaluate CTS
01368 ;
2980 217028 01369 SETCTS LD HL,CTRESP ;Response byte
2983 0E08 01370 LD C,00001000B ;Bit mask
2985 CD8A29 01371 CALL SETIT ;Setup data
01372 ;
01373 ; Evaluation complete
01374 ;
2988 F1 01375 POP AF ;Remove param error vect
2989 C9 01376 RET ;Return from evaluate
01377 ;
298A 34 01378 SETIT INC (HL) ;Any response?
298B 35 01379 DEC (HL) ;(HL) = 00?
298C C8 01380 RET Z ;Back if no change
298D 23 01381 INC HL ;Point to response data
298E CDB429 01382 CALL GETHL ;Load HL with (HL)
2991 CDB429 01383 CALL GETHL ;Get user response
2994 79 01384 LD A,C ;Get response data ON
2995 07 01385 RLCA ;Align to upper 4 bits
2996 07 01386 RLCA
2997 07 01387 RLCA
2998 07 01388 RLCA
2999 B1 01389 OR C ;Combine
299A 47 01390 LD B,A ;Set response data OFF
299B 2F 01391 CPL ;Reverse bits
299C DDA604 01392 AND (IX+MSMASK) ;Drop desired bits
299F 5F 01393 LD E,A ;Save new mask
29A0 7C 01394 LD A,H ;Check if OFF
29A1 B5 01395 OR L ;HL = 0000?
29A2 78 01396 LD A,B ;Get OFF bits
29A3 2801 01397 JR Z,$+3 ;Go if off
29A5 79 01398 LD A,C ;Get ON bits
29A6 B3 01399 OR E ;Combine with remainder
29A7 DD7704 01400 LD (IX+MSMASK),A ;Update mask
29AA C9 01401 RET ;Done
01402 ;
01403 ; Set bits in C from A using B as mask
01404 ;
29AB A0 01405 SETBITS AND B ;Mask others
29AC F5 01406 PUSH AF ;Save data
29AD 78 01407 LD A,B ;Get mask
29AE 2F 01408 CPL ;Reverse for mask off
29AF A1 01409 AND C ;Remove undesired bits
29B0 C1 01410 POP BC ;B = new bits
29B1 B0 01411 OR B ;Combine
29B2 4F 01412 LD C,A ;Update
29B3 C9 01413 RET ;New bits set
01414 ;
01415 ; Fetch HL from (HL)
01416 ;
29B4 7E 01417 GETHL LD A,(HL) ;Get lsb
29B5 23 01418 INC HL ;Bump pointer
29B6 66 01419 LD H,(HL) ;Get msb
29B7 6F 01420 LD L,A ;HL = (HL)
29B8 C9 01421 RET ;Done
01422 ;
01423 ; Convert char in A to upper case
01424 ;
29B9 FE61 01425 UCASE CP 'a' ;In range?
29BB D8 01426 RET C ;Nope, go
29BC FE7B 01427 CP 'z'+1 ;In range?
29BE D0 01428 RET NC ;Nope, go
29BF E65F 01429 AND 5FH ; else make upper case
29C1 C9 01430 RET ;Done
01431 ;
01432 ; Check for valid baud rate entered
01433 ;
29C2 ED5B4E27 01434 CKBAUD LD DE,(BAUDP) ;Baud parm (default 300)
29C6 21FA26 01435 LD HL,BAUDTBL ;Point to baud table
29C9 010010 01436 LD BC,16<8+0 ;B=count, C=position
01437 ;
29CC 7E 01438 BLOOP LD A,(HL) ;Fetch LSB baud
29CD 23 01439 INC HL ;Bump table
29CE BB 01440 CP E ;Lsb match?
29CF 2004 01441 JR NZ,NOMATB ;Nope, go next entry
29D1 7E 01442 LD A,(HL) ;Get MSB baud
29D2 BA 01443 CP D ;Msb match?
29D3 2805 01444 JR Z,MATCHB ;Yes, baud found
01445 ;
29D5 23 01446 NOMATB INC HL ;Bump to next entry
29D6 0C 01447 INC C ;Bump position count
29D7 10F3 01448 DJNZ BLOOP ;Go for table length
29D9 C9 01449 RET ;Param error
01450 ;
29DA 79 01451 MATCHB LD A,C ;Pick up baud rate code
29DB 07 01452 RLCA ;Align to high bits
29DC 07 01453 RLCA
29DD 07 01454 RLCA
29DE 07 01455 RLCA
29DF B1 01456 OR C ;Use for xmit and rcv
29E0 BF 01457 CP A ;Z=good value
29E1 C9 01458 RET ;Return with BAUD setting
01459 ;
01460 ; Nil params entered, display current settings
01461 ;
29E2 01462 SHOW EQU $
01463 IF @MOD2
01464 LD A,-1 ;Set NO flag
01465 LD (SHOWF),A ;Save flag
01466 LD DE,MDNAME1 ;CL1
01467 LD A,'A' ;Comm A
01468 LD (MSG1A),A ;To text
01469 CALL SHOW1 ;Display
01470 LD DE,MDNAME2 ;CL2
01471 LD A,'B' ;Comm B
01472 LD (MSG1A),A ;To text
01473 CALL SHOW1 ;Display
01474 LD A,-1 ;Get flag
01475 SHOWF EQU $-1
01476 OR A ;Any found?
01477 JP NZ,BADMOD ;Not installed
01478 RET ; else OK
01479 ;
01480 SHOW1 @@GTMOD ;Locate module
01481 RET NZ ;Module not found
01482 XOR A ;Set module found
01483 LD (SHOWF),A ;Init flag
01484 PUSH DE ;Pass to IX
01485 POP IX ;IX => module
01486 ENDIF
01487 ;
29E2 C33126 01488 JP DSPALL ;Display all settings
01489 ;
01490 ; Mini param block for 'query' evaluation
01491 ;
29E5 80 01492 PTBL2 DB 80H ;Extended param
01493 ;
29E6 C1 01494 FTYP DB FLAG!NUM!1
29E7 46 01495 DB 'F'
29E8 00 01496 FRESP DB 0
29E9 6A27 01497 DW FPARM
01498 ;
29EB 00 01499 DB 0
01500 ;
01501 ; Text string passed to @PARAM for query eval
01502 ;
29EC 28 01503 FSTR DB '(F='
46 3D
29EF 01504 INBUF EQU $ ;Keyboard input buffer
01505 ;
2400 01506 END BEGIN
2400 is the transfer address
00000 Total errors
[Copyright 1999,2002 Frank Durda IV, All Rights Reserved. Mirroring of any material on this page in any form is expressly prohibited. The official web site for this material is: http://nemesis.lonestar.org Contact this address for use clearances: clearance at nemesis.lonestar.org Comments and queries to this address: web_software_2011 at nemesis.lonestar.org]