Multiple distinct objects: Difference between revisions

Line 1,447:
execute(func$(i))
next i</lang>
 
 
=={{header|Z80 Assembly}}==
Variables in assembly languages don't work the same as they do in high-level languages, so the "n references to the same object mistake" isn't really a thing in your typical assembly language. This is as simple as creating an array of ascending values. Being an 8-bit computer, you're limited in how big <i>n</i> can be before the values repeat.
 
<lang z80>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</lang>
 
=={{header|zkl}}==
1,489

edits