[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:23:55 SETKI - LS-DOS 6.2 Page 00001
00001 ;LBSETKI/ASM - Set Keyboard Parameters
00003 ;
0004 00004 OFFSET EQU 4 ;Length: end of name to data area
0006 00005 DELAY EQU OFFSET+2
0007 00006 RPEAT EQU OFFSET+3
000A 00007 DMIN EQU 10
0001 00008 RMIN EQU 1
0016 00009 DDFALT EQU 22
0002 00010 RDFALT EQU 2
0003 00011 ETX EQU 03H
000D 00012 CR EQU 0DH
000A 00013 LF EQU 0AH
002C 00014 PAR_ERR EQU 44 ;Parameter Error
00015 ;
0040 00016 FLAG EQU 01000000B
0010 00017 ABB EQU 00010000B
0080 00018 NUM EQU 10000000B
00019 ;
0000 00020 *GET BUILDVER/ASM:3 ;<631>
00021 ;
00022 ; Buildver/asm is a bit of a kludge since not all utilities can load
00023 ; equates from LDOS60 and still compile. LOWCORE and everybody else
00024 ; relies on this setting, and it eventually ends up in LDOS60/EQU
00025 ; for programs that can use that.
00026 ;
FFFF 00027 @BLD631 EQU -1 ;<631>Build 631 distribution (LEVEL 1B)
00028 ; These switches activate patches made since the 1B release.
00029 ; It is important that all earlier patches be enabled when a higher
00030 ; patch is enabled.
00031 ; Patches C thru F were published in TMQ IV.iv, page 32 (NOTE: the
00032 ; patch addresses listed for SPOOL in SPOOL1/FIX are 19H high.)
FFFF 00033 @BLD631C EQU -1 ;<631>Apply 1C patches (SETKI)
FFFF 00034 @BLD631D EQU -1 ;<631>Apply 1D patches (DIR)
FFFF 00035 @BLD631E EQU -1 ;<631>Apply 1E patches (DIR & MEMDISK/DCT)
FFFF 00036 @BLD631F EQU -1 ;<631>Apply 1F patches (SPOOL)
00037 ; Patches G and H were published in TMQ V.i, pages 10 and 18/19.
FFFF 00038 @BLD631G EQU -1 ;<631>Apply 1G patches (//KEYIN,DIR,DO *)
FFFF 00039 @BLD631H EQU -1 ;<631>Apply 1H patches (MEMORY)
00040 ;
00041 ;End of BUILDVER/ASM
0000 00042 *GET SVCMAC:3 ;SVC Macro equivalents
00043 ;SVCMAC/ASM - LS-DOS Version VI
00044 *LIST OFF
00436 *LIST ON
00438 ;
2400 00439 ORG 2400H
00440 ;
2400 00441 BEGIN EQU $
2400 ED730B24 00442 LD (SAVESP+1),SP
2404 CD2E24 00443 CALL PGRM ;Exit via RET
00444 ;
00445 ; Set exit conditions
00446 ;
2407 210000 00447 $EXIT LD HL,0 ;Init to no error
240A 310000 00448 SAVESP LD SP,$-$ ;P/u original SP
240D 00449 @@CKBRKC ;Clear any
240D+3E6A 00450 LD A,106
240F+EF 00451 RST 40
2410 C9 00452 RET
2411 21FFFF 00453 $ABORT LD HL,-1 ;Set abort code
2414 18F4 00454 JR SAVESP
00455 ;
2416 00456 $DSP @@DSP ;Display a character
2416+3E02 00457 LD A,2
2418+EF 00458 RST 40
2419 C8 00459 RET Z ;Back if good
241A 1807 00460 JR IOERR
241C 00461 $DSPLY @@DSPLY ;Display a line
00462 IFEQ 00H,1
00463 LD HL,
00464 ENDIF
241C+3E0A 00465 LD A,10
241E+EF 00466 RST 40
241F C8 00467 RET Z ;Back if good
2420 21 00468 DB 21H ;Skip LD A,##
2421 3E2C 00469 PRMERR LD A,PAR_ERR ;Parameter Error
00470 ;
00471 ; I/O Error Processing
00472 ;
2423 2600 00473 IOERR LD H,0
2425 6F 00474 LD L,A ;Save error #
2426 F6C0 00475 OR 0C0H
2428 4F 00476 LD C,A
2429 00477 @@ERROR ;Display message
2429+3E1A 00478 LD A,26
242B+EF 00479 RST 40
242C 18DC 00480 JR SAVESP ;Exit
00481 ;
00482 ; PGRM - Set Keyboard Parameters
00483 ;
242E E5 00484 PGRM PUSH HL ;Save cmdline ptr
242F 113925 00485 LD DE,MDNAME ;Name of keyboard driver
2432 00486 @@GTMOD ;Find module header
2432+3E53 00487 LD A,83
2434+EF 00488 RST 40
2435 3E08 00489 LD A,8 ;Device not available
2437 C22324 00490 JP NZ,IOERR ;Exit if not found
243A D5 00491 PUSH DE ;Point to next byte
243B DDE1 00492 POP IX ; after module name
00493 ;
243D E1 00494 POP HL ;=>cmd line
243E CD1725 00495 CALL SKSP ;Move to non-space
2441 7E 00496 LD A,(HL) ;Char fm cmd line
2442 FE28 00497 CP '(' ;Any params?
2444 CA6224 00498 JP Z,GETNEW ;Get/set new values
00499 ;
00500 ; Display old values
00501 ;
2447 CD5024 00502 CALL SETMSG ;Move old values for dsply
244A 211E25 00503 LD HL,DMSG ;Pt to dsply string
244D C31C24 00504 JP $DSPLY ;Dsply and exit
00505 ;
00506 ; Set up values in string
00507 ;
2450 DD7E06 00508 SETMSG LD A,(IX+DELAY) ;P/u old Wait value
2453 112725 00509 LD DE,DDELAY ;=>buffer to receive
2456 CD6625 00510 CALL HEXDEC ;Convert to ASCII decimal
2459 DD7E07 00511 LD A,(IX+RPEAT) ;P/u old Rate value
245C 113525 00512 LD DE,DRPEAT ;Pt to dsply area
245F C36625 00513 JP HEXDEC ;Convert to decimal ASCII
00514 ;
2462 114025 00515 GETNEW LD DE,PRMTBL$ ;Check user parameters
2465 00516 @@PARAM
2465+3E11 00517 LD A,17
2467+EF 00518 RST 40
2468 C22124 00519 JP NZ,PRMERR ;Go on "Parm error
246B 110000 00520 LD DE,$-$ ;P/u D parm
246C 00521 DFPARM EQU $-2
246E 7A 00522 LD A,D ;Default setting wanted?
246F B3 00523 OR E
2470 2808 00524 JR Z,SETSTR ;Keep existing if not
2472 DD360616 00525 LD (IX+DELAY),DDFALT ;Stuff defaults
2476 DD360702 00526 LD (IX+RPEAT),RDFALT
247A CD5024 00527 SETSTR CALL SETMSG ;Put numbers in string
247D 110000 00528 QCHK LD DE,$-$
247E 00529 QPARM EQU $-2 ;Query parm used?
2480 7A 00530 LD A,D
2481 B3 00531 OR E
2482 2834 00532 JR Z,CKPARM ;Go if not
00533 ;
2484 3A5925 00534 LD A,(WRESP) ;P/u Wait response byte
2487 E680 00535 AND NUM ;If a "W" number given,
2489 2013 00536 JR NZ,CKR ; then ask for R only
248B 211E25 00537 GETD LD HL,DMSG ;Pt to Wait prompt msg
248E CDDE24 00538 CALL SHOW ;Ask for W time
2491 CD8225 00539 CALL GETIT ;Get it (in DE)
2494 2808 00540 JR Z,CKR ;Don't change if CR only
2496 CD7925 00541 CALL DCHECK ;Check if good value
2499 20F0 00542 JR NZ,GETD ;Don't change if not
249B DD7706 00543 LD (IX+DELAY),A ;Store new Wait
00544 ;
249E 3A5125 00545 CKR LD A,(RRESP) ;P/u Rate resopnse byte
24A1 E680 00546 AND NUM ; and go if Rate
24A3 2013 00547 JR NZ,CKPARM ; entered on cmdline
24A5 212C25 00548 LD HL,RMSG ;Pt to Rate prompt msg
24A8 CDDE24 00549 CALL SHOW
24AB CD8225 00550 CALL GETIT ;Get new Rate
24AE 2808 00551 JR Z,CKPARM ;Don't change if CR only
24B0 CD7525 00552 CALL RCHECK ;Check range & don't
24B3 20E9 00553 JR NZ,CKR ; change if out of range
24B5 DD7707 00554 LD (IX+RPEAT),A ;Store new Rate
00555 ;
00556 ; Check entries given on cmd line
00557 ;
24B8 3A5925 00558 CKPARM LD A,(WRESP)
24BB E680 00559 AND NUM ;W parm response
24BD 280C 00560 JR Z,CKRP ;Go if not entered
24BF 110000 00561 LD DE,$-$ ;P/u Wait value
24C0 00562 WPARM EQU $-2
24C2 CD7925 00563 CALL DCHECK ;Check value
24C5 C22124 00564 JP NZ,PRMERR ;Go if bad
24C8 DD7706 00565 LD (IX+DELAY),A ; else store it
00566 ;
24CB 3A5125 00567 CKRP LD A,(RRESP) ;Rate response
24CE E680 00568 AND NUM
24D0 C8 00569 RET Z ;Done if none
24D1 110000 00570 LD DE,$-$ ;P/u Rate value
24D2 00571 RPARM EQU $-2
24D4 CD7525 00572 CALL RCHECK ;Check value
24D7 C22124 00573 JP NZ,PRMERR ; and go if bad
24DA DD7707 00574 LD (IX+RPEAT),A ; else store it
24DD C9 00575 RET ;Done
00576 ;
24DE 060C 00577 SHOW LD B,12 ;Col posn
24E0 4E 00578 SH2 LD C,(HL) ;Get char in C
24E1 CD1624 00579 CALL $DSP ;Print byte fm string
24E4 05 00580 DEC B ;Dec chars to print
24E5 23 00581 INC HL ;Bump string ptr
24E6 3E3D 00582 LD A,'='
24E8 B9 00583 CP C
24E9 20F5 00584 JR NZ,SH2 ;Display up to =
24EB 0E20 00585 LD C,' ' ;Then space
24ED CD1624 00586 CALL $DSP
24F0 CD1725 00587 CALL SKSP ;Move to number
24F3 0E7B 00588 LD C,'{'
24F5 CD1624 00589 CALL $DSP ;Dsply opening brace
24F8 4E 00590 SH3 LD C,(HL) ;P/u character
24F9 3E2F 00591 LD A,'0'-1 ;Check C for numeric value
24FB B9 00592 CP C
24FC 3007 00593 JR NC,SH4 ;Go if not
24FE CD1624 00594 CALL $DSP ; else dsply,
2501 05 00595 DEC B ; dec chars remaining,
2502 23 00596 INC HL ; pt to next char in string
2503 18F3 00597 JR SH3 ; and loop
2505 0E7D 00598 SH4 LD C,'}' ;Display closing brace
2507 CD1624 00599 CALL $DSP
250A 0E20 00600 LD C,' '
250C CD1624 00601 SH5 CALL $DSP ;Tab remaining distance
250F 10FB 00602 DJNZ SH5
2511 213D25 00603 LD HL,ENDSTR ;Print "?"
2514 C31C24 00604 JP $DSPLY
00605 ;
2517 3E20 00606 SKSP LD A,' ' ;Bypass all leading spaces
2519 BE 00607 SKP2 CP (HL)
251A C0 00608 RET NZ
251B 23 00609 INC HL
251C 18FB 00610 JR SKP2
00611 ;
00612 ;
00613 ;
251E 57 00614 DMSG DB 'Wait = '
61 69 74 20 20 20 3D 20
2527 20 00615 DDELAY DB ' , '
20 20 2C 20
252C 52 00616 RMSG DB 'Rate = '
61 74 65 20 20 20 3D 20
2535 20 00617 DRPEAT DB ' ',CR
20 20 0D
2539 24 00618 MDNAME DB '$KI',ETX
4B 49 03
253D 3F 00619 ENDSTR DB '? ',ETX
20 03
00620 ;
2540 80 00621 PRMTBL$ DB 80H
00622 ;
2541 57 00623 DB FLAG!ABB!7
2542 44 00624 DB 'DEFAULT'
45 46 41 55 4C 54
2549 00 00625 DB 0
254A 6C24 00626 DW DFPARM
00627 ;
254C 94 00628 DB ABB!NUM!4
254D 52 00629 DB 'RATE' ;Repeat key rate
41 54 45
2551 00 00630 RRESP DB 0
2552 D224 00631 DW RPARM
00632 ;
2554 94 00633 DB ABB!NUM!4
2555 57 00634 DB 'WAIT' ;Delay before repeat
41 49 54
2559 00 00635 WRESP DB 0
255A C024 00636 DW WPARM
00637 ;
255C 55 00638 DB ABB!FLAG!5
255D 51 00639 DB 'QUERY'
55 45 52 59
2562 00 00640 DB 0
2563 7E24 00641 DW QPARM
00642 ;
2565 00 00643 NOP ;Note end of parm table
00644 ;
00645 ;
00646 ; HEXDEC - Convert Hex Number to Decimal ASCII
00647 ; A => 8-bit Hex Number to Convert
00648 ; DE => Destination of ASCII characters
00649 ;
00650 ;
2566 C5 00651 HEXDEC PUSH BC ;Save regs
2567 E5 00652 PUSH HL
2568 F5 00653 PUSH AF
00654 ;
00655 ; Xfer number to HL
00656 ;
2569 2600 00657 LD H,0 ;Set HL = #
256B 6F 00658 LD L,A
00659 IF @BLD631
256C 0603 00660 LD B,3 ;<631>
256E 00661 @@HEXD ;<631>
256E+3E5F 00662 LD A,95
2570+EF 00663 RST 40
00664 ELSE
00665 ;
00666 LD A,' ' ;Character if leading 0
00667 LD BC,100 ;Set 10's power
00668 CALL CVD1 ;Convert to ASCII
00669 LD BC,10
00670 CALL CVD1
00671 LD A,L ;Get remainder
00672 ADD A,'0' ;Make ASCII and
00673 LD (DE),A ; stuff in buffer
00674 ;
00675 ENDIF
2571 F1 00676 POP AF ;Recover #
2572 E1 00677 POP HL ;And other regs
2573 C1 00678 POP BC
2574 C9 00679 RET
00680 ;
00681 IF @BLD631
00682 ELSE
00683 CVD1 PUSH DE ;Save user buffer
00684 LD E,A ;Save pad character
00685 LD D,0FFH ;Init digit count to -1
00686 XOR A
00687 CVD2 INC D ;Inc digit count and
00688 SBC HL,BC ; sub 10' power untill
00689 JR NC,CVD2 ; underflow
00690 ADD HL,BC ;Add back last sub
00691 LD A,E ;Recover pad char
00692 LD B,D ;Count to B
00693 POP DE ;Recover buffer ptr
00694 LD (DE),A ;Tempy store pad char
00695 INC B ;See if char a 0
00696 DEC B
00697 JR Z,CVD3 ;Go if so
00698 LD A,B ; else make digit ASCII
00699 ADD A,'0'
00700 LD (DE),A ; and put in buffer
00701 LD A,'0' ;Change the pad char
00702 CVD3 INC DE ;Bump buffer
00703 RET
00704 ENDIF
00705 ;
2575 1601 00706 RCHECK LD D,RMIN ;Rate minimum value
2577 1802 00707 JR CHECK
2579 160A 00708 DCHECK LD D,DMIN ;Wait minimum value
257B 7B 00709 CHECK LD A,E ;Get number
257C E67F 00710 AND 7FH ;Keep positive
257E BA 00711 CP D ;Lowest allowed
257F D8 00712 RET C ;Too low
2580 BF 00713 CP A ;Set Z if good value
2581 C9 00714 RET
00715 ;
2582 219625 00716 GETIT LD HL,INBUF ;Key buffer
2585 010003 00717 LD BC,3<8 ;3 chars max
2588 00718 @@KEYIN
2588+3E09 00719 LD A,9
258A+EF 00720 RST 40
258B DA1124 00721 JP C,$ABORT ;Quit if Break
00722 IF @BLD631
00723 IF @BLD631C
00724 ; Hmm, did we forget something... (See FIX631B/JCL & SETKI1/FIX)
258E 00725 @@DECHEX ;<631C>
258E+3E60 00726 LD A,96
2590+EF 00727 RST 40
2591 50 00728 LD D,B ;<631C>
2592 59 00729 LD E,C ;<631C>
2593 79 00730 LD A,C ;<631C>
2594 B7 00731 OR A ;<631C>
2595 C9 00732 RET ;<631C>
00733 ENDIF
00734 ELSE
00735 ;
00736 ; DECHEX - Decimal ASCII to Hex
00737 ; DE <= returns the Hex num
00738 ; HL => points to the start of Dec asc string
00739 ; A <= # of characters converted
00740 ;
00741 ;
00742 DECHEX LD B,0 ;Init counter to 0
00743 LD D,B ;Init ret valu to 0
00744 LD E,B
00745 CVDEC LD A,(HL) ;P/u a character
00746 SUB 30H ;Make binary
00747 CP 10
00748 JR NC,DONECON ;Leave when non-decimal found
00749 PUSH HL
00750 LD H,D
00751 LD L,E ;Prev. total to HL
00752 ADD HL,HL ;X2
00753 ADD HL,HL ;X4
00754 ADD HL,DE ;X5
00755 ADD HL,HL ;X10
00756 EX DE,HL ;Result back to DE
00757 ADD A,E ;Add in newest digit
00758 LD E,A
00759 LD A,0
00760 ADC A,D
00761 LD D,A
00762 POP HL ;Get buffer posn
00763 INC HL
00764 INC B ;Inc chars found
00765 JR CVDEC ; and continue next
00766 ;
00767 DONECON LD A,B
00768 OR A
00769 RET
00770 ENDIF
2596 00771 INBUF EQU $
00772 ;
2400 00773 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]