I am learning programming for 8 bit 6502 in C compiler (www.cc65.org)
The NES FC has a 8bit 6502 processor and a 2K RAM. However, the following C compiles (into a nes file) and loads successfully in VirtualNES emulator.
#include "conio.h"
#include "stdlib.h"
int dump[1000];
void main()
{
int *a;
a = (int*)malloc(19222999);
cputs("Hello, World!");
a[0] = 1;
for(;;); // loop forever, never ends
}
Why this is OK ? clearly I have allocated more memory than 2K in the above C code.