/* The Basys 3 RISC-V computer's I/O, for C programs (see rtl/rv32_system.v). * * Port N of the Z-80 machine is the byte at FFFF_FF00 + N, so IO8(0x01) = c * compiles to one store relative to x0. The 32-bit registers are at * FFFF_FE00 + N. */ #ifndef BASYS3_H #define BASYS3_H #define IO8(n) (*(volatile unsigned char *)(0xFFFFFF00u + (n))) #define IO32(n) (*(volatile unsigned int *)(0xFFFFFE00u + (n))) #define IO_MS IO32(0x00) /* milliseconds since reset */ #define IO_US IO32(0x04) /* microseconds since reset */ #define IO_TIMECMP IO32(0x08) /* timer interrupt when IO_US reaches it */ #define IO_BP0 IO32(0x10) /* monitor breakpoint addresses */ #define IO_BP1 IO32(0x14) #define ROM_TOP 0x0000A000u /* BASIC's code below: the hardware ignores writes */ #define ARENA_BASE 0x0000A000u /* BASIC's program area */ #define GAME_BASE 0x0000A200u /* machine-code programs loaded into it */ #define MC_FREE 0x00012000u /* 12000h-12FFFh: free for machine code */ #define MON_BASE 0x00020000u /* the monitor: NMI entry */ #define MON_TRAP 0x00020004u /* the monitor's trap entry (mtvec) */ /* BASIC's clock, set by DATE, at a fixed place the monitor can read */ #define CLK_SEC (*(volatile unsigned int *)0x13FF8u) /* seconds since 2000 */ #define CLK_MS (*(volatile int *)0x13FFCu) /* IO_MS at CLK_SEC */ #endif