Şu an senin yaptığın uygulamalarda PIC metin harici resim falan tarzı şeyler de aktarıyor mu I2C üstünden FPGA'e?
Evet aslında metin kısmını da komple resim olarak aktarıyor.
Bu arada FPGA ile I2C yapılabiliyor. Hatta benim uygulamalarda kullanıyorum. Kendim yazmadım ama bulduğum bir I2C kodunu uyarladım. Bu sayede PIC, I2C üzerinden FPGA'e komut da gönderebiliyor. Örneğin scanline şiddeti vb gibi parametreleri PIC, FPGA'e I2C ile gönderiyor...
6502 benim de aklıma geldi, denemek lazım. Tek konforsuz yanı, PIC'i C ile yazabiliyorum, şimdi 6502 yaparsak oturup asm yazmak lazım. Olmaz değil tabiki ama daha uzun sürecek bir iş...
Benim PIC kodumda aşağıda bir kısmını paste ettiğim şekilde bir constant array var, bunu C64 deki char rom olarak düşünebilirsin. Tüm karakterlerin bitmap karşılıkları ve hatta bir de logo datası.
const rom unsigned char logotop[256]=
{
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x03,0x03,0x03,0x03,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x03,0x03,0x03,0x03,0xFF,0xFF,0x13,
0x13,0x13,0x13,0xF3,0xF3,0xF3,0xF3,0xF3,0xF3,0xF3,0x03,0x03,0x03,0x07,0xFF,0xFF,0x03,0x03,0x03,0x03,0xF3,0xF3,0xF3,0xF3,0x03,0x03,0x03,0x03,0xF3,0xF3,0xF3,0xF3,
0x03,0x03,0x03,0x07,0xFF,0xFF,0x03,0x03,0x03,0x03,0xFF,0xFF,0x3F,0x3F,0xFF,0xFF,0x07,0x03,0x03,0x03,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x73,0xFF,
0xFF,0x83,0x03,0x03,0x03,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x03,0x03,0x03,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x30,0x30,0x30,0x30,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x30,0x30,0x30,0x30,0x3F,0x3F,0x30,
0x30,0x30,0x30,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x30,0x30,0x30,0x38,0x3F,0x3F,0x30,0x30,0x30,0x30,0x3F,0x3F,0x3F,0x3F,0x30,0x30,0x30,0x30,0x3F,0x3F,0x3F,0x3F,
0x30,0x30,0x30,0x30,0x3F,0x3F,0x30,0x30,0x30,0x30,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x38,0x30,0x30,0x30,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x30,0x30,0x30,0x38,0x3F,
0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x30,0x30,0x30,0x30,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
};
rom const unsigned char gfxrom[]=
{
0x1F,0x11,0x1F,0x00,0x12,0x1F,0x10,0x00, // ASCII 000 Mini01
0x1D,0x15,0x17,0x00,0x11,0x15,0x1F,0x00, // ASCII 001 Mini23
0x07,0x04,0x1F,0x00,0x17,0x15,0x1D,0x00, // ASCII 002 Mini45
0x1F,0x15,0x1D,0x00,0x01,0x01,0x1F,0x00, // ASCII 003 Mini67
0x1F,0x15,0x1F,0x00,0x17,0x15,0x1F,0x00, // ASCII 004 Mini89
0x04,0x04,0x04,0x00,0x04,0x0E,0x04,0x00, // ASCII 005 Mini+-
0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00, // ASCII 006 Mini.
0x08,0x1C,0x3E,0x00,0x3E,0x1C,0x08,0x00, // ASCII 007 Mini<>
.
.
.
Bunu da yazdığım bir grafik kütüphanesi ile aşağıdaki şekilde kolayca kullanabiliyorum:
void menu(void)
{
unsigned int tmt=0;
unsigned char menu=0;
unsigned char topidx=0;
unsigned char m,b,y,t;
FpgaSetReg(0x04,0x01); // OSD ON
refresh:
ClrWdt();
GLCDClear();
GLCDPutLogo();
for (m=0;m<13;m++)
{
// Menu Görünür mü?
if ((topidx<=m) && ((topidx+4)>=m))
{
y=15+10*(m-topidx);
switch (m)
{
case 0 : STR2RAM(str,"INPUT");
GLCDTextBox(0,y,64,0,(menu==m),str);
if (SetInput==0) STR2RAM(str,"CVBS"); else STR2RAM(str,"LUMA/CHR");
GLCDTextBox(65,y,63,0,(menu==m),str);
if (menu==m) GLCDDrawCombo(y);
break;
case 1 : STR2RAM(str,"COLOR");
GLCDTextBox(0,y,64,0,(menu==m),str);
GLCDDrawBar(65,y,48,31,SetColor);
sprintf(str,"%02d\n",SetColor);
GLCDTextBox(115,y,13,0,(menu==m),str);
break;
case 2 : STR2RAM(str,"BRIGHTNESS");
GLCDTextBox(0,y,64,0,(menu==m),str);
GLCDDrawBar(65,y,48,31,SetBrightness);
sprintf(str,"%02d",SetBrightness);
GLCDTextBox(115,y,13,0,(menu==m),str);
break;
case 3 : STR2RAM(str,"CONTRAST");
GLCDTextBox(0,y,64,0,(menu==m),str);
GLCDDrawBar(65,y,48,31,SetContrast);
sprintf(str,"%02d",SetContrast);
GLCDTextBox(115,y,13,0,(menu==m),str);
break;
case 4 : STR2RAM(str,"HUE");
GLCDTextBox(0,y,64,0,(menu==m),str);
GLCDDrawBar(65,y,48,31,SetHue);
sprintf(str,"%02d",SetHue);
GLCDTextBox(115,y,13,0,(menu==m),str);
break;
case 5 : STR2RAM(str,"SCANLINES");
GLCDTextBox(0,y,64,0,(menu==m),str);
if (SetScanlines==0) STR2RAM(str,"OFF"); else
if (SetScanlines==1) STR2RAM(str,"LOW"); else
if (SetScanlines==2) STR2RAM(str,"MID"); else STR2RAM(str,"HIGH");
GLCDTextBox(65,y,63,0,(menu==m),str);
if (menu==m) GLCDDrawCombo(y);
break;
case 6 : STR2RAM(str,"COL.EFFECT");
GLCDTextBox(0,y,64,0,(menu==m),str);
if (SetEffect==0) STR2RAM(str,"OFF"); else
if (SetEffect==1) STR2RAM(str,"MONO-GREEN"); else
if (SetEffect==2) STR2RAM(str,"MONO-AMBER"); else STR2RAM(str,"B/W");
GLCDTextBox(65,y,63,0,(menu==m),str);
if (menu==m) GLCDDrawCombo(y);
break;
case 7 : STR2RAM(str,"PAL BLEND");
GLCDTextBox(0,y,64,0,(menu==m),str);
if (SetPalBlend==0) STR2RAM(str,"OFF"); else
if (SetPalBlend==1) STR2RAM(str,"LOW"); else
if (SetPalBlend==2) STR2RAM(str,"MID"); else STR2RAM(str,"HIGH");
GLCDTextBox(65,y,63,0,(menu==m),str);
if (menu==m) GLCDDrawCombo(y);
break;
case 8 : STR2RAM(str,"INP.FILTER");
GLCDTextBox(0,y,64,0,(menu==m),str);
if (SetFilter==0) STR2RAM(str,"OFF"); else
if (SetFilter==1) STR2RAM(str,"AMP"); else STR2RAM(str,"FILT+AMP");
GLCDTextBox(65,y,63,0,(menu==m),str);
if (menu==m) GLCDDrawCombo(y);
break;
case 9 : STR2RAM(str,"CHROM.BW");
GLCDTextBox(0,y,64,0,(menu==m),str);
if (SetChrBandwidth==0) STR2RAM(str,"620KHZ"); else
if (SetChrBandwidth==1) STR2RAM(str,"800KHZ"); else
if (SetChrBandwidth==2) STR2RAM(str,"920KHZ"); else STR2RAM(str,"1000KHZ");
GLCDTextBox(65,y,63,0,(menu==m),str);
if (menu==m) GLCDDrawCombo(y);
break;
case 10 : STR2RAM(str,"COMB.FILTER");
GLCDTextBox(0,y,64,0,(menu==m),str);
if (SetCombFilter==0) STR2RAM(str,"OFF"); else STR2RAM(str,"ON");
GLCDTextBox(65,y,63,0,(menu==m),str);
if (menu==m) GLCDDrawCombo(y);
break;
case 11 : STR2RAM(str,"---- EXIT MENU ----");
GLCDTextBox(0,y,128,0,(menu==m),str);
break;
}
}
}
GLCDUpdateData();
Delay10KTCYx(32); // 5 mS
b=CheckButton();
if (b!=BTN_NONE) tmt=0; else tmt++;
if (tmt>750)
{
goto exit;
}
if (menu==0) if (checkincdec(BTN_L,BTN_R,&SetInput,1,b,1))
{
saa7113_SetSource(SetInput);
}
if (menu==1) if (checkincdec(BTN_L,BTN_R,&SetColor,31,b,0))
{
saa7113_SetColor(SetColor);
}
if (menu==2) if (checkincdec(BTN_L,BTN_R,&SetBrightness,31,b,0))
{
saa7113_SetBrightness(SetBrightness);
}
if (menu==3) if (checkincdec(BTN_L,BTN_R,&SetContrast,31,b,0))
{
saa7113_SetContrast(SetContrast);
}
if (menu==4) if (checkincdec(BTN_L,BTN_R,&SetHue,31,b,0))
{
saa7113_SetHue(SetHue);
}
if (menu==5) if (checkincdec(BTN_L,BTN_R,&SetScanlines,3,b,1))
{
// Scanlines ...
FpgaSetReg(0x00,SetScanlines);
}
if (menu==6) if (checkincdec(BTN_L,BTN_R,&SetEffect,3,b,1))
{
// Effects ...
FpgaSetReg(0x01,SetEffect);
}
if (menu==7) if (checkincdec(BTN_L,BTN_R,&SetPalBlend,3,b,1))
{
// Effects ...
FpgaSetReg(0x02,SetPalBlend);
}
if (menu==8) if (checkincdec(BTN_L,BTN_R,&SetFilter,2,b,1))
{
FpgaSetReg(0x02,SetPalBlend);
saa7113_SetInputAmp(SetFilter);
}
if (menu==9) if (checkincdec(BTN_L,BTN_R,&SetChrBandwidth,3,b,1))
{
saa7113_SetChrBandwidth(SetChrBandwidth);
}
if (menu==10) if (checkincdec(BTN_L,BTN_R,&SetCombFilter,1,b,1))
{
saa7113_SetCombFilter(SetCombFilter);
}
if ((menu==11) && ((b==BTN_L) || (b==BTN_R)) )
{
goto exit;
}
if (b==BTN_D)
{
menu++;
if (menu>11) topidx=0,menu=0;
if (menu>topidx+4) topidx=menu-4;
}
if (b==BTN_U)
{
menu--;
if (menu>11) topidx=7,menu=10;
if (menu<topidx) topidx=menu;
}
goto refresh;
exit:
Write_b_eep(0,SetInput); Busy_eep();
Write_b_eep(1,SetFilter); Busy_eep();
Write_b_eep(2,SetColor); Busy_eep();
Write_b_eep(3,SetBrightness); Busy_eep();
Write_b_eep(4,SetContrast); Busy_eep();
Write_b_eep(5,SetHue); Busy_eep();
Write_b_eep(7,SetChrBandwidth); Busy_eep();
Write_b_eep(8,SetCombFilter); Busy_eep();
Write_b_eep(9,SetScanlines); Busy_eep();
Write_b_eep(10,SetEffect); Busy_eep();
Write_b_eep(11,SetPalBlend); Busy_eep();
FpgaSetReg(0x04,0x00); // OSD OFF
return;
}
Şimdi C ile bu kadar kolay yazılmış olan bir kodu asm ile yazmak daha zor olacak. Hatta hiç uC core kullanmadan state machine yapısıyla komple FPGA e logic olarak yazmak da mümkün. Ama bu menüyü bu şekilde hazırlamak herhalde 1-2 hafta alır o şekilde...