home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / 94adjust.zip / 94ADJUST.ASM next >
Assembly Source File  |  2000-01-16  |  1KB  |  54 lines

  1. ; Program to adjust the RTC date from 1994 to 2000 during OS/2 bootstrap.
  2.  
  3. ; Copyright (C) 2000, David W. Noon
  4.  
  5. ; You may use this code freely. You may also distribute it provided no
  6. ; charge is levied beyond the price of its distribution medium.
  7.  
  8.            .386
  9.            .MODEL  FLAT
  10.  
  11. ; Our entry points into the OS/2 kernel
  12.            INCLUDELIB OS2386.LIB
  13.            EXTRN   DosGetDateTime: NEAR
  14.            EXTRN   DosSetDateTime: NEAR
  15.  
  16. ; OS/2 date and time structure (11 bytes)
  17. DATETIME   STRUCT
  18. hours      DB      ?
  19. minutes    DB      ?
  20. seconds    DB      ?
  21. hundredths DB      ?
  22. day        DB      ?
  23. month      DB      ?
  24. year       DW      ?
  25. timezone   DW      ?
  26. weekday    DB      ?
  27. DATETIME   ENDS
  28.  
  29.            ASSUME  CS:FLAT, DS:FLAT, SS:FLAT
  30.  
  31.            .STACK
  32.  
  33.            .CODE
  34. mainentry: PUSH    EBP
  35.            MOV     EBP, ESP
  36.            SUB     ESP, 12
  37.  
  38.            PUSH    ESP
  39.            CALL    DosGetDateTime        ; Obtain current date and time
  40.            ADD     ESP, 4
  41.  
  42.            CMP     WORD PTR 6[ESP], 1994 ; Is current year 1994?
  43.            JNE     SHORT NoAdjust        ; No, leave it as is
  44.            MOV     WORD PTR 6[ESP], 2000 ; Yes, set it to 2000
  45.  
  46.            PUSH    ESP
  47.            CALL    DosSetDateTime        ; Update current date and time
  48.  
  49. NoAdjust:  MOV     ESP,EBP
  50.            XOR     EAX,EAX
  51.            POP     EBP
  52.            RET
  53.            END     mainentry
  54.