home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Library / Manuels & Misc / Assembly / AOA.ZIP / CH09 / EX9_2.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-09-25  |  1.4 KB  |  81 lines

  1.  
  2. dseg        segment    para public 'data'
  3.  
  4. I        word    0
  5. J        word    0
  6. K        word    0
  7.  
  8. dseg        ends
  9.  
  10.  
  11. cseg        segment    para public 'code'
  12.         assume    cs:cseg, ds:dseg
  13.  
  14.  
  15. ; This program is useful for debugging purposes only!
  16. ; The intent is to execute this code from inside CodeView.
  17. ;
  18. ; This version of the program has all the bugs corrected.
  19.  
  20. Main        proc
  21.         mov    ax, dseg
  22.         mov    ds, ax
  23.         mov    es, ax
  24.  
  25. ; The following loop increments I until it reaches 10
  26.  
  27. ForILoop:    inc    I
  28.         cmp    I, 10
  29.         jb    ForILoop
  30.  
  31. ; So does this loop.
  32.  
  33.         mov    I, 0        ;Added this statement.
  34. ForILoop2:    inc    I
  35.         cmp    I, 10
  36.         jb    ForILoop2
  37.  
  38.  
  39. ; So does this loop:
  40.  
  41.         mov    I, 0
  42. ForILoop3:    inc    I
  43.         cmp    I, 10
  44.         jb    ForILoop3    ;Corrected this statement.
  45.  
  46.  
  47. ; The following loop adds I to J until J reaches 100.
  48.  
  49. WhileJLoop:    mov    ax, I
  50.         add    J, ax
  51.         cmp    J, 100        ;Corrected this statement.
  52.         jb    WhileJLoop
  53.  
  54.  
  55.  
  56.  
  57.         mov    ah, 4ch        ;Quit to CodeView/DOS.
  58.         int    21h
  59. Main        endp
  60.  
  61. cseg            ends
  62.  
  63.  
  64.  
  65. ; Allocate a reasonable amount of space for the stack (8k).
  66. ; Note: if you use the pattern matching package you should set up a
  67. ;    somewhat larger stack.
  68.  
  69. sseg        segment    para stack 'stack'
  70. stk        db    1024 dup ("stack   ")
  71. sseg        ends
  72.  
  73.  
  74. ; zzzzzzseg must be the last segment that gets loaded into memory!
  75. ; This is where the heap begins.
  76.  
  77. zzzzzzseg    segment    para public 'zzzzzz'
  78. LastBytes    db    16 dup (?)
  79. zzzzzzseg    ends
  80.         end    Main
  81.