> Stamp104/s 10-Aug-2007  Source for *Stamp " Syntax: *Stamp ( Now does () 2? NB: Whether full range is stored depends on filing system <3 12-Aug-1998 v1.03 JGH: Allows full date range F< 10-Aug-2007 v1.04 JGH: Full 7-bit year range 1981-2108 P: Z! mcode% &200:load%=&FFFF0900 dOSFILE=&FFDD:OSARGS=&FFDA nlptr=&A8:temp=&AA xver$="1.04" : P=0 1 O%=mcode%:P%=load% [OPT P*3+4 .error BRK:EQUB 220 3EQUS "Syntax: Stamp ":BRK:\ "()"BRK .start% &LDX #lptr:LDY #0:LDA #1:JSR OSARGS )LDA lptr:STA blk:LDA lptr+1:STA blk+1 )LDY #0:LDA (lptr),Y:CMP #13:BEQ error .SkpToSpc LDA (lptr),Y:INY:CMP #"!" BCS SkpToSpc ECMP #13:BNE SkpSpc :\ Not eol, parse date #LDX #date 255:LDY #date 256 "NLDA #1:STA date:LDA #14:JSR &FFF1 :\ Reads current Year/Month/Day ,JMP SetDate 6: @ .SkpSpc JLDA (lptr),Y:INY:CMP #" " TBEQ SkpSpc:DEY ^;JSR GetHex: #&3F:STA Day:INY :\ Day &01-&31 h=JSR GetHex: #&1F:STA Month:INY :\ Month &01-&12 rGJSR GetHex:BEQ SetYear :\ 00xx -> leave as 20xx |GCPX #&20:BEQ SetYear :\ 20xx -> leave as 20xx HCLC:ADC #&60:CPX #&19:BEQ SetYear :\ 19xx -> becomes 140+yr HCLC:ADC #&40 :\ 21xx -> becomes 100+yr  .SetYear  STA Year :  .SetDate LDX #3:.SetDateLp GLDA date,X:JSR BCDToBIN:STA date,X :\ Convert date from BCD DEX:BPL SetDateLp BLDA Day:PHA: #31:STA Day :\ Ensure day is 1-31 IPLA: #&E0:LSR A:ADC Year :\ Get any overflow from Day GCMP #140:BCC P%+4:ADC #95 :\ If 19xx, year=-20..-1 MCLC:ADC #19:STA Year :\ Convert to offset from 1981 (LDX #blk 255:LDY #blk 256:LDA #5 IJSR OSFILE:CMP #0:BEQ NotFound :\ Read current attributes @LDA Year: #&70:ASL A:A Day:STA blk+15 :\ Merge Day+YearTop &DLDA Year:ASL A:ASL A:ASL A:ASL A:A Month :\ Merge Month+YearBot 0JSTA blk+16:LDA #4:JMP OSFILE :\ Write updated attributes :: D .NotFound NBRK:EQUB 214 XEQUS "File not found":BRK b: l .GetHex v LDX #0:STX temp+0:STX temp+1  .GetHexLp (LDA (lptr),Y:CMP #"0":BCC GetHexEnd CMP #"9"+1:BCC GetHexDigit " #&DF:CMP #"G":BCS GetHexEnd SBC #6+64:BCC GetHexEnd .GetHexDigit /ASL temp+0:ROL temp+1:ASL temp+0:ROL temp+1 /ASL temp+0:ROL temp+1:ASL temp+0:ROL temp+1 # #15:CLC:ADC temp+0:STA temp+0 INX:INY:BNE GetHexLp .GetHexEnd >LDA temp+0:LDX temp+1:RTS :\ Return &XXAA :  .BCDToBIN  +PHA: #&F0:LSR A:LSR A:LSR A:STA date+4 %ASL A:ASL A:ADC date+4:STA date+4  \CMP #99:\BCS BCDToBINErr *)PLA: #&0F:\CMP #&0A:\BCS BCDToBINErr 4ADC date+4:RTS >\.BCDToBINErr H\JMP error R: \.date:EQUS "YMDdHMS" f.blk :EQUS ver$ p] z%Year=date:Month=date+1:Day=date+2  D"*SAVE Stamp ";~mcode%;" ";~O%;" ";~start%&FFFF0000;" ";~load%