home *** CD-ROM | disk | FTP | other *** search
- ;
- ; TITLE 'ZDBDATE.Z80 DBase II DATE SET FUNCTION '
- ;
- ; This program is used to create an overlay for DBase II which
- ; will set the clock using the ZSDOS Function 98 (Get Time).
- ;
- ; The program is compatible with both plain vanilla DBASE.COM
- ; files and with files that have been modified by NEWBASE.COM.
- ;
- ; The program will set the date when entering DBase if ZSDOS
- ; and an appropriate clock driver are present. If there is an
- ; error reading the clock the program will print the message
- ; 'CLOCK NOT WORKING' and will return to DBase. If the version
- ; of DBase does not have the Newbase 'SKIPDATE' on, you will be
- ; prompted for the date.
- ;
- ; Information on the size and location of the free area in the
- ; various versions of DBase was obtained from the program
- ; NEWBASE.ASM. Only versions 2.41 & 2.43* have a sufficient
- ; free area to use this program.
- ;
- ; Many thanks to Gene Head, the author of NEWBASE.ASM (TM), whose
- ; work in dissecting the various versions of DBase II provided
- ; starting points and valuable aid in preparing this routine and
- ; to the developers of ZSDOS and the ZSYStem libraries.
- ;
- ; If anyone wishes to incorporate this program into other versions
- ; of DBase - the writer will be willing to provide help as required.
- ; Please leave a message on Jay Sage's Znode (617) 965-7259 or call
- ; me at (516) 224-5935 voice-evenings.
- ; Ed McGovern
- ;
- ; REVISION HISTORY
- ; ================
- ;
- ; 22-Jun-91 Gene Pizzetta
- ; ZDBDATE did not work (in fact, crashed the system, if
- ; NEWBASE had the ALTDRIVE (ZCPR) equate set TRUE for DBASE
- ; version 2.43*. It now overwrites part of the "Thirty days
- ; hath September" message instead. I don't own DBASE 2.41,
- ; so somebody else will have to deal with that one.
- ; 14-Jun-91 Ed McGovern
- ; Original Release
- ;
- false equ 0
- true equ false-1
- bdos equ 0005h
- gt_time equ 62h
- CR equ 0Dh
- LF equ 0Ah
- ;
- ;
- ;set the equate for your version of dbII to true
-
- db241 equ false
- db243 equ true
-
- if db241
- date equ 44ffh ; month location in version 2.41 (mdy)
- hdate equ 4b45h ; high date day location (dmy)
- db_ret equ 49ffh ; address for normal return to dbase
- free equ 45a7h ; free area in version 2.41 (344 bytes)
- jp_date equ 48e2h ; address to patch to jump to date routine
- nc_ret equ 491bh ; address to return to if clock error
- pr_msg equ 36c5h ; dbase print message routine
- endif
-
- if db243
- date equ 4941h ; month location in version 2.43*
- hdate equ 501eh ; high date day location (dmy)
- db_ret equ 4eaeh ; address for normal return to dbase
- free equ 4a2bh ; free area in version 2.43* (112 bytes)
- morfre equ 4f74h ; more free area if NEWBASE is used
- jp_date equ 4d91h ; address to patch for jump to date routine
- nc_ret equ 4dcah ; address to return to if clock error
- pr_msg equ 3a90h ; dbase print message routine
- endif
-
- page
- ;
- ; main line
- ;
- org free ;org at start of free area
- exx ;save the registers
- ld de,buffer ;location to store datespec
- ld c,gt_time ;Call the ZSDOS get-time
- call bdos ; function
- inc a ;check for error and
- jr z,noclock ; branch if we have one
- ld hl,buffer ;location to store datespec
- ld de,date+2 ;destination (Year location in date)
- ld ix,hdate ;high date location
- ld a,(hl) ;get the year,
- call bcd2bin ; convert it to binary,
- ld (de),a ; and store it in date
- ld (ix+2),a ; and hdate
- dec de ;point to the month
- dec de ; in dbase and
- inc hl ; the datespec
- ld a,(hl) ;get the month,
- call bcd2bin ; convert it to binary,
- ld (de),a ; store it in date
- ld (ix+1),a ; and hdate
- inc hl ;point to the day in the
- inc de ; datespec and dbase
- ld a,(hl) ;get the day,
- call bcd2bin ; convert it to binary,
- ld (de),a ; and store it
- ld (ix+0),a
- exx ;restore the registers
- jp db_ret ;normal return
- ;
- noclock ld hl,msg ;load the error message address
- call pr_msg ;print the message
- exx ;restore the registers
- jp nc_ret ; and return to dbase date routine
- ;
- buffer defs 12,0
-
- IF DB243
- org morfre
- db 0
- ENDIF ; DB243
- ;
- msg: defb 'CLOCK NOT WORKING',CR,LF,0
- ;
- bcd2bin ld b,a ;save the byte
- and 0f0h ;clear the low nibble
- rrc a ;shift right 1 bit
- ld c,a ;and put it into C (hi-nibble *8)
- rrc a
- rrc a ;hi-nibble*2
- add c ;hi-nibble * 10
- ld c,a
- ld a,b ;restore the byte
- and 0fh ;clear the hi-nibble
- add a,c ;add to binary hi-nibble
- ret ; and return
- ;
- ;---------------------------------------------------------------
- ;
- org jp_date ;jump to modifiy to reference new routine
- jp free ;new instruction
- ;
- end