home *** CD-ROM | disk | FTP | other *** search
/ Game Developers Magazine 6 / GDM006.ZIP / ASMINTRO / EXAMPLE.ASM next >
Assembly Source File  |  1995-01-17  |  2KB  |  42 lines

  1. ;this is a program which demonstrates what is in my article.
  2. ;This program was written by Gavin Estey on 17.1.95. It is public domain.
  3.  
  4. .MODEL  SMALL
  5. .CODE
  6. Start:                          ;a good place to start.
  7.         ASSUME  CS:@CODE, DS:@CODE ;don't worry about this for now        
  8.         
  9.         mov dx,offset StartUpMessage  ;display a message on the screen
  10.         mov ah,9                      ;using function 09h
  11.         int 21h                       ;of interrupt 21h
  12.         mov dx,offset Instructions    ;display a message on the screen  
  13.         mov ah,9                      ;using function 09h
  14.         int 21h                       ;of interrupt 21h
  15.         mov ah,0                      ;function 00h of
  16.         int 16h                       ;interrupt 16h gets a character from user     
  17.         mov bl,al                     ;save bl    
  18.         mov dl,al                     ;move ascii value of key pressed to dl
  19.         mov ah,02h                    ;function 02h of 
  20.         int 21h                       ;interrupt 21h displays a char to screen
  21.         cmp bl,'Y'                    ;is al=Y?
  22.         je PrintThanks                ;if yes then goto PrintThanks
  23.         jmp TheEnd
  24. PrintThanks:
  25.         mov dx,offset Thanks          ;display message
  26.         mov ah,9                      ;using function 9
  27.         int 21h                       ;of interrupt 21h
  28. TheEnd:
  29.         mov dx,offset GoodBye         ;print goodbye message
  30.         mov ah,9                      ;using function 9
  31.         int 21h                       ;of interrupt 21h
  32.         mov AX,4C00h                  ;terminate program and return to DOS using
  33.         INT 21h                       ;interrupt 21h function 4CH
  34.  
  35. .DATA                            
  36. StartUpMessage      DB "A Simple Input Program$"     ;define some messages
  37. Instructions        DB 0Dh,0Ah,"Just press a Y to continue..$" ;newline at beginning
  38. Thanks              DB 0Dh,0Ah,"Thanks for pressing Y!$"    
  39. GoodBye             DB 0Dh,0Ah,"Have a nice day!$"
  40.  
  41.         END MAIN
  42.