/******************************************************************************
** FILE: simple.fs
** Basic sparc istruction simulator (emulation only).
*/
#include "sparc_v9.fs"
fun initialize()
{
R4(14,system?start_sp);
return (system?start_pc, system?start_pc + 4);
}
val init = initialize();
fun main(pc, npc)
{
// Copy arguments to global variables
PC = pc; nPC = npc;
nPC2 = nPC + 4; // default next nPC
PC?exec(); // execute instruction
init = (nPC, nPC2);
}