vmemcpy.s (932B)
1 .include "global.s" 2 3 .title "VRAM utilities" 4 .module VRAMUtils 5 .area _HOME 6 7; void vmemcpy (unsigned int dst, const void *src, unsigned int size) __z88dk_callee __preserves_regs(iyh,iyl); 8_set_data:: 9_vmemcpy:: 10 pop de ; pop ret address 11 pop hl ; dst 12 13 DISABLE_VBLANK_COPY 14 15 VDP_WRITE_CMD h, l 16 17 pop hl ; src 18 pop bc ; size 19 20 ld a, b ; HI(size) 21 ld b, c ; LO(size) 22 23 ld c, #.VDP_DATA 24 25 rlc b 26 rrc b ; check b is zero 27 jr z, 2$ 281$: 29 outi 30 jp nz, 1$ ; 10 = 26 (VRAM safe) 312$: 32 inc a 33 jp 4$ 343$: 35 outi 36 jp nz, 3$ ; 10 = 26 (VRAM safe) 374$: 38 dec a 39 jp nz, 3$ 40 41 ENABLE_VBLANK_COPY 42 43 ld h, d 44 ld l, e 45 jp (hl)