Skip to content

Commit f92c473

Browse files
committed
debugging
1 parent 87339a7 commit f92c473

File tree

5 files changed

+127
-20
lines changed

5 files changed

+127
-20
lines changed

assets/progs/debug1.txt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
P1 ------
2+
page-1
3+
when page_start do show_image LED_image `
4+
. . . . .
5+
1 1 . 1 1
6+
. . . . .
7+
. 1 1 1 .
8+
. . . . .
9+
`
10+
11+
12+
when press logo do show_image LED_image `
13+
. . . . .
14+
. 1 . 1 .
15+
. . . . .
16+
1 . . . 1
17+
. 1 1 1 .
18+
`
19+
LED_image `
20+
. . . . .
21+
1 1 . 1 1
22+
. . . . .
23+
. 1 1 1 .
24+
. . . . .
25+
`
26+
repeat 3
27+
28+
when press logo do play_sound giggle
29+
30+
when move shake do show_image LED_image `
31+
. . . . .
32+
. 1 . 1 .
33+
. . . . .
34+
. 1 1 1 .
35+
1 . . . 1
36+
`
37+
LED_image `
38+
. . . . .
39+
1 1 . 1 1
40+
. . . . .
41+
. 1 1 1 .
42+
. . . . .
43+
`
44+
repeat 3
45+
46+
when move shake do play_sound sad
47+
48+
page-2
49+
50+
page-3
51+
52+
page-4
53+
54+
page-5
55+
56+

assets/progs/debug2.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
P2 ---------
2+
page-1
3+
when page_start do show_image LED_image `
4+
. . . . .
5+
1 1 . 1 1
6+
. . . . .
7+
. 1 1 1 .
8+
. . . . .
9+
`
10+
11+
12+
when press logo do show_image LED_image `
13+
. . . . .
14+
. 1 . 1 .
15+
. . . . .
16+
1 . . . 1
17+
. 1 1 1 .
18+
`
19+
LED_image `
20+
. . . . .
21+
1 1 . 1 1
22+
. . . . .
23+
. 1 1 1 .
24+
. . . . .
25+
`
26+
repeat 3
27+
28+
when press logo do play_sound giggle
29+
30+
when move shake do show_image LED_image `
31+
. . . . .
32+
. 1 . 1 .
33+
. . . . .
34+
. 1 1 1 .
35+
1 . . . 1
36+
`
37+
LED_image `
38+
. . . . .
39+
1 1 . 1 1
40+
. . . . .
41+
. 1 1 1 .
42+
. . . . .
43+
`
44+
repeat 3
45+
46+
when move shake do play_sound sad
47+
48+
page-2
49+
50+
page-3
51+
52+
page-4
53+
54+
page-5

editor.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -294,21 +294,21 @@ namespace microcode {
294294
this.app.save(SAVESLOT_AUTO, this.progdef.toBuffer())
295295
} else {
296296
this.progdef = ProgramDefn.fromBuffer(new BufferReader(buf))
297-
298-
progToString(this.progdef)
299-
const pas1 = progToStringRet
300-
// console.log(`PAS1\n${pas1}`)
301-
parseProg(pas1)
302-
const progFromString = parseProgRet
303-
progToString(progFromString)
304-
const pas2 = progToStringRet
305-
// console.log("PAS2")
306-
// console.log(pas2)
307-
// check the programs are the same
308-
control.assert(
309-
pas1 == pas2,
310-
`progs not the same ${pas1} \n---\n ${pas2}`
311-
)
297+
if (true) {
298+
progToString(this.progdef)
299+
const pas1 = progToStringRet
300+
// console.log(`PAS1\n${pas1}`)
301+
parseProg(pas1)
302+
const progFromString = parseProgRet
303+
const buf2 = progFromString.toBuffer()
304+
progToString(progFromString)
305+
const pas2 = progToStringRet
306+
// check the programs are the same
307+
control.assert(
308+
buf.equals(buf2),
309+
`progs not the same:\nP1 ------\n${pas1}\nP2 ---------\n${pas2}`
310+
)
311+
}
312312
}
313313
this.configureP1Keys()
314314
}

interpreter.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ namespace microcode {
109109
public matchWhen(tid: number, filter: number = undefined): boolean {
110110
const sensor = this.rule.sensor
111111
if (tid != sensor) return false
112-
if (
113-
sensor == Tid.TID_SENSOR_START_PAGE &&
114-
this.rule.filters.length == 0
115-
) {
112+
if (sensor == Tid.TID_SENSOR_START_PAGE) {
116113
return true
117114
} else if (getKind(sensor) == TileKind.Variable) {
118115
return this.filterViaCompare()

mcparser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace microcode {
4040
return res.join("\n")
4141
}
4242
const res = prog.pages.map(pageToString)
43-
progToStringRet = res.map((ps, i) => `page-${i}\n${ps}`).join("\n")
43+
progToStringRet = res.map((ps, i) => `page-${i + 1}\n${ps}`).join("\n")
4444
}
4545

4646
enum Phase {

0 commit comments

Comments
 (0)