home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s157 / 1.ddi / SAMPLE.ASM < prev    next >
Encoding:
Assembly Source File  |  1991-11-08  |  1.3 KB  |  76 lines

  1.    Page 55,80
  2.    Title Sample program for Soft-ICE tutorial
  3.  
  4. DATA    Segment Public 'Data'
  5. pad    db 12H dup(0)
  6. char    db 0
  7. answer    db 0
  8. space_msg     db 'The Character is a SPACE',0DH,0AH,'$'
  9. no_space_msg  db 'The Character is NOT a'
  10.           db 'SPACE',0DH,0AH,'$'
  11. DATA    Ends
  12.  
  13. STACK Segment Stack  'Stack'
  14.     dw 128 Dup(?)
  15. STACK Ends
  16.  
  17. CODE Segment Public 'Code'
  18. Assume CS:CODE, DS:DATA, ES:Nothing, SS:STACK
  19. start:
  20.  
  21. ; Set up segments
  22.     mov ax, DATA
  23.     mov es,ax
  24.     mov ds,ax
  25.  
  26. ; Main Program Loop
  27.  
  28. main_loop:
  29.     call get_key
  30.     call is_space?
  31.     cmp  answer, 0
  32.     je no_space
  33.  
  34. ; It's a space, so display the space message
  35.     mov ah,9
  36.     mov dx, offset space_msg
  37.     int 21H
  38.     jmp main_loop
  39.  
  40. ; It's NOT  a space, so display the no space message
  41. no_space: mov ah,9
  42.       mov dx, offset no_space_msg
  43.       int 21H
  44.       jmp main_loop
  45.  
  46. ;--------------------------------------------------------------;
  47. ;   JAKE'S ROUTINES
  48. ;--------------------------------------------------------------;
  49. ;  Get Key Routine (one of Jake's routines)
  50.  
  51. get_key proc
  52.     mov ah,8
  53.     int 21H
  54.     mov char,al
  55.     ret
  56. get_key endp
  57.  
  58. ;  Check if character is a space (one of Jake's routines)
  59.  
  60. is_space?  proc
  61.     cmp char,20H
  62.     jne not_space
  63.     mov answer,1
  64.     ret
  65. not_space:
  66.     mov cs:answer,0
  67.     ret
  68. is_space? endp
  69.  
  70. CODE    Ends
  71.     End  start
  72.  
  73.  
  74.  
  75.  
  76.