home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 December / simtel1292_SIMTEL_1292_Walnut_Creek.iso / msdos / batutl / bigecho.arc / GOODDAY.ASM < prev    next >
Assembly Source File  |  1987-10-15  |  2KB  |  139 lines

  1. ;GOODDAY.ASM
  2.     
  3. CR    EQU    0DH
  4.  
  5. Cseg segment
  6.     assume CS:Cseg , DS:Cseg
  7.     org 100H
  8.  
  9. Enter:    jmp    Begin
  10. ;---------------------------------
  11.     db    CR,'GOODDAY from R.M.Wilson, c(o) 1986',26
  12. string1 db    '   Good   ',CR
  13. string2 db    ' Morning! ',CR
  14. string3 db    'Afternoon!',CR
  15. string4 db    ' Evening! ',CR
  16. string5 db    '  Night!  ',CR
  17. string6 db    ' T G I F  ',CR
  18.  
  19. hold    db    80 dup(0)    ;Holds 8 bytes for 10 characters.
  20. screen    dw    0B000H        ;Will be set correctly.
  21. ;---------------------------
  22. Begin:    xor    ax,ax        ;First, decide which monitor.
  23.     mov    DS,ax
  24.     mov    ax,0B000H
  25.     test    byte ptr DS:[410H],10H
  26.     jne    Over1
  27.     add    ax,800H        ;if color monitor
  28. Over1:    push    CS
  29.     pop    DS
  30.     mov    screen,ax
  31.     mov    ES,ax
  32.     mov    cx,2000
  33.     mov    ax,1320H
  34.     xor    di,di
  35.     rep    stosw        ;Clear screen.
  36.  
  37.     xor    bp,bp
  38.     xor    di,di
  39.     call    Send        ;Say "Good".
  40.  
  41.     mov    ah,2CH
  42.     int    21H        ;Get time.
  43.     cmp    ch,6
  44.     jb    Nigh
  45.     cmp    ch,12
  46.     jb    Morn
  47.     cmp    ch,18
  48.     jb    Afte
  49.     jmp    short Even
  50.  
  51. Morn:    mov    bp,11
  52.     jmp    short Over2
  53.  
  54. Afte:    mov    bp,22
  55.     jmp    short Over2
  56.  
  57. Even:    mov    bp,33
  58.     jmp    short Over2
  59.  
  60. Nigh:    mov    bp,44
  61.     jmp    short Over2
  62.  
  63. Over2:    mov    di,8*160
  64.     call    Send
  65.     mov    ah,2AH        ;Check whether it's Friday.
  66.     int    21H
  67.     cmp    al,5
  68.     jne    Cursor
  69.     mov    bp,55
  70.     mov    di,17*160
  71.     call    Send
  72. Cursor:
  73.     xor    bh,bh        ;Place the cursor and return.
  74.     mov    dx,0F00H
  75.     mov    ah,2
  76.     int    10H
  77.     ret
  78. ;------------------------------------------
  79.  
  80. Form:    mov    bl,CS:string1[bp]
  81.     cmp    bl,CR
  82.     jne    Over
  83.     ret
  84.  
  85. Over:    xor    bh,bh
  86.     shl    bx,1
  87.     shl    bx,1
  88.     shl    bx,1        ;mult by 8
  89.     push    si
  90.     add    si,bx
  91.     mov    cx,8
  92.     rep    movsb
  93.     pop    si
  94.     inc    bp
  95.     jmp    Form
  96.  
  97. Send:    push    di    ;This routine writes the message at offset 3+bp
  98.     push    CS    ;on the screen starting at offset di.
  99.     pop    ES
  100.     mov    si,0FA6EH    ;Point DS:si to address in ROM
  101.     mov    ax,0F000H    ;where character set is stored.
  102.     mov    DS,ax
  103.     mov    di,offset hold
  104.     call    Form
  105.     push    CS
  106.     pop    DS
  107.     pop    di
  108.     mov    ax,CS:screen
  109.     mov    ES,ax
  110.     xor    bp,bp
  111.  
  112. Up2:    mov    si, offset hold
  113.     add    si,bp
  114.     mov    cx,10
  115. Up:    lodsb
  116.     mov    bl,80H   ;8 bytes
  117. Up3:    push    ax
  118.     mov    dl,32
  119.     and    al,bl
  120.     jz    Over4
  121.     mov    dl,219
  122. Over4:    mov    ES:[di],dl
  123.     mov    byte ptr ES:[di+1],13H
  124.     inc    di
  125.     inc    di
  126.     ror    bl,1
  127.     pop    ax
  128.     cmp    bl,80H
  129.     jne    Up3
  130.     add    si,7
  131.     loop    Up
  132.     inc    bp
  133.     cmp    bp,8
  134.     jl    Up2
  135.     ret
  136. ;-----------------------
  137. Cseg    ends
  138.     end    Enter
  139.