C51 COMPILER V6.00 TEST 05/18/2000 08:49:51 PAGE 1 C51 COMPILER 6.00, COMPILATION OF MODULE TEST NO OBJECT MODULE REQUESTED COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE .\Test.c OBJECTEXTEND DEBUG stmt level source *** WARNING 500 IN LINE 1 OF .\TEST.C: MISSING DEVICE (SECURITY KEY NOT FOUND) 1 #include "xbus.h" 2 #include 3 #include 4 5 sbit NOSRAM = 0xB0; /* error pin is P3.0 */ 6 sbit SRAM = 0xB2; /* noerror pin is P3.2 */ 7 sbit DONE = 0xB3; /* noerror pin is P3.3 */ 8 9 void PCReset(); 10 void SRAMTest(); 11 void EndProg (); 12 void BoxColorCycle(); 13 void DrawBox(int width,int height,int ulx,int uly, unsigned char color); 14 15 void main() 16 { 17 1 PCReset(); 18 1 XInit(); 19 1 SRAMTest(); 20 1 BoxColorCycle(); 21 1 EndProg(); 22 1 } 23 24 void PCReset() 25 { 26 1 IE = 0x00; /* no interrupts */ 27 1 P0 = 0xff; /* tristate (not pull down) the port */ 28 1 P1 = 0xff; /* tristate (not pull down) the port */ 29 1 P2 = 0xff; /* tristate (not pull down) the port */ 30 1 P3 = 0xff; /* tristate (not pull down) the port */ 31 1 } 32 33 // Test the 32K of SRAM by writing and reading back 34 void SRAMTest() 35 { 36 1 unsigned long errors = 0; 37 1 unsigned char value; 38 1 long address; 39 1 40 1 NOSRAM = 0; 41 1 SRAM = 0; 42 1 DONE = 0; 43 1 for(address=0;address<0x8000;address++) 44 1 { 45 2 value = (unsigned char)address; 46 2 XWrite((unsigned int)address,value); 47 2 } 48 1 for(address=0;address<0x8000;address++) 49 1 { 50 2 value = XRead((unsigned int)address); 51 2 if (value != (unsigned char)address) 52 2 { 53 3 errors++; 54 3 } C51 COMPILER V6.00 TEST 05/18/2000 08:49:51 PAGE 2 55 2 } 56 1 if (errors == 0) 57 1 { 58 2 /* There were no errors in the SRAM */ 59 2 SRAM = 1; 60 2 } else { 61 2 /* There were errors in the SRAM */ 62 2 NOSRAM = 1; 63 2 } 64 1 // XWrite(0xfff0,(unsigned char)errors); 65 1 // XWrite(0xfff1,(unsigned char)(errors>>8)); 66 1 // XWrite(0xfff2,(unsigned char)(errors>>16)); 67 1 // XWrite(0xfff3,(unsigned char)(errors>>24)); 68 1 DONE = 1; 69 1 } 70 71 void EndProg () 72 { 73 1 while (1) {} 74 1 } 75 76 void BoxColorCycle() 77 { 78 1 unsigned char startcolor = 0; 79 1 unsigned char panvalue = 0; 80 1 unsigned int width,height,ulx,uly; 81 1 long address; 82 1 unsigned char value = 0; 83 1 84 1 /* this routine was designed for the 512x128 8bit mode */ 85 1 86 1 /* clear the screen */ 87 1 for(address=0;address<0x8000;address++) { 88 2 XWrite((unsigned int)address,value); 89 2 } 90 1 91 1 /* draw boxes and color cycle forever */ 92 1 /* we don't have access to the color map so we must do */ 93 1 /* the color cycling by redrawing with a new color */ 94 1 /* only cycle colors 1-63 so background stays black */ 95 1 while (1) { 96 2 startcolor++; 97 2 if (startcolor >= 64) { 98 3 startcolor = 1; 99 3 /* assign the next value to the pan register */ 100 3 panvalue++; 101 3 if (panvalue > 7) panvalue = 0; 102 3 XWrite(0xffff,panvalue); 103 3 } 104 2 ulx = (rand()>>5)%240; 105 2 uly = (rand()>>5)%124; 106 2 width = (rand()>>5)%240 + 2; 107 2 if (ulx + width > 240) width = 240 - ulx; 108 2 height = (rand()>>5)%120 + 2; 109 2 if (uly + height > 120) height = 120 - uly; 110 2 DrawBox(width,height,ulx,uly,startcolor); 111 2 } 112 1 } 113 114 void DrawBox(int width,int height,int ulx,int uly, unsigned char color) 115 { 116 1 unsigned int x,y,address; C51 COMPILER V6.00 TEST 05/18/2000 08:49:51 PAGE 3 117 1 118 1 /* this addressing is only for 512xVVVx8bpp */ 119 1 120 1 for(y=uly;y<=(uly+height);y++) 121 1 for(x=ulx;x<=(ulx+width);x++) { 122 2 address = x+(y*256); 123 2 XWrite(address,color); 124 2 } 125 1 } 126 MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 650 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = ---- ---- PDATA SIZE = ---- ---- DATA SIZE = ---- 39 IDATA SIZE = ---- ---- BIT SIZE = ---- ---- END OF MODULE INFORMATION. C51 COMPILATION COMPLETE. 1 WARNING(S), 0 ERROR(S)