Beispiel #1
0
void tty_error ( const char *error )
{
	vt100_cursor_save();
	vt100_cursor_set( tty_winsize.ws_row, 1 );
	vt100_erase_line();
	printf( "%s", error );
	fflush( stdout );
	vt100_cursor_load();
}
Beispiel #2
0
void tty_command_mode( char *buffer, size_t maxbuf)
{
	char c;
	int wid;
	int bufptr = 0;
	vt100_cursor_save ();
	vt100_cursor_set( tty_winsize.ws_row, 1 );
	vt100_erase_line();
	tty_write_char(':');
	wid = tty_winsize.ws_col - 1;
	maxbuf--;
	if ( maxbuf < wid )
		wid = maxbuf;
	while ( ( c = tty_read_input() ) != '\r' ) {
		if ( c >= ' ' && c < 0x7F ) {
			if ( bufptr == wid ) {
				tty_write_char( '\a' );
			} else {
				buffer[bufptr++] = c;
				tty_write_char( c );
			}
			
		} else if ( c == '\b' || c == 0x7F ) {
			if ( bufptr == 0 ) {
				tty_write_char( '\a' );
			} else {
				tty_erase_char();
				bufptr--;
			}
		} else if ( c == '\r' || c == '\n' ) {
			break;
		}
	} 
	buffer[bufptr] = 0;
	vt100_cursor_set( tty_winsize.ws_row, 1 );
	vt100_erase_line();
	vt100_cursor_load();
}
Beispiel #3
0
int main(void) {

	//uart_configureinterrupts(0, true, false, false, false);

	volatile uint16_t* basicvideo = (uint16_t*) 0x200000;
	volatile uint16_t* basicsound = (uint16_t*) 0x600000;

	vt100_resetdevice();
	vt100_setattributes();
	vt100_erase_screen();
	vt100_cursor_home_pos(1, 0);

	test_dma();

	//while(1){};

	//while (1) {

	//	printf("Hello, World! 0x%02"PRIx8"\n", input_port0);

	//	for (int y = 0; y < 128; y++) {
	//		for (int x = 0; x < (256 / 2); x++) {
	//			*(basicvideo + (((256 / 2) * y) + x)) = i;
	//if (y < 128 / 2) {
	//	*(basicvideo + (((256 / 2) * y) + x)) = x < (128 / 2) ? 0xE0E0 : 0x0707;
	//}
	//else {
	//	*(basicvideo + (((256 / 2) * y) + x)) = x < (128 / 2) ? 0x1818 : 0x1f1f;
	//}
	//		}
	//	}
	//	i++;
	//}

	uint16_t sr = machine_getstatusregister();
	machine_setstatusregister((sr & 0xf8ff));

	while (1) {
		vt100_cursor_save;
		vt100_erase_line();
		uint8_t port0 = input_port0;
		printf("pwm divisor 0x%04"PRIx16" ", *basicsound);
		if (port0 != 0xFF) {
			printf("port0 0x%02x - ", port0);
			if ((port0 & ~BUTTON_UP) == 0) {
				printf("UP ");
				*basicsound += 10;
			}
			if ((port0 & ~BUTTON_DOWN) == 0) {
				printf("DOWN ");
				*basicsound -= 10;
			}
			if ((port0 & ~BUTTON_LEFT) == 0) {
				printf("LEFT ");
				*basicsound -= 1;
			}
			if ((port0 & ~BUTTON_RIGHT) == 0) {
				printf("RIGHT ");
				*basicsound += 1;
			}
			if ((port0 & ~BUTTON_START) == 0) {
				printf("START ");
			}
			if ((port0 & ~BUTTON_A) == 0) {
				printf("A ");
			}
			if ((port0 & ~BUTTON_B) == 0) {
				printf("B ");
			}
			if ((port0 & ~BUTTON_C) == 0) {
				printf("C ");
			}
		}
		printf("\n");
		vt100_cursor_unsave();

	}

	return 0;
}