1 /** iP6: PC-6000/6600 series emualtor ************************/
5 /** modified by Windy 2002-2004 **/
6 /** by ISHIOKA Hiroshi 1998,1999 **/
7 /** This code is based on fMSX written by Marat Fayzullin **/
8 /** and Adaptions for any X-terminal by Arnold Metselaar **/
9 /*************************************************************/
12 NEC PC-6001 Emulator 'yaPC-6001'
13 NEC PC-6001mkII Emulator 'yaPC-6201'
14 NEC PC-6001mkIISR Emulator 'yaPC-6401'
15 NEC PC-6601 Emulator 'yaPC-6601'
16 NEC PC-6601SR Emulator 'yaPC-6801'
26 #define CGROM1 (MEMORY_BASE + CGROM1_BASE)
27 #define CGROM5 (MEMORY_BASE + CGROM5_BASE)
28 #define CGROM6 (MEMORY_BASE + CGROM6_BASE)
30 #define SETSCRVARM1(y1) dest = &screen[y1][0];W=0;
31 #define SETSCRVARM5(y1) dest = &screen[y1][0];W=0;
35 #define SeqPix21(c) dest[X*8+W]=c;W++;
36 #define SeqPix41(c) dest[X*8+W]=c;W++;dest[X*8+W]=c;W++;
40 void MEMORY::draw_screen()
43 for(int y = 0; y < 400; y++) {
44 scrntype_t* dest = emu->get_screen_buffer(y);
45 memset(dest, 0, 640 * sizeof(scrntype_t));
47 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
48 } else if (static_cast<VM *>(vm)->sr_mode) {
50 if (CRTMode3) RefreshScr63();
52 } else RefreshScr61();
54 emu->set_vm_screen_lines(200);
56 for(int y = 0; y < 200; y++) {
57 scrntype_t* dest = emu->get_screen_buffer(y*2);
58 scrntype_t* dest1 = emu->get_screen_buffer(y*2+1);
59 for(int x = 0; x < 320; x++) {
60 dest[x*2] = dest[x*2+1] = palette_pc[screen[y][x*2]];
62 if(config.scan_line) {
63 memset(dest1, 0, 640 * sizeof(scrntype_t));
65 my_memcpy(dest1, dest, 640 * sizeof(scrntype_t));
68 } else if (cols==40) {
69 for(int y = 0; y < 200; y++) {
70 scrntype_t* dest = emu->get_screen_buffer(y*2);
71 scrntype_t* dest1 = emu->get_screen_buffer(y*2+1);
72 for(int x = 0; x < 320; x++) {
73 dest[x*2] = dest[x*2+1] = palette_pc[screen[y][x]];
75 if(config.scan_line) {
76 memset(dest1, 0, 640 * sizeof(scrntype_t));
78 my_memcpy(dest1, dest, 640 * sizeof(scrntype_t));
82 for(int y = 0; y < 200; y++) {
83 scrntype_t* dest = emu->get_screen_buffer(y*2);
84 scrntype_t* dest1 = emu->get_screen_buffer(y*2+1);
85 for(int x = 0; x < 640; x++) {
86 dest[x] = palette_pc[screen[y][x]];
88 if(config.scan_line) {
89 memset(dest1, 0, 640 * sizeof(scrntype_t));
91 my_memcpy(dest1, dest, 640 * sizeof(scrntype_t));
99 if (CRTMode3) RefreshScr54();
103 emu->set_vm_screen_lines(200);
104 for(int y = 0; y < 200; y++) {
105 scrntype_t* dest = emu->get_screen_buffer(y*2);
106 scrntype_t* dest1 = emu->get_screen_buffer(y*2+1);
107 for(int x = 0; x < 320; x++) {
108 dest[x*2] = dest[x*2+1] = palette_pc[screen[y][x]];
110 if(config.scan_line) {
111 memset(dest1, 0, 640 * sizeof(scrntype_t));
113 my_memcpy(dest1, dest, 640 * sizeof(scrntype_t));
119 emu->set_vm_screen_lines(200);
120 for(int y = 0; y < 200; y++) {
121 scrntype_t* dest = emu->get_screen_buffer(y*2);
122 scrntype_t* dest1 = emu->get_screen_buffer(y*2+1);
123 for(int x = 0; x < 320; x++) {
124 if (x >= 32 && x < 288 && y >=4 && y < 196) {
125 dest[x*2] = dest[x*2+1] = palette_pc[screen[y-4][x-32]];
127 dest[x*2] = dest[x*2+1] = palette_pc[8];
130 if(config.scan_line) {
131 memset(dest1, 0, 640 * sizeof(scrntype_t));
133 my_memcpy(dest1, dest, 640 * sizeof(scrntype_t));
138 emu->screen_skip_line(true);
141 // RefreshScr10: N60-BASIC select function
142 void MEMORY::RefreshScr10()
144 if ((*VRAM&0x80) == 0x00)
147 switch (*(VRAM)&0x1C) {
148 case 0x00: case 0x10: // 64x 64 color / 128x 64
149 RefreshScr13a(); break;
150 case 0x08: // 128x 64 color
151 RefreshScr13b(); break;
152 case 0x18: // 128x 96
153 RefreshScr13c(); break;
154 case 0x04: // 128x 96 color
155 RefreshScr13d(); break;
156 case 0x14: // 128x192
157 RefreshScr13e(); break;
158 default: // 128x192 color / 256x192
159 RefreshScr13(); break;
163 // RefreshScr11: N60-BASIC screen 1,2
164 void MEMORY::RefreshScr11()
171 G = CGROM; /* CGROM */
172 T1 = VRAM; /* attribute data */
173 T2 = VRAM+0x0200; /* ascii/semi-graphic data */
174 for(Y=0; Y<M1HEIGHT; Y++) {
175 SETSCRVARM1(Y); /* Drawing area */
176 for(X=0; X<32; X++, T1++, T2++) {
177 /* get CGROM address and color */
178 if (*T1&0x40) { /* if semi-graphic */
179 if (*T1&0x20) { /* semi-graphic 6 */
180 S = G+((*T2&0x3f)<<4)+0x1000;
181 FC = BPal12[(*T1&0x02)<<1|(*T2)>>6]; BC = BPal[8];
182 } else { /* semi-graphic 4 */
183 S = G+((*T2&0x0f)<<4)+0x2000;
184 FC = BPal12[(*T2&0x70)>>4]; BC = BPal[8];
186 } else { /* if normal character */
188 FC = BPal11[(*T1&0x03)]; BC = BPal11[(*T1&0x03)^0x01];
192 SeqPix21(K&0x80? FC:BC); SeqPix21(K&0x40? FC:BC);
193 SeqPix21(K&0x20? FC:BC); SeqPix21(K&0x10? FC:BC);
194 SeqPix21(K&0x08? FC:BC); SeqPix21(K&0x04? FC:BC);
195 SeqPix21(K&0x02? FC:BC); SeqPix21(K&0x01? FC:BC);
197 if (Y%12!=11) { T1-=32; T2-=32; }
201 // RefreshScr13: N60-BASIC screen 3,4
202 void MEMORY::RefreshScr13()
208 T1 = VRAM; /* attribute data */
209 T2 = VRAM+0x0200; /* graphic data */
210 for (Y=0; Y<M1HEIGHT; Y++) {
211 SETSCRVARM1(Y); /* Drawing area */
212 for (X=0; X<32; X++,T1++,T2++) {
213 if (*T1&0x10) { /* 256x192 (SCREEN 4) */
216 SeqPix21(BPal14[attr|(*T2&0x80)>>7]);
217 SeqPix21(BPal14[attr|(*T2&0x40)>>6]);
218 SeqPix21(BPal14[attr|(*T2&0x20)>>5]);
219 SeqPix21(BPal14[attr|(*T2&0x10)>>4]);
220 SeqPix21(BPal14[attr|(*T2&0x08)>>3]);
221 SeqPix21(BPal14[attr|(*T2&0x04)>>2]);
222 SeqPix21(BPal14[attr|(*T2&0x02)>>1]);
223 SeqPix21(BPal14[attr|(*T2&0x01) ]);
224 } else { /* 128x192 color (SCREEN 3) */
225 attr = (*T1&0x02)<<1;
227 SeqPix41(BPal13[attr|(*T2&0xC0)>>6]);
228 SeqPix41(BPal13[attr|(*T2&0x30)>>4]);
229 SeqPix41(BPal13[attr|(*T2&0x0C)>>2]);
230 SeqPix41(BPal13[attr|(*T2&0x03) ]);
233 if (T1 == VRAM+0x200) T1=VRAM;
237 // RefreshScr13a: N60-BASIC screen 3,4
238 void MEMORY::RefreshScr13a() /* 64x 64 color / 128x 64 */
245 T1 = VRAM; /* attribute data */
246 T2 = VRAM+0x0200; /* graphic data */
247 for (Y=0; Y<M1HEIGHT; Y++) {
248 SETSCRVARM1(Y); /* Drawing area */
249 for (X=0; X<16; X++,T1++,T2++) {
250 if (*T1&0x10) { /* 128x 64 */
253 SeqPix41(BPal14[attr|(*T2&0x80)>>7]);
254 SeqPix41(BPal14[attr|(*T2&0x40)>>6]);
255 SeqPix41(BPal14[attr|(*T2&0x20)>>5]);
256 SeqPix41(BPal14[attr|(*T2&0x10)>>4]);
257 SeqPix41(BPal14[attr|(*T2&0x08)>>3]);
258 SeqPix41(BPal14[attr|(*T2&0x04)>>2]);
259 SeqPix41(BPal14[attr|(*T2&0x02)>>1]);
260 SeqPix41(BPal14[attr|(*T2&0x01) ]);
261 } else { /* 64x 64 color */
262 attr = (*T1&0x02)<<1;
264 SeqPix41(L=BPal13[attr|(*T2&0xC0)>>6]);
266 SeqPix41(L=BPal13[attr|(*T2&0x30)>>4]);
268 SeqPix41(L=BPal13[attr|(*T2&0x0C)>>2]);
270 SeqPix41(L=BPal13[attr|(*T2&0x03) ]);
274 if (Y%3 != 2) { T1-=16; T2-=16; }
275 else if (T1 == VRAM+0x200) T1=VRAM;
279 // RefreshScr13b: N60-BASIC screen 3,4
280 void MEMORY::RefreshScr13b() /* 128x 64 color */
286 T1 = VRAM; /* attribute data */
287 T2 = VRAM+0x0200; /* graphic data */
288 for (Y=0; Y<M1HEIGHT; Y++) {
289 SETSCRVARM1(Y); /* Drawing area */
290 for (X=0; X<32; X++,T1++,T2++) {
292 attr = (*T1&0x02)<<1;
293 SeqPix41(BPal13[attr|(*T2&0xC0)>>6]);
294 SeqPix41(BPal13[attr|(*T2&0x30)>>4]);
295 SeqPix41(BPal13[attr|(*T2&0x0C)>>2]);
296 SeqPix41(BPal13[attr|(*T2&0x03) ]);
298 if (Y%3 != 2) { T1-=32; T2-=32; }
299 else if (T1 == VRAM+0x200) T1=VRAM;
303 // RefreshScr13c: N60-BASIC screen 3,4
304 void MEMORY::RefreshScr13c() /* 128x 96 */
310 T1 = VRAM; /* attribute data */
311 T2 = VRAM+0x0200; /* graphic data */
312 for (Y=0; Y<M1HEIGHT; Y++) {
313 SETSCRVARM1(Y); /* Drawing area */
314 for (X=0; X<16; X++,T1++,T2++) {
317 SeqPix41(BPal14[attr|(*T2&0x80)>>7]);
318 SeqPix41(BPal14[attr|(*T2&0x40)>>6]);
319 SeqPix41(BPal14[attr|(*T2&0x20)>>5]);
320 SeqPix41(BPal14[attr|(*T2&0x10)>>4]);
321 SeqPix41(BPal14[attr|(*T2&0x08)>>3]);
322 SeqPix41(BPal14[attr|(*T2&0x04)>>2]);
323 SeqPix41(BPal14[attr|(*T2&0x02)>>1]);
324 SeqPix41(BPal14[attr|(*T2&0x01) ]);
326 if (!(Y&1)) { T1-=16; T2-=16; }
327 else if (T1 == VRAM+0x200) T1=VRAM;
331 // RefreshScr13d: N60-BASIC screen 3,4
332 void MEMORY::RefreshScr13d() /* 128x 96 color */
338 T1 = VRAM; /* attribute data */
339 T2 = VRAM+0x0200; /* graphic data */
340 for (Y=0; Y<M1HEIGHT; Y++) {
341 SETSCRVARM1(Y); /* Drawing area */
342 for (X=0; X<32; X++,T1++,T2++) {
343 attr = (*T1&0x02)<<1;
345 SeqPix41(BPal13[attr|(*T2&0xC0)>>6]);
346 SeqPix41(BPal13[attr|(*T2&0x30)>>4]);
347 SeqPix41(BPal13[attr|(*T2&0x0C)>>2]);
348 SeqPix41(BPal13[attr|(*T2&0x03) ]);
350 if (!(Y&1)) { T1-=32; T2-=32; }
351 else if (T1 == VRAM+0x200) T1=VRAM;
355 // RefreshScr13e: N60-BASIC screen 3,4
356 void MEMORY::RefreshScr13e() /* 128x192 */
362 T1 = VRAM; /* attribute data */
363 T2 = VRAM+0x0200; /* graphic data */
364 for (Y=0; Y<M1HEIGHT; Y++) {
365 SETSCRVARM1(Y); /* Drawing area */
366 for (X=0; X<16; X++,T1++,T2++) {
369 SeqPix41(BPal14[attr|(*T2&0x80)>>7]);
370 SeqPix41(BPal14[attr|(*T2&0x40)>>6]);
371 SeqPix41(BPal14[attr|(*T2&0x20)>>5]);
372 SeqPix41(BPal14[attr|(*T2&0x10)>>4]);
373 SeqPix41(BPal14[attr|(*T2&0x08)>>3]);
374 SeqPix41(BPal14[attr|(*T2&0x04)>>2]);
375 SeqPix41(BPal14[attr|(*T2&0x02)>>1]);
376 SeqPix41(BPal14[attr|(*T2&0x01) ]);
378 if (T1 == VRAM+0x200) T1=VRAM;
382 // RefreshScr51: N60m/66-BASIC screen 1,2
383 void MEMORY::RefreshScr51()
390 G = CGROM; /* CGROM */
391 T1 = VRAM; /* attribute data */
392 T2 = VRAM+0x0400; /* ascii/semi-graphic data */
393 for(Y=0; Y<M5HEIGHT; Y++) {
394 SETSCRVARM5(Y); /* Drawing area */
395 for(X=0; X<40; X++, T1++, T2++) {
396 /* get CGROM address and color */
397 S = G+(*T2<<4)+(*T1&0x80?0x1000:0);
398 FC = BPal[(*T1)&0x0F]; BC = BPal[(((*T1)&0x70)>>4)|CSS2];
401 SeqPix21(K&0x80? FC:BC); SeqPix21(K&0x40? FC:BC);
402 SeqPix21(K&0x20? FC:BC); SeqPix21(K&0x10? FC:BC);
403 SeqPix21(K&0x08? FC:BC); SeqPix21(K&0x04? FC:BC);
404 SeqPix21(K&0x02? FC:BC); SeqPix21(K&0x01? FC:BC);
406 if (Y%10!=9) { T1-=40; T2-=40; }
410 // RefreshScr53: N60m/66-BASIC screen 3
411 void MEMORY::RefreshScr53()
416 T1 = VRAM; /* attribute data */
417 T2 = VRAM+0x2000; /* graphic data */
418 for(Y=0; Y<M5HEIGHT; Y++) {
419 SETSCRVARM5(Y); /* Drawing area */
420 for(X=0; X<40; X++) {
422 SeqPix41(BPal53[CSS3|((*T1)&0xC0)>>6|((*T2)&0xC0)>>4]);
423 SeqPix41(BPal53[CSS3|((*T1)&0x30)>>4|((*T2)&0x30)>>2]);
424 SeqPix41(BPal53[CSS3|((*T1)&0x0C)>>2|((*T2)&0x0C) ]);
425 SeqPix41(BPal53[CSS3|((*T1)&0x03) |((*T2)&0x03)<<2]);
431 // RefreshScr54: N60m/66-BASIC screen 4
432 void MEMORY::RefreshScr54()
438 T1 = VRAM; /* attribute data */
439 T2 = VRAM+0x2000; /* graphic data */
441 cssor = CSS3|CSS2|CSS1;
442 for(Y=0; Y<M5HEIGHT; Y++) {
443 SETSCRVARM5(Y); /* Drawing area */
444 for(X=0; X<40; X++) {
446 SeqPix21(BPal53[cssor|((*T1)&0x80)>>7|((*T2)&0x80)>>6]);
447 SeqPix21(BPal53[cssor|((*T1)&0x40)>>6|((*T2)&0x40)>>5]);
448 SeqPix21(BPal53[cssor|((*T1)&0x20)>>5|((*T2)&0x20)>>4]);
449 SeqPix21(BPal53[cssor|((*T1)&0x10)>>4|((*T2)&0x10)>>3]);
450 SeqPix21(BPal53[cssor|((*T1)&0x08)>>3|((*T2)&0x08)>>2]);
451 SeqPix21(BPal53[cssor|((*T1)&0x04)>>2|((*T2)&0x04)>>1]);
452 SeqPix21(BPal53[cssor|((*T1)&0x02)>>1|((*T2)&0x02) ]);
453 SeqPix21(BPal53[cssor|((*T1)&0x01) |((*T2)&0x01)<<1]);
459 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
460 // RefreshScr61: N66-SR BASIC screen 1
461 void MEMORY::RefreshScr61()
471 G = CGROM; /* CGROM */
472 T1 = TEXTVRAM+1; /* attribute data */
473 T2 = TEXTVRAM; /* ascii/semi-graphic data */
474 high= (rows==20)? 10:8; /* charactor's high SR BASIC 2002/2/23 */
475 addr= (rows==20)? 0x2000: 0x1000; /* CGROM address SR BASIC 2002/2/23 */
476 semi_addr= (rows==20)? 0x3000: 0x4000; /* semi address 2003/7/8 */
477 for(Y=0; Y<M5HEIGHT; Y++) {
478 SETSCRVARM5(Y); /* Drawing area */
479 for(X=0; X< cols; X++, T1+=2, T2+=2) {
481 S= G+(*T2<<4)+(*T1&0x80?semi_addr:addr); /*for CGROM6 SR semi graph 2002/2/23*//* 2003/7/8 */
482 FC = BPal[ (*T1)&0x0F]; /* fast Palet (2002/9/27) */
483 BC = BPal[ (((*T1)&0x70)>>4) |CSS2];
484 K=*(S+Y%high); /* character high 2002/2/23 */
485 SeqPix21(K&0x80? FC:BC); SeqPix21(K&0x40? FC:BC);
486 SeqPix21(K&0x20? FC:BC); SeqPix21(K&0x10? FC:BC);
487 SeqPix21(K&0x08? FC:BC); SeqPix21(K&0x04? FC:BC);
488 SeqPix21(K&0x02? FC:BC); SeqPix21(K&0x01? FC:BC);
490 if (Y% high!=high-1) { T1-=cols*2; T2-=cols*2; } /* character high 2002/2/23 */
494 // RefreshScr62 N66-SR BASIC screen 2
495 void MEMORY::RefreshScr62()
501 for(Y=0; Y<M6HEIGHT; Y++) {
502 SETSCRVARM5(Y); /* Drawing area */
503 for(X=0; X< 64; X++) {
505 SeqPix41(BPal53[ CSS3|((*T1)&0x0f) ]);
506 SeqPix41(BPal53[ CSS3|((*T1)&0xf0)>>4 ]);
508 SeqPix41(BPal53[ CSS3|((*T1)&0x0f) ]);
509 SeqPix41(BPal53[ CSS3|((*T1)&0xf0)>>4 ]);
512 for(X=64 ;X<80 ; X++) {
514 SeqPix41(BPal53[ CSS3|((*T2)&0x0f) ]);
515 SeqPix41(BPal53[ CSS3|((*T2)&0xf0)>>4 ]);
517 SeqPix41(BPal53[ CSS3|((*T2)&0x0f) ]);
518 SeqPix41(BPal53[ CSS3|((*T2)&0xf0)>>4 ]);
522 { T1-=(254); T2-=(62);}
528 // RefreshScr63 N66-SR BASIC screen 3
529 void MEMORY::RefreshScr63()
537 cssor = CSS3|CSS2|CSS1;
538 for(Y=0; Y<M6HEIGHT; Y++) {
539 SETSCRVARM5(Y); /* Drawing area */
540 for(X=0; X< 64; X++) {
542 SeqPix41(BPal53[cssor|((*T1)&0x80)>>7|((*(T1+1))&0x80)>>6]);
543 SeqPix41(BPal53[cssor|((*T1)&0x40)>>6|((*(T1+1))&0x40)>>5]);
544 SeqPix41(BPal53[cssor|((*T1)&0x20)>>5|((*(T1+1))&0x20)>>4]);
545 SeqPix41(BPal53[cssor|((*T1)&0x10)>>4|((*(T1+1))&0x10)>>3]);
546 SeqPix41(BPal53[cssor|((*T1)&0x08)>>3|((*(T1+1))&0x08)>>2]);
547 SeqPix41(BPal53[cssor|((*T1)&0x04)>>2|((*(T1+1))&0x04)>>1]);
548 SeqPix41(BPal53[cssor|((*T1)&0x02)>>1|((*(T1+1))&0x02) ]);
549 SeqPix41(BPal53[cssor|((*T1)&0x01) |((*(T1+1))&0x01)<<1]);
552 for(X=64 ;X<80 ; X++) {
554 SeqPix41(BPal53[cssor|((*T2)&0x80)>>7|((*(T2+1))&0x80)>>6]);
555 SeqPix41(BPal53[cssor|((*T2)&0x40)>>6|((*(T2+1))&0x40)>>5]);
556 SeqPix41(BPal53[cssor|((*T2)&0x20)>>5|((*(T2+1))&0x20)>>4]);
557 SeqPix41(BPal53[cssor|((*T2)&0x10)>>4|((*(T2+1))&0x10)>>3]);
558 SeqPix41(BPal53[cssor|((*T2)&0x08)>>3|((*(T2+1))&0x08)>>2]);
559 SeqPix41(BPal53[cssor|((*T2)&0x04)>>2|((*(T2+1))&0x04)>>1]);
560 SeqPix41(BPal53[cssor|((*T2)&0x02)>>1|((*(T2+1))&0x02) ]);
561 SeqPix41(BPal53[cssor|((*T2)&0x01) |((*(T2+1))&0x01)<<1]);
565 { T1-=(254); T2-=(62);}
571 void MEMORY::do_palet(int dest,int src)
573 int textpalet2[16]={0,4,1,5,2,6,3,7,8,12,9,13,10,14,11,15}; /* color code-> VRAM code*/
574 // *************** for RefreshScr 53/54/62/63 ***************************
575 if ((CSS3 & 0x10) ==0 ) // CSS3 =0
577 if(dest>=0 && dest<32 && src>=0 && src<32)
579 BPal53[dest]= BPal62[src];
582 if (dest>=0 && dest<32 && src>=0 && src<32)
587 case 16: dest1 =13; dest2 = 5; break;
588 case 15: dest1 =10; dest2 = 2; break;
589 case 14: dest1 =14; dest2 = 6; break;
590 case 13: dest1 = 1; dest2 = 9; break;
592 BPal53[16+dest1-1]= BPal62[src];
593 BPal53[16+dest2-1]= BPal62[src];
596 // ************** for RefreshScr51/61 **************************
597 if(dest>=0 && dest<16 && src>=0 && src<16)
598 BPal[textpalet2[dest]]= BPal61[ textpalet2[src]];
601 void MEMORY::make_semigraph(void)
604 unsigned int i, j, m1, m2;
606 for(i=0; i<64; i++) {
607 for(j=0; j<16; j++) {
609 case 0: m1=0x20; m2=0x10; break;
610 case 1: m1=0x08; m2=0x04; break;
611 case 2: m1=0x02; m2=0x01; break;
614 *P++=(i&m1 ? 0xF0: 0) | (i&m2 ? 0x0F: 0);
618 for(i=0; i<16; i++) {
619 for(j=0; j<16; j++) {
621 case 0: m1=0x08; m2=0x04; break;
622 case 1: m1=0x02; m2=0x01; break;
625 *P++=(i&m1 ? 0xF0: 0) | (i&m2 ? 0x0F: 0);
629 for(i=0; i<256; i++) {
630 for(j=0; j<16; j++) {
632 case 0: m1=0x80; m2=0x40; break;
633 case 1: m1=0x20; m2=0x10; break;
634 case 2: m1=0x08; m2=0x04; break;
635 case 3: m1=0x02; m2=0x01; break;
638 *P++=(i&m1 ? 0xF0: 0) | (i&m2 ? 0x0F: 0);
643 int MEMORY::chk_gvram(uint32_t A,int flag)
645 if (port60[ (A>>13)+flag ]==0x00 && bitmap) // VRAM
\82Ì
\90æ
\93ª
\82©
\82Â
\81ACRT
\82ª BITMAP mode
650 uint8_t MEMORY::gvram_read(uint32_t A)
657 y = portCF*16+portCE; /* y
\8dÀ
\95W */
658 if( y >=204) y-=204; /* Y
\8dÀ
\95W 204
\88È
\8fã
\82¾
\82Æ 204
\88ø
\82 add 2003/10/22 */
659 w = (x <256) ? 256: 64; /* width:0..255
\82È
\82ç256 / 256..319
\82È
\82ç 64
\82É
\82·
\82é*/
660 off=(x <256) ? 0x1a00: 0x0000; /* offset: Vram offset address */
661 x = (x <256) ? x: x-256; /* x:256..319
\82È
\82ç 256
\82ð
\88ø
\82
\81@ */
662 z = ((y & 1 )==1) ? 2: 0; /* z:Y
\8dÀ
\95W
\82ª
\8aï
\90\94\82È
\82ç
\81A2
\82ð
\91«
\82· */
663 adr = (VRAM+ (off+ (y>>1)*w + (x&0xffc)+z));
666 case 0: ret= *(adr); break;
667 case 1: ret= *(adr)>>4; break;
668 case 2: ret= *(adr+1); break;
669 case 3: ret= *(adr+1)>>4; break;
674 void MEMORY::gvram_write(uint32_t A, uint32_t V)
680 y = portCF*16+portCE; /* y
\8dÀ
\95W */
681 if( y >=204) y-=204; /* Y
\8dÀ
\95W 204
\88È
\8fã
\82¾
\82Æ 204
\88ø
\82 */
682 w = (x <256) ? 256: 64; /* width:0..255
\82È
\82ç256 / 256..319
\82È
\82ç 64
\82É
\82·
\82é*/
683 off=(x <256) ? 0x1a00: 0x0000; /* offset: Vram offset address */
684 x = (x <256) ? x: x-256; /* x:256..319
\82È
\82ç 256
\82ð
\88ø
\82
\81@ */
685 z = ((y & 1 )==1) ? 2: 0; /* z:Y
\8dÀ
\95W
\82ª
\8aï
\90\94\82È
\82ç
\81A2
\82ð
\91«
\82· */
687 adr = VRAM+(off+ (y>>1)*(w) + (x&0xffc)+z);
690 case 0: *(adr)=(*(adr) &0xf0) |V; break;
691 case 1: *(adr)=(*(adr) &0x0f) |V<<4; break;
692 case 2: *(adr+1)=(*(adr+1)&0xf0)|V; break;
693 case 3: *(adr+1)=(*(adr+1)&0x0f)|V<<4; break;