/* Set_Active_Port() *========================================================================== * Set the port variables to the NEW port * 1) On a regular ST, the port is ALWAYS the ST SERIAL ( PORT_A ) * 2) (TT): If the port is Channel A and the LAN is active, we reset * the port to ST SERIAL instead. * 3) ( MEGA STE ): if the port is Channel A and the LAN is active, we * reset the port to ST SERIAL instead * Return: cur_port - 0, 1, 2, 3 with the actual port set to. */ int Set_Active_Port( int port ) { Set_Number_Of_Ports(); if( IsTT() ) { if(( port == PORT_D ) && IsLanActive() ) old_port = cur_port = PORT_A; else old_port = cur_port = port; xbios( 0x2c, ( cur_port + MASK_A ) ); return( cur_port );; } if( IsSTE() ) { if( ( port == PORT_C ) && IsLanActive() ) old_port = cur_port = PORT_A; else old_port = cur_port = port; xbios( 0x2c, ( cur_port + MASK_A ) ); return( cur_port ); } old_port = cur_port = PORT_A; return( cur_port ); }
/* Set_Blitter() *========================================================================== * Check to see if a blitter exists * Slam the current state of the blitter variable into the blitter */ void Set_Blitter( void ) { BOOLEAN flag; if( IsBlitter() ) { flag = ( cur_value.BlitCache & BLIT_ON ); xbios( 0x40, flag ); } }
/* Check_Blitter() *========================================================================== * Check for the Presence of a blitter * IN: NONE * OUT: Return BLITTER if detected, else NO_SPEED otherwise */ int Check_Blitter( void ) { long flag; flag = xbios( 0x40, -1 ); if( flag & 0x02L ) return( BLITTER ); else return( NO_SPEED ); }
/* Get_Blitter() *========================================================================== * Get the current status of the blitter and store it in * cur_value.blitter */ void Get_Blitter( void ) { long flag; int state; if( IsBlitter() ) { flag = xbios( 0x40, -1 ); state = ( ( flag & 0x01L ) ? ( BLIT_ON ) : ( BLIT_OFF ) ); /* Preserve TTCACHE bit */ cur_value.BlitCache &= TTCACHE; cur_value.BlitCache |= state; } }
static long getborder(void) { unsigned long couleur1; unsigned long couleur2; unsigned long r,v,b; if ((((unsigned int)Vsetmode(-1))&7)==4) { /* En mode True Color, sur TV, la couleur de bordure est la couleur systeme no 240 (et la couleur hardware no 0), mais n'est pas mise a jour dans les variables systemes lors de l'initialisation du mode True color : il faut le faire soi-meme au moins une fois, pour esperer la preserver */ couleur1=*((unsigned long *)0xffff9800L); /* recupere couleur hard no 0 */ r=((couleur1>>24L)&0x000000fcL)+((couleur1>>30L)&0x00000003L); v=((couleur1>>16L)&0x000000fcL)+((couleur1>>22L)&0x00000003L); b=((couleur1)&0x000000fcL)+((couleur1>>6L)&0x00000003L); couleur2=r*65536L+v*256L+b; xbios(93,240,1,&couleur2); /* met a jour la couleur systeme no 240 */ }
/******************************************************************** * * * Gestion du menu * * * ********************************************************************/ boolean MenuSelect(int object, int scan, int state, int button) { int index, entree, key; if (object < 0) { /* attend qu'on relache la souris */ NoClick(); if (button < 0) { /* regarde la touche */ key = scantoascii(scan); if (key == 0) key = scan & 0xFF00; /* scan code */ else key = UpperChar(key); for (index = 0; index < NbMenus; index++) for (entree = 0; entree < MenuShortCuts[index].nb_entrees; entree++) if (MenuShortCuts[index].menu[entree].key == key && MenuShortCuts[index].menu[entree].state == state) { if (ob_isstate(Menu, MenuShortCuts[index].menuid, DISABLED) == 0 && ob_isstate(Menu, MenuShortCuts[index].menu[entree].itemid, DISABLED) == 0) { object = MenuShortCuts[index].menu[entree].itemid; index = NbMenus; } break; } } } if (object < 0) return FALSE; /* kein entsprechender Eintrag gefunden */ /* Men�punkte 'Fenster wechseln' und 'Fenster schliežen' werden inklusive der dazugeh”rigen Hotkeys automatisch verwaltet */ switch (object) { /* menu Zorg */ case INFORMATIONS: presentation(); break; /* menu Etat */ case INFORMATION: informations(Drive); break; case REPERTOIRE_LOUPE: if (ManageVFAT) open_directory_vfat(); else open_directory_short(); break; case TEST_STRUCTURE: if (ManageVFAT) structure_test_vfat(Drive); else structure_test_short(Drive); break; case STATISTIQUES: statistiques(Drive); break; case OCCUPATION: occupation(Drive); break; case TRACE_UN_FICHIER: trace_file(); break; case QUITTER: if (Reset) { if (my_alert(1, 2, X_ICN_QUESTION, Messages(MENU_1), Messages(BOOT_32)) == 0) shutdown(TRUE); } else { button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_2), Messages(MENU_4)); if (button == 0 || button == 1 && (int)xbios(0x11) % 2) shutdown(FALSE); } break; /* menu Ouvre */ case UNITE_LOGIQUE: open_disk(); break; case OUVRE_DISQUETTE: raw_floppy(FALSE); break; case OUVRE_DISQUE_DUR: raw_hard(FALSE); break; case OUVRE_FICHIER: open_file(); break; case OUVRE_FICHIER_FS: open_file_other_fs(); break; case OUVRE_FICH_TEXTE: voir_fichier(); break; case CREER_FICHIER: creer_fichier(); break; case FERMER: fermer(Thefrontwin -> win -> handle); break; case LIRE_BOOT: lire_boot(); break; case CHARGER_BOOT: charger_boot(); break; case SAUVER_BOOT: sauver_boot(); break; case ECRIRE_BOOT: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else ecrire_boot(); #endif break; /* menu Edition */ case SAUVER_SECTEUR: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else save_secteur(Thefrontwin, MENU_EDITION); #endif break; case COPIER_SECTEUR: copier_tampon(Thefrontwin); break; case COLLER_SECTEUR: coller_tampon(Thefrontwin); break; case ECHANGER_TAMPON: echanger_tampon(Thefrontwin); break; case RETOUR_INITIAL: load_secteur(Thefrontwin, MENU_EDITION); break; case OUVRIR_TAMPON: ouvrir_tampon(); break; case SAUVER_TAMPON: sauver_tampon(); break; case CHARGER_TB_ASCII: ascii_tampon(); break; case EFFACER_TAMPON: effacer_tampon(); break; /* menu Structure */ case DEFRAGMENTATION: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else reconnect(Drive); #endif break; case UNIQUE_LIBRE: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else compresse(Drive); #endif break; case RESTO_COMPLETE: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else restauration_complete(Drive); #endif break; case VIDE_CLST_LIBRES: nettoie_clusters_libres(Drive); break; case NETTOIE_REPERTOI: #ifdef TEST_VERSION /* relache la souris */ NoClick(); /* on attend avant de redessiner */ Event_Timer(0, 0, TRUE); my_alert(1, FAIL, X_ICN_STOP, Messages(MENU_6), NULL); #else nettoie_repertoire(Drive); #endif break; /* menu Deplacement */ case SECTEUR_SUIVANT: next_secteur(Thefrontwin); break; case SECTEUR_PRECEDEN: previous_secteur(Thefrontwin); break; case BLOC_SUIVANT: next_bloc(Thefrontwin); break; case BLOC_PRECEDENT: previous_bloc(Thefrontwin); break; case MARQUER_POSITION: marquer_position(Thefrontwin); break; case ALLER_MARQUE: goto_marque(Thefrontwin); break; case ALLER_SECTEUR: goto_secteur(Thefrontwin); break; case CHERCHER_CHAINE: search_first(Thefrontwin); break; case CHERCHER_NOUVEAU: search_next(Thefrontwin); break; /* menu Fenˆtres */ case CHOIX_FONTE: choix_fonte(Thefrontwin); break; case CHOIX_COULEURS: couleur(Thefrontwin); break; case TAILLE_IDEALE: taille_ideale(Thefrontwin); break; case ASCENSEURS: ascenseurs(Thefrontwin); break; case CYCLER_FENETRES: cycle_window(); break; case WINDOW_LIST_1: case WINDOW_LIST_2: case WINDOW_LIST_3: case WINDOW_LIST_4: case WINDOW_LIST_5: case WINDOW_LIST_6: case WINDOW_LIST_7: case WINDOW_LIST_8: case WINDOW_LIST_9: case WINDOW_LIST_10: { windowptr thewin; for (thewin = Firstwindow; thewin; thewin = thewin -> next) if (thewin -> menu_entry == object - WINDOW_LIST_1) make_frontwin(thewin); } break; /* menu Options */ case CONFIG_GENERALE: config_generale(); break; case CONFIG_DSK: config_disques(); break; case RACCOURCIS_CLAVI: raccourcis_clavier(); break; case DONNEES_ZORG: from_zorg_inf(TRUE); break; case DONNEES_SYSTEME: from_zorg_inf(FALSE); break; case INVALIDE_CACHE: if (Kbshift(FAIL) & 4) { int i; for (i=0; i<MAX_DEVICES; i++) change_disque(i, FALSE); } else change_disque(Drive, TRUE); break; case UPDATE_SYSTEME: if (Kbshift(FAIL) & 4) { int i; for (i=0; i<MAX_DEVICES; i++) update_systeme(i); } else update_systeme(Drive); break; case VISU_TEXTE: really_voir_fichier(Thefrontwin -> fonction.fichier.nom); break; case VISU_ASCII: secteur_ascii(Thefrontwin); break; case VISU_HEXA: secteur_hexa(Thefrontwin); break; case AFFICHE_DECIMAL: affichage_decimal(Thefrontwin); break; case FICHIER_ASSOCIE: secteur_file(Thefrontwin); break; case CURSEUR_VISIBLE: curseur_on(Thefrontwin); break; case CLIPBOARD_GEM: clipboard_gem(Thefrontwin); break; /* menu Aide */ case TABLE_ASCII: AsciiChar = m_ascii_box(AsciiChar, FALSE); break; case AIDE: aide(); break; case EXECUTER_PROG: lance_prg(); break; case RESET: if (Reset) { Reset = FALSE; menu_icheck(Menu, RESET, 0); } else { int button; button = my_alert(2, 3, X_ICN_QUESTION, Messages(MENU_3), Messages(MENU_5)); if (button == 1) shutdown(TRUE); else if (button == 0) reset(); } break; } return TRUE; } /* MenuSelect */
void get_set_video (int set){ /* 0=get, 1=set, 2=set & change rez */ long #ifdef _OVSCAN s, /* sup.stack p. */ #endif logb, /* logical screen base */ phyb; /* physical screen base */ #ifdef _OVSCAN char *acia; static int ov_max_h, ov_max_w; int std_x[4] = {320,640,1280,0}; int std_y[4] = {200,400,800,0}; int idi; #endif /* Where is the screen ? */ logb = xbios(3); /* Logbase(); */ phyb = xbios(2); /* Physbase(); */ if ( set == 0 ){ /* get data */ /* Find about video hardware (shifter; will be 0xffffffff without cookie */ vdo = find_cookie( '_VDO' ); /* Try to find out about a couple of overscan types */ #ifdef _OVSCAN if ( ( (over = find_cookie('OVER')) != - 1 ) || ( (over = find_cookie('Lace')) != - 1 ) ) { ovrstat = 0; for ( idi = 0; idi < 3; idi++ ) if ( max_h > std_y[idi] && max_h < std_y[idi + 1] ) { ov_max_w = max_w; ov_max_h = max_h; ovrstat = 1; break; } if ( ovrstat != 0 ) options.V2_2.vprefs |= VO_OVSCAN; else options.V2_2.vprefs &= ~VO_OVSCAN; } else over = 0xffffffffL; #endif /* Get current blitter state; insert into options */ if ( get_tosversion() >= 0x104 ) bltstat = Blitmode(-1); /* Function known only to tos >= 1.4 ? */ else bltstat = 0; if ( bltstat & 0x0001 ) options.V2_2.vprefs |= VO_BLITTER; else options.V2_2.vprefs &= ~VO_BLITTER; /* Which is the current standard resolution ? */ currez = xbios(4); /* Getrez() */ options.V2_2.vrez = currez; } else /* set data */ { /* Set blitter, if present */ if ( bltstat & 0x0002 ) { if ( options.V2_2.vprefs & VO_BLITTER ) bltstat |= 0x0001; else bltstat &= ~0x0001; bltstat = Blitmode ( bltstat ); } #ifdef _OVSCAN /* * Set overscan (Lacescan, in fact) * that which is below is ok but not enough !!!! * therefore disabled for the time being */ if ( (over != 0xffffffffL ) && ( (vprefsold^options.V2_2.vprefs) && VO_OVSCAN) ) { menu_bar ( menu, 0 ); s = Super (0L ); (long)acia = 0xFFFC00L; /* address of the acia chip reg HR 240203 (long) */ if ( options.V2_2.vprefs & VO_OVSCAN ) { *acia = 0xD6; /* value for the acia reg- switch overscan ON */ ovrstat = 1; max_h = ov_max_h; max_w = ov_max_w; } else { *acia = 0x96; /* value for the acia reg- switch overscan OFF */ ovrstat = 0; max_w = std_x[idi]; max_h = std_y[idi]; } /* * An attempt to change resolution (to the same one) will * provoke Lacescan to adapt */ xbios(5, logb, phyb, currez); /* Setscreen (logb,phyb,currez); */ Super ( (void *) s ); wind_set(0, WF_NEWDESK, desktop, 0); /* * For some reason desktop doesn't get redrawn correctly here * after overstat switch unless menu_bar is called TWICE * (possibly at first call it is too long and corrupts * part of the screen?) */ menu_bar(menu, 1); dsk_draw(); menu_bar(menu, 1); /* wd_attrib(); */ wd_fields(); /* HR 050303 */ } #endif /* Change resolution */ /* xbios(...) produces slightly smaller code */ if ( set > 1 ) { /* * This will actually (almost) reset the computer */ shel_write( 5, currez + 2, 0, NULL, NULL ); /* DjV 007 110203 */ /* DjV 007 290103: is no good, so disabled for the time being */ xbios(5, logb, phyb, currez); /* Setscreen (logb,phyb,currez); */ } } }
void p_grafik(void) { deftext( 1,24,0,32); text( 174,200,-1,"4. DEMO: GRAFIK"); p_s_top(); printf("\33E"); deftext( -1,1,0,13); for(h_long=1;h_long<=2;h_long++) { for(j_long=4;j_long<=24 ;j_long+= 4) { for(i_long=0;i_long<=5;i_long++) { deftext( -1,pow(2,i_long),-1,-1); text( 320,50+i_long*(16+j_long*2),-1,"B_NACH_C"); } pause( 10); printf("\33E"); deftext( -1,-1,-1,j_long); } deftext( -1,-1,h_long*1800,-1); } deftext( -1,1,-1,13); for(h_long=1;h_long<=4;h_long++) { for(i_long=2;i_long<=3;i_long++) { for(j_long=0;j_long<=2;j_long++) { defline( h_long,i_long,j_long,j_long); draw(100+50*j_long,50+25*j_long , 539-50*j_long,50+25*j_long); box( 50+50*j_long,150,320-50*j_long,350); circle( 480,250,20+40*j_long); } pause( 10); printf("\33E"); } } defline( 1,2,1,1); deffill( 1,1,1); for(i_long=2;i_long<=3;i_long++) { for(j_long=1;j_long<=20;j_long++) { deffill( 1,i_long,j_long); pbox( 16*j_long-16,10,655-16*j_long,190); pcircle( 160,299,105-5*j_long); pellipse( 480,299,5*j_long,105-5*j_long); } if(j_long>20 & i_long==2) { bild_char = sget(bild_char); } } pause( 50); s_adr_long=(long)(bild_char); d_adr_long=xbios(2); for(i_long=1;i_long<=1000;i_long++) { rc_copy(s_adr_long,(int)((double)rand()*(10)/32767)*64,(int)((double)rand()*(10)/32767)*40,64,40 ,d_adr_long,(int)((double)rand()*(10)/32767)*64,(int)((double)rand()*(10)/32767)*40, -1); } pause( 100); printf("\33E"); sput( bild_char); deffill( 1,1,1);
/* Code Principal */ int main(void) { int ability,i,fhandle; char buffer[2000]; DTA *mydta; char *pmodule; if ((mydta = (long)(Malloc(44))) == NULL) { printf("Erreur Reservation memoire !!!"); return -4; } Fsetdta(mydta); printf("\033E"); /* Initialisation du DSP */ ability=xbios(113); if ((Dsp_LoadProg(DSP_CODE,ability,buffer))==0) printf("Chargement du code DSP = OK !!!\n"); else { printf("Erreur de chargement du programme DSP !!!\n"); i=getchar(); return -1; } /* Chargement du module */ if (Fsfirst(MODULE,0) == 0) if ((pmodule=Malloc(TAILLE_BUFF+(mydta->d_length))) != NULL) { fhandle=Fopen(MODULE,0 ); Fread(fhandle,mydta->d_length,pmodule); Fclose(fhandle); } else { printf("Pas assez de memoire !!!\n"); i=getchar(); return -2; } else { printf("Module introuvable\n"); i=getchar(); return -3; } /* Initialisation du player */ printf("Un petit moment SVP...\n"); if (Player_dtm(0,pmodule,pmodule+mydta->d_length)==-1) { printf("Erreur initialisation du module !!!"); i=getchar(); return -2; } printf("Appuyez sur une RETURN...\n");
static double real_cputime() { long thetime; ptime = &thetime; xbios(38, gettime); return (((double)thetime) / (Getrez() == 2 ? 70 : 60)); }