home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 181.img / TASM-101.ZIP / HELLO2.ASM < prev    next >
Assembly Source File  |  1988-10-31  |  2KB  |  33 lines

  1.    DOSSEG
  2.    .MODEL  SMALL
  3.    .STACK  100h
  4.    .DATA
  5. TimePrompt DB 'Is it after 12 noon (Y/N)?$'
  6. GoodMorningMessage  LABEL  BYTE
  7.    DB  13,10,'Good morning, world!',13,10,'$'
  8. GoodAfternoonMessage  LABEL  BYTE
  9.    DB  13,10,'Good afternoon, world!',13,10,'$'
  10.    .CODE
  11.    mov  ax,@data
  12.    mov  ds,ax                                ;set DS to point to the data segment
  13.    mov  dx,OFFSET TimePrompt                 ;point to the time prompt
  14.    mov  ah,9                                 ;DOS print string function #
  15.    int  21h                                  ;display the time prompt
  16.    mov  ah,1                                 ;DOS get character function #
  17.    int  21h                                  ;get a single-character response
  18.    cmp  al,'y'                               ;typed lowercase y for after noon?
  19.    jz   IsAfternoon                          ;yes, it's after noon
  20.    cmp  al,'Y'                               ;typed uppercase Y for after noon?
  21.    jnz  IsMorning                            ;no, it's before noon
  22. IsAfternoon:
  23.    mov  dx,OFFSET GoodAfternoonMessage       ;point to the afternoon greeting
  24.    jmp  DisplayGreeting
  25. IsMorning:
  26.    mov  dx,OFFSET GoodMorningMessage         ;point to the before noon greeting
  27. DisplayGreeting:
  28.    mov  ah,9                                 ;DOS print string function #
  29.    int  21h                                  ;display the appropriate greeting
  30.    mov  ah,4ch                               ;DOS terminate program function #
  31.    int  21h                                  ;terminate the program
  32.    END
  33.