@@ -101,7 +101,7 @@ def int_in_range(arg, low, high, what, radix=0):
101
101
pio_version = int_in_range (words [1 ], 0 , 2 , ".pio_version" )
102
102
elif line .startswith (".origin" ):
103
103
require_before_instruction ()
104
- offset = int ( line . split () [1 ], 0 )
104
+ offset = int_in_range ( words [1 ], 0 , 32 , ".origin" )
105
105
elif line .startswith (".wrap_target" ):
106
106
wrap_target = len (instructions )
107
107
elif line .startswith (".wrap" ):
@@ -126,7 +126,7 @@ def int_in_range(arg, low, high, what, radix=0):
126
126
if words [1 ] in ("txfifo" , "rxfifo" ):
127
127
if words [2 ] != "<" :
128
128
raise RuntimeError (f"Invalid { line } " )
129
- mov_status_count = int (words [3 ])
129
+ mov_status_count = int_in_range (words [3 ], 0 , 16 , words [ 1 ])
130
130
elif words [1 ] == "irq" :
131
131
required_version = 1
132
132
idx = 2
@@ -139,9 +139,6 @@ def int_in_range(arg, low, high, what, radix=0):
139
139
if words [idx ] != "set" :
140
140
raise RuntimeError (f"Invalid { line } )" )
141
141
mov_status_count = int (words [idx + 1 ])
142
-
143
- if not 0 <= mov_status_count < 16 :
144
- raise RuntimeError (f"Invalid mov_status count { mov_status_count } " )
145
142
require_version (required_version , line )
146
143
elif words [0 ] == ".in" :
147
144
require_before_instruction ()
0 commit comments