ld a,$ff ;byte to be copied
ld ix,$fc00 ;start address to copy
ld (ix+0),a ;ix+0=$fc00
ld (ix+1),a ;ix+1=$fc01
ld (ix+2),a ;ix+2=$fc02
ld (ix+3),a
ld (ix+4),a
First off, using the Index
Registers is not a speed efficient choice. The basic
instruction ld (ix+$??),a is three bytes long. It is much
wiser to stay away from these registers all together. They are
generally one byte longer than using the hl register
because they have a byte preceding that signals the processor
to use the ix register instead of the hl
register. It would also be quicker here to set up a loop.
|
ld a,$ff ;byte to be copied
ld b,5 ;how many times to copy
ld hl,$fc00 ;where to start
loop_start:
ld (hl),a ;load a at (hl)
inc hl ;inc to point to next spot
djnz loop_start ;do it 4 more times until
; b=$00
| |