#include char screen_buffer[LCD_SIZE]; HSym hsym; //reusable HANDLE handle; //reusable char *cptr; // pointer to MLC source code char *pptr; // pointer to tokenized program SYM_ENTRY *SymPtr; //reusable void error(const char* bad){ memcpy(LCD_MEM, screen_buffer, LCD_SIZE); ST_helpMsg(bad); exit(0); } void _main(void) { memcpy(screen_buffer, LCD_MEM, LCD_SIZE); ESI argptr; int argtype; short num; unsigned long a = 0; unsigned short size; short b; const char* filename; InitArgPtr (argptr); while ((argtype = GetArgType (argptr)) != END_TAG) { if (argtype == STR_TAG && !a){ filename = GetStrnArg(argptr); hsym = SymFind (SYMSTR (filename)); if(hsym.folder == 0){ error("Can't find MLC source code file"); } SymPtr = (DerefSym (hsym)); cptr = HeapDeref (SymPtr->handle); size=*(unsigned short *)cptr; cptr+=5; if((*cptr)!='M' || *(cptr+1)!='L' || *(cptr+2)!='C' || *(cptr+3)!=':' || *(cptr+4)!=0x0d) error("Not an MLC file"); error("Not an MLC file"); cptr+=5; a=1; } else if (argtype == STR_TAG && a){ filename = GetStrnArg(argptr); hsym = SymFind (SYMSTR (filename)); if(hsym.folder != 0){ clrscr(); printf("MLC program file already exists\n\n"); printf("1. Overwrite\n2. Abort"); b=ngetchx(); if(b=='1'){ goto cont; } else if(b=='2'){ error("Tokenization aborted"); } } cont:; hsym = SymAdd (SYMSTR (filename)); // HeapAlloc must be executed before DerefSym // because of possible garbage collection. handle = HeapAlloc ((unsigned short)((size/2+6))); SymPtr = (DerefSym (hsym)); pptr = HeapDeref (SymPtr->handle = handle); *((unsigned short*)pptr)=(unsigned short)((size/2+4)); pptr+=2; *pptr = 'M'; // actual data *(pptr+1) = 'L'; *(pptr+2) = 'C'; *(pptr+3) = ':'; *(pptr+4) = 0x0d; pptr+=5; unsigned long line; char text[44][4]={ {'D','A','T','A'}, {'D','E','N','D'}, {'B','I','T','M'}, {'A','R','R','Y'}, {'S','I','Z','E'}, {'C','L','R','S'}, {'T','E','X','T'}, {'L','I','N','E'}, {'P','I','X','L'}, {'P','I','X','T'}, {'S','P','R','T'}, {'D','I','S','P'}, {'D','B','M','P'}, {'C','L','S','M'}, {'R','E','C','T'}, {'D','R','A','W'}, {'S','T','O','P'}, {'R','C','L','P'}, {'S','H','F','T'}, {'G','K','E','Y'}, {'W','K','E','Y'}, {'P','A','U','S'}, {'F','N','C','T'}, {'F','R','U','N'}, {'F','G','O','B'}, {'F','E','N','D'}, {'I','I','F','F'}, {'R','N','D','M'}, {'H','A','L','T'}, {'W','A','I','T'}, {'W','R','T','E'}, {'R','E','A','D'}, {'P','O','L','R'}, {'S','U','B','S'}, {'R','S','E','T'}, {'C','I','N','T'}, {'A','B','S','L'}, {'I','N','P','T'}, {'N','M','A','P'}, {'T','I','L','E'}, {'C','M','A','P'}, {'T','C','H','K'}, {'D','M','A','P'}}; short counter, counter2; for(line=0;line