NOSLTDOS.DOC R.Gaspari 12-04-87 Use of the SMT no-slot clock with date-stamping BDOS. There are several date-stamping bdos replacements available today, most of which are freely distributed in the public domain. Each has tended to add features onto its predecessor so that the most recent has the most features. Versions especially notable are: P2DOS H.A.J.Ten Brugge The original imaginative leap that started it. DOS+25 C.B. Falconer Added access date info, current DMA, good docs. SUPRDOS2 Benjamin Ho Added auto disk relogging & delete key process. Z80DOS10 Carson Wilson Added get stamp & use stamp features. In each of the versions noted above, the intent is to store time in what is referred to as a 5 byte DRI format: 1. Days since Jan 1 1978 MSByte 2. Days since Jan 1 1978 LSByte 3. Hours in BCD 4. Minutes in BCD 5. Seconds in BCD However, the SMT no-slt clock reports its date information directly as month, day, year, and weekday directly in BCD. Thus to use the SMT clock with any version above, one must convert the info into DRI format for storage on disk and then re-convert it back again (in TDIR for example) for the directory display. The lines of code required to do this must reside in BIOS along with the TIME routine to read the clock. I found this restriction objectionable. Spare space in my bios is so jealously hoarded that I won't even put "set time" into bios....do it from the A> command line or not at all! An alternative is to modify the bdos to work with the SMT clock. First, one must decide on how many bytes to save per file. Then, one must decide on how to use these bytes (store creation date, modify date, access date, etc.). I accepted 30 bytes for three files as a reasonable standard. Then C.B.Falconer's INITDIR can be used without modification. But the use of the 10 bytes per file is a dilemma. If 3 bytes are needed for each date (month, day, year) instead of the 2 bytes per date in the DRI format, then creation date and update date require 6 bytes total. Only 4 bytes are left for other info. The remaining 4 bytes could be used for "last access" date or they could be used for "time" information. I chose "time." Unfortunately, this also means that "last access" information can no longer be supported. This choice is depicted below: byte C.Wilson SMT no-slot clk 1 CREATE date byte 1 CREATE date byte 1 2 CREATE date byte 2 CREATE date byte 2 3 UPDATE date byte 1 CREATE date byte 3 4 UPDATE date byte 2 CREATE time byte 1 5 UPDATE time byte 1 CREATE time byte 2 6 UPDATE time byte 2 UPDATE date byte 1 7 ACCESS date byte 1 UPDATE date byte 2 8 ACCESS date byte 2 UPDATE date byte 3 9 ACCESS time byte 1 UPDATE time byte 1 10 ACCESS time byte 2 UPDATE time byte 2 Once the byte usage is decided, the replacement bdos must be modified to accomodate it. I have modified both SUPRBDOS and Z80DOS10 successfully. The notes below document the changed as implemented. SUPRBDOS: a) in DOS.AZM DOTIME EQU TRUE Z80MR EQU TRUE RESDSK EQU FALSE b) in DOS1.MAC TIME EQU P2BIOS+0015H (see USER20 for bios notes) at VERS: remove the six DB 00h replace with a DS 6 c) in DOS2.MAC at CLOSE3: change LD E,5 to LD E,6 at MAKE0: change LD E,5 to LD E,6 in notes above STIME: note that E=6 sets update. at end of STIME: change LD BC,4 to LD BC,5 Z80DOS10: a) in Z80DOS10.Z80, make minor mods for assembly by Z80MR change name to Z80DOS.AZM move INCLUDE statements to left margin and add asterisk *include z80dhdr *include z80dchar.z80 *include z80ddisk.z80 *include z80dtime.z80 b) in Z80DHDR.LIB, provide system equates base equ 0d700h ; start of my ccp (N* Advantage) BIOStim equ BIOS+0015H ; my time routine (see USER20 notes) true equ .not.no ; for Z80MR c) in Z80DCHAR.Z80, make minor mods for assembly by Z80MR at num: change d,-1 to d,0ffh at mbfunc: remove all embedded spaces at mfile: remove all embedded spaces d) in Z80DDISK.Z80, modify function call code at chkdr0: change a,true to a,0ffh (not needed in v2.0) at openf0: delete 4 lines of code push hl ld e,8 call stime pop hl at close3: change e,4 to e,7 at make0: change e,4 to e,7 delete ld e,8 & call stime e) in Z80DTIME.Z80, modify time call code at and above stim1: remove the following 5 lines ld e,a and 8 jr z,stim1 srl e modify the next line from ld b,e to ld b,5 in the middle of stim1: remove push bc and pop bc around call time in the middle of stim1: remove the line ld c,b replace the line ld b,0 with ld bc,5 at cdate: modify reserved space to read cdate: ds 5 udate: ds 5 at very end, change " gt 3584" to ".gt.3584" INCOMPATIBILITY One incompatibility results because of this. Suprbdos has it's one unused byte at the end of the 32 byte entry, and Z80dos has it's one unused byte at position 1 (immediately after the 21h in entry 0). This difference is due to the use of E=1 and E=6 in Suprbdos, while Z80dsos uses E=2 & E=7. As long as TDIR knows which to look for this is not a problem. The TDIR.AZM enclosed is set to look for Z80dos. DEBUGGING For debugging, I found PATCH18A.COM convenient. Look at disk (T)racks, and address track (2) sector (0). Every fourth entry should have the 21h byte initialized by INITDIR. Then the bytes remaining are: (21) (00) (-10 bytes file 1-) (-10 bytes file 2-) (-10 bytes file 3-) REQUIREMENTS FOR USE Probably the hardest task of all is putting the TIME routines somewhere in protected memory. In the small portion of bios that Northstar shared with its users (USER.ASM) I have the squeezed space for time routines and for resident pop-up clock display support. While the specifics of this are of interest only to Northstar users, it may serve as a useful example, and is included as USER20. BLACK HOLE PROBLEMS To use the SMT no-slot clock, one must first have solved the problem of addressing it. In the initial release NOSLT20.LBR, sample code was given for mapping the boot prom onto addressable memory space so that the clock can be enabled and read. When used as a stand along program and run from the command line I found absolutely no problems. When the code to read the clock is moved up to high memory, however, odd things can happen. Since some application program (Wordstar, Supercalc, etc) remains in low memory while the clock is called, the interrupt handlers of the application program have their addresses set at run time. But when the clock is called, the memory addresses are re-defined in order to be able to addresses the prom under which the no-slot clock sits. More specifically, I found that when the current fcb (file control block) for disk read & write is in the same address space that the PROM is being mapped onto, the whole system is thrown into a tailspin. My solution for this is to use two different time routines. One maps the prom onto address space 0000h to 4000h, the other maps the prom onto address space 4000h to 8000h. The hard part was figuring out which to use! The latest version of the hardware clock address software as shown in USER20.AZM looks at the current fcb address by inspecting the most significant byte of the ix register. If the application program is using an fcb above 4000h, then map the prom from 0000h - 3FFFh. If the application program is using an fcb below 4000h, then map the prom from 4000h - 7FFFh. INSTALLATION First, edit the replacement bdos to suit the target computer system. Second, assemble the replacement bdos. A>Z80MR Z80DOS10 Third, calculate the offset required for your sysgen. Carson Wilson gives excellent instructions for this in Z80DOS10. Essentially you subtract the bdos image address (where sysgen puts it) minus the bdos actual address (the upper memory resident address). The subtraction should be done modulo FFFFh. In my system this is 1D00h - DF00h = 3E00h. Fourth, overlay the bdos onto the memory image of your cpm. A>SYSGEN -Enter drive to get cpm system (or return if already in RAM) 1 -Enter drive to put cpm system (or CONTROL-C to warm boot) ^C A>DDT ; use orig DDT only, it's 6K vs DDTZ 8K size -IZ80DOS10.HEX ; insert the bdos hex file -R3E00 ; read it in with the proper offset value -IUSER20.HEX ; insert the user hex file (with time support) -R3E00 ; read it in with proper offset -^C ; exit ddt A>SYSGEN -Enter drive to get cpm system (or return if already in RAM) -Enter drive to put cpm system (or CONTROL-C to warm boot) 1 Send bug reports and comments to: Russell A. Gaspari 6656 W. 87th Place Los Angeles 90045