home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_26_1988_Transactor_Publishing.d64
/
redate.asm
< prev
next >
Wrap
Assembly Source File
|
2023-02-26
|
11KB
|
543 lines
rEDATE
; 1 title
;
; redate (C) 1988 aDAM hERST, tORONTO, oNT.
;
;sET THE SYSTEM DATE
;TO THAT OF THE MOST RECENTLY ACCESSED FILE
;ON THE SPECIFIED DISK.
;rEQUIRES THAT ACCESS FILE STAMPING HAS BEEN ACTIVATED.
;
; 2 history
;
;V2.1aDDS DRIVE OPTION
;sETS PROGRAM RETURN CODE TO ERROR IF NO STAMP FOUND
;
;V2.0fIRST WORKING VERSION
;
;V1.0nON-WORKING PROTOTYPE
;
; 3 equates
gETsETrETcODEEQU6CH
sETdmaaDDREQU1AH
sELdISKEQU0EH
gETsETuSEREQU20H
pARSEfILEnAMEEQU98H
sEARCHfIRSTEQU11H
sEARCHnEXTEQU12H
gETdATEpASSWDEQU66H
sETdATEEQU68H
bdos:EQU5H
cpmfcb:EQU5CH
fcbfilename:EQUcpmfcb+1D
fcbaccess:EQUcpmfcb+24D
mydma:EQU0400H
filenamestack:EQU0500H
dmarecoffsetEQU20H
retcodeccpsuc:EQU0000H; ccp-INITIALIZED SUCCESS CODE
retcodeusrerr:EQU0ff00H; uSER SET ERROR CODE
; 4 prolog
; 4.1 pROGRAM START
ORG100H
; 4.2 sET PROGRAM RETURN CODE TO ERROR
MVIC,gETsETrETcODE
LXID,retcodeusrerr
CALLbdos
; 4.3 sET DMA BUFFER
MVIC,sETdmaaDDR
LXID,mydma
CALLbdos
; 5 fIND MOST RECENT ACCESS STAMP AND SAVE IT
; 5.1 hAS A DRIVE BEEN SPECIFIED?
LXIH,cpmfcb; POINT TO DRIVE LETTER
MOVA,M; GET DRIVE LETTER
CPI0H; IS IT ALREADY THE DEFAULT?
; 5.2 iF NO THEN START CHECKING FILES
JZcheckfiles; FILENAME IS ALREADY THE DEFAULT
; 5.3 sET DEFAULT DRIVE TO SPECIFIED DRIVE
DCRA
MVIC,sELdISK
MOVE,A
CALLbdos
; 5.4 fOR usernum: = 0 TO 15
checkfiles:
LXIH,usernum; POINT TO COUNTER
MVIM,0H ; SET IT TO 0
forusernum:
MOVA,M; GET COUNTER
CPI0FH; IS IT EQUAL TO 15
JNCdodate; YES SO JUMP TO SET SYSTEM DATE
; 5.4.1 sET USER NUMBER TO usernum:
MVIC,gETsETuSER
MOVE,M
CALLbdos
; 5.4.2 sET FCB TO MATCH ALL WILDCARD
LXIH,allfiles; POINT TO WILDCARD FILESPEC STRING
SHLDpfcbfspecptr; PUT POINTER IN pfcbstruct
LXIH,cpmfcb; POINT TO FILE CONTROL BLOCK
SHLDpfcbfcbptr; PUT POINTER IN pfcbstruct
MVIC,pARSEfILEnAME; PARSE THE STRING AND INITIALIZE fcb
LXID,pfcbstruct
CALLbdos
; 5.4.3 sETUP THE FILENAME STACK TO STORE FILESPEC MATCHES FOR PROCESSING
LXIH,filenamestack; POINT TO BOTTOM OF FILENAME STACK
SHLDfilenameptr; SET TOP STACK POINTER TO BOTTOM
; 5.4.4 gET DIRECTORY ENTRY FOR FIRST FILE MATCH
MVIC,sEARCHfIRST
LXID,cpmfcb
CALLbdos
; 5.4.5 wHILE THERE IS A FILE MATCH
whileamatch:
CPI0FFH; IS IT THE NO MATCH CODE?
JZwhilenotempty; YES SO JUMP TO PROCESS MATCHES
; 5.4.5.1 pUSH FILENAME ONTO FILENAME STACK
CALL pUSHfILEnAME; SAVE FILENAME FROM dma BUFFER
; 5.4.5.2 gET DIRECTORY ENTRY FOR NEXT FILE MATCH
MVIC,sEARCHnEXT
LXID,cpmfcb
CALLbdos
; 5.4.5.3 cHECK IF THERE WAS A MATCH TO SAVE
JMPwhileamatch
; 5.4.6 wHILE FILENAME STACK IS NOT EMPTY
whilenotempty
LXIH,filenamestack; POINT TO BOTTOM OF STACK
PUSHH; PUT POINTER IN de
POPD
LHLDfilenameptr; POINT TO TOP OF STACK
CALLcOMPAREdetOhl; DO THEY POINT TO THE SAME LOCATION
JZnextusernum; YES SO NO FILES TO PROCESS
; 5.4.6.1 pOP FILENAME FROM filenamestack
CALLpOPfILEnAME; PUT FILENAME IN fcb
; 5.4.6.2 gET ACCESS STAMP INFORMATION FOR FILE IN cpmfcb
MVIC,gETdATEpASSWD
LXID,cpmfcb
CALLbdos
; 5.4.6.3 iS THE FILE ACCESS DATE NEWER THAN THE CURRENT SAVED DATE?
LXID,newsysdate; POINT TO SAVED DATE
LXIH,fcbaccess; POINT TO ACCESS DATE
CALLcOMPAREdATE; COMPARE SAVED DATE TO ACCESS DATE
; 5.4.6.4 iF NO THEN PROCESS NEXT FILENAME
JNCwhilenotempty; SAVED IS LARGER SO DO NEXT FILE
; 5.4.6.5 sAVE ACCESS DATE OF FILENAME
LXIH,newsysdate
LXID,fcbaccess
MVIB,04H
CALLcOPYbYTESuP
; 5.4.6.6 cHECK IF THERE IS ANOTHER FILENAME TO PROCESS
JMPwhilenotempty
; 5.4.7 dO NEXT USER NUMBER
nextusernum:LXIH,usernum; POINT TO USER NUMBER COUNTER
INRM; INCREMENT IT
JMPforusernum; CHECK IF ITS VALID
; 6 sET THE SYSTEM DATE IF AN ACCESS STAMP HAS BEEN FOUND
dodate:
; 6.1 iS THE SAVED DATE EQUAL TO ITS INITIAL VALUE?
LXIH,newsysdate
MOVA,M
INXH
ORAM
INXH
ORAM
INXH
ORAM
; 6.2 iF YES THEN DO AN UNSUCCESSFUL EXIT
JZexiterror
; 6.3 sET THE SYSTEM DATE
MVIC,sETdATE
LXID,newsysdate
CALLbdos
; 7 exit
; 7.1 sUCCESS
exitsuccess:
MVIC,gETsETrETcODE
LXID,retcodeccpsuc
CALLbdos
; 7.2 eRROR
exiterror:
JMP 00H
; 8 subroutines
; 8.1 cURRENTdMArEC - pOINT TO THE CURRENT dma RECORD
;
; cURRENTdMArEC7/3/88aDAM hERST
;
; dESCRIPTION:pOINT TO THE START OF
;THE CURRENT RECORD IN THE dma BUFFER.
;
; aRGUMENTS:a - NUMBER OF CURRENT RECORD IN DMA BUFFER (0-3)
;
; rETURNS:hl - POINTS TO START OF CURRENT RECORD
;
cURRENTdMArEC
LXIH,mydma; POINT TO FIRST dma RECORD
LXID,dmarecoffset; GET THE RECORD OFFSET
INRA; INITIALIZE RECORD COUNTER
nextdmarec:
DCRA; IS IT THE RIGHT RECORD?
RZ; YES SO RETURN
DADD; POINT TO NEXT dma RECORD
JMPnextdmarec; CHECK IF IT IS THE RIGHT RECORD
; 8.2 cOMPAREdATE - cOMPARE hl DATE TO de DATE
;
; cOMPAREdATE6/19/88aDAM hERST
;
; dESCRIPTIONcOMPARE THE cp/m DATE STRUCTURES.
;tHE STANDARD DATE IS SMALLER/EQUAL/LARGER
;THAN THE ARGUMENT DATE
;
;
; aRGUMENTS:de - STANDARD DATE
;hl - ARGUMENT DATE
;
; rETURNS:z - SET IF EQUAL
;c - SET IF STD IS SMALLER
;
cOMPAREdATE
INXH; HIGH BYTE OF YEARS IN DAYS OF ARGUMENT
INXD; HIGH BYTE OF YEARS IN DAYS OF STANDARD
LDAXD; GET STANDARD
CMPM; IS IT EQUAL TO ARGUMENT
RC; NO IT IS SMALLER
RNZ; NO IT IS LARGER
DCXH; LOW BYTE OF YEARS IN DAYS OF ARGUMENT
DCXD; LOW BYTE OF YEARS IN DAYS OF STANDARD
LDAXD; GET STANDARD
CMPM; IS IT EQUAL TO ARGUMENT
RC; NO IT IS SMALLER
RNZ; NO IS IS LARGER
INXH; HOURS BYTE OF ARGUMENT
INXH
INXD; HOURS BYTE OF STANDARD
INXD
LDAXD; GET STANDARD
CMPM; IS IT EQUAL TO ARGUMENT
RC; NO IT IS SMALLER
RNZ; NO IT IS LARGER
INXH; MINUTES BYTE OF ARGUMENT
INXD; MINUTES BYTE OF STANDARD
LDAXD; GET STANDARD
CMPM; IS IT EQUAL TO ARGUMENT
RET
; 8.3 pUSHfILEnAME - pUSH CURRENT FILENAME IN dma BUFFER ONTO filenamestack
;
; pUSHfILEnAME7/1/88aDAM hERST
;
; dESCRIPTION:cOPY CURRENT FILENAME IN dma BUFFER
;TO THE TOP OF THE FILENAME STACK.
;rEQUIRES THAT filenamestack HAS BEEN SET UP
;AND filenameptr HAS BEEN DEFINED.
;
; aRGUMENTS:a - CURRENT RECORD IN dma BUFFER
;
pUSHfILEnAME
CALLcURRENTdMArEC; POINT TO CURRENT RECORD IN dma
INXH; POINT TO START OF FILENAME
PUSHH; PUT SOURCE POINTER IN de
POPD
LHLDfilenameptr; PUT DESTINATION POINTER IN hl
MVIB,11D; PUT NUMBER OF BYTES TO COPY
CALLcOPYbYTESuP; COPY THEM INCREMENTING POINTER
SHLDfilenameptr; SAVE THE NEW POINTER
RET
; 8.4 pOPfILEnAME - pUSH FILENAME IN fcb ONTO filenamestack
;
; pOPfILEnAME7/1/88aDAM hERST
;
; dESCRIPTION:cOPY THE FILENAME
;ON THE TOP OF THE FILENAME STACK
;TO THE fcb.
;rEQUIRES THAT filenamestack: HAS
;AT LEAST ONE ENTRY.
;
pOPfILEnAME
LHLDfilenameptr; GET SOURCE POINTER
PUSHH; PUT IT IN de
POPD
LXIH,fcbfilename+11D; GET DESTINATION POINTER
MVIB,11D; NUMBER OF BYTES TO COPY
CALLcOPYbYTESdOWN; COPY THEM DECRMENTING POINTER
PUSHD; SAVE NEW POINTER
POPH
SHLDfilenameptr
RET
; 8.5 cOMPAREdetOhl - cOMPARE THE WORD IN de TO THE WORD IN hl
;
; cOMPAREdetOhl7/2/88aDAM hERST
;
; dESCRIPTION:cOMPARE hl TO de.
;hl IS SMALLER/EQUAL/LARGER THAN de.
;sET APPROPRIATE FLAGS ON RETURN.
;
; aRGUMENTS:hl - WORD IN LOW BYTE, HIGH BYTE FORMAT
;de - WORD IN LOW BYTE, HIGH BYTE FORMAT
;
; rETURNS:z - SET IF EQUAL
;c - SET IF hl IS SMALLER
;
cOMPAREdetOhl
MOVA,L; GET HIGH BYTE
CMPE; IS HL HIGH BYTE EQUAL TO DE HIGH BYTE?
RC; NO, IT IS SMALLER, SO hl IS SMALLER
RNZ; NO IT IS LARGER, SO hl IS LARGER
MOVA,H; GET LOW BYTE
CMPD; IS HL LOW BYTE EQUAL TO DE LOW BYTE?
RET
; 8.6 cOPYbYTESuP - cOPY b NUMBER OF BYTES MOVING UP FROM de TO hl
;
; cOPYbYTESuP7/2/88aDAM hERST
;
; dESCRIPTION:cOPY THE BYTES POINTED TO BY de TO
;THE BYTES POINTED TO BY hl
;INCREMENTING THE POINTERS.
;
; aRGUMENTS:de - START OF SOURCE BYTES
;hl - START OF DESTINATION BYTES
;b - NUMBER OF BYTES TO COPY
;
; rETURNS:de - BYTE AFTER LAST BYTE OF SOURCE STRING
;hl - BYTE AFTER LAST BYTE OF DESTINATION STRING
cOPYbYTESuP
MVIC,0H; INITIALIZE BYTE COUNTER
nextbyte2:
MOVA,C; GET COUNTER FOR COMPARISON
CMPB; IS IT EQUAL TO THE NUMBER OF BYTES?
RZ; YES SO FINISHED
INRC; INCREMENT COUNTER
LDAXD; GET SOURCE BYTES
MOVM,A; PUT IT IN DESTINATION
INXD; POINT TO NEXT SOURCE BYTES
INXH; POINT TO NEXT DESTINATION
JMPnextbyte2; CHECK IF MORE BYTES TO COPY
; 8.7 cOPYbYTESdOWN - cOPY b NUMBER OF BYTES MOVING DOWN FROM de TO hl
;
; cOPYbYTESdOWN7/2/88aDAM hERST
;
; dESCRIPTION:cOPY THE BYTES POINTED TO BY de TO
;THE BYTES POINTED TO BY hl
;DECREMENTING THE POINTERS.
;
; aRGUMENTS:de - START OF SOURCE BYTES+1
;hl - START OF DESTINATION BYTES+1
;b - NUMBER OF BYTES TO COPY
;
; rETURNS:de - LAST BYTE OF SOURCE BYTES
;hl - LAST BYTE OF DESTINATION BYTES
cOPYbYTESdOWN
MVIC,0H; INITIALIZE BYTE COUNTER
nextbyte3:
MOVA,C; GET COUNTER FOR COMPARISON
CMPB; IS IT EQUAL TO THE NUMBER OF BYTES
RZ; YES SO NO MORE BYTES TO COPY
INRC; INCREMENT THE COUNTER
DCXD; POINT TO SOURCE BYTE TO COPY
DCXH; POINT TO DESTINATION
LDAXD; GET SOURCE BYTE
MOVM,A; PUT IT IN DESTINATION
JMPnextbyte3; CHECK IF MORE BYTES TO COPY
; 9 structures
; 9.1 version: - vERSION AND COPYRIGHT STRING
;
; version:
;
; dESCRIPTION:vERSION AND RELEASE NUMBER
;AND COPYRIGHT STRING
;
version:
DB'redate V2.1 (C) aDAM hERST 1988'
; 9.2 newsysdate: - dATE TO SET SYSTEM TIME TO
;
; newsysdate:6/18/88aDAM hERST
;
; dESCRIPTION:DATE AND TIME IN cp/m FORMAT
;
newsysdate:
DB0H; LOW BYTE OF YEARS IN DAYS
DB0H; HIGH BYTE OF YEARS IN DAYS
DB0H; HOURS IN BCD
DB0H; MINUTES IN BCD
; 9.3 pfcbstruct: - pARSE fcb STRUCTURE
;
; pfcbstruct:6/18/88aDAM hERST
;
; dESCRIPTION:pARSE FILE CONTROL BLOCK POINTER STRUCTURE
;
pfcbstruct:
pfcbfspecptr:DW0000H; POINTER TO CP/M STYLE FILESPEC STRING
pfcbfcbptr:DW0000H; POINTER TO FILE CONTROL BLOCK
; 9.4 usernum: - USER NUMBER COUNTER
;
; usernum:6/20/88aDAM hERST
;
; dESCRIPTION:uSER NUMBER COUNTER
;
usernum:
DB0H
; 9.5 allfiles: - FILESPEC STRING M:*.*
;
; allfiles:6/22/88aDAM hERST
;
; dESCRIPTION:cp/m STYLE STRING FOR WILDCARD FILESPEC
;
allfiles:
DB'*.*$'
; 9.6 filenameptr: - POINTER TO TOP OF filenamestack
;
; filenameptr7/1/88aDAM hERST
;
; dESCRIPTION:pOINTER TO TOP OF filenamestack
;
filenameptr:DW0500H
; 10 end
END