Exemplo n.º 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)
}
Exemplo n.º 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)
}
Exemplo n.º 3
0
// binaries running standalone or embedded in a web browser window.
//
// The C version of the API is documented at
// http://nativeclient.googlecode.com/svn/data/docs_tarball/nacl/googleclient/native_client/scons-out/doc/html/group__audio__video.html
package av

import (
	"exp/draw"
	"exp/nacl/srpc"
	"log"
	"os"
	"syscall"
	"unsafe"
)

var srpcEnabled = srpc.Enabled()

// native_client/src/trusted/service_runtime/include/sys/audio_video.h

// Subsystem values for Init.
const (
	SubsystemVideo = 1 << iota
	SubsystemAudio
	SubsystemEmbed
)

//	SubsystemRawEvents;

// Audio formats.
const (
	AudioFormatStereo44K = iota