megadrive_test2

diff src/vdp.c @ 5:ea70f3da150f

color cycling tunnel
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 20 Jun 2017 06:08:58 +0300
parents ce1b05082ac4
children
line diff
     1.1 --- a/src/vdp.c	Mon Jun 19 08:02:51 2017 +0300
     1.2 +++ b/src/vdp.c	Tue Jun 20 06:08:58 2017 +0300
     1.3 @@ -2,8 +2,31 @@
     1.4  
     1.5  void vdp_init(void)
     1.6  {
     1.7 +	int i;
     1.8 +
     1.9  	vdp_setreg(VDP_REG_MODE1, VDP_MODE1_BASE);
    1.10  	vdp_setreg(VDP_REG_MODE2, VDP_MODE2_BASE | VDP_MODE2_DISP);
    1.11  
    1.12 +	vdp_set_nametab_addr(VDP_PLANE_A, 0xc000);
    1.13 +	vdp_set_nametab_addr(VDP_PLANE_B, 0xe000);
    1.14 +	vdp_disable_layer(VDP_PLANE_WIN);
    1.15 +	vdp_set_scroll_table(0xd000);
    1.16 +	vdp_set_sprite_table(0xd400);
    1.17 +
    1.18 +	vdp_setreg(VDP_REG_MODE3, VDP_MODE3_BASE);
    1.19 +	vdp_setreg(VDP_REG_MODE4, VDP_MODE4_BASE | VDP_MODE4_H40CELL);
    1.20 +	vdp_setreg(VDP_REG_SCROLL_SIZE, VDP_SCROLL_H64 | VDP_SCROLL_V32);
    1.21 +
    1.22  	vdp_set_autoinc(2);
    1.23 +	vdp_set_bgcolor(0, 0);
    1.24 +
    1.25 +	vdp_setreg(VDP_REG_HINTR, 0);
    1.26 +	vdp_setreg(VDP_REG_WIN_XPOS, 0);
    1.27 +	vdp_setreg(VDP_REG_WIN_YPOS, 0);
    1.28 +
    1.29 +	/* clear vmem at the planes A/B name tables, scroll table, and sprite table */
    1.30 +	vdp_setup_access(0xd000, VDP_MEM_WRITE, VDP_MEM_VRAM);
    1.31 +	for(i=0xd000; i<65536; i++) {
    1.32 +		VDP_PORT_DATA = 0;
    1.33 +	}
    1.34  }