home *** CD-ROM | disk | FTP | other *** search
- .hm1
- .fm1
- .sr0
- .he ZCPR3: THE LIBRARIES 4.2 -- DSLIB
- .fo Page #
- .pn 161
-
- IV« DSLI┬ -¡ Clocδ anΣ Filσ Stam≡ Support
-
- Introductioε « « « « « « « « « « « « « « « « « « « « « « 162
- Systeφ Identit∙ « « « « « « « « « « « « « « « « « « 163
- TIMINI¼ GETDOS¼ FINDCK¼ CKTDF¼ DOSTY╨ (global)¼
- DOSVE╥ (global)¼ TIMTY╨ (global)
- Clocδ Readinτ « « « « « « « « « « « « « « « « « « « 164
- RCLOCK¼ RDCLK
- Filσ Stam≡ Routine≤ « « « « « « « « « « « « « « « « 165
- GSTAMP¼ PSTAMP¼ GETTD¼ SETTD
- Director∙ Selectioε « « « « « « « « « « « « « « « « 167
- DDIRQS¼ DDIRQ¼ DDIRNPAK¼ DDIRPAK¼ DDIRSEL
- Timσ Conversion≤ « « « « « « « « « « « « « « « « « 169
- U2PTIM¼ P2UTIM¼ U2MTIM¼ M2UTIM
- Utilit∙ Routine≤ « « « « « « « « « « « « « « « « « 172
- FSTNXT¼ BCD2BIN¼ BIN2BCD¼ DVERS
- DateStampe≥ TIME&DA╘ « « « « « « « « « « « « « « « 173
- OPENTD¼ CLOSTD¼ RWTD
-
- .pa
- è
- DSLI┬ -¡ Clocδ anΣ Filσ Stam≡ Support
-
-
- INTRODUCTION:é Thi≤ librar∙ contain≤ ß collectioε oµ routine≤ át∩ ì
- facilitatσ additioε oµ filσ timσ anΣ datσ stampinτ anΣ rea∞ átimσ ì
- clocδ áfeatures« á ┴ commoε datσ anΣ timσ forma⌠ i≤ useΣ át∩ áexì
- changσ datσ anΣ timσ datß witΦ use≥ programs« I⌠ use≤ BC─ digit≤ ì
- as:
-
- Byte Offset: 00 01 02 03 04 05
- YY MM DD hh mm ss
-
- wherσ áYYÖ ╜ yea≥ (7╕-9╣ i≤ 197╕-1999¼ 0░-7╖ i≤ 200░-2077)¼ áMMÖ á╜ ì
- montΦ á(1..12)¼ DDÖ ╜ da∙ (1..28,30,31)¼ hhÖ ╜ hou≥ (0..23)¼ ámmÖ á╜ ì
- minutσ (00..59)¼ anΣ ssÖ ╜ seconΣ (00..59).
-
- GeneralizeΣ ároutine≤ arσ includeΣ whicΦ uniforml∙ áreturε áclocδ ì
- time¼ áa≤ wel∞ a≤ filσ stam≡ datß froφ ZSDOS/ZDDOS¼ CP/═ 2.2¼ áo≥ ì
- ZRDO╙ á1.xÖ áwitΦ Plu*Perfec⌠ Systemsº áDateStamper¼ áanΣ áDigita∞ ì
- Research'≤ áCP/═ áPlu≤ (als∩ knowε a≤ CP/═ 3)« Thσ ácommoε ádatß ì
- structure≤ arσ automaticall∙ converteΣ t∩ thσ appropriatσ áinte≥ì
- na∞ format≤ fo≥ thσ runninτ system.
-
- A≤ áwitΦ áthσ clocδ structure¼ filσ stam≡ datß i≤ áhandleΣ áiε áß ì
- consisten⌠ DateStampe≥-ZSDO╙ forma⌠ oµ packeΣ BC─ digit≤ iε ß 1╡-ì
- bytσ field:
-
- |-- Create --| |¡ Las⌠ Acc -| |-- Modify --|
- Byte Offset: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- YY MM DD hh mm YY MM DD hh mm YY MM DD hh mm
-
- wherσ áYYÖ ╜ yea≥ (7╕-9╣ i≤ 197╕-1999¼ 0░-7╖ i≤ 200░-2077)¼ áMMÖ á╜ ì
- montΦ á(1..12)¼ DDÖ ╜ da∙ (1..28,30,31)¼ hhÖ ╜ hou≥ (0..23)¼ ámmÖ á╜ ì
- minutσ (00..59).
-
- Iε áadditioε t∩ thσ generalizeΣ interfacσ routines¼ entr∙ ápoint≤ ì
- exis⌠ fo≥ DateStampe≥ specifiπ routines« Man∙ oµ thesσ áspecΘfiπ ì
- routine≤ áarσ automaticall∙ calleΣ froφ thσ generalizeΣ áro⌡tine≤ ì
- wheε DateStampe≥ i≤ detected.
-
- Conversioε routine≤ als∩ exis⌠ t∩ managσ interface≤ betweeε datσ-ì
- timσ áfield≤ oµ DateStamper¼ thσ M╙-DO╙ compatiblσ áDosDisk¼ áanΣ ì
- thσ CP/═ Plu≤-compatiblσ P2DO╙ format.
- .pa
- èSYSTEM IDENTITY:
-
- Routine║ TIMINI
- Function║ See if there is a clock we can read.
- Entry║ None
- Exit: A = time method¼ zero flag clear (NZ) if clock found
- A = 0, zero flag set (Z) if no clock found
- Affected║ AF
- Usage: Call≤ GETDO╙ settinτ DOSVE╥ anΣ DOSTYP¼ theε look≤ ì
- áááááááááááááááfo≥ ß clocδ t∩ read¼ implyinτ ß filσ stam≡ method« ì
- áááááááááááááááType≤ are║ "Só ╜ ZSDOS/ZDDO╙ internal¼ "Dó ╜ Datσì
- áááááááááááááááStamper¼ á"3ó á╜ CP/═ Plu≤ (CP/═ 3¼ áP2DO╙ átype)« ì
- áááááááááááááááThi≤ TIMTY╨ bytσ ma∙ bσ accesseΣ wheε desireΣ áanΣ ì
- ááááááááááááááái≤ áuseΣ b∙ GSTAM╨ anΣ PSTAM╨ t∩ ge⌠ anΣ se⌠ áfilσ ì
- ááááááááááááááástamp≤ respectively.
-
- Routine║ GETDOS
- Function║ Determine DOS type and version, set global variables.
- Entry║ None
- Exit║ A = DOS type (character), zero clear (NZ) if identified
- A = 0, zero flag set (Z) if not identified
- Affected║ AF
- Usage: UseΣ t∩ identif∙ thσ runninτ DO╙ typσ anΣ version« ì
- áááááááááááááááI⌠ i≤ calleΣ froφ TIMINI¼ bu⌠ ma∙ bσ calleΣ ásepaì
- ááááááááááááááárately« á Afte≥ ái⌠ i≤ called¼ DOSTY╨ áanΣ áDOSVE╥ ì
- áááááááááááááááglobal≤ ma∙ bσ directl∙ accessed.
-
- .ix DOSTYP (g)
- Global: DOSTYP á¡¡ áBytσ characte≥ variablσ fo≥ áDO╙ átypσ ì
- ááááááááááááááá("S"=ZSDOS¼ "D"=ZDDOS¼ "1"=CP/═ 1.x¼ "2"=CP/═ 2.x¼ ì
- ááááááááááááááá"3"=CP/═ Plu≤ (3.x)¼ "R"=ZRDOS¼ 0=Unknown)
-
- .ix DOSVER (g)
- Global: DOSVER á¡¡ áBytσ variablσ fo≥ DO╙ áversioε ánumbe≥ ì
- ááááááááááááááá(vendo≥ specific)
-
- .ix TIMTYP (g)
- Global: TIMTYP ¡¡ Bytσ characte≥ variablσ fo≥ typσ oµ timσ ì
- áááááááááááááááanΣ datσ stampinτ anΣ clocδ iε usσ ("3"=CP/═ Plus¼ ì
- ááááááááááááááá"S"=Interna∞ ZSDO╙ o≥ ZDDOS¼ "D"=DateStamper).
-
- Routine║ FINDCK
- Function║ Check for DateStamper clock and set read status
- Entry: None
- Exit: A <> 0, zero flag clear (NZ) if clock found
- HL = pointer to clock starting address if found
- A = 0, zero flag set (Z), HL = - if not found
- Affected: AF¼ BC¼ DE¼ HL
- Usage: UseΣ áwitΦ DateStampe≥-specifiπ interfaces« á Cal∞ ì
- áááááááááááááááthi≤ ároutinσ nea≥ thσ beginninτ oµ ß áprograφ át∩ ì
- ááááááááááááááádeterminσ clocδ status« Thi≤ routinσ i≤ no⌠ needì
- áááááááááááááááeΣ áiµ thσ recommendeΣ áTIMINI/RCLOC╦ ágeneralizeΣ ì
- ááááááááááááááároutine≤ arσ used.
- .pa
- è Routine║ CKTDF
- Function║ Check for DateStamper TIME&DAT file on drive
- Entry: None¼ bu⌠ use≥ must log desired drive before calling
- Exit: A <> 0, zero flag reset (NZ) if TIME&DAT file i≤ located
- A = 0, zero flag set (Z) if no TIME&DAT file present
- Affected: AF¼ BC¼ DE¼ HL
- Usage: UseΣ witΦ DateStampe≥-specifiπ filσ stam≡ routine≤ ì
- áááááááááááááááonly¼ o≥ witΦ routine≤ wherσ individua∞ filσ stam≡ ì
- áááááááááááááááacces≤ ái≤ to∩ slow« I⌠ shoulΣ bσ ácalleΣ ábeforσ ì
- áááááááááááááááan∙ attemp⌠ i≤ madσ t∩ acces≤ filσ stam≡ áinformaì
- ááááááááááááááátion« á ┴ ácommoε áusσ i≤ t∩ se⌠ áflag≤ áfo≥ ámodσ ì
- áááááááááááááááchanginτ betweeε stam≡ anΣ noε-stam≡ operations.
-
- CLOCK READING:
-
- Routine║ RCLOCK
- Function║ ReaΣ clocδ identifieΣ b∙ TIMIN╔ t∩ specifieΣ address
- Entry: HL = address of 6-byte area to receive time string
- Exit: A = 0, zero flag set (Z) if OK, time string filled
- A <> 0, zero flag clear (NZ) if error
- Affected: HL¼ DE¼ BC¼ AF
- Usage: Form≤ áß generalizeΣ clocδ reaΣ fo≥ áZSDOS¼ áDateì
- áááááááááááááááStamper¼ o≥ CP/═ Plu≤ clock≤ identifieΣ b∙ TIMINI« ì
- áááááááááááááááI⌠ áread≤ clocδ datß t∩ thσ specifieΣ áaddres≤ áiε ì
- áááááááááááááááthσ ástandarΣ áformat« Sincσ CP/═ Plu≤ ádoe≤ áno⌠ ì
- áááááááááááááááreturε áß ávaliΣ reaΣ flag¼ thσ statu≤ ái≤ áalway≤ ì
- áááááááááááááááassumeΣ át∩ ábσ truσ fo≥ ß gooΣ áread« á Yo⌡ ámus⌠ ì
- áááááááááááááááinsurσ tha⌠ ß valiΣ clocδ i≤ installeΣ anΣ workinτ ì
- ááááááááááááááábeforσ callinτ thi≤ routine.
- Example║
- EXT TIMINI,RCLOCK ; always declare both routines
- ... ; ..preliminary code
- CALL TIMINI ; initialize and identify clock
- ... ; ..other program code
- LD HL,TIMSTR ; place the time here
- CALL RCLOCK ; ..and read the clock
- JR NZ,BADCLK ; jump if error reading clock
- ... ; ..else proceed to use it
- TIMSTR: DEFS 6 ; date/time: YY MM DD HH MM SS
-
- Routine║ RDCLK
- Function║ Read DateStamper clock to specified buffer
- Entry: HL = pointer to 6-byte buffer location
- FINDCK must have been previously called
- Exit: HL = pointer to last byte of date/time string iµ OK
- A <> 0, zero flag clear (NZ) if OK
- A = 0, zero set (Z), HL = 0 if bad clock read
- Affected: AF¼ BC¼ DE¼ HL
- Usage: UseΣ át∩ reaΣ ß DateStampe≥-specifiπ clock« á Datσ ì
- áááááááááááááááanΣ timσ informatioε i≤ returneΣ iε thσ samσ áforì
- áááááááááááááááma⌠ a≤ othe≥ routine≤ iε thi≤ library.
- Example:
- EXT RDCLK,FINDCK ; declare the routine
- ... ; ..initial program code
- CALL FINDCK ; call this early in program
- è ... ; ..intervening program code
- LD HL,TIMSTR ; set addr for 6-byte buffer
- CALL RDCLK ; read the clock
- JR Z,NOGOOD ; ..jump if bad read
-
- FILE STAMP ROUTINES:
-
- Routine║ GSTAMP
- Function║ Return file date stamp data for specified file
- Entry: DE = pointer to FCB for file of interest
- HL = pointer to 15-byte buffer fo≥ stamp data
- TIMIN╔ mus⌠ havσ beeε calleΣ t∩ se⌠ globa∞ ávarißì
- ááááááááááááááábles« Drivσ anΣ use≥ areß fo≥ thσ specifieΣ áfilσ ì
- ááááááááááááááámus⌠ bσ se⌠ prio≥ t∩ callinτ thi≤ routine.
- Exit: A <> 0, zero flag clear (NZ) if operation successful
- A = 0, zero flag set (Z) on error
- Affected: AF¼ BC¼ HL
- Curren⌠ DM┴ addres≤ i≤ altereΣ.
- Usage: RecommendeΣ fo≥ filσ stam≡ acces≤ iε CP/═-compatiì
- áááááááááááááááblσ systems« Use≤ DOSTY╨ anΣ TIMTY╨ variable≤ át∩ ì
- ááááááááááááááádeterminσ ástam≡ methoΣ iε effect¼ anΣ áwil∞ áreaΣ ì
- áááááááááááááááfilσ stamp≤ unde≥ ZSDO╙ anΣ DateStampe≥ witΦ áCP/═ ì
- ááááááááááááááá2.▓ o≥ ZRDOS¼ anΣ wil∞ reaΣ stamp≤ froφ CP/═ áPlu≤ ì
- ááááááááááááááá(CP/═ 3).
- Example║ Seσ PSTAM╨ below.
-
- Routine║ PSTAMP
- Function║ Set file date stamp data for specified file
- Entry: DE = pointer to FCB for file of interest
- HL = pointer to 15-byte buffer with stamp data
- TIMIN╔ mus⌠ havσ beeε calleΣ t∩ se⌠ globa∞ ávariaì
- ááááááááááááááábles« Drivσ anΣ use≥ areß fo≥ thσ specifieΣ áfilσ ì
- ááááááááááááááámus⌠ bσ se⌠ prio≥ t∩ callinτ thi≤ routine.
- Exit: A <> 0, zero flag clear (NZ) if operation successful
- A = 0, zero flag set (Z) on error
- Affected: AF¼ BC¼ HL
- Curren⌠ DM┴ addres≤ i≤ altereΣ.
- Usage: RecommendeΣ fo≥ filσ stam≡ acces≤ iε CP/═-compatiì
- áááááááááááááááblσ systems« Use≤ thσ DOSTY╨ anΣ TIMTY╨ variable≤ ì
- ááááááááááááááát∩ ádeterminσ ástam≡ methoΣ iε áeffect¼ áanΣ áwil∞ ì
- áááááááááááááááwritσ filσ stamp≤ unde≥ ZSDO╙ anΣ DateStampe≥ witΦ ì
- áááááááááááááááCP/═ á2.▓ o≥ ZRDOS¼ bu⌠ no⌠ unde≥ CP/═ Plu≤ á(CP/═ ì
- ááááááááááááááá3).
- Example:
- EXT GSTAMP,PSTAMP,TIMIN╔ ; declare routines
- ... ; ..preceding code
- CALL TIMINI ; set the time sybsystem early
- ... ; ..other program code
- CALL SETFCB ; set an FCB to a desired file
- LD DE,FCB ; ..point to it
- LD HL,TBUFF ; ..and to buffer for stamps
- CALL GSTAMP ; get stamp for this file
- JR Z,NOSTAMP ; ..go to error handler if bad
- ... ; use the data
- CALL SETDAT ; set stamp data in buffer
- è LD DE,FCB ; ..point to FCB for file
- LD ╚L,TBUFF ; ..and to buffer with stamps
- CALL PSTAMP ; stamp file with TBUFF values
- JR Z,NOSTAMP ; ..jump error if bad return
- ... ; else carry on
-
- FCB: DEFS 36 ; FCB for file of interest
- TBUFF: DEFS 15 ; buffer for stamp data
-
- Routine║ GETTD
- Function║ Get DateStamper file stamp for specified file
- Entry: A = TIME&DAT sector index (0..7) (from FSTNXT)
- DE = randoφ record number (from FSTNXT)
- HL = pointer to 15-byte buffer for date-time info
- User must log onto drive containing file and stamp
- Exit: A <> 0, zero flag clear (NZ) if OK
- A = 0, zero flaτ set (Z) if no file or read error
- Affected: AF¼ BC¼ DE¼ HL
- DMA is altered by this routine.
- Usage: DateStampe≥-specifiπ routinσ returninτ filσ ástam≡ ì
- ááááááááááááááádatß fo≥ ß filσ usinτ FSTNX╘ cal∞ parameters.
- Example:
- EXT GETTD ; declare the routine
- ... ; ..check DateStamper
- ... ; ..log drive, call FSTNXT
- LD HL,USRDAT ; put 15-byte stamp data here
- CALL GETTD ; fill in destination string
- JR Z,NODATA ; ..jump if bad/no stamp
- ... ; else process the stamp
-
- Routine║ SETTD
- Function║ Set DateStamper file stamp for specified file.
- Entry: A = TIME&DAT sector index (0..7) (from FSTNXT)
- DE = random record number (from FSTNXT)
- HL = pointer to stamp data in 15-byte buffer
- Use≥ must log onto drive containing file and stamp
- Exit: A <> 0, zero flag clear (NZ) if OK
- A = 0, zero set (Z) if no file or read error
- Affected: AF¼ BC¼ DE¼ HL
- DMA is altered by this routine.
- Usage: DateStampe≥-specifiπ routinσ set≤ filσ stam≡ ádatß ì
- áááááááááááááááfo≥ ß specifieΣ filσ t∩ use≥-supplieΣ values.
- Example:
- EXT SETTD ; declare the routine
- ... ; ..validate DateStamper
- ... ; ..log drive, call FSTNXT
- LD HL,USRDAT ; point to 15-byte stamp field
- CALL SETTD ; set DateStamper file stamp
- JR Z,BADSET ; ..jump if if error
- ... ; else carry on!
- .pa
- èDIRECTORY SELECTION:
-
- Routine║ DDIRQS
- Function║ Return sorted directory with file stamps and sizing
- Entry: HL = address of TPA buffer start
- DE = points to FCB entry to match directory entries
- A = modσ selec⌠ character:
- b7 -- 1 = select system files
- b6 -- 1 = select non-system files
- b5 -- 1 = select all users
- C = secondary modσ selec⌠:
- b7 -- ▒ ╜ sort type then name, ░ ╜ name then type
- b0 -- 1 = searcΦ ááDateStampe≥ áfirst¼ áátheε ì
- ááááááááááááááááááááááááááááááDosDisk¼ átheε áP2DO╙ stamps╗ á░ á╜ ì
- ááááááááááááááááááááááááááááááski≡ DateStamper
- Exit: A <> 0, zero flag clear (NZ) if OK
- A = 0, zero set (Z) if TPA overflow
- BC = number of files in sorted directory array
- HL = address of first file in buffer
- Affected: HL¼ BC¼ AF
- DMA Address is set to 80h
- Usage: ┴ replacemen⌠ fo≥ thσ SYSLI┬ routinσ DIRQS« á Filσ ì
- ááááááááááááááástamp≤ áarσ áautomaticall∙ appendeΣ át∩ ádirector∙ ì
- ááááááááááááááádatß áfroφ áDateStamper¼ P2DO╙ á(CP/═ áPlus)¼ áanΣ ì
- áááááááááááááááDosDisk« á Thσ álas⌠ áacces≤ fielΣ ái≤ ánulleΣ áiε ì
- áááááááááááááááP2DOS¼ anΣ thσ singlσ DosDisδ stam≡ i≤ returneΣ iε ì
- áááááááááááááááthσ las⌠ modifieΣ field« EacΦ entr∙ i≤ 3▒ characì
- áááááááááááááááter≤ lonτ (1╢ fo≥ filσ entry¼ 1╡ fo≥ stamp).
- Example║ Seσ DDIR╤ below.
-
- Routine║ DDIRQ
- Function║ Return sorted directory with file stamps
- Entry: HL = address of TPA buffer start
- DE = points to FCB entry to match directory entries
- A = modσ select character:
- b7 -- 1 = select system files
- b6 -- 1 = select non-system files
- b5 -- 1 = select all users
- C = secondary modσ select:
- b7 -- 1 = sor⌠ typσ theε name¼ ░ ╜ namσ átheε ì
- áááááááááááááááááááááááááááááátype
- b0 -- 1 = searcΦ ááDateStampe≥ áfirst¼ áátheε ì
- ááááááááááááááááááááááááááááááDosDisk¼ átheε áP2DO╙ stamps╗ á░ á╜ ì
- ááááááááááááááááááááááááááááááski≡ DateStamper
- Exit: A <> 0, zero flag clear (NZ) if OK
- A = 0, zero set (Z) if TPA overflow
- BC = number of files in sorted directory array
- HL = address of first file in buffer
- Affected: HL¼ BC¼ AF
- DMA Address is set to 80h
- Usage: ┴ replacemen⌠ fo≥ thσ SYSLI┬ routine≤ DIRQ« á Filσ ì
- ááááááááááááááástamp≤ áarσ áautomaticall∙ appendeΣ át∩ ádirector∙ ì
- ááááááááááááááádatß áfroφ áDateStamper¼ P2DO╙ á(CP/═ áPlus)¼ áanΣ ì
- áááááááááááááááDosDisk« á Thσ álas⌠ áacces≤ fielΣ ái≤ ánulleΣ áiε ì
- áááááááááááááááP2DOS¼ anΣ thσ singlσ DosDisδ stam≡ i≤ returneΣ iε ìèáááááááááááááááthσ las⌠ modifieΣ field« EacΦ entr∙ i≤ 3▒ characì
- áááááááááááááááter≤ lonτ (1╢ fo≥ filσ entry¼ 1╡ fo≥ stamp).
- Example:
- EXT DDIR╤ ; ..or DDIRQS, don't use both
- ...
- CALL CODEND ; get lower TPA value in HL
- LD DE,MYFCB ; match this file spec
- LD C,01H ; sort name/type, DS first
- LD A,0E0H ; SYS & non-SYS, all user areas
- CALL DDIRQ ; do the call (or to DDIRQS)
- JP Z,ERROR ; ..error if not enough space
- LD A,B ; do we have any files?
- OR C ; ..BC has number of files
- JP Z,NOFILS ; jump if no files in array
- ... ; ..use the files in the array
-
- MYFCB: DEFB 0,'???????????',0,0,0,0 ; FCB to match
- DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
- Routine║ DDIRNPAK
- Function║ Negate selection markings in directory buffer
- Entry: HL = points to directory buffer from DDIRQ/DDIRQS
- BC = number of entries in the buffer
- Exit: BC = number of entries in buffer after select/packing
- Affected: BC
- Usage: UseΣ át∩ deletσ filσ entrie≤ froφ DDIRQ╙ o≥ áDDIR╤ ì
- ááááááááááááááádirector∙ routines« Upoε completion¼ onl∙ entrie≤ ì
- ááááááááááááááápreviousl∙ unmarkeΣ remain¼ anΣ thσ tablσ i≤ ácoφì
- ááááááááááááááápresseΣ t∩ onl∙ thesσ entries« Thi≤ i≤ simila≥ t∩ ì
- áááááááááááááááthσ SYSLI┬ routinσ DIRNPAK¼ bu⌠ tailoreΣ t∩ átimσ-ì
- ááááááááááááááádatσ stampeΣ director∙ lists.
- Example:
- EXT DDIRNPAK ; declare the routine
- ... ; build dir table (DDIRQ(S))
- ... ; ..and select entries
- LD HL,(BUFF) ; buffer start (DDIRQ/DDIRQS)
- LD BC,(COUNT) ; ..# of entries (DDIRQ/DDIRQS)
- CALL DDIRNPAK ; Keep unselected & pack buffer
- ... ; ..continue w/ new file count
-
- Routine║ DDIRPAK
- Function║ Pack directory buffer from DDIRQ/DDIRQS
- Entry: HL = points to directory buffer from DDIRQ/DDIRQS
- BC = number of entries in the buffer
- Exit: BC = new number of buffer entries after select/pack
- Affected: BC
- Usage: Compres≤ filσ I─ arra∙ froφ director∙ sor⌠ routinσ ì
- áááááááááááááááretaininτ onl∙ markeΣ filσ entries« Thi≤ ároutinσ ì
- ááááááááááááááái≤ simila≥ t∩ thσ SYSLI┬ routinσ DIRPAK¼ bu⌠ funcì
- ááááááááááááááátion≤ witΦ timσ-datσ stampeΣ director∙ lists.
- Example:
- EXT DDIRPAK ; declare the routine
- ... ; build dir table (DDIRQ/DDIRQS)
- ... ; ..and select entries
- LD HL,(BUFF) ; buffer start (DDIRQ/DDIRQS)
- è LD BC,(COUNT) ; ..# of entries (DDIRQ/DDIRQS)
- CALL DDIRPAK ; keep selected entries & pack
- ... ; ..continue w/new file count
-
- Routine║ DDIRSEL
- Function║ Select entries from DDIRQ/DDIRQS directory buffer
- Entry: HL = points to directory buffer from DDIRQ/DDIRQS
- DE = FCB entry to select against
- BC = number of entries in the buffer
- A = modσ select flag:
- b7 -- select non-system files
- b6 -¡ select system files
- b5 -- select all users
- b4..b0 -- user number
- Exit: Selected files are marked
- Affected: None
- Usage: Selec⌠ áfilσ áentrie≤ b∙ settinτ thσ áMS┬ áoµ áthσ ì
- áááááááááááááááfirs⌠ bytσ (use≥ #⌐ baseΣ oε filσ namσ anΣ typσ iε ì
- áááááááááááááááFCB¼ anΣ selectioε flags« Thi≤ routinσ i≤ simila≥ ì
- ááááááááááááááát∩ áthσ áSYSLI┬ routinσ áDIRSEL¼ ábu⌠ áaccomodate≤ ì
- ááááááááááááááátimσ-datσ stampeΣ director∙ lists.
- Example:
- EXT DDIRSEL ; declare the routine
- ... ; build dir (DDIRQ/DDIRQS)
- LD HL,(BUFF) ; buffer start (DDIRQ/DDIRQS)
- LD DE,MYFCB ; ..FCB criteria for selection
- LD BC,(COUNT) ; ..and # entries (from DDIRQ)
- LD A,01100000B ; SYS files in all user areas
- CALL DDIRSEL ; mark matching entries
- ... ; ..continue on
-
- TIME CONVERSIONS:
-
- Routine║ U2PTIM
- Function║ Convert ZSDOS-DateStamper time to P2DOS (CP/M Plus)
- Entry: DE = points to Universal time string (source)
- HL = points to P2DOS time string (destination)
- Exit: ┴ á╜ 0¼ zer∩ se⌠ (Z⌐ iµ OK¼ destinatioε átimσ áse⌠ ì
- ááááááááááááááá(les≤ seconds)
- A <> 0, zero clear (NZ) if error, destination zeroed
- D┼ ╜ pointe≥ t∩ second≤ bytσ iε sourcσ strinτ (no⌠ ì
- ááááááááááááááámoved)
- H╠ ╜ pointe≥ t∩ second≤ bytσ iε destinatioε strinτ ì
- ááááááááááááááá(no⌠ filled)
- Affected: HL¼ DE¼ BC¼ AF
- Usage: Conversioε oµ timσ froφ ZSDO╙-DateStampe≥ t∩ áCP/═ ì
- áááááááááááááááPlu≤ type« Onl∙ thσ date¼ hour¼ anΣ minutσ field≤ ì
- áááááááááááááááarσ áconverted¼ ábu⌠ register≤ arσ áreturneΣ ásucΦ ì
- ááááááááááááááátha⌠ ß singlσ LD╔ movσ instructioε afte≥ thσ árouì
- ááááááááááááááátinσ wil∞ movσ an∙ second≤ information« Year≤ 7╕-ì
- ááááááááááááááá9╣ arσ assumeΣ t∩ bσ 197╕-1999¼ ░-7╖ a≤ 200░-2077« ì
- áááááááááááááááThi≤ ároutinσ woulΣ commonl∙ bσ useΣ áiε áprogram≤ ì
- ááááááááááááááásucΦ áa≤ librar∙ utilitie≤ whicΦ internall∙ usσ áß ì
- áááááááááááááááCP/═ Plu≤ typσ oµ stamp.
- .pa
- è Example:
- EXT U2PTIM ; declare the variable
- ... ; read a clock or stamp
- LD DE,UTIM ; set source time spec address
- LD HL,PTIM ; ..and dest time spec addr
- CALL U2PTIM ; do the conversion
- JR NZ,ERROR ; ..jump if conversion error
- ... ; else use the P2DOS string
-
- Routine║ P2UTIM
- Function║ Convert P2DOS (CP/M Plus) time spec to standard
- Entry: HL = points to P2DOS (CP/M Plus) time string (source)
- DE = points to universal time string (destination)
- Exit: ┴ á╜ á0¼ zer∩ se⌠ (Z)¼ destinatioε ástrinτ áfilleΣ ì
- ááááááááááááááá(les≤ seconds)
- Errors only due to bad entry (check YY=MM=0).
- H╠ ╜ point≤ t∩ second≤ bytσ iε sourcσ strinτ á(no⌠ ì
- ááááááááááááááámoved)
- D┼ ╜ point≤ t∩ second≤ bytσ iε destinatioε ástrinτ ì
- ááááááááááááááá(no⌠ filled)
- Affected: HL¼ DE¼ BC¼ AF
- Usage: Commonl∙ useΣ t∩ providσ interfacσ froφ CP/═ áPlu≤ ì
- ááááááááááááááásystem≤ át∩ CP/═ 2.2¼ o≥ iε librar∙ áutilit∙ árouì
- ááááááááááááááátine≤ t∩ providσ timσ interface« Sourcσ stam≡ ái≤ ì
- áááááááááááááááP2DO╙ á(CP/═ áPlu≤ ácompatible)¼ ádestinatioε áái≤ ì
- áááááááááááááááZSDO╙-DateStampe≥ ástandard« á ┴ singlσ áLD╔ ámovσ ì
- áááááááááááááááinstructioε afte≥ conversioε wil∞ movσ thσ second≤ ì
- ááááááááááááááábyte« á Onl∙ date≤ froφ ▒ Jaε 197╕ througΦ 3▒ áDeπ ì
- ááááááááááááááá207╖ wil∞ bσ properl∙ converted« Othe≥ date≤ wil∞ ì
- áááááááááááááááse⌠ áyea≥ áanΣ montΦ byte≤ t∩ ázero« á Checδ áthi≤ ì
- ááááááááááááááástatσ fo≥ erro≥ condition.
- Example:
- EXT P2UTIM ; declare the variable
- ... ; read a clock or stamp
- LD DE,UTIM ; point to the dest string
- LD HL,PTIM ; ..and the source string
- CALL P2UTIM ; do the conversion
- LDI ; move the seconds (if desired)
- LD HL,UTIM ; check for errors
- LD A,(HL) ; get years byte
- INC HL ; ..advance to months
- OR L ; ..and check for errors
- JR Z,ERROR ; jump if error
- ... ; ..continue on
- .pa
- è Routine║ U2MTIM
- Function║ Convert universal time specification to MS-DOS/DosDisk
- Entry: DE = points to universal time string (source)
- HL = points to MS-DOS format time string (destination)
- Exit: ┴ á╜ 0¼ zer∩ se⌠ (Z⌐ iµ OK¼ destinatioε átimσ áse⌠ ì
- ááááááááááááááá(les≤ seconds)
- ┴ á<╛ á0¼ zer∩ clea≥ (NZ⌐ áiµ áerror¼ ádestinatioε ì
- ááááááááááááááástrinτ zeroed
- DE = pointer to seconds byte in source string (not moved)
- H╠ á╜ ápointe≥ t∩ higΦ-orde≥ timσ bytσ áiε áM╙-DO╙ ì
- áááááááááááááááfielΣ (lo≈-orde≥ bytσ ha≤ second≤ fielΣ nulled)
- Affected: HL¼ DE¼ BC¼ AF
- Usage: Commonl∙ useΣ t∩ conver⌠ froφ interna∞ timσ forma⌠ ì
- ááááááááááááááát∩ áexterna∞ forφ fo≥ writinτ t∩ M╙-DO╙ disδ áforì
- ááááááááááááááámats« á Conversioε oµ second≤ datß t∩ áthσ áforma⌠ ì
- áááááááááááááááuseΣ áiε thσ M╙-DO╙ timσ specificatioε i≤ áß áuse≥ ì
- áááááááááááááááprograφ responsibility« Date≤ froφ ▒ Januar∙ 198░ ì
- ááááááááááááááát∩ 3▒ Decembe≥ 207╖ wil∞ bσ properl∙ converted.
- Example:
- EX╘ U2MTIM ; declare the variable
- ... ; read a clock or stamp
- LD DE,UTIM ; source time spec string addr
- LD HL,MTIM ; ..dest time spec string addr
- CALL U2MTIM ; do the conversion
- JR NZ,ERROR ; ..jump if conversion error
- ... ; else use P2DOS string
-
- Routine║ M2UTIM
- Function║ Convert MS-DOS/DosDisk time to universal
- Entry: HL = points to MS-DOS time string (source)
- DE = points to universal time string (destination)
- Exit: ┴ á╜ á0¼ zer∩ se⌠ (Z)¼ destinatioε ástrinτ áfilleΣ ì
- ááááááááááááááá(les≤ seconds)
- A <> 0, zero clear (NZ) if error, destination nulled
- HL = points to second (hi-order) byte in MS-DOS string
- D┼ ╜ point≤ t∩ second≤ bytσ iε destinatioε ástrinτ ì
- ááááááááááááááá(no⌠ filled)
- Affected: HL¼ DE¼ BC¼ AF
- Usage: Commonl∙ áuseΣ t∩ conver⌠ M╙-DO╙ timσ t∩ áinterna∞ ì
- áááááááááááááááforma⌠ fo≥ interna∞ prograφ manipulation« Converì
- ááááááááááááááásioε áoµ ásecond≤ i≤ you≥ áresponsibility« á Date≤ ì
- áááááááááááááááfroφ á▒ Jaε 198░ througΦ 3▒ Deπ 207╖ wil∞ bσ áproì
- áááááááááááááááperl∙ converted« Other≤ producσ ß nul∞ date.
- Example:
- EXT M2UTIM ; declare the variable
- ... ; read a clock or stamp
- LD DE,UTIM ; point to the dest string
- LD HL,MTIM ; ..and the source string
- CALL M2UTIM ; do the conversion
- JR NZ,ERROR ; ..handle error if bad
- ... ; else convert secs & continue
- .pa
- èUTILITY ROUTINES:
-
- Routine║ FSTNXT
- Function║ File search returning DateStamper indices
- Entry: C = 1╖ (search first) or 1╕ (search next) DOS command
- DE = points to FCB containing the target filename
- User must log drive and user before calling
- Exit: ┴ ╜ director∙ inde° (0..3)¼ carr∙ flaτ clea≥ á(NC⌐ ì
- áááááááááááááááiµ found
- A ╜ indeterminate, carry flag set (C) if not found
- DE = random sector number in !!!TIME&.DAT
- B = index into TIME&DAT sector (0..7)
- Affected: AF¼ BC¼ DE¼ HL
- Usage: UseΣ áiε DateStampe≥-specifiπ system≤ át∩ áperforφ ì
- áááááááááááááááfilσ searche≤ anΣ returε indice≤ int∩ thσ TIME&DA╘ ì
- áááááááááááááááfile« Usσ thi≤ cal∞ fo≥ functioε 1╖ anΣ 1╕ searcΦ ì
- ááááááááááááááácall≤ iε lie⌡ oµ ß direc⌠ cal∞ t∩ thσ BDO╙ ávecto≥ ì
- áááááááááááááááa⌠ locatioε 5.
- Example:
- EXT FSTNXT ; declare the routine
- ... ; log drive/user & set FCB
- LD C,17 ; set for search first command
- LD DE,FCB ; ..addr FCB for desired name
- CALL FSTNXT ; search for the desired file
- JR NC,FOUND ; ..jump if file found
- ... ; else do not found things
-
- Routine║ BCD2BIN
- Function║ Convert binary coded decimal (BCD) byte to binary
- Entry: A = BCD digit to convert (0-99 value)
- Exit: A = binary byte representation of digit(s) (00-63h)
- Affected: AF
- Usage: Primaril∙ áuseΣ áiε conversion≤ oµ date≤ áuseΣ áb∙ ì
- áááááááááááááááDSLI┬ ároutines¼ bu⌠ i≤ availablσ fo≥ othe≥ áuses« ì
- áááááááááááááááI⌠ convert≤ ß packeΣ BC─ bytσ iε thσ rangσ oµ ░ t∩ ì
- ááááááááááááááá9╣ t∩ ß binar∙ bytσ oµ 0..63h.
-
- Routine║ BIN2BCD
- Function║ Convert binary byte to packed BCD
- Entry: A = binary digit to convert (00-63h, 0-99 decimal)
- Exit: A = packed BCD byte (1 or 2 digits)
- Affected: AF
- Usage: Commonl∙ useΣ t∩ conver⌠ byte≤ iε thσ rangσ oµ á░-ì
- ááááááááááááááá9╣ (0░-63h⌐ t∩ ß packeΣ BC─ byte« I⌠ i≤ primaril∙ ì
- áááááááááááááááuseΣ iε datσ conversioε routine≤ iε DSLIB¼ bu⌠ ái≤ ì
- áááááááááááááááavailablσ fo≥ othe≥ uses.
-
- Routine║ DVERS
- Function║ Return the DSLIB version number
- Entry: None
- Exit: HL = the version number (╚ ╜ major, ╠ ╜ minor)
- Affected: HL
- Usage: Mos⌠ ofteε useΣ fo≥ contro∞ o≥ debugginτ ápurpose≤ ì
- ááááááááááááááát∩ embeΣ thσ linkeΣ librar∙ version.
- .pa
- èDATESTAMPER TIME&DAT:
-
- Routine║ OPENTD
- Function║ Open DateStamper TIME&DAT file for reaΣ o≥ write
- Entry: A = 0 for read, A = 0FFh for write
- You must select the drive before calling
- Exit: A <> 0, zero flag clear (NZ) if OK
- A = 0, zero flag set (Z) if open error
- Affected: AF¼ BC¼ DE¼ HL
- Usage: DateStampe≥-specifiπ ároutinσ ái≤ useΣ át∩ áacces≤ ì
- ááááááááááááááálargσ ánumber≤ áoµ stamps¼ áo≥ áwherσ áperformancσ ì
- ááááááááááááááápenaltie≤ iε pe≥-filσ stam≡ accesse≤ arσ undesireì
- áááááááááááááááable« á Thi≤ ároutinσ open≤ thσ TIME&DA╘ áfilσ áiε ì
- áááááááááááááááuse≥ ░ oε thσ curren⌠ drive« Iµ openeΣ fo≥ áwritì
- áááááááááááááááing¼ thσ R/╧ attributσ i≤ cleared« Thσ use≥ ánumì
- ááááááááááááááábe≥ i≤ restoreΣ oε exit.
-
- Routine║ CLOSTD
- Function║ Close DateStamper TIME&DAT file
- Entry: None
- Exit: A <> 0, zero flag clear (NZ) if OK
- A = 0, zero flag set (Z) if error
- Affected: AF¼ BC¼ DE¼ HL
- Usage: DateStampe≥-specifiπ ároutinσ close≤ thσ áTIME&DA╘ ì
- áááááááááááááááfilσ iε use≥ ░ oµ curren⌠ drive¼ anΣ set≤ thσ áR/╧ ì
- ááááááááááááááábit« I⌠ i≤ useΣ iε conjunctioε witΦ OPENT─ above.
-
- Routine║ RWTD
- Function║ Read or write to TIME&DAT file on current drive
- Entry: A = 0 to read, A = 0FFh to write
- DE = random record to read or write
- Exit: H╠ ╜ addresse≤ thσ star⌠ oµ TIME&DA╘ secto≥ t∩ ábσ ì
- áááááááááááááááreaΣ o≥ written
- A <> 0, zero flag clear (NZ) if OK
- A = 0, zero flag set (Z) if error
- Affected: AF¼ BC¼ DE¼ HL, and BDOS DMA address
- Usage: DateStampe≥-specifiπ ároutinσ normall∙ áuseΣ áonl∙ ì
- áááááááááááááááfo≥ director∙ lis⌠ anΣ cataloτ o≥ archivσ program≤ ì
- áááááááááááááááwherσ acces≤ t∩ block≤ oµ datσ stamp≤ i≤ ádesired« ì
- áááááááááááááááYo⌡ mus⌠ rese⌠ DM┴ addres≤ afte≥ cal∞ iµ needed.
- Example:
- EXT RWTD ; declare the routine
- ... ; log drive, set DMA addr
- LD DE,(RECNUM) ; get T&D rec # from FSTNXT or
- ; ..specified random rec number
- LD A,MODE ; A=0 for read, A=FF for write
- CALL RWTD ; perform the action
- JR NZ,RWOK ; ..jump if OK
- ... ; else perform error activity
- RWOK: ... ; sector has been read/written
- .pa
- è
-
-
-
-
-
-
-
-
- Thi≤ pagσ intentionall∙ lef⌠ blank.
- .pa
- è