/examples/scanline/iop.asm
	name memcpy
	public _tb_setup, _tb_frobline

IOP	SEGMENT

_tb_setup:
	wid 16, 16
	lpd ga, [pp].4  ; source
	movi cc, 0800Ch ; port-block, byte count termination
	movi ix, 8
	hlt

_tb_frobline:
	lpd gb, [pp].8  ; dest                 11+3 fetch + 20 execute
	xfer            ;                      7 fetch + 4 + 16*50 = 804 execute
	movbi bc, 100   ; len                  14 fetch + 3 execute
	mov gc, [pp].4  ; delay                11 fetch + 8 execute
	mov gc, [pp]    ;                      7 fetch + 8 execute
	mov gc, [pp]    ;                      7 fetch + 8 execute
	mov gc, [pp]    ;                      7 fetch + 8 execute
	mov gc, [pp]    ;                      7 fetch + 8 execute
	addi ga, 2      ; next character       14 fetch + 3 execute              -- 958 cycles
	lpd gb, [pp].8  ; dest                 11 fetch + 20 execute
	xfer            ;                      7 fetch + 804 execute
	movbi bc, 100   ; len                  14 fetch + 3 execute
	addi ga, -2     ; previous character   11 fetch + 3 execute
	dec ix          ;                      7 fetch + 3 execute
	mov gc, [pp]    ;                      7 fetch + 8 execute
	mov gc, [pp]    ;                      7 fetch + 8 execute
	mov gc, [pp]    ;                      7 fetch + 8 execute
	mov gc, [pp]    ;                      7 fetch + 8 execute
	jnz ix, _tb_frobline  ;                14 fetch + 5 execute              -- 962 cycles
	hlt

IOP	ENDS