Exemplo n.º 1
0
void showSearchString(void)
{
    Goto_pos(0, 1);
    (void) Cconws("Search:                              ");
    Goto_pos(8, 1);
    (void) Cconws(search.text);
}
Exemplo n.º 2
0
void
main( void )
{
    int abort;
#define AES_active ( _GemParBlk.global[0] )

    appl_init();
    fix_rsh();	/* needed for addresses of "hello" strings */
/* get_cookie is now called from the startup
    Supexec((long(*)())get_cookie);
*/
    if( !ma_info ) {
	ma_info = &start;
    /* Not installed, set vectors */
	Supexec( (long(*)())sethooks );
    }

    if( AES_active ) {
	abort = configure();
	appl_exit();
	if( abort && (ma_info == &start) ) {
	    Supexec( (long(*)())unhook );
	    Pterm0();
	}
    }
    if( ma_info == &start )
	Supexec( (long(*)())set_cookie );
    if( !AES_active ) {
	Cconws( (char *)rs_frstr[HELLO1] );
	Cconws( (char *)rs_frstr[HELLO2] );
    }
}
Exemplo n.º 3
0
/*
 * Cleanup -- restore palette and sane VT52 state.
 */
vt_cleanup()
{
    /*
     * Restore desktop resolution (if we switched).
     */
    if (drez != Getrez())
        Setscreen(-1L, -1L, drez);

    if (drez != 2) {
        /*
         * Restore desktop palette.
         */
        Setpalette(dpalette);

        Cconws("\033b");
        Cconout(3 + VTC);
        Cconws("\033c");
        Cconout(0 + VTC);
    }

    /*
     * Bring the mouse back
     */
    graf_mouse(M_ON, NULL);

    /*
     * Make the cursor visible
     */
    curs_show();
}
Exemplo n.º 4
0
void getStatus(void)
{
    commandShort[4] = FDD_CMD_GET_IMAGE_ENCODING_RUNNING;
    commandShort[5] = 0;

    sectorCount = 1;                            // read 1 sector

    BYTE res = Supexec(ce_acsiReadCommand); 

    if(res != FDD_OK) {                         // fail? just quit
        return;
    }

    status.encoding = pBfr[0];                  // isRunning - 1: is running, 0: is not running

    status.prevDoWeHaveStorage = status.doWeHaveStorage;    // make a copy of previous value
    status.doWeHaveStorage = pBfr[1];           // do we have storage on RPi attached?

    status.prevDownloadCount = status.downloadCount;        // make a copy of previous download files count 
    status.downloadCount = pBfr[2];             // how many files are still downloading?

    Goto_pos(0, 23);                            // show status line
    (void) Cconws("\33p");                      // inverse on
    (void) Cconws((const char *) (pBfr + 4));   // status string
    (void) Cconws("\33q");                      // inverse off
}
Exemplo n.º 5
0
BYTE find_STiNG(void)
{
   DWORD *work;
   sting_drivers = NULL;
   
   for (work = * (DWORD **) 0x5a0L; *work != 0L; work += 2) {
        if (*work == 'STiK') {
            sting_drivers = (DRV_LIST *) *(++work);
            break;
        }
    }
    
    if(sting_drivers == NULL) {
        (void) Cconws("STiNG not found.\r\n");
        return 0;
    }
   
    if(strncmp(sting_drivers->magic, MAGIC, 8) != 0) {
        (void) Cconws("STiNG MAGIC mismatch.\r\n");
        return 0;
    }

    tpl = (TPL *) (*sting_drivers->get_dftab) (TRANSPORT_DRIVER);

    if (tpl == (TPL *) NULL) {
        (void) Cconws("STiNG TRANSPORT layer not found.\r\n");
        return 0;
    }

    (void) Cconws("STiNG found.\r\n");
    return 1;
}
Exemplo n.º 6
0
void showCmdLog(void)
{
    int i, j, len;
    (void) Cconws("\n\r\n\rCMD log:\n\r");
    
    for(i=0; i<5; i++) {
        if((cmdLog[i * 12] & 0x1f) == 0x1f) {
            len = 11;
        } else {
            len = 6;
        }
    
        for(j=0; j<len; j++) {
            showHexByte(cmdLog[i * 12 + j]);        // show cmd
            Cconout(' ');
        }
        
        for(j=0; j<(11 - len); j++) {               // pad with spaces
            (void) Cconws("   ");
        }
        
        (void) Cconws(" - ");
        showHexByte(cmdLog[i * 12 + 11]);           // show res
        (void) Cconws("\n\r");
    }
}
Exemplo n.º 7
0
main()
{
  Cconws ("Ceci est le programme appelant.\15\12\12");

  if (Pexec (CHARGE_ET_LANCE, NOMFICH, PARAMETRE, ENVIRONNEMENT) < 0)  
      Cconws("Une erreur s'est produite!!!\15\12\12");

  Cconws ("Revoici le programme appelant!\15\12"); 
  Crawcin();     /* Fin en tapant une touche */
}
Exemplo n.º 8
0
void err_init(const char *str)
{
	/*
	 * FIXME: figure out how to get at the apid of the
	 * the app that loaded us (LDG->id), and perform
	 * either Cconws() or form_alert()
	 */
	(void) Cconws(str);
	(void) Cconws("\r\n");
	/* if (__mint) */ Salert(str);
}
Exemplo n.º 9
0
void showPageNumber(void)
{
    Goto_pos(13, 2);
    (void) Cconws("Page:        ");
    Goto_pos(19, 2);

    char tmp[10];
    intToStr(search.pageCurrent + 1, tmp);
    tmp[3] = '/';
    intToStr(search.pagesCount, tmp + 4);
    (void) Cconws(tmp);
}
Exemplo n.º 10
0
main()
{
int i;
  init_screens ();                          /* Initialisiation du 2Šme ‚cran */

  gem_init();                    /* Se trouve dans fichier Include GEM_INEX.C */

  v_hide_c (handle);                        /* D‚sactiver pointeur souris */
  
  for (i=20; i<=300; i++)
  {
     Cconws ("\33E");                        /* Effacer ‚cran */
     v_gtext (handle, i, i, "Salut!");       /* Affichage texte sous GEM */
     swap_screens ();                        /* Commuter ‚crans log./phys. */
     
     Vsync();                                /* Attente retour image */
  }

  Crawcin();                                 /* Attente appui touche */

  Setscreen (screen1, screen1, -1);          /* Retour … l'‚cran normal */
  v_show_c (handle, 1);                      /* Pointeur souris actif */

  gem_exit();
}
Exemplo n.º 11
0
static void InitNatfeat(void)
{
	long ver;
	
	nfOps = nf_init();
	if (!nfOps) {
		err_init("__NF cookie not present on this system");
		return;
	}

	nfOSMesaId=nfOps->get_id("OSMESA");
	if (nfOSMesaId==0) {
		err_init("NF OSMesa functions not present on this system");
		return;
	}
	ver = nfOps->call(nfOSMesaId+GET_VERSION, 0l, 0l);
	if (ver < ARANFOSMESA_NFAPI_VERSION)
	{
		if (err_old_nfapi())
		{
			err_init("NF OSMesa functions in ARAnyM too old");
			nfOSMesaId = 0;
			return;
		}
	}
	if (ver > ARANFOSMESA_NFAPI_VERSION)
	{
		/*
		 * they should be backward compatible, but give a warning
		 */
	    (void) Cconws("Warning: NF OSMesa functions in ARAnyM newer than library\r\n");
	}
}
Exemplo n.º 12
0
static int wait_key(void)
{
	while (Cconis()) {
		Cconin();
	}
	Cconws("\r\n<press key>\r\n");
	return Cconin();
}
Exemplo n.º 13
0
void showMenuDownload(BYTE showMask)
{
    if(showMask & SHOWMENU_STATICTEXT) {
        (void) Clear_home();
        (void) Cconws("\33p[Floppy image download,  Jookie 2014-18]\33q\r\n");
    }

    if(showMask & SHOWMENU_SEARCHSTRING) {
        showSearchString();
    }

    if(showMask & SHOWMENU_RESULTS_ALL) {
        showPageNumber();
    }

    showResults(showMask);

    if(showMask & SHOWMENU_STATICTEXT) {
        Goto_pos(0, 19);
        (void) Cconws("\33pA..Z\33q - search, \33p(shift) arrows\33q - move\r\n");

        if(status.doWeHaveStorage) {    // with storage
            (void) Cconws("\33pF1, F2, F3\33q - insert into slot 1, 2, 3\r\n");
            (void) Cconws("\33pF4\33q   - download,     \33pF5\33q  - refresh list,\r\n");
        } else {                        // without storage
            (void) Cconws("                                         \r\n");
            (void) Cconws("                     \33pF5\33q  - refresh list,\r\n");
        }

        (void) Cconws("\33pF8\33q   - setup screen, \33pF10\33q - quit\r\n");
    }
}
Exemplo n.º 14
0
long nf_print(const char *text)
{
	if (nfid_print) {
		return nf_call(nfid_print, text);
	} else {
		Cconws("NF_STDERR unavailable!\r\n");
		return 0;
	}
}
Exemplo n.º 15
0
long nf_debugger(void)
{
	if (nfid_debugger) {
		return nf_call(nfid_debugger);
	} else {
		Cconws("NF_DEBUGGER unavailable!\r\n");
		return 0;
	}
}
Exemplo n.º 16
0
long nf_fastforward(long enabled)
{
	if (nfid_fastforward) {
		return nf_call(nfid_fastforward, enabled);
	} else {
		Cconws("NF_FASTFORWARD unavailable!\r\n");
		return 0;
	}
}
Exemplo n.º 17
0
void showMenu(void)
{
    //(void) Cconws("\33E");
    (void) Cconws("Select which tests to run:\r\n");
    (void) Cconws(" \33p[ 0 ]\33q Basic API tests + resolve\r\n");
    (void) Cconws(" \33p[ 1 ]\33q TCP/UDP echo + UDP datagrams\r\n");
    (void) Cconws(" \33p[ 2 ]\33q CNbyte_count / CNget_char / CNget_block / etc.\r\n");
    (void) Cconws(" \33p[ 3 ]\33q ICMP\r\n");
    (void) Cconws(" \33p[ S ]\33q SPEED TEST\r\n");
    (void) Cconws(" \33p[ A ]\33q ALL TESTS\r\n");
    (void) Cconws(" \33p[ Q ]\33q QUIT\r\n");
}
Exemplo n.º 18
0
int main(int argc, char *argv[])
{
	char str[1024];
	int i;

	for (i = 0; i < 10; i++)
	{
		sprintf(str, "this is test #%d\r\n", i);
		Cconws(str);
	}

	for (i = 0; i < 10; i++)
	{
		sprintf(str, "this is test #%f\r\n", (float) i);
		Cconws(str);
	}

	sprintf(str, "This %s %d complex %s%s", "is", 1, "test", "\r\n");
	Cconws(str);
	printf("little test: %x, %d, %f\r\n", 0xff, 12345, 3.1415926);
	
	char *endp;
	#define	_strtol(v) do{ printf("strtol(\"" v "\") => %x", strtol(v,&endp,0)); printf(*endp ? " Rest:%s\n\r":"\n\r", endp); } while(0)
	#define	_strtoul(v) do{ printf("strtoul(\"" v "\") => %x", strtoul(v,&endp,0)); printf(*endp ? " Rest:%s\n\r":"\n\r", endp); } while(0)
	_strtol("0x5050");
	_strtol("0b1010");
	_strtol("077");
	_strtol("-0x5050");
	_strtol("0xDEADBEEF");
	_strtol("10kg");

	_strtoul("0x5050");
	_strtoul("0b1010");
	_strtoul("077");
	_strtoul("-0x5050");
	_strtoul("0xDEADBEEF");
	_strtoul("10kg");
	
	
	Cconws("press a key to return to desktop\r\n");
	Cconin();
}
Exemplo n.º 19
0
void getServerIp(void)
{
    (void) Cconws("Enter server IP (default " SERVER_ADDR_DEFAULT_STRING ") : ");

    char inIp[20];
    memset(inIp, 0, 20);
    inIp[0] = 19;           // offset 0: maximum number of chars allowed to read
    Cconrs(inIp);           // read the string from keyboard
                            // offset 1: number of chars retrieved
                            // offset 2: the retrieved string
                            
    // minimal IP lenght: strlen("1.2.3.4") = 7
    
    if(inIp[1] < 7) {       // if the new IP is too short to be valid, use default
        SERVER_ADDR = SERVER_ADDR_DEFAULT_DWORD;
    } else {
        SERVER_ADDR = tryToParseIp(inIp + 2);
    }
    (void) Cconws("\r\n");
    
    char tmp[100];
    strcpy(tmp, "Server IP      : ");
    
    int ofs;

    ofs = strlen(tmp);
    intToString((SERVER_ADDR >> 24) & 0xff, -1, tmp + ofs);
    strcat(tmp, ".");

    ofs = strlen(tmp);
    intToString((SERVER_ADDR >> 16) & 0xff, -1, tmp + ofs);
    strcat(tmp, ".");

    ofs = strlen(tmp);
    intToString((SERVER_ADDR >>  8) & 0xff, -1, tmp + ofs);
    strcat(tmp, ".");

    ofs = strlen(tmp);
    intToString((SERVER_ADDR      ) & 0xff, -1, tmp + ofs);
    
    out_s(tmp);
}
Exemplo n.º 20
0
void nf_exit(long exitval)
{
	long id;
	if(nf_ok && (id = nf_id("NF_EXIT"))) {
		nf_call(id, exitval);
	} else {
		/* NF_EXIT is Hatari specific, NF_SHUTDOWN isn't */
		Cconws("NF_EXIT unavailable, trying NF_SHUTDOWN...\r\n");
		nf_shutdown();
	}
}
Exemplo n.º 21
0
void nf_shutdown(void)
{
	long id;
	if(nf_ok && (id = nf_id("NF_SHUTDOWN"))) {
		void *sup = (void*)Super(0);
		/* needs to be called in supervisor mode */
		nf_call(id);
		Super(sup);
	} else {
		Cconws("NF_SHUTDOWN unavailable!\r\n");
	}
}
Exemplo n.º 22
0
int main(void)
{
    Clear_home();

    initBuffer();

    rBuf = readBuffer;
    wBuf = writeBuffer;

    (void) Cconws("STiNG test...\r\n");

    BYTE found = Supexec (find_STiNG);
    if(!found) {
        sleep(3);
        return 0;
    }

    getServerIp();
	WORD whichTests = 0;
	while(whichTests == 0) {
		showMenu();
		char req = Cnecin();
		if(req >= 'A' && req <= 'Z') req += 32;	// to upper case
		if(req == 'q') break;	// quit
		switch(req) {
		case 'a':	// all tests
			whichTests = 0xffff;
			break;
		case 's':
			whichTests = 0x8000;
			break;
		case '0':
		case '1':
		case '2':
		case '3':
			whichTests = 1 << (req - '0');
		}
	}

    if(whichTests & 1) doTest00();
    if(whichTests & 2) doTest01();
    if(whichTests & 4) doTest02();
    if(whichTests & 8) doTest03();
    if(whichTests & 0x8000) doSpeedTest();

    if(whichTests != 0) writeBufferToFile();
    deinitBuffer();
    
    sleep(3);
    return 0;
}
Exemplo n.º 23
0
int
boot_kernel_p()
{
	extern int gl_lang;
	struct yn_message *msg;
	int y;

	msg = &boot_it[gl_lang];
	Cconws(msg->message);
	y = (int) Cconin();
	if (tolower(y) == msg->yes_let)
		return 1;
	else
		return 0;
}
Exemplo n.º 24
0
/* show emulator name */
static void nf_showname(void)
{
	long id;
	if (nf_ok && (id = nf_id("NF_NAME"))) {
		long chars;
		char buffer[64];
		id |= 0x0001;  /* name + version */
		chars = nf_call(id, buffer, (long)sizeof(buffer)-2);
		buffer[chars++] = '\n';
		buffer[chars++] = '\0';
		nf_print(buffer);
	} else {
		Cconws("NF_NAME unavailable!\r\n");
	}
}
Exemplo n.º 25
0
int nf_init(void)
{
	void *sup = (void*)Super(0);
	nf_ok = detect_nf();
	Super(sup);

	if (nf_ok) {
		/* initialize commonly used handles */
		nfid_print = nf_id("NF_STDERR");
		nfid_debugger = nf_id("NF_DEBUGGER");
		nfid_fastforward = nf_id("NF_FASTFORWARD");
	} else {
		Cconws("Native Features initialization failed!\r\n");
	}
	return nf_ok;
}
Exemplo n.º 26
0
/******************
* scan thru arg list, call check func for each arg
* default to *.fnt if no args
*/
int main( int argc, char *argv[] )
{

   dtap = (struct _dta*)Fgetdta();
   if( argc == 1 ) check_files( "*.fnt" );
   else {
      while( --argc>0 ) check_files(*++argv);
   } /* if */

   Cconws( "finished! press a key ..." );   
   while( Cconis() == 0 );
   (void)Cconin();

   return 0;
     
} /* main() */
Exemplo n.º 27
0
void _crtinit(void)
{
	register BASEPAGE *bp;
	register long m;
	register long freemem;
	
	bp = _base;

	/* m = # bytes used by environment + args */
	m = parseargs(bp);

	/* make m the total number of bytes required by program sans stack/heap */
	m += (bp->p_tlen + bp->p_dlen + bp->p_blen + sizeof(BASEPAGE));
	m = (m + 3L) & (~3L);

	/* freemem the amount of free mem accounting for MINFREE at top */
	if ((freemem = (long)bp->p_hitpa - (long)bp - MINFREE - m) <= 0L)
		goto notenough;
	
	/* make m the total number of bytes including stack */
	m += _stksize;

	/* make sure there's enough room for the stack */
	if (((long)bp + m) > ((long)bp->p_hitpa - MINFREE))
		goto notenough;

	/* set up the new stack to bp + m */
	_setstack((char *)bp + m);

	/* shrink the TPA */
	(void)Mshrink(0, bp, m);

	Pterm(main());
	__builtin_unreachable();
	
notenough:
	(void) Cconws("Fatal error: insufficient memory\r\n"
	              "Hint: either decrease stack size using 'stack' command (not recomended)\r\n"
		          "      or increase TPA_INITIALMEM value in mint.cnf.\r\n");
	Pterm(-1);
	__builtin_unreachable();
}
Exemplo n.º 28
0
void showInt(int value, int length)
{
    char tmp[10];
    memset(tmp, 0, 10);

    //--------------------------------------
    // determine length?
    if(length == -1) {
        length = countIntDigits(value);
    }
    //--------------------------------------
    // check if it will fit in the displayed lenght
    int bigDiv = 1;
    int i;
    for(i=0; i<length; i++) {               // create the big divider, which will determine if the number will fit in the length or not
        bigDiv *= 10;
    }
    
    if((value / bigDiv) != 0) {             // if this value won't fit in the specified length
        value = 999999;
    }
    //--------------------------------------
    // show the digits
    for(i=0; i<length; i++) {               // go through the int lenght and get the digits
        int val, mod;

        val = value / 10;
        mod = value % 10;

        tmp[length - 1 - i] = mod + 48;     // store the current digit

        value = val;
    }

    (void) Cconws(tmp);                     // write it out
}
Exemplo n.º 29
0
BYTE searchInit(void)
{
    commandShort[4] = FDD_CMD_SEARCH_INIT;
    commandShort[5] = 0;

    sectorCount = 1;                            // read 1 sector
    BYTE res;

    (void) Clear_home();
    (void) Cconws("Initializing... Press ESC to stop.\n\r\n\r");

    while(1) {
        res = Supexec(ce_acsiReadCommand);

        if(res == FDD_DN_LIST) {
            (void) Cconws("Downloading list of floppy images...\n\r");
        } else if(res == FDD_ERROR) {
            (void) Cconws("Failed to initialize! Press any key.\n\r");
            Cnecin();
            return 0;
        } else if(res == FDD_OK) {
            (void) Cconws("Done.\n\r");
            return 1;
        } else {
            (void) Cconws("CosmosEx device communication problem!\n\r");
        }

        WORD val = Cconis();            // see if there is some char waiting
        if(val != 0) {                  // char waiting?
            BYTE key = getKey();

            if(key == KEY_ESC) {
                (void) Cconws("Init terminated by user. Press any key.\n\r");
                Cnecin();
                return 0;
            }
        }

        sleep(1);
    }
}
Exemplo n.º 30
0
void handleImagesDownload(void) // OBSOLETE
{
    if(destDir.isSet == 0) {                    // destination dir not set?
        selectDestinationDir();
        
        if(destDir.isSet == 0) {                // destination dir still not set?
            (void) Clear_home();
            (void) Cconws("You have to select destination dir!\r\nPress any key to continue.\n\r");
            getKey();
            return;
        }
    }
    
    BYTE res;
    
    (void) Clear_home();
    (void) Cconws("Downloading selected images...\r\n");

    while(1) {
        commandShort[4] = FDD_CMD_SEARCH_DOWNLOAD;
        commandShort[5] = 0;
        sectorCount = 1;                        // read 1 sector
        res = Supexec(ce_acsiReadCommand);

        if(res == FDD_DN_WORKING) {             // if downloading
            (void) Cconws(pBfr);                // write out status string
            (void) Cconws("\n\r");
        } else if(res == FDD_DN_NOTHING_MORE) { // if nothing more to download
            (void) Cconws("All selected images downloaded.\r\nPress any key to continue.\n\r");
            getKey();
            break;
        } else if(res == FDD_DN_DONE) {         // if this image finished downloading
            downloadImage(10);                  // store this downloaded image
            (void) Cconws("\n\r\n\r");
        } 

        sleep(1);                               // wait a second
    }
}