Exemple #1
0
func main() {
	runtime.LockOSThread()
	if srpc.Enabled() {
		go srpc.ServeRuntime()
	}

	w, err := av.Init(av.SubsystemVideo, 512, 512)
	if err != nil {
		log.Exitf("av.Init: %s", err)
	}

	go quitter(w.QuitChan())

	var m SpacewarPDP1
	m.Init(w)
	m.PC = 4
	f := bytes.NewBuffer(strings.Bytes(spacewarCode))
	if err = m.Load(f); err != nil {
		log.Exitf("loading %s: %s", "spacewar.lst", err)
	}
	for err == nil {
		//fmt.Printf("step PC=%06o ", m.PC);
		//fmt.Printf("inst=%06o AC=%06o IO=%06o OV=%o\n",
		//	m.Mem[m.PC], m.AC, m.IO, m.OV);
		err = m.Step()
	}
	log.Exitf("step: %s", err)
}
Exemple #2
0
func main() {
	// Native Client requires that some calls are issued
	// consistently by the same OS thread.
	runtime.LockOSThread()

	if srpc.Enabled() {
		go srpc.ServeRuntime()
	}

	args := os.Args
	p := pieces4
	if len(args) > 1 && args[1] == "-5" {
		p = pieces5
	}
	dx, dy := 500, 500
	w, err := av.Init(av.SubsystemVideo|av.SubsystemAudio, dx, dy)
	if err != nil {
		log.Exit(err)
	}

	sndc = make(chan []uint16, 10)
	go audioServer()
	Play(p, w)
}