#include "xparameters.h"
#include "xbasic_types.h"
#include "xio.h"

int main()
{
  int i;
  int addr;
  char j, k;
  print("Hello World!\r\n");

  j = 0;
  for ( i = 0 ; i < 512 ; i++ ) {
    addr = XPAR_BRAM_PERIPHERAL_BASEADDR + (i << 2);
    XIo_Out8(addr, j);
    j += 17;
  }

  j = 0;
  for ( i = 0 ; i < 512 ; i++ ) {
    addr = XPAR_BRAM_PERIPHERAL_BASEADDR + (i << 2);
    k = XIo_In8(addr);
    putnum(addr);
    print(" got ");
    putnum(k);
    if ( k != j ) {
      print(" expected ");
      putnum(j);
    }
    print("\r\n");
    j += 17;
  }

  print("Goodbye\r\n");
  return 0;
}
