home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / ASMVLA00.ZIP / ASM2.ASM < prev    next >
Assembly Source File  |  1993-03-21  |  1KB  |  61 lines

  1. ;   ASM2.ASM
  2. ; Prints messages get keyboard input and has control flow    
  3.  
  4.     DOSSEG
  5.     .MODEL SMALL
  6.     .STACK 200h
  7.     .DATA
  8.  
  9. Prompt      db  13,10,"Do you want to be prompted again? (Y/N) $"
  10. NoMessage   db  13,10,"Ok, then I won't prompt you anymore.$"
  11. YesMessage  db  13,10,"Here comes another prompt!$"
  12. UnKnownKey  db  13,10,"Please hit either Y or N.$"
  13.             
  14.     .CODE
  15.     
  16. START:
  17.     mov     ax,@DATA    ;moves the segment of data into ax 
  18.     mov     ds,ax
  19.  
  20. MainLoop:
  21.     mov     ah,9
  22.     mov     dx,offset Prompt
  23.     int     21h         ;print a message
  24.  
  25.     mov     ah,0
  26.     int     16h         ;get a key, returned in AX
  27.                         ;AL is the ASCII part
  28.                         ;AH is the SCAN CODE
  29.     push    ax
  30.     mov     dl,al
  31.     mov     ah,2
  32.     int     21h         ;print character in dl
  33.     pop     ax
  34.  
  35.     cmp     al,"Y"      ;was the character a 'Y'?
  36.     jne     NotYes      ;nope it was Not Equal
  37.  
  38.     mov     ah,9
  39.     mov     dx,offset YesMessage
  40.     int     21h
  41.     jmp     MainLoop
  42.  
  43. NotYes:
  44.     cmp     al,"N"      ;was the character a 'N'
  45.     je      ByeBye      ;Yes, it was Equal
  46.  
  47.     mov     dx,offset UnknownKey
  48.     mov     ah,9
  49.     int     21h
  50.     jmp     MainLoop
  51.     
  52. ByeBye:
  53.     mov     dx,offset NoMessage
  54.     mov     ah,9
  55.     int     21h
  56.  
  57.     mov     ax,4c00h    ;Returns control to DOS
  58.     int     21h         ;MUST be here! Program will crash without it!
  59.  
  60. END START
  61.