summaryrefslogtreecommitdiff
path: root/vm/rom.go
diff options
context:
space:
mode:
authorstefan <stefan@s00.xyz>2023-05-24 22:29:46 -0400
committerstefan <stefan@s00.xyz>2023-05-24 22:29:46 -0400
commit20621e073562ee5d423b636fae8b6aa8e38275fa (patch)
tree4a81bde039e58602e44a213cfb8d91a65f1dadd9 /vm/rom.go
parentba2b9c8a1bb1876b6eb4c9783fde798b19de4418 (diff)
downloadevm-20621e073562ee5d423b636fae8b6aa8e38275fa.tar.gz
readme and cleanup
Diffstat (limited to 'vm/rom.go')
-rw-r--r--vm/rom.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/vm/rom.go b/vm/rom.go
index 958e70e..b638da0 100644
--- a/vm/rom.go
+++ b/vm/rom.go
@@ -1,16 +1,15 @@
package main
import (
- "os"
- "fmt"
+// "os"
+// "fmt"
)
type Rom []byte
func (r *Rom) Fetch(pc *uint64, n uint64) []byte {
- if (*pc + n > uint64(len(*r)) - 1) {
- fmt.Fprintf(os.Stderr, "error: trying to read outside of rom\n")
- os.Exit(1)
+ if (*pc + n > uint64(len(*r))) {
+ return nil
}
x := make([]byte, n)
copy(x, (*r)[*pc:*pc + n])