/*********************************** * Name - Allocate_space() * * * * Purpose: * * To allocate all the space that * * will be required by the editor * * * * Returns - BAD not enough memory * * GOOD no problems * * * ***********************************/ uint Allocate_space(void) { if( (screen_space=malloc(25*80*2))==NULL) return(BAD); return(GOOD); } /************************************* * Name - Install_mouse(opt) * * * * Purpose: * * To install or deinstall the mouse * * * * opt - START install mouse driver * * - STOP de-install mouse * * * * Returns - BAD no mouse * * GOOD found mouse * *************************************/ uint Install_mouse(uint opt) { int installed = 0; if(opt==START) { inregs.w.ax = 0; int386 (0x33, &inregs, &outregs); if( (outregs.w.ax != 0xffff)) { return(BAD); } else { return(GOOD); } } return(GOOD); } /************************************* * Name - Get_mouse() * * * * Purpose - Get mouse data and fill * * structure * * * *************************************/ void Get_mouse(void) { inregs.w.ax = 3; int386(0x33,&inregs,&outregs); mouse_data.x_pos=(outregs.w.cx)/8; mouse_data.y_pos=(outregs.w.dx)/8; mouse_data.left=(outregs.w.bx)&1; mouse_data.right=((outregs.w.bx)&2)>>1; } /************************************* * Name - Mouse_Cursor_onoff() * * * * Purpose - to turn the cursor on * * and off * * * * Input - ON/OFF * *************************************/ void Mouse_cursor_onoff(uint type) { inregs.w.ax = type; int386(0x33,&inregs,&outregs); mouse_data.leftlast=0; } /************************************** * Name - Setup_screen(opt) * * * * Purpose: (opt = START) * * To record the current screen mode * * To change the screen mode * * To display the initial screen * * * * Purpose: (opt = STOP) * * To return the screen to its former * * mode * * * * Returns - BAD errors in changing * * GOOD all ok * **************************************/ uint Setup_screen(opt) { if(opt==START) { // get the original screen mode inregs.w.ax = 0x0f00; int386 (0x10, &inregs, &outregs); original_screen_mode = outregs.h.al; // now change to 80x40 16 colour (mode 3) inregs.h.ah = 0x00; inregs.h.al = 0x3; int386( 0x10, &inregs, &outregs ); // get the original cursor size inregs.w.ax = 0x300; inregs.w.bx = 0x0000; int386 (0x10, &inregs, &outregs); original_cursor_size = outregs.w.cx; // now kill the cursor inregs.w.ax = 0x100; inregs.w.cx = 0x2000; int386 (0x10, &inregs, &outregs); return(GOOD); } if(opt==STOP) { // restore original mode inregs.h.ah = 0x00; inregs.h.al = original_screen_mode; int386( 0x10, &inregs, &outregs ); // restore the cursor inregs.w.ax = 0x100; inregs.w.cx = original_cursor_size; int386 (0x10, &inregs, &outregs); return(GOOD); } return(GOOD); } /******************************************* * Name - Load_menu_data * * * * Purpose: * * To load the menu file and strip out all * * the comments * * * * Returns - BAD an error occured * * GOOD no problems * *******************************************/ uint Load_menu_data(void) { uint counter=0; uint counter1=0; uint white_space_size; uchar character; char *white_space=" \n\t"; // setup up white space compare int menu_buffer_size; // **** // * Open the menu file // **** if((menu_file=fopen("BANKEDIT.MNU","r"))==NULL) { printf("ERROR - Could not open menu file 'test.mnu'\n "); return(BAD); } // **** // * store the menu file in memory and remove white space and comments // **** while (fgets(menu_buffer,199,menu_file) != NULL) { white_space_size=strspn(menu_buffer,white_space); menu_buffer_size=strlen(menu_buffer)-white_space_size; if( (menu_buffer_size)>3 && (menu_buffer[white_space_size]!=';')) { strncpy(menu_data[counter],menu_buffer+white_space_size,menu_buffer_size); menu_data[counter++][menu_buffer_size]=0; } if(counter>=MAX_LINES) { printf("ERROR - Menu file 'test.mnu' is to big\n"); fclose(menu_file); return(BAD); } } fclose(menu_file); if(counter<2) return(BAD); // not enough data // **** // * make a list of all the BOX positions // **** menu_data_total=counter; counter1=0; for(counter=0;counter4) && (count2!=sample)) { // ok all the check seem correct SO FAR // check to see if same actual sample for(counts=0;countscount)) { running_total+=sound_data[count].size; } } return(running_total); } /******************************* * name - Get_input(button) * * * * Purpose: To get a File name * *******************************/ void Get_input(uint x,uint y) { int count=0; int key; int counter; char filename[13]; char filecopy[13]; char *datain="QWERTYUIOPLKJHGFDSAZXCVBNM_1234567890~!$@"; while(kbhit()!=0) { getch(); } strcpy(filecopy,".SFX "); for(counter=0;counter<12;counter++) { *(screen_space+((counter+x)*2)+(y*160))=filecopy[counter]; *(screen_space+((counter+x)*2)+(y*160)+1)=15; } Display_boxes(); filename[0]=0; while((key=getch())!=13) { key=toupper(key); if((key==0x8) && (count>0)) { filename[--count]=0; } if((strchr(datain,key)!=NULL) && (count!=8)) { filename[count++]=key; filename[count]=0; } strcpy(filecopy,filename); strncat(filecopy,".SFX ",12-strlen(filename)); for(counter=0;counter<12;counter++) { *(screen_space+((counter+x)*2)+(y*160))=filecopy[counter]; *(screen_space+((counter+x)*2)+(y*160)+1)=15; } Display_boxes(); } memcpy(current_file,filecopy,12); } /*********************** * Name - Get_long() * * * * Purpose: read a long* * from a file * ***********************/ ulong Get_long(void) { ulong read_long; ulong read_store; read_long=fgetc(load_file); read_store=fgetc(load_file); read_long+=read_store<<8; read_store=fgetc(load_file); read_long+=read_store<<16; read_store=fgetc(load_file); read_long+=read_store<<24; return(read_long); }