org 0000h jmp start ;data - you CAN do this! org 8000h source: dfb 0ah, 19h, 81h, 0f4h, 0c8h, 32h, 41h, 49h, 85h, 0ffh, 0eah, 7bh org 8800h target: dfs 1 ; dummy ;test code - make sure redefine org! org 0040h start: lxi sp, 9000h call routine hlt routine: push h ; just formalities push d push b lxi h, 8000h ; source lxi d, 8800h ; target mov c, m ; length in reg c! inx h ; prepare for data xchg mov m, c ; copy first data raw! inx h xchg loop: mov a, m ; get source data inx h xchg cpi 50 jc make_zero cpi 200 jc save_this mvi a, 0ffh ; make_one jmp save_this make_zero: xra a save_this: mov m, a inx h xchg dcr c ; check length jnz loop pop b pop d pop h ret