@@ -19,6 +19,8 @@
Loading
19 19
20 20
import (
21 21
	"log"
22 +
	"runtime"
23 +
	"time"
22 24
23 25
	"github.com/andreas-jonsson/virtualxt/emulator/memory"
24 26
	"github.com/andreas-jonsson/virtualxt/emulator/processor"
@@ -1500,6 +1502,11 @@
Loading
1500 1502
			if primitive && ((p.repeatMode == 0xF2 && p.ZF) || (p.repeatMode == 0xF3 && !p.ZF)) {
1501 1503
				break
1502 1504
			}
1505 +
1506 +
			// This is to prevent the JS backend from deadlocking.
1507 +
			if runtime.GOOS == "js" && p.CX%1000 == 0 {
1508 +
				time.Sleep(time.Nanosecond)
1509 +
			}
1503 1510
		}
1504 1511
	} else {
1505 1512
		p.repeatMode = 0

@@ -1,4 +1,4 @@
Loading
1 -
// +build !sdl
1 +
// +build !sdl,!js
2 2
3 3
/*
4 4
Copyright (C) 2019-2020 Andreas T Jonsson

@@ -1,3 +1,5 @@
Loading
1 +
// +build !js
2 +
1 3
/*
2 4
Copyright (C) 2019-2020 Andreas T Jonsson
3 5

@@ -17,6 +17,13 @@
Loading
17 17
18 18
package platform
19 19
20 +
import (
21 +
	"io"
22 +
	"os"
23 +
24 +
	"github.com/andreas-jonsson/virtualxt/platform/dialog"
25 +
)
26 +
20 27
type internalPlatform interface{}
21 28
22 29
type Config func(internalPlatform) error
@@ -27,7 +34,21 @@
Loading
27 34
	Samples int
28 35
}
29 36
37 +
type File interface {
38 +
	io.ReadWriteSeeker
39 +
	io.ReaderAt
40 +
	io.Closer
41 +
}
42 +
43 +
type FileSystem interface {
44 +
	Create(name string) (File, error)
45 +
	Open(name string) (File, error)
46 +
	OpenFile(name string, flag int, perm os.FileMode) (File, error)
47 +
}
48 +
30 49
type Platform interface {
50 +
	FileSystem
51 +
31 52
	HasAudio() bool
32 53
	RenderGraphics(backBuffer []byte, r, g, b byte)
33 54
	RenderText(mem []byte, blink bool, bg, cx, cy int)
@@ -41,6 +62,13 @@
Loading
41 62
42 63
var Instance Platform
43 64
65 +
func setDialogFileSystem(fs FileSystem) {
66 +
	dialog.OpenFileFunc = func(name string, flag int, perm os.FileMode) (dialog.File, error) {
67 +
		fp, err := fs.OpenFile(name, flag, perm)
68 +
		return fp.(dialog.File), err
69 +
	}
70 +
}
71 +
44 72
type Scancode byte
45 73
46 74
const KeyUpMask Scancode = 0x80

@@ -1,3 +1,5 @@
Loading
1 +
// +build !js
2 +
1 3
/*
2 4
Copyright (C) 2019-2020 Andreas T Jonsson
3 5
@@ -21,6 +23,7 @@
Loading
21 23
	"bytes"
22 24
	"flag"
23 25
	"log"
26 +
	"os"
24 27
	"sync"
25 28
26 29
	"github.com/gdamore/tcell"
@@ -57,6 +60,7 @@
Loading
57 60
	}
58 61
59 62
	Instance = &tcellPlatformInstance
63 +
	setDialogFileSystem(Instance)
60 64
	s := tcellPlatformInstance.screen
61 65
62 66
	if err = s.Init(); err != nil {
@@ -74,12 +78,24 @@
Loading
74 78
	mainLoop(Instance)
75 79
}
76 80
81 +
func (*tcellPlatform) Open(name string) (File, error) {
82 +
	return os.Open(name)
83 +
}
84 +
85 +
func (*tcellPlatform) Create(name string) (File, error) {
86 +
	return os.Create(name)
87 +
}
88 +
89 +
func (*tcellPlatform) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
90 +
	return os.OpenFile(name, flag, perm)
91 +
}
92 +
77 93
func (p *tcellPlatform) HasAudio() bool {
78 94
	return false
79 95
}
80 96
81 97
func (p *tcellPlatform) RenderGraphics([]byte, byte, byte, byte) {
82 -
	// Not supported for the Tcell platform.
98 +
	panic("not implemented")
83 99
}
84 100
85 101
func (p *tcellPlatform) RenderText(mem []byte, blink bool, bg, cx, cy int) {
Files Coverage
emulator/processor/cpu 80.38%
platform 0.00%
Project Totals (8 files) 71.20%
248.1
TRAVIS_OS_NAME=linux
1.15.x=.15.x
248.3
TRAVIS_OS_NAME=windows
1.15.x=.15.x

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading