ld hl,RamArea ;a label for an arbitrary section of RAM ld a,(foo) ;load the value of some memory location. "foo" is the label of a 16-bit address. ld b,a ;use this as a loop counter. xor a ;set A to zero loop: ;creates a list of ascending values starting at zero. Each is stored at a different memory location ld (hl),a ;store A in ram inc a ;ensures each value is different. inc hl ;next element of list djnz loop