Sam Paulson (FidoNet POWER_BAS Echo) DATE & TIME TSR ------------------------------------------------------------------------------ 'In an interesting conversation between Sam Paulson and "Unnamed" he wrote: '>> Is it normal for a PowerBASIC TSR to take up 94k of RAM? '>> All my program does is display the time and date. '> Do you mean when it is waiting to be invoked or when it is '> actually running? 'While it is waiting to be invoked. My offline mail reader (SLMR) 'displays the amount of memory available, so I checked to see what 'it said with both the TSR loaded and unloaded, and there was a 94k 'difference. '> I'm using PB 3.1 here and the several "test" TSR's I've written '> seem to be about 5K in size when they are waiting to be triggered. '> I've never checked how large they are when actually running but I'd '> expect them to be a lot bigger since the mechanism swaps whatever '> is running out while it loads the running code for the TSR. 'I use PB 3.00a, and my program was just a first attempt at writing 'a TSR with PB. Using the example from one of the online help topics, 'I figured out how to leave the disk swapping out of the program (takes 'forever to load on a floppy-only system like mine), so maybe that's 'the reason. 'I guess my program isn't any big secret , so here it is for all to 'examine (and poke fun at): '------------------------------------- 'Time & Date TSR $compile exe $lib iprint off $option cntlbreak off x& = setmem(-700000) popup key chr$(8,30,247) popup multiplex &HC000,254 reg 1,&HC000 : reg 4,254 call interrupt &H2F if reg(1) <> &HC000 and reg(4) <> 254 then end print "Time & Date Installed. Press Alt-A to activate." reg 1,&HC001 : reg 4,252 popup sleep while 1=1 x% = pos : y% = csrlin def seg = &hB800 : savedSreen$ = peek$(0,4000) color 9,1 : Center 11, "" Center 12, " " Center 13, " " if reg(1) = &HC000 and reg(4) = 254 then Center 14, "" color 15,1 : Center 12, "Time & Date" Center 13, "Already Installed" i$ = input$(1) else Center 14, "ninstall" color 15,1 : while a$ = "" a$ = inkey$ TimeConvert tim$ : Center 12, tim$ DateConvert dat$ : Center 13, dat$ wend end if poke$ 0, savedSreen$ locate y%, x% if lcase$(a$) = "u" then if popup(1) then end reg 1, &HC001 : reg 4,252 a$ = "" popup sleep wend sub DateConvert (dat$) static 'date format = 05-23-1995 restore d = val(left$(date$, 2)) for i = 1 to 12 read month$ if i = d then dat$ = month$ + " " + mid$(date$,4,2) + ", " + mid$(date$,7,4) if val(mid$(date$,4,1)) = 0 then dat$ = month$ + " " + mid$(date$,5,1) + ", " + mid$(date$,7,4) end if end if next i data January,February,March,April,May,June,July,August,September,Octc end sub sub TimeConvert (tim$) static 'time format = 05:35:20.43 if val(left$(time$,2)) > 12 then tim$ = str$(val(left$(time$,2)) - 12) + mid$(time$,3,3) + "pm" else tim$ = left$(time$, 5) + "am" if val(left$(time$,1)) < 1 then tim$ = mid$(time$,2,4) + "am" if val(left$(time$,2)) < 1 then tim$ = " 12" + mid$(time$,3,3) + end if end sub sub Center (lineNumber%, text$) row% = (80 - len(text$)) \ 2 locate lineNumber%, row% print text$; end sub