megadrive_test2
annotate src/vdp.c @ 6:df2c6b3c6f2e
added NTSC/PAL detection
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 21 Jun 2017 06:32:10 +0300 |
parents | ce1b05082ac4 |
children |
rev | line source |
---|---|
nuclear@0 | 1 #include "vdp.h" |
nuclear@0 | 2 |
nuclear@0 | 3 void vdp_init(void) |
nuclear@0 | 4 { |
nuclear@5 | 5 int i; |
nuclear@5 | 6 |
nuclear@0 | 7 vdp_setreg(VDP_REG_MODE1, VDP_MODE1_BASE); |
nuclear@0 | 8 vdp_setreg(VDP_REG_MODE2, VDP_MODE2_BASE | VDP_MODE2_DISP); |
nuclear@0 | 9 |
nuclear@5 | 10 vdp_set_nametab_addr(VDP_PLANE_A, 0xc000); |
nuclear@5 | 11 vdp_set_nametab_addr(VDP_PLANE_B, 0xe000); |
nuclear@5 | 12 vdp_disable_layer(VDP_PLANE_WIN); |
nuclear@5 | 13 vdp_set_scroll_table(0xd000); |
nuclear@5 | 14 vdp_set_sprite_table(0xd400); |
nuclear@5 | 15 |
nuclear@5 | 16 vdp_setreg(VDP_REG_MODE3, VDP_MODE3_BASE); |
nuclear@5 | 17 vdp_setreg(VDP_REG_MODE4, VDP_MODE4_BASE | VDP_MODE4_H40CELL); |
nuclear@5 | 18 vdp_setreg(VDP_REG_SCROLL_SIZE, VDP_SCROLL_H64 | VDP_SCROLL_V32); |
nuclear@5 | 19 |
nuclear@0 | 20 vdp_set_autoinc(2); |
nuclear@5 | 21 vdp_set_bgcolor(0, 0); |
nuclear@5 | 22 |
nuclear@5 | 23 vdp_setreg(VDP_REG_HINTR, 0); |
nuclear@5 | 24 vdp_setreg(VDP_REG_WIN_XPOS, 0); |
nuclear@5 | 25 vdp_setreg(VDP_REG_WIN_YPOS, 0); |
nuclear@5 | 26 |
nuclear@5 | 27 /* clear vmem at the planes A/B name tables, scroll table, and sprite table */ |
nuclear@5 | 28 vdp_setup_access(0xd000, VDP_MEM_WRITE, VDP_MEM_VRAM); |
nuclear@5 | 29 for(i=0xd000; i<65536; i++) { |
nuclear@5 | 30 VDP_PORT_DATA = 0; |
nuclear@5 | 31 } |
nuclear@0 | 32 } |