File tree Expand file tree Collapse file tree 4 files changed +183
-13
lines changed Expand file tree Collapse file tree 4 files changed +183
-13
lines changed Original file line number Diff line number Diff line change 1+ Page 1
2+ move shake set_variable_X random_number 3 EOR
3+
4+ move shake play_sound slide EOR
5+
6+ variable_X_set equals 1 show_image LED_image
7+ . . . . .
8+ . . . . .
9+ . . . . .
10+ . . . . .
11+ . . . . .
12+
13+ LED_image
14+ . . . . .
15+ . 1 1 1 .
16+ . 1 1 1 .
17+ . 1 1 1 .
18+ . . . . .
19+
20+ EOR
21+
22+ variable_X_set equals 2 show_image LED_image
23+ . . . . .
24+ . . . . .
25+ . . . . .
26+ . . . . .
27+ . . . . .
28+
29+ LED_image
30+ 1 1 1 1 1
31+ 1 . . . 1
32+ 1 . . . 1
33+ 1 . . . 1
34+ 1 1 1 1 1
35+
36+ EOR
37+
38+ variable_X_set equals 3 show_image LED_image
39+ . . . . .
40+ . . . . .
41+ . . . . .
42+ . . . . .
43+ . . . . .
44+
45+ LED_image
46+ 1 1 . . 1
47+ 1 1 . 1 .
48+ . . 1 . .
49+ 1 1 . 1 .
50+ 1 1 . . 1
51+
52+ EOR
53+
54+ EOP
55+ Page 2
56+
57+ EOP
58+ Page 3
59+
60+ EOP
61+ Page 4
62+
63+ EOP
64+ Page 5
65+
66+ EOP
Original file line number Diff line number Diff line change 1+ Page 1
2+ press button_A show_image LED_image
3+ 1 1 . 1 1
4+ 1 1 . 1 1
5+ . . . . .
6+ 1 . . . 1
7+ . 1 1 1 .
8+
9+ LED_image
10+ 1 1 . 1 1
11+ . . . . .
12+ 1 . . . 1
13+ . 1 1 1 .
14+ . . . . .
15+
16+ EOR
17+
18+ press button_A play_sound happy EOR
19+
20+ press button_B show_image LED_image
21+ 1 1 . 1 1
22+ 1 1 . 1 1
23+ . . . . .
24+ . 1 1 1 .
25+ 1 . . . 1
26+
27+ LED_image
28+ 1 1 . 1 1
29+ 1 1 . 1 1
30+ . . . . .
31+ . . . . .
32+ 1 1 1 1 1
33+
34+ EOR
35+
36+ press button_B play_sound sad EOR
37+
38+ EOP
39+ Page 2
40+
41+ EOP
42+ Page 3
43+
44+ EOP
45+ Page 4
46+
47+ EOP
48+ Page 5
49+
50+ EOP
51+
52+ button-up
53+
54+ Page 1
55+ press button_A show_image LED_image
56+ 1 1 . 1 1
57+ 1 1 . 1 1
58+ . . . . .
59+ 1 . . . 1
60+ . 1 1 1 .
61+
62+ LED_image
63+ 1 1 . 1 1
64+ . . . . .
65+ 1 . . . 1
66+ . 1 1 1 .
67+ . . . . .
68+
69+ EOR
70+
71+ press button_A play_sound happy EOR
72+
73+ press button_B show_image LED_image
74+ 1 1 . 1 1
75+ 1 1 . 1 1
76+ . . . . .
77+ . 1 1 1 .
78+ 1 . . . 1
79+
80+ LED_image
81+ 1 1 . 1 1
82+ 1 1 . 1 1
83+ . . . . .
84+ . . . . .
85+ 1 1 1 1 1
86+
87+ EOR
88+
89+ press button_B play_sound sad EOR
90+
91+ EOP
92+ Page 2
93+
94+ EOP
95+ Page 3
96+
97+ EOP
98+ Page 4
99+
100+ EOP
101+ Page 5
102+
103+ EOP
Original file line number Diff line number Diff line change @@ -294,6 +294,18 @@ namespace microcode {
294294 this . app . save ( SAVESLOT_AUTO , this . progdef . toBuffer ( ) )
295295 } else {
296296 this . progdef = ProgramDefn . fromBuffer ( new BufferReader ( buf ) )
297+ // to string
298+ const progAsString = this . progdef . toString ( )
299+ const progFromString = parse ( progAsString )
300+ const progAsBuf = progFromString . toBuffer ( )
301+ // compare buffers
302+ if ( buf . length == progAsBuf . length ) {
303+ } else {
304+ control . assert (
305+ false ,
306+ `buf.length = ${ buf . length } progAsBuf.length = ${ progAsBuf . length } `
307+ )
308+ }
297309 }
298310 this . configureP1Keys ( )
299311 }
Original file line number Diff line number Diff line change 11// a parser for MC programs
22
3- // Page [num]
4- // When [Event] Do [Action] [Loop]
5-
6- // TODO: need to make tokens have unique tids (filter/mod replication)
7- // TID_MODIFIER_CUP_X_READ...
8- // TID_MODIFIER_COIN_1...
9- // translate
10- // TODO: scripts reverse the tooltip
11-
123namespace microcode {
13- // resolveTooltip to go from Tid to string (replace space by -)
14- // reverseTooltip to go from string to tid
15-
16- export function parse ( str : string ) {
4+ export function parse ( str : string ) : ProgramDefn {
175 const token2tile = ( tok : string ) => {
186 const tid = tooltip2tid ( tok . replaceAll ( "_" , " " ) )
197 // check to see if field editor needed
@@ -82,5 +70,6 @@ namespace microcode {
8270 }
8371 }
8472 }
73+ return prog
8574 }
8675}
You can’t perform that action at this time.
0 commit comments