6363 */
6464
6565#define PCB_MAJOR_VERSION 0
66- #define PCB_MINOR_VERSION 3
66+ #define PCB_MINOR_VERSION 4
6767
6868#define GPIO_CD0 14
6969#define GPIO_CSR tmsRead_CSR_PIN // defined in tms9918.pio
105105#define TMS_IRQ PIO1_IRQ_0
106106
107107
108- /* file globals */
108+
109+
110+ /* file globals */
109111
110112static uint8_t nextValue = 0 ; /* TMS9918A read-ahead value */
111113static bool currentInt = false; /* current interrupt state */
@@ -191,7 +193,6 @@ static inline void disableTmsPioInterrupts()
191193 __dmb ();
192194}
193195
194-
195196/*
196197 * generate a single VGA scanline (called by vgaLoop(), runs on proc1)
197198 */
@@ -211,6 +212,9 @@ static void __time_critical_func(tmsScanline)(uint16_t y, VgaParams* params, uin
211212 const uint32_t vBorder = (VIRTUAL_PIXELS_Y - TMS9918_PIXELS_Y ) / 2 ;
212213 const uint32_t hBorder = (VIRTUAL_PIXELS_X - TMS9918_PIXELS_X * 2 ) / 2 ;
213214
215+ static int frameCount = 0 ;
216+ static int logoOffset = 100 ;
217+
214218 uint16_t bg = tms9918PaletteBGR12 [vrEmuTms9918RegValue (TMS_REG_FG_BG_COLOR ) & 0x0f ];
215219
216220 /*** top and bottom borders ***/
@@ -226,24 +230,37 @@ static void __time_critical_func(tmsScanline)(uint16_t y, VgaParams* params, uin
226230 * : 430 bytes
227231 * format: 16-bit abgr palette, 2bpp indexed image
228232 */
229- if (y >= vBorder + TMS9918_PIXELS_Y + 12 )
233+ if (frameCount < 600 )
230234 {
231- y -= vBorder + TMS9918_PIXELS_Y + 12 ;
232- if (y < splashHeight )
235+ if (y == 0 )
236+ {
237+ ++ frameCount ;
238+ if (frameCount & 0x01 )
239+ {
240+ if (frameCount < 200 && logoOffset > 12 ) -- logoOffset ;
241+ else if (frameCount > 500 ) ++ logoOffset ;
242+ }
243+ }
244+
245+ if (y < (VIRTUAL_PIXELS_Y - 1 ))
233246 {
234- uint8_t * splashPtr = splash + ( y * splashWidth / 4 ) ;
235- for ( int x = 4 ; x < 4 + splashWidth ; x += 4 )
247+ y -= vBorder + TMS9918_PIXELS_Y + logoOffset ;
248+ if ( y < splashHeight )
236249 {
237- uint8_t c = * (splashPtr ++ );
238- uint8_t p0 = (c & 0xc0 );
239- uint8_t p1 = (c & 0x30 );
240- uint8_t p2 = (c & 0x0c );
241- uint8_t p3 = (c & 0x03 );
242-
243- if (p0 ) { pixels [x ] = splash_pal [(p0 >> 6 )]; }
244- if (p1 ) { pixels [x + 1 ] = splash_pal [(p1 >> 4 )]; }
245- if (p2 ) { pixels [x + 2 ] = splash_pal [(p2 >> 2 )]; }
246- if (p3 ) { pixels [x + 3 ] = splash_pal [p3 ]; }
250+ uint8_t * splashPtr = splash + (y * splashWidth / 4 );
251+ for (int x = 4 ; x < 4 + splashWidth ; x += 4 )
252+ {
253+ uint8_t c = * (splashPtr ++ );
254+ uint8_t p0 = (c & 0xc0 );
255+ uint8_t p1 = (c & 0x30 );
256+ uint8_t p2 = (c & 0x0c );
257+ uint8_t p3 = (c & 0x03 );
258+
259+ if (p0 ) { pixels [x ] = splash_pal [(p0 >> 6 )]; }
260+ if (p1 ) { pixels [x + 1 ] = splash_pal [(p1 >> 4 )]; }
261+ if (p2 ) { pixels [x + 2 ] = splash_pal [(p2 >> 2 )]; }
262+ if (p3 ) { pixels [x + 3 ] = splash_pal [p3 ]; }
263+ }
247264 }
248265 }
249266 }
@@ -348,6 +365,9 @@ uint initClock(uint gpio, float freqHz)
348365 */
349366void tmsPioInit ()
350367{
368+ irq_set_exclusive_handler (TMS_IRQ , pio_irq_handler );
369+ irq_set_enabled (TMS_IRQ , true);
370+
351371 uint tmsWriteProgram = pio_add_program (TMS_PIO , & tmsWrite_program );
352372
353373 pio_sm_config writeConfig = tmsWrite_program_get_default_config (tmsWriteProgram );
@@ -357,6 +377,7 @@ void tmsPioInit()
357377
358378 pio_sm_init (TMS_PIO , tmsWriteSm , tmsWriteProgram , & writeConfig );
359379 pio_sm_set_enabled (TMS_PIO , tmsWriteSm , true);
380+ pio_set_irq0_source_enabled (TMS_PIO , pis_sm0_rx_fifo_not_empty , true);
360381
361382 uint tmsReadProgram = pio_add_program (TMS_PIO , & tmsRead_program );
362383
@@ -375,9 +396,6 @@ void tmsPioInit()
375396
376397 pio_sm_init (TMS_PIO , tmsReadSm , tmsReadProgram , & readConfig );
377398 pio_sm_set_enabled (TMS_PIO , tmsReadSm , true);
378- irq_set_exclusive_handler (TMS_IRQ , pio_irq_handler );
379- irq_set_enabled (TMS_IRQ , true);
380- pio_set_irq0_source_enabled (TMS_PIO , pis_sm0_rx_fifo_not_empty , true);
381399 pio_set_irq0_source_enabled (TMS_PIO , pis_sm1_rx_fifo_not_empty , true);
382400
383401 pio_sm_put (TMS_PIO , tmsReadSm , 0x000000ff );
@@ -406,7 +424,6 @@ void proc1Entry()
406424}
407425
408426
409-
410427/*
411428 * main entry point
412429 */
@@ -438,10 +455,10 @@ int main(void)
438455 vgaInit (params );
439456
440457 /* signal proc1 that we're ready to start the display */
441- multicore_fifo_push_timeout_us ( 0 , 0 );
458+ multicore_fifo_push_blocking ( 0 );
442459
443460 /* twiddle our thumbs - everything from this point on
444- is handled by interrupts and PIOs */
461+ is handled by interrupts and PIOs */ ;
445462 while (1 )
446463 {
447464 tight_loop_contents ();
0 commit comments