;This program adds up a series of bytes using SELF-MODIFYING CODE!
; IT is not really recommended, but possible to do this in the debugger
;
;
;  ASsume there is an array from locations 1000h thru 1fffh.
;

        mov     al, 0          ;clear accumulator - note: instruction 2 bytes long
lp:     add     al, byte ptr 1000h  ; first add - 4  bytes long
;
;  NOTE that locations 104h & 105h have the location (1000h) you are adding
;    into in the above statement.  In particular, location 104 has the LOW
;    byte (00) and location 105h has the HIGH byte (10h)
;
        add     byte ptr 104h, 1        ;get to next byte (?)
        jnc     lp                      ;new location created OK
        add     byte ptr 105h, 1        ;add the carry into HIGH byte
        cmp     byte ptr 105h, 20h      ;done??
        jb      lp

        int     20h                     ;done adding all 1000h bytes together
        end