#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "system.h"

#define lcd_on (volatile char *) 0x00041010
#define lcd_blon (volatile char *) 0x00041020


int main()
{
	*lcd_on = 1;
	*lcd_blon = 1;
	printf("Hello from Nios II!\n");
	hello();
	return 0;
}

void hello() {
	FILE *pLCD;
	char msg[] = "Hello\nWorld\n";

	pLCD = fopen(LCD_16207_0_NAME, "w");
	if (pLCD) {
		fwrite(msg, strlen(msg), 1, pLCD);
		fclose(pLCD);
	} else {
		printf("failed to say Hello World\n");
	}
	printf("end");
}
