daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Nov 5th, 2018 150 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model small
  2. .stack 100
  3.  
  4. DISP MACRO STRING
  5.     PUSH AX
  6.     PUSH DX
  7.    
  8.     MOV AH, 09
  9.     MOV DX, OFFSET STRING
  10.     INT 21H
  11.    
  12.     POP DX
  13.     POP AX
  14. DISP ENDM
  15.  
  16. .data
  17.     TODAY DB "Today is: ", "$"
  18.     TIME DB ", The Time is: ", "$"
  19.     BS DB 60 DUP(8), "$"
  20.  
  21.     DAY DW D0, D1, D2, D3, D4, D5, D6
  22.    
  23.     D0 DB "SUNDAY ", "$"
  24.     D1 DB "MONDAY ", "$"
  25.     D2 DB "TUESDAY ", "$"
  26.     D3 DB "WEDNESDAY ", "$"
  27.     D4 DB "THURSDAY ", "$"
  28.     D5 DB "FRIDAY ", "$"
  29.     D6 DB "SATURDAY ", "$"
  30.  
  31.     MONTH DW M0, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11
  32.  
  33.     M0 DB "/January/", "$"
  34.     M1 DB "/February/", "$"
  35.     M2 DB "/March/", "$"
  36.     M3 DB "/April/", "$"
  37.     M4 DB "/May/", "$"
  38.     M5 DB "/June/", "$"
  39.     M6 DB "/July/", "$"
  40.     M7 DB "/August/", "$"
  41.     M8 DB "/September/", "$"
  42.     M9 DB "/October/", "$"
  43.     M10 DB "/November/", "$"
  44.     M11 DB "/December/", "$"
  45.    
  46.     TEMP DB 10 DUP(?)
  47.  
  48. .code
  49. mov ax, @data
  50. mov ds, ax
  51.  
  52. main:
  53.     ; read the status of the stdin
  54.     mov ah,0bh
  55.     int 21h
  56.  
  57.     ; FF there is character , 00 there is no character
  58.     cmp al,0ffh
  59.     jnz skip
  60.    
  61.     ; read character
  62.     mov ah,8
  63.     int 21h
  64.     cmp al,27
  65.     jz exit
  66.  
  67. skip:
  68.     call print_all
  69.     jmp main
  70.  
  71. exit:
  72.     mov ah, 4ch
  73.     int 21h
  74.  
  75. ; PRINTS THE CURRENT TIME, DATE, ..
  76. print_all proc
  77.     PUSH AX
  78.     PUSH DX
  79.     PUSH SI
  80.     PUSH CX
  81.    
  82.     DISP TODAY
  83.    
  84.     ; print day name
  85.     MOV SI, OFFSET DAY
  86.     MOV AH, 02AH
  87.     INT 21H
  88.     MOV AH, 0
  89.     ADD AX, AX
  90.     ADD SI, AX
  91.     MOV AH, 09H
  92.     MOV DX, [SI]
  93.     INT 21H
  94.  
  95.     ; PRINTS THE DAY OF MONTH    
  96.     MOV AH, 02AH
  97.     INT 21H
  98.     xor dh, dh
  99.     mov ax, dx
  100.     call print_dec
  101.  
  102.     ; PRINT MONTH    
  103.     MOV SI, OFFSET MONTH
  104.     MOV AH, 02AH
  105.     INT 21H
  106.     MOV DL, DH
  107.     XOR DH, DH
  108.     DEC DX
  109.     ADD DX, DX
  110.     ADD SI, DX
  111.     MOV AH, 09H
  112.     MOV DX, [SI]
  113.     INT 21H  
  114.    
  115.     ; PRINTS THE YEAR
  116.     MOV AH, 02AH
  117.     INT 21H
  118.     MOV AX, CX
  119.     CALL PRINT_DEC
  120.    
  121.     DISP TIME
  122.  
  123.     ; PRINTS HOUR    
  124.     MOV AH, 2CH
  125.     INT 21H
  126.     MOV AL, CH
  127.     XOR AH, AH
  128.     CALL PRINT_DEC
  129.    
  130.     MOV DL, ":"
  131.     MOV AH, 2
  132.     INT 21H
  133.    
  134.     ; PRINTS MINUTE
  135.     MOV AH, 2CH
  136.     INT 21H
  137.     MOV AL, CL
  138.     XOR AH, AH
  139.     CALL PRINT_DEC
  140.    
  141.     MOV DL, ":"
  142.     MOV AH, 2
  143.     INT 21H
  144.    
  145.     ; PRINTS SECOND
  146.     MOV AH, 2CH
  147.     INT 21H
  148.     MOV AL, DH
  149.     XOR AH, AH
  150.     CALL PRINT_DEC
  151.  
  152.     MOV CX, 58
  153.    
  154.     MOV DX, OFFSET BS
  155.     MOV AH, 9
  156.     INT 21H
  157.    
  158.     POP CX
  159.     POP SI
  160.     POP DX
  161.     POP AX
  162.    
  163.     ret
  164. endp
  165.  
  166. ; PRINTS DECIMAL NUMBER SOTRED IN AX
  167. print_dec proc
  168.    
  169.     MOV SI, 0
  170.     MOV BX, 10
  171.     MOV CX, 0
  172.  
  173. DISPX1:
  174.    
  175.     MOV DX, 0
  176.     DIV BX
  177.     MOV TEMP[SI], DL
  178.    
  179.     INC SI
  180.     INC CX
  181.    
  182.     ADD AX, 00
  183.     JNZ DISPX1
  184.     DEC SI
  185.  
  186. DISPX2:
  187.    
  188.     MOV DL, TEMP[SI]
  189.    
  190.     MOV AH, 02H
  191.     ADD DL, 30H
  192.     INT 21H
  193.    
  194.     DEC SI
  195.     LOOP DISPX2
  196.  
  197.     ret
  198. endp
  199.  
  200. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top