newsclan(zhblue) a écrit : > Hi, > i found this old thread on bank switching,but it makes it quite clean on the theory,but i just need an sample on bank switching. > http://www.cc65.org/mailarchive/2002-10/1604.html > > i have a lot of const char [] to store in PRGROM. > i guess it should work like this, but how ? > > 1.use ld65 memory config file to define a memory map (how if i use MMC1),add more bank ROMs in to the config file. > 2.use #pragma XXXXX ( what exectly should be written?) > to force array value code into certain Segment which defined by the 1st step > 3.adding code of bank switching before using data in a certain bank.(combined the thread and the MMC1 reference) > > can anyone help? > > thanks > zhblue N�����r��y���^�+-��ݙ�������ݢj&����yװ��m��-�)�{.n�+���s�b��^n�r��azf�l=== If you want to do bankswitching on the NES you'd definitely want to write the bankswitching routines in assembly even if the rest of the programm is in C (as for the interrupt vectors). #define MMC1Reg1 (*char)0x8000 void writeReg(unsigned char value) { int i; *MMC1Reg1 = (char)0x80 //Reset MMC1 register for (i == 5; i!=0; --i) { *MMC1Reg1 = value; //Write 5 bits value = value >> 1; //shifting right each loop } } that should work (no guarantee I haven't tried at all), altough it's really not a good implementation I belive ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Thu Mar 12 19:57:52 2009
This archive was generated by hypermail 2.1.8 : 2009-03-12 19:57:54 CET