home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / asm / OKTIMDAT.ZIP / TIMEHACK.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-11-23  |  5.6 KB  |  108 lines

  1. Title   TimeHack.ASM - Shows/Sets Computer hh:mm Time
  2. _TEXT   SEGMENT
  3.         ASSUME CS:_TEXT,DS:_TEXT,ES:_TEXT,SS:_TEXT
  4.         ORG     100H
  5. Begin:  Jmp     Start
  6. Program DB  13,"Time Hack Version 1.0 Copyright (c) 1988"
  7. Usage   DB  13,10," for NON-Commercial Use ONLY!"
  8.         DB  13,10," Use and distribution without charge"
  9.         DB  13,10,"  IS authorized and encouraged by:"
  10. Author  DB  13,10,9,"Tom Gilbert's Heart&Mind",26
  11. Msg_St  DB  10                          ; Blank Line
  12.         DB  "At the sound of the BEEP - Your Computer Time will be"
  13.         DB  13,10,9," <== ESC to EXIT or UpDnArrows & ENTER to SET"
  14. Time    DB  13,"  :  ",9,36             ; hh:mm+1, TAB & "$"
  15. CRLF    DB  13,10                       ; New Line
  16. Start:  Mov     AH,9                    ; Display
  17.         Mov     DX,OFFSET Msg_St        ; Complete
  18.         Int     21h                     ; Message
  19.         Mov     AH,2Ch                  ; Get DOS
  20.         Int     21h                     ; Time and
  21.         Mov     BX,CX                   ; Copy into BX
  22.         Cmp     BL,59                   ; If NOT Last Minute
  23.         Jc      NextM                   ; Then Increment it
  24.         Xor     BL,BL                   ; Else Zero Minutes
  25.         Inc     BH                      ; Increment Hours
  26.         Cmp     BH,24                   ; If NOT Next Day
  27.         Jc      ShoTL                   ; Then Show Time
  28.         Xor     BH,BH                   ; Else Zero Time
  29.         Jmp     SHORT ShoTL             ;  for Next Day
  30. NextM:  Inc     BL                      ; Set Next Minute
  31. ShoTL:  Mov     DI,OFFSET Time+1        ; Show Time Loop
  32.         Mov     AL,BH                   ; Make Hours
  33.         Aam                             ; Two Byte
  34.         Add     AX,"00"                 ; ASCII Digit
  35.         Xchg    AH,AL                   ; in Hi/Lo
  36.         StoSW                           ; order and
  37.         Inc     DI                      ; skip ":"
  38.         Mov     AL,BL                   ; Make Minutes
  39.         Aam                             ; Two Byte
  40.         Add     AX,"00"                 ; ASCII Digits
  41.         Xchg    AH,AL                   ; in Hi/Lo
  42.         StoSW                           ; order and
  43.         Mov     AH,9                    ; Display the
  44.         Mov     DX,OFFSET Time          ; Time String
  45.         Int     21h
  46.         Cmp     CX,BX                   ; If at SET Time
  47.         Jz      Beep                    ; Then BEEP Exit
  48.         Mov     AH,2Ch                  ; Else Get Time
  49.         Int     21h
  50.         Call    DoWhat                  ; If Key
  51.         Cmp     AL,27                   ; is ESC
  52.         Jz      Exit                    ; Then EXIT
  53.         Cmp     AL,0Dh                  ; Else If NOT <ENTER>
  54.         Jnz     ShoTL                   ; Then Show Time Loop
  55.         Xor     DX,DX                   ; Else Zero the
  56.         Mov     AH,2Dh                  ; Seconds to SET
  57.         Mov     CX,BX                   ; Displayed Time
  58.         Int     21h
  59. Beep:   Mov     DL,7                    ; Send BEEP
  60.         Mov     AH,2                    ; Character
  61.         Int     21h                     ; to Console
  62. Exit:   Mov     AH,40h                  ; Use Standard
  63.         Mov     BX,1                    ; Console Output
  64.         Mov     CX,2                    ; for EndLine
  65.         Mov     DX,OFFSET CRLF          ; Characters
  66.         Int     21h
  67.         Mov     AX,4C00h                ; No Error Exit to
  68.         Int     21h                     ; Operating System
  69.  
  70. DoWhat: Mov     AH,1                    ; Check Keyboard
  71.         Int     16h                     ; If a Key Waiting
  72.         Jnz     AKey                    ; Then Process it
  73.         Xor     AL,AL                   ; Else Clear Key
  74.         Jmp     SHORT DoWx              ;  and Exit DoWhat
  75. AKey:   Xor     AH,AH                   ; Get
  76.         Int     16h                     ; Key
  77.         Cmp     AL,27                   ; If Key
  78.         Jz      DoWx                    ; is ESC
  79.         Cmp     AL,13                   ; Or If <ENTER>
  80.         Jz      DoWx                    ; Then Exit DoWhat
  81.         Or      AL,AL                   ; Or If NOT Extended
  82.         Jnz     DoWx                    ; Then Exit DoWhat
  83.         Cmp     AH,72                   ; Else If NOT UpArrow
  84.         Jnz     CkDn                    ; Then Check DwnArrow
  85.         Inc     BL                      ; Else Increase Minutes
  86.         Cmp     BL,60                   ; If NOT 60 Minutes
  87.         JC      DoWx                    ; Then Exit DoWhat
  88.         Xor     BL,BL                   ; Else Zero Minutes
  89.         Inc     BH                      ;  and Increase Hours
  90.         Cmp     BH,24                   ; If NOT 24 hours yet
  91.         Jc      DoWx                    ; Then Exit DoWhat
  92.         Xor     BH,BH                   ; Else Zero Hours
  93. CkDn:   Cmp     AH,80                   ; If NOT DwnArrow
  94.         Jnz     DoWx                    ; Then Exit DoWhat
  95.         Dec     BL                      ; Else Decrease Minutes
  96.         Jnl     CkMin                   ; Unless Below Zero
  97. SM59:   Mov     BL,59                   ; & then Last Minute
  98.         Dec     BH                      ; and Decrease Hours
  99.         Jnl     DoWx                    ; Unless Below Zero
  100.         Mov     BH,23                   ; Then Time is 23:59
  101. CkMin:  Cmp     BL,CL                   ; If Minute <> SET
  102.         Jnz     DoWx                    ; Then Exit DoWhat
  103.         Dec     BL                      ; Else Decrease Minutes
  104.         Jl      SM59                    ;  and Hour If Required
  105. DoWx:   Ret                             ; Return Flags or <ENTER>
  106. _TEXT   EndS
  107.         End Begin
  108.