; HDOSHDR.INS v1 17 Apr 88 ; ; By Irv Hoff, based on Russ Pencin's PBBS, based on Simon Ewin's EMX. ; ;----------------------------------------------------------------------- ; You MUST have the next section EXACTLY as it is here.... ;----------------------------------------------------------------------- ; TIME: DEFB 'HH:MM:SS',0 ; <== place your ASCII time string here DATE: DEFB 'MM/DD/YY',0 ; <== place your ASCII date string here BDATE: DEFS 3 ; Binary date storage, filled in by HBBS BTIME: DEFS 3 ; Binary time storage, filled in by HBBS ; ; ;----------------------------------------------------------------------- ; The values are returned from BYE as BCD and are converted below ;----------------------------------------------------------------------- ; GETTIM: PUSH DE PUSH HL LD C,79 ; Return the RTC buffer pointer in HL CALL BDOS LD DE,TIME CALL BCD2A ; Convert hours digits INC HL INC DE ; Skip the colon CALL BCD2A ; Convert minutes digits INC HL INC DE ; Skip colon CALL BCD2A ; Convert seconds digits INC HL INC HL ; Skip century INC HL ; Skip year INC DE ; Skip the null between CALL BCD2A ; Convert month digits INC HL INC DE ; Skip the slash CALL BCD2A ; Convert day digits DEC HL ; Skip month DEC HL ; Point to year INC DE ; Skip the slash CALL BCD2A ; Convert year digits POP HL POP DE CALL CTIME ; Convert strings to binary CALL CDATE ; Convert strings to binary RET ;..... ; BCD2A: LD A,(HL) PUSH AF RRA ; Move high nibble to low RRA RRA RRA CALL SPLAT ; Save it POP AF ; Get BCD value back ; SPLAT: AND 0FH ; Only want low nibble ADD A,'0' ; Make ASCII LD (DE),A ; Place in string INC DE ; Point to next byte in string RET ; Back to the city.... ;..... ; ;----------------------------- end -------------------------------------