Mercurial > sdl-ios-xcode
comparison src/video/nds/SDL_ndsvideo.c @ 2679:bc3e3e889f6d gsoc2008_nds
More NDS video driver work.
author | Darren Alton <dalton@stevens.edu> |
---|---|
date | Sun, 13 Jul 2008 04:28:54 +0000 |
parents | 6386764eb222 |
children | 4135aa9c5645 |
comparison
equal
deleted
inserted
replaced
2678:3895761db26a | 2679:bc3e3e889f6d |
---|---|
114 int i; | 114 int i; |
115 | 115 |
116 /* simple 256x192x15x60 for now */ | 116 /* simple 256x192x15x60 for now */ |
117 mode.w = 256; | 117 mode.w = 256; |
118 mode.h = 192; | 118 mode.h = 192; |
119 mode.format = SDL_PIXELFORMAT_BGR555; | 119 mode.format = SDL_PIXELFORMAT_ABGR1555; |
120 mode.refresh_rate = 60; | 120 mode.refresh_rate = 60; |
121 mode.driverdata = NULL; | 121 mode.driverdata = NULL; |
122 | 122 |
123 SDL_AddBasicVideoDisplay(&mode); | 123 SDL_AddBasicVideoDisplay(&mode); |
124 SDL_AddRenderDriver(0, &NDS_RenderDriver); | 124 SDL_AddRenderDriver(0, &NDS_RenderDriver); |
125 /*SDL_AddBasicVideoDisplay(&mode); two screens, same mode. uncomment later | |
126 SDL_AddRenderDriver(1, &NDS_RenderDriver);*/ | |
125 | 127 |
126 SDL_zero(mode); | 128 SDL_zero(mode); |
127 SDL_AddDisplayMode(0, &mode); | 129 SDL_AddDisplayMode(0, &mode); |
128 | 130 |
129 /* hackish stuff to get things up and running for now, and for a console */ | 131 /* hackish stuff to get things up and running for now, and for a console */ |
130 powerON(POWER_ALL); | 132 powerON(POWER_ALL); |
131 videoSetMode(MODE_FB0); | |
132 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */ | |
133 | |
134 vramSetBankA(VRAM_A_LCD); | |
135 vramSetBankC(VRAM_C_SUB_BG); | |
136 | |
137 irqInit(); | 133 irqInit(); |
138 irqEnable(IRQ_VBLANK); | 134 irqEnable(IRQ_VBLANK); |
139 /* set up console for debug text 'n stuff */ | 135 NDS_SetDisplayMode(_this, &mode); |
140 SUB_BG0_CR = BG_MAP_BASE(31); | |
141 BG_PALETTE_SUB[255] = RGB15(31, 31, 31); | |
142 consoleInitDefault((u16 *) SCREEN_BASE_BLOCK_SUB(31), | |
143 (u16 *) CHAR_BASE_BLOCK_SUB(0), 16); | |
144 | |
145 /*NDS_SetDisplayMode(_this, &mode); */ | |
146 return 0; | 136 return 0; |
147 } | 137 } |
148 | 138 |
149 static int | 139 static int |
150 NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode) | 140 NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode) |
151 { | 141 { |
152 /* right now this function is just hard-coded for 256x192 ABGR1555 */ | 142 /* right now this function is just hard-coded for 256x192 ABGR1555 */ |
153 #if 0 | |
154 videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE); /* display on main core */ | 143 videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE); /* display on main core */ |
155 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */ | 144 videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub */ |
156 vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_LCD, | 145 vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_LCD, |
157 VRAM_C_SUB_BG, VRAM_D_LCD); | 146 VRAM_C_SUB_BG, VRAM_D_LCD); |
158 | 147 |
148 /* set up console for debug text 'n stuff */ | |
149 SUB_BG0_CR = BG_MAP_BASE(31); | |
150 BG_PALETTE_SUB[255] = RGB15(31, 31, 31); | |
151 consoleInitDefault((u16 *) SCREEN_BASE_BLOCK_SUB(31), | |
152 (u16 *) CHAR_BASE_BLOCK_SUB(0), 16); | |
153 | |
154 #if 0 | |
155 /* we should be using this as a texture for rendering, not as a framebuffer */ | |
159 /* maps well to the 256x192 screen anyway. note: need VRAM_B for bigger */ | 156 /* maps well to the 256x192 screen anyway. note: need VRAM_B for bigger */ |
160 BG3_CR = BG_BMP16_256x256; | 157 BACKGROUND.control[3] = BG_BMP16_256x256; |
161 /* affine transformation matrix. nothing too fancy here */ | 158 /* affine transformation matrix. nothing too fancy here */ |
162 BG3_XDX = 0x100; | 159 BG3_XDX = 0x100; |
163 BG3_XDY = 0; | 160 BG3_XDY = 0; |
164 BG3_YDX = 0; | 161 BG3_YDX = 0; |
165 BG3_YDY = 0x100; | 162 BG3_YDY = 0x100; |
171 } | 168 } |
172 | 169 |
173 void | 170 void |
174 NDS_VideoQuit(_THIS) | 171 NDS_VideoQuit(_THIS) |
175 { | 172 { |
173 videoSetMode(DISPLAY_SCREEN_OFF); | |
174 videoSetModeSub(DISPLAY_SCREEN_OFF); | |
175 vramSetMainBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_LCD, VRAM_D_LCD); | |
176 } | 176 } |
177 | 177 |
178 /* vi: set ts=4 sw=4 expandtab: */ | 178 /* vi: set ts=4 sw=4 expandtab: */ |