Skip to content

Commit

Permalink
Fix issues in the API functions in the demo cartridge.
Browse files Browse the repository at this point in the history
  • Loading branch information
bryce-carson committed Nov 9, 2024
1 parent 3f02357 commit 4a71fa4
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 114 deletions.
23 changes: 14 additions & 9 deletions demos/rdemo.r
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,33 @@
## version: 0.1
## script: r

## pee pee poo poo

t <- 0
x <- 96
y <- 24

inc <- \(x) eval.parent(substitute(x <- x + 1))
dec <- \(x) eval.parent(substitute(x <- x - 1))

## The program eventually SEGFAULTs with the following message.
## *** caught segfault ***
## address (nil), cause 'memory not mapped'
`TIC-80` <- function() {
mapply(\(b, o) if (.External("btn", b)) eval(o, .GlobalEnv),
0:3,
list(quote(dec(y)), quote(inc(y)),
quote(dec(x)), quote(inc(x))));
.External("cls", 13);
.External("spr",
mapply(function(b, o) {
if (.External("t80.btn", b)) {
eval(as.expression(o), .GlobalEnv)
}
},
0:3,
list(quote(dec(y)), quote(inc(y)),
quote(dec(x)), quote(inc(x))));
.External("t80.cls", 13);
.External("t80.spr",
id = 1 + (t %% 60) / 30 * 2,
scale = 3,
x, y,
colorkey = 14,
w = 2, h = 2);
.External("print", "HELLO WORLD!", 84, 84);
.External("t80.print", "HELLO WORLD!", 84, 84);
inc(t);
}

Expand Down
Loading

0 comments on commit 4a71fa4

Please sign in to comment.