[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 00:05:55 DATE/TIME - LS-DOS 6.3 Page 00001 00001 ;LBDATE/ASM - Date/Time Commands 00003 ; 0000 00004 *GET BUILDVER/ASM:3 00005 ; 00006 ; Buildver/asm is a bit of a kludge since not all utilities can load 00007 ; equates from LDOS60 and still compile. LOWCORE and everybody else 00008 ; relies on this setting, and it eventually ends up in LDOS60/EQU 00009 ; for programs that can use that. 00010 ; FFFF 00011 @BLD631 EQU -1 ;<631>Build 631 distribution (LEVEL 1B) 00012 ; These switches activate patches made since the 1B release. 00013 ; It is important that all earlier patches be enabled when a higher 00014 ; patch is enabled. 00015 ; Patches C thru F were published in TMQ IV.iv, page 32 (NOTE: the 00016 ; patch addresses listed for SPOOL in SPOOL1/FIX are 19H high.) FFFF 00017 @BLD631C EQU -1 ;<631>Apply 1C patches (SETKI) FFFF 00018 @BLD631D EQU -1 ;<631>Apply 1D patches (DIR) FFFF 00019 @BLD631E EQU -1 ;<631>Apply 1E patches (DIR & MEMDISK/DCT) FFFF 00020 @BLD631F EQU -1 ;<631>Apply 1F patches (SPOOL) 00021 ; Patches G and H were published in TMQ V.i, pages 10 and 18/19. FFFF 00022 @BLD631G EQU -1 ;<631>Apply 1G patches (//KEYIN,DIR,DO *) FFFF 00023 @BLD631H EQU -1 ;<631>Apply 1H patches (MEMORY) 00024 ; 00025 ;End of BUILDVER/ASM 0000 00026 *GET SVCMAC:3 ;SVC Macro equivalents 00027 ;SVCMAC/ASM - LS-DOS Version VI 00028 *LIST OFF 00420 *LIST ON 00422 *LIST OFF ;Get LDOS60/EQU 00560 *LIST ON 00561 ; 000D 00562 CR EQU 13 001D 00563 @ADTSK EQU 29 ;Add Task SVC # 001E 00564 @RMTSK EQU 30 ;Remove Task SVC # 0005 00565 CLK_SLT EQU 5 ;Clock Task Slot # 00566 ; 00567 ; 00568 ; DATE$ Storage 00569 ; 00570 ; DATE$+0 Year (80-87) 00571 ; DATE$+1 Day of the month (1-31) 00572 ; DATE$+2 Month (1-12) 00573 ; DATE$+3 Bits 0-7 of Day of Year 00574 ; Date$+4 Bit 0 = bit 8 of Day of Year 00575 ; Bits 1-3 contain Day of Week 00576 ; Bit 7 set if a leap year 00577 ; 00578 ; TIME$ Storage 00579 ; 00580 ; TIME$+0 Seconds (0-59) 00581 ; TIME$+1 Minutes (0-59) 00582 ; TIME$+2 Hours (0-23) 00583 ; 00584 ; 00585 ; 2400 00586 ORG 2400H 00587 ; 00588 ; Branch to TIME entry point 00589 ; 2400 C31825 00590 JP TIME ;Time entry point 00591 ; 00593 ; 2403 00594 DATE @@CKBRKC ;Break key down? 2403+3E6A 00595 LD A,106 2405+EF 00596 RST 40 2406 2804 00597 JR Z,BEGINA ;Ok if not 2408 21FFFF 00598 LD HL,-1 ; else abort 240B C9 00599 RET 00600 ; 00601 ; DATE - Pick up DATE$+0 pointer & stuff in IY 00602 ; 240C E5 00603 BEGINA PUSH HL ;Save command ptr 240D 218E27 00604 LD HL,DUMBUF ;HL => Dummy Buffer 2410 00605 @@DATE ;DE <= DATE$+0 2410+3E12 00606 LD A,18 2412+EF 00607 RST 40 2413 E1 00608 POP HL ;Recover command ptr 2414 D5 00609 PUSH DE ;Xfer ptr to IY 2415 FDE1 00610 POP IY 00611 ; 00612 ; Was a Date entered on the command line ? 00613 ; 2417 7E 00614 LD A,(HL) ;P/u character 2418 FE0E 00615 CP CR+1 ;Date entry ? 241A DA6224 00616 JP C,DSPDATE ;No - display date 00617 ; 00618 ; Date entered - check if legal format 00619 ; 241D 0E30 00620 LD C,'0' ;Init separator 241F CDB525 00621 CALL PARSDAT ;Parse entry 2422 C21125 00622 JP NZ,BADFMT ;Bad entry - abort 00623 ; 00624 ; Legal Date - If Intl date - swap DTBUF+1 & 2 00625 ; 00626 IF @INTL 00627 INC DE ;DE => DTBUF+1 00628 LD H,D ;HL => DTBUF+1 00629 LD L,E 00630 LD C,(HL) ;C = Intl MONTH 00631 INC HL ;HL => DTBUF+2 00632 LD A,(HL) ;A = Intl DAY 00633 LD (DE),A ;Set DTBUF+1 = DAY 00634 LD (HL),C ;Set DTBUF+2 = MONTH 00635 DEC DE ;DE => DTBUF+0 00636 ELSE 2425 00 00637 DC 9,0 ;Pad US ver to match Intl 00 00 00 00 00 00 00 00 00638 ENDIF 00639 ; 00640 ; Is the year legal ? 00641 ; 242E 1A 00642 LD A,(DE) ;P/u year entry 00643 IF @BLD631 242F FE0C 00644 CP 0CH ;<631> 2431 3003 00645 JR NC,L2436 ;<631> 2433 C664 00646 ADD A,64H ;<631> 2435 12 00647 LD (DE),A ;<631> 00648 L2436: 00649 ENDIF 2436 D650 00650 SUB 80 ;Accept only 80-87 2438 DA1125 00651 JP C,BADFMT ;Less than 80 - bad 00652 IF @BLD631 243B FE20 00653 CP 20H ;<631> 00654 ELSE 00655 CP 20 ;Greater than 99 ? 00656 ENDIF 243D 3018 00657 JR NC,BADFMT2 ;Yes - bad 00658 ; 00659 ; If Year is 1980 or 84 then set FEB = 29 days 00660 ; 243F E603 00661 AND 3 ;0 or 4 ? 2441 214D27 00662 LD HL,MAXDAYS+2 ;Set Feb to have 29 days 2444 2001 00663 JR NZ,NOTLEAP ;No - don't inc 2446 34 00664 INC (HL) ;Leap year - inc max days 00665 ; 00666 ; Check Range of month - must be 1 - 12 00667 ; 2447 3A8D27 00668 NOTLEAP LD A,(DTBUF+2) ;P/u month 244A 3D 00669 DEC A ;Set month = 0-11 244B FE0C 00670 CP 12 ;Valid Month ? 244D 3008 00671 JR NC,BADFMT2 ;Abort if 0 or >12 00672 ; 00673 ; Valid month - point HL to max days/month 00674 ; 244F 2B 00675 DEC HL ;HL => Max day table 2450 85 00676 ADD A,L ;Add month # to start 2451 6F 00677 LD L,A ;HL => Max days for month 00678 ; 00679 ; Check for Day entry is valid 00680 ; 2452 3A8C27 00681 LD A,(DTBUF+1) ;P/u day entry 2455 3D 00682 DEC A ;Reduce for test (0->FF) 2456 BE 00683 CP (HL) ;More than max days ? 2457 D21125 00684 BADFMT2 JP NC,BADFMT ;Go if too large (or 0) 00685 ; 00686 ; Transfer Date into buffer 00687 ; 245A EB 00688 EX DE,HL ;Point HL to DTBUF 245B FDE5 00689 PUSH IY ;Point DE = DATE$ 245D D1 00690 POP DE 245E 0E03 00691 LD C,3 ;BC = 3 chars to xfer 2460 EDB0 00692 LDIR ;Xfer 3 chars 00693 ; 00694 ; Display "No Date in System" if illegal Date 00695 ; 2462 FD7E02 00696 DSPDATE LD A,(IY+2) ;P/u month 2465 215827 00697 LD HL,NODATE$ ;"No Date in system" 2468 B7 00698 OR A ;Better not be zero 2469 CA1425 00699 JP Z,LOGABRT ;Log & abort 246C 47 00700 GOTDATE LD B,A ;Xfer month to B 246D 214D27 00701 LD HL,MAXDAYS+2 ;Adjust February if 2470 7E 00702 LD A,(HL) ; year is leap year 2471 D61D 00703 SUB 29 ; & not already adjusted 2473 2808 00704 JR Z,PUDAY ; in parsing date entry 00705 ; 00706 ; Pick up Year & increment max days if leap yr 00707 ; 2475 FD7E00 00708 LD A,(IY) ;P/u year 2478 E603 00709 AND 3 ;1980 and 1984 are lp yrs 247A 2001 00710 JR NZ,PUDAY ;Not leap year - fine 247C 34 00711 INC (HL) ;Bump to 29 00712 ; 00713 ; Set HL = day # this month, DE => Max table 00714 ; 247D FD6E01 00715 PUDAY LD L,(IY+1) ;P/u day # this month 2480 2600 00716 LD H,0 ; in HL 2482 114B27 00717 LD DE,MAXDAYS ;DE => Max day table 00718 ; 00719 ; Loop to Count up total # of days up to now 00720 ; 2485 1A 00721 DAYLP LD A,(DE) ;P/u max day 2486 85 00722 ADD A,L ;Add to HL 2487 6F 00723 LD L,A 2488 8C 00724 ADC A,H 2489 95 00725 SUB L 248A 67 00726 LD H,A 248B 13 00727 INC DE ;Bump days ptr 248C 10F7 00728 DJNZ DAYLP ;B months of max days 00729 ; 00730 ; Stuff days (9 bits) into DATE$ 00731 ; 248E FD7503 00732 LD (IY+3),L ;Stuff in lsb 2491 7C 00733 LD A,H ;Get bit "8" 2492 FDB604 00734 OR (IY+4) ; and OR it in 2495 FD7704 00735 LD (IY+4),A ;Then put it back 00736 ; 00737 ; Pick up year in E (0-7) 00738 ; 2498 FD7E00 00739 LD A,(IY) ;P/u year 249B D650 00740 SUB 80 ;Offset from 80 249D 5F 00741 LD E,A ;Put 0-7 in E 249E C603 00742 ADD A,3 ;Ck for year >= 84 24A0 0F 00743 RRCA 24A1 0F 00744 RRCA 00745 IF @BLD631 24A2 E60F 00746 AND 0FH ;<631>Keep bits 3-0 00747 ELSE 00748 AND 7 ;Keep bits 0,1,2 00749 ENDIF 24A4 83 00750 ADD A,E ;Add back to year 24A5 5F 00751 LD E,A ; & save in DE 24A6 1600 00752 LD D,0 24A8 19 00753 ADD HL,DE ;Add to days in year 24A9 23 00754 INC HL ;To start in right place 00755 ; 00756 ; HL = desired number to divide by seven 00757 ; 24AA 010700 00758 LD BC,7 ;Now divide by 7 24AD AF 00759 XOR A 24AE ED42 00760 DIV7 SBC HL,BC ;Subtract weeks (7-days) 24B0 30FC 00761 JR NC,DIV7 ; until under flow 00762 ; 00763 ; Correct # for division, & put in bits 1-3 00764 ; 24B2 7D 00765 LD A,L 24B3 C608 00766 ADD A,8 ;Add back to get 1-7 24B5 47 00767 LD B,A ;Save day of week 24B6 07 00768 RLCA ;Shift to bits 1-3 24B7 4F 00769 LD C,A ; to store in DATE$ 00770 ; 00771 ; Merge day of week with bit 9 of day of year 00772 ; 24B8 FD7E04 00773 LD A,(IY+4) ;P/u DATE$ + 4 24BB E6F1 00774 AND 0F1H ;Keep lp yr bit & bit 0 24BD B1 00775 OR C ;Merge day of week 24BE FD7704 00776 LD (IY+4),A ;Stuff back in 00777 ; 00778 ; Transfer Day string into display buffer 00779 ; 24C1 210027 00780 LD HL,DAYTBL ;HL => Day string table 24C4 113927 00781 LD DE,DATEBUF ;Date display buffer 24C7 D5 00782 PUSH DE ;Save start 24C8 CDA625 00783 CALL DSPMDY ;Write out the day 00784 ; 00785 ; Position DE to month destination in buffer 00786 ; 24CB 13 00787 INC DE ;Bump 24CC 13 00788 INC DE 00789 ; 00790 ; Pick up month, & stuff string into buffer 00791 ; 24CD FD7E02 00792 LD A,(IY+2) ;P/u month number 24D0 47 00793 LD B,A ;Stuff in B 24D1 211527 00794 LD HL,MONTBL ;HL => Month string table 24D4 CDA625 00795 CALL DSPMDY ;Write out the month name 00796 ; 00797 ; P/u day of the month & convert to ASCII 00798 ; 24D7 13 00799 INC DE ;DE => Day destination 24D8 FD7E01 00800 LD A,(IY+1) ;P/u day 24DB 06FF 00801 LD B,-1 ;Init # of tens to -1 00802 ; 00803 ; Divide day of the month by 10 00804 ; 24DD 04 00805 DIV10 INC B ;Divide by 10 24DE D60A 00806 SUB 10 ; with quotient in B 24E0 30FB 00807 JR NC,DIV10 ;Subtract until carry 00808 ; 00809 ; Convert to tens digit to ASCII 00810 ; 24E2 F5 00811 PUSH AF ;Save (10-remainder) 24E3 78 00812 LD A,B ;P/u quotient 24E4 C630 00813 ADD A,'0' ;Change to ASCII 00814 ; 00815 ; Change to a space if it's a leading zero 00816 ; 24E6 FE30 00817 CP '0' ;Zero? 24E8 2002 00818 JR NZ,NOTLD0 ;No - use it 24EA 3E20 00819 LD A,' ' ;Change leading 0 to ' ' 24EC 12 00820 NOTLD0 LD (DE),A ;Stuff in buffer 00821 ; 00822 ; Convert remainder to ASCII & stuff in buffer 00823 ; 24ED 13 00824 INC DE ;DE => ones destination 24EE F1 00825 POP AF ;Get back remainder 24EF C63A 00826 ADD A,3AH ;Change to ASCII 24F1 12 00827 LD (DE),A ;Stuff in buffer 00828 ; 00829 ; P/u year & stuff lower digit + "0" in buffer 00830 ; 24F2 FD7E00 00831 LD A,(IY) ;Form last year digit 00832 IF @BLD631 24F5 216C07 00833 LD HL,1900 ;<631> 24F8 85 00834 ADD A,L ;<631> 24F9 6F 00835 LD L,A ;<631> 24FA 8C 00836 ADC A,H ;<631> 24FB 95 00837 SUB L ;<631> 24FC 67 00838 LD H,A ;<631> 24FD 114527 00839 LD DE,YRBUF ;<631> 2500 00840 @@HEXDEC ;<631> 2500+3E61 00841 LD A,97 2502+EF 00842 RST 40 00843 ELSE 00844 SUB 80 ;A = 0-19 00845 CP 10 ;In 1980's? 00846 JR C,WAS80 00847 LD B,A 00848 LD A,'9' ;Nope, 1990's 00849 LD (DATEBUF+15),A 00850 LD A,B ;Get back year offset 00851 SUB 10 ;Sub off decade 00852 WAS80 ADD A,'0' ;Make ascii 00853 LD (DATEBUF+16),A ;Stuff year 00854 ENDIF 00855 ; 00856 ; Set B = 0 (Normal Exit) 00857 ; 2503 0600 00858 LOGDT LD B,0 ;B = 0 (normal exit) 2505 E1 00859 POP HL ;HL => Date/Time string 00860 ; 00861 ; Display Date or Time String 00862 ; 2506 C5 00863 LOGMSG PUSH BC ;Save Error #, B (exit) 2507 00864 @@LOGOT ;Log message 00865 IFEQ 00H,1 00866 LD HL, 00867 ENDIF 2507+3E0C 00868 LD A,12 2509+EF 00869 RST 40 250A C1 00870 POP BC ;B = exit condition 00871 ; 00872 ; If B = 0 then exit HL = 0, otherwise HL = -1 00873 ; 250B 60 00874 LD H,B ;Set HL = -1 or 0 250C 68 00875 LD L,B ; 250D 00876 @@CKBRKC ;Clear any break 250D+3E6A 00877 LD A,106 250F+EF 00878 RST 40 2510 C9 00879 RET ;RETurn with condition 00880 ; 00881 ; Bad Format - display error & abort 00882 ; 2511 216B27 00883 BADFMT LD HL,BADDAT$ ;Illegal Date/Time 2514 06FF 00884 LOGABRT LD B,-1 ;Abort Condition 2516 18EE 00885 JR LOGMSG ;Log Message 00886 ; 00889 ; 2518 00890 TIME @@CKBRKC ;Break key down? 2518+3E6A 00891 LD A,106 251A+EF 00892 RST 40 251B 2804 00893 JR Z,BEGINB ;Ok if not 251D 21FFFF 00894 LD HL,-1 ; else abort 2520 C9 00895 RET 00896 ; 00897 ; TIME entry point - Any Parms entered ? 00898 ; 2521 E5 00899 BEGINB PUSH HL ;Save pointer 2522 7E 00900 TLOOP LD A,(HL) ;P/u character 2523 FE28 00901 CP '(' ;Any parameters ? 2525 2807 00902 JR Z,GETPRMS ;Yes - get 'em 2527 FE0D 00903 CP CR ;End of line ? 2529 2809 00904 JR Z,CLRSTK ;Yes - go check time 252B 23 00905 INC HL ;Bump ptr 252C 18F4 00906 JR TLOOP ;Do til terminator 00907 ; 00908 ; Process any Parameters 00909 ; 252E 11F825 00910 GETPRMS LD DE,PRMTBL$ ;DE => Parameter Table 2531 00911 @@PARAM ;Get parameters 2531+3E11 00912 LD A,17 2533+EF 00913 RST 40 00914 ; 00915 ; Stuff "Illegal Time" Mess in error routine 00916 ; 2534 217B27 00917 CLRSTK LD HL,BADTIM$ ;Chg "Bad date format" 2537 221225 00918 LD (BADFMT+1),HL ; to "Bad time... 253A E1 00919 POP HL ;Recover command ptr 253B 280A 00920 JR Z,GDPARMS ;Z - ok to continue 00921 ; 00922 ; Parameter Error - Display & abort 00923 ; 253D 6F 00924 IOERR LD L,A ;Xfer errcod to HL 253E 2600 00925 LD H,0 2540 F6C0 00926 OR 0C0H ;Short error 2542 4F 00927 LD C,A ;Xfer to C 2543 00928 @@ERROR ;Log error 2543+3E1A 00929 LD A,26 2545+EF 00930 RST 40 2546 C9 00931 RET 00932 ; 00933 ; Was there a TIME string entered ? 00934 ; 2547 7E 00935 GDPARMS LD A,(HL) ;P/u char 2548 FE28 00936 CP '(' ;Parms only? 254A CA9925 00937 JP Z,DSPTIME ;Display old time 254D FE0D 00938 CP CR ;End of line? 254F CA9925 00939 JP Z,DSPTIME ;Display old time 00940 ; 00941 ; Requested time set - Check if legal format 00942 ; 2552 AF 00943 XOR A 2553 32D225 00944 LD (ISTIM),A ;Show doint time 2556 328B27 00945 LD (DTBUF),A ;Init seconds to 0 2559 0E30 00946 LD C,'0' ;Init separator 255B CDB525 00947 CALL PARSDAT ;Parse entry 255E 20B1 00948 JR NZ,BADFMT ;Bad - abort 00949 ; 00950 ; Legal Format - Check if Hours are legal 00951 ; 2560 218D27 00952 LD HL,DTBUF+2 ;HL => Hours byte 2563 3E17 00953 LD A,23 ;Greater than 23 ? 2565 BE 00954 CP (HL) 2566 38A9 00955 JR C,BADFMT ;Yes - bad format 00956 ; 00957 ; Hours legal - Check if minutes legal 00958 ; 2568 2B 00959 DEC HL ;HL => Minutes 2569 3E3B 00960 LD A,59 ;Greater than 59 ? 256B BE 00961 CP (HL) 256C 38A3 00962 JR C,BADFMT ;Yes - bad format 00963 ; 00964 ; Minutes legal - Check if seconds legal 00965 ; 256E 2B 00966 DEC HL ;HL => Seconds 256F BE 00967 CP (HL) ;Greater than 59 ? 2570 389F 00968 JR C,BADFMT ;Yes - bad format 00969 ; 00970 ; Legal input - transfer to TIME$ storage area 00971 ; 2572 E5 00972 PUSH HL ;Save TIME buffer ptr 2573 218E27 00973 LD HL,DUMBUF ;HL => dummy buffer 2576 00974 @@TIME ;DE <= TIME$+0 2576+3E13 00975 LD A,19 2578+EF 00976 RST 40 2579 E1 00977 POP HL ;Recover TIME buffer ptr 257A 010300 00978 LD BC,3 ;3 bytes to xfer 257D EDB0 00979 LDIR ;Xfer 00980 ; 00981 ; Was the CLOCK (C) parameter entered ? 00982 ; 257F 210000 00983 DOCLOCK LD HL,0 ;HL = 0 (Normal Exit) 2582 3AFF25 00984 LD A,(CRESP) ;P/u response 2585 B7 00985 OR A 2586 C8 00986 RET Z ;RETurn if no response 00987 ; 00988 ; CLOCK (C) parameter entered - ON or OFF ? 00989 ; 2587 110000 00990 CLOCK LD DE,$-$ ;P/u parm = FFFF or 0000 258A 00991 @@FLAGS ;IY => System Flags 258A+3E65 00992 LD A,101 258C+EF 00993 RST 40 00994 ; 00995 ; Just Set/Reset CLOCK bit if Model IV version 00996 ; 00997 IF @MOD4 258D FDCB15E6 00998 SET 4,(IY+'V'-'A') ;Set Clock bit 2591 1C 00999 INC E ;Return if CLOCK = YES 2592 C8 01000 RET Z ; 2593 FDCB15A6 01001 RES 4,(IY+'V'-'A') ;Otherwise Reset bit 2597 1D 01002 DEC E ;Set Z flag 2598 C9 01003 RET ;Done - RETurn 01004 ENDIF 01005 ; 01006 ; Also Add or Remove Task if Model II Version 01007 ; 01008 IF @MOD2 01009 RES 4,(IY+'V'-'A') ;Reset clock bit 01010 LD C,CLK_SLT ;Set C = Clock Slot # 01011 LD A,@RMTSK ;A = Remove Task SVC # 01012 INC E ;Clock Off ? 01013 JR NZ,CLOFF ;Yes - remove task 01014 CLON LD DE,DO_CLOCK ;Clock on - DE => Address 01015 SET 4,(IY+'V'-'A') ;Set clock bit 01016 LD A,@ADTSK ;A = Add Task SVC # 01017 CLOFF RST 40 ;Issue SVC 01018 XOR A ;Set Z for no error 01019 LD H,A ;Pass to HL 01020 LD L,A ;For normal exit 01021 RET 01022 ENDIF 01023 ; 01024 ; Display the Time 01025 ; 2599 214227 01026 DSPTIME LD HL,DATEBUF+9 ;Pt to space for time str 259C E5 01027 PUSH HL ;Save pointer 259D 01028 @@TIME ;Xfer time into buffer 259D+3E13 01029 LD A,19 259F+EF 01030 RST 40 25A0 CD7F25 01031 CALL DOCLOCK ;Set/Reset Clock bit 25A3 C30325 01032 JP LOGDT ;Log it & exit 01035 ; 01036 ; DSPMDY - Xfer 3 char string from table to buffer 01037 ; 01038 ; B => Entry # in table to display 01039 ; HL => Table to fetch data from 01040 ; DE => Buffer to receive string 01041 ; 25A6 05 01042 DSPMDY DEC B ;B = entry, 0-6 25A7 7D 01043 LD A,L ;P/u lsb of table start 25A8 80 01044 ADD A,B 25A9 80 01045 ADD A,B ;Entries 3 bytes long 25AA 80 01046 ADD A,B 25AB 6F 01047 LD L,A ;HL => Table entry 01048 ; 01049 ; Transfer string into buffer 01050 ; 25AC 0603 01051 LD B,3 ;Three chars to xfer 25AE 7E 01052 DSPM1 LD A,(HL) ;P/u char from table 25AF 12 01053 LD (DE),A ;Stuff into buffer 25B0 23 01054 INC HL ;Bump 25B1 13 01055 INC DE 25B2 10FA 01056 DJNZ DSPM1 ;Three chars to xfer 25B4 C9 01057 RET ;Done - RETurn 01058 ; 01059 ; PARSDAT - Parse TIME/DATE string entry 01060 ; 01061 ; HL => Buffer containing string to parse 01062 ; C => Delimiter (<"0" = DATE, <"0"or=":" = TIME) 01063 ; 01064 ; DTBUF-DTBUF+2 <= Data in compressed format 01065 ; Z - Set if successful 01066 ; 25B5 118D27 01067 PARSDAT LD DE,DTBUF+2 ;Point to buf end 25B8 0603 01068 LD B,3 ;Process 3 fields 01069 ; 01070 ; Parse a field - Return NZ if bad 01071 ; 25BA D5 01072 PRS1 PUSH DE ;Save pointer 25BB CDDB25 01073 CALL PRS2 ;Get a digit pair 25BE D1 01074 POP DE ;Recover pointer 25BF C0 01075 RET NZ ;Ret if bad digit pair 01076 ; 01077 ; Good field - Stuff in buff, dec ptr, & count 01078 ; 25C0 12 01079 LD (DE),A ; else stuff the value 25C1 05 01080 DEC B ;Loop countdown 25C2 C8 01081 RET Z ;Do for 3 fields 25C3 1B 01082 DEC DE ;Backup the pointer 01083 ; 01084 ; Parsed a field - is the separator valid ? 01085 ; 25C4 7E 01086 LD A,(HL) ;P/u separator 25C5 23 01087 INC HL ;Bump pointer 25C6 FE3A 01088 CP ':' ;Check for ':' 25C8 28F0 01089 JR Z,PRS1 ; loop if so 25CA B9 01090 CP C ;Correct ? 25CB 300C 01091 JR NC,PRSRET ;NC = bad 25CD FE0D 01092 CP CR ;If end of line, ck for time 25CF 20E9 01093 JR NZ,PRS1 25D1 3EFF 01094 LD A,-1 25D2 01095 ISTIM EQU $-1 ;Set zero by time 25D3 B7 01096 OR A 25D4 2003 01097 JR NZ,PRSRET ;Bad if date 25D6 78 01098 LD A,B 25D7 3D 01099 DEC A ;If B was one, done 25D8 C8 01100 RET Z 01101 ; 25D9 B7 01102 PRSRET OR A ;Set NZ 25DA C9 01103 RET ;Return bad entry 01104 ; 01105 ; PRS2 - Parse a digit pair at HL 01106 ; 25DB CDF125 01107 PRS2 CALL PRS4 ;Get a digit 25DE 300F 01108 JR NC,PRS3 ;Illegal - return 01109 ; 01110 ; Legal Digit - Multiply by 10 01111 ; 25E0 5F 01112 LD E,A ;Multiply by ten 25E1 07 01113 RLCA ;X 2 25E2 07 01114 RLCA ;X 4 25E3 83 01115 ADD A,E ;X 5 25E4 07 01116 RLCA ;X 10 25E5 5F 01117 LD E,A ;Stuff in E 01118 ; 01119 ; Get another digit 01120 ; 25E6 CDF125 01121 CALL PRS4 ;Get ones digit 25E9 3004 01122 JR NC,PRS3 ;Bad - return NZ 01123 ; 01124 ; Legal digit - Add to tens digit & set Z flag 01125 ; 25EB 83 01126 ADD A,E ;Accumulate new digit 25EC 5F 01127 LD E,A ;Save 2-digit value 25ED BF 01128 CP A ;Clear flags 25EE C9 01129 RET ;Return Z 01130 ; 01131 ; Force NZ & Return 01132 ; 25EF B7 01133 PRS3 OR A ;Set NZ 25F0 C9 01134 RET ;RETurn 01135 ; 01136 ; Pick up a digit and convert to binary 01137 ; 25F1 7E 01138 PRS4 LD A,(HL) ;P/u a digit & 25F2 23 01139 INC HL ; bump ptr 25F3 D630 01140 SUB '0' ;Convert to binary 25F5 FE0A 01141 CP 10 ;Legal ? 25F7 C9 01142 RET ;C - legal, NC - illegal 01143 ; 01144 ; Parameter table 01145 ; 0080 01146 NUM EQU 80H 0040 01147 FLAG EQU 40H 0020 01148 STR EQU 20H 0010 01149 ABB EQU 10H 01150 ; 25F8 80 01151 PRMTBL$ DB 80H ;6.x Parameter Table 01152 ; 25F9 55 01153 DB FLAG!ABB!5 25FA 43 01154 DB 'CLOCK' 4C 4F 43 4B 25FF 00 01155 CRESP DB 0 2600 8825 01156 DW CLOCK+1 2602 00 01157 DB 0 01158 ; 2700 01159 ORG $<-8+1<+8 01160 ; 2700 53 01161 DAYTBL DB 'SunMonTueWedThuFriSat' 75 6E 4D 6F 6E 54 75 65 57 65 64 54 68 75 46 72 69 53 61 74 2715 4A 01162 MONTBL DB 'JanFebMarAprMayJunJulAugSepOctNovDec' 61 6E 46 65 62 4D 61 72 41 70 72 4D 61 79 4A 75 6E 4A 75 6C 41 75 67 53 65 70 4F 63 74 4E 6F 76 44 65 63 01163 IF @BLD631 2739 44 01164 DATEBUF:DB 'Day, Mon xx,' ;<631> 61 79 2C 20 4D 6F 6E 20 78 78 2C 2745 20 01165 YRBUF: DB ' 198x',CR ;<631> 31 39 38 78 0D 01166 ELSE 01167 DATEBUF DB 'Day, Mon xx, 198x',CR 01168 ENDIF 274B 00 01169 MAXDAYS DB 0,31,28,31,30,31,30,31,31,30,31,30,31 1F 1C 1F 1E 1F 1E 1F 1F 1E 1F 1E 1F 2758 44 01170 NODATE$ DB 'Date not in system',CR 61 74 65 20 6E 6F 74 20 69 6E 20 73 79 73 74 65 6D 0D 276B 42 01171 BADDAT$ DB 'Bad Date format',CR 61 64 20 44 61 74 65 20 66 6F 72 6D 61 74 0D 277B 42 01172 BADTIM$ DB 'Bad Time format',CR 61 64 20 54 69 6D 65 20 66 6F 72 6D 61 74 0D 01173 ; 01174 ; 278B 01175 DTBUF EQU $ 278E 01176 DUMBUF EQU $+3 01177 ; 2403 01178 END DATE 2403 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]