RosettaCodeData/Task/Multiple-distinct-objects/Z80-Assembly/multiple-distinct-objects.z80

11 lines
461 B
Z80 Assembly

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