1; 2; z88dk library: Generic VDP support code 3; 4; extern void vread(unsigned int source, void* dest, unsigned int count); 5; 6; Transfer count bytes from VRAM to RAM 7; 8; $Id: gen_vread.asm,v 1.3 2016-06-16 19:30:25 dom Exp $ 9; 10 11 SECTION code_clib 12 PUBLIC msx_vread 13 PUBLIC _msx_vread 14 15 EXTERN SETRD 16 17 INCLUDE "video/tms9918/vdp.inc" 18 19 20msx_vread: 21_msx_vread: 22 push ix ;save callers ix 23 ld ix,4 24 add ix,sp 25 26 27 28 ld e, (ix+2) ; dest 29 ld d, (ix+3) 30 31 ld l, (ix+4) ; source 32 ld h, (ix+5) 33 34 ;ld ix,LDIRMV 35 ;jp msxbios 36 37 call SETRD 38 ex (sp),hl ; VDP Timing 39 ex (sp),hl ; VDP Timing 40 41 ld c, (ix+0) ; count 42 ld b, (ix+1) 43 44rdloop: 45IF VDP_DATAIN < 0 46 ld a,(-VDP_DATAIN) 47ELSE 48 IF VDP_DATAIN > 256 49 ld a,(VDP_DATAIN / 256) 50 ENDIF 51 in a,(VDP_DATAIN % 256) 52ENDIF 53 ld (de),a 54 inc de 55 dec bc 56 ld a,c 57 or b 58 jr nz,rdloop 59 pop ix ;restore callers 60 ret 61 62