diff --git a/src/asm/state.rs b/src/asm/state.rs index 42eecf7b..6afb287d 100644 --- a/src/asm/state.rs +++ b/src/asm/state.rs @@ -270,6 +270,15 @@ impl State report: diagn::RcReport) -> Result<(), ()> { + if self.banks.len() > 0 && self.bankdata[0].cur_bit_offset != 0 + { + report.error_span( + "cannot create new bank if the default bank has already been used", + &bank.decl_span.as_ref().unwrap()); + + return Err(()); + } + if bank.output_offset.is_some() { for j in 1..self.banks.len() diff --git a/tests/bank_default.asm b/tests/bank_default.asm new file mode 100644 index 00000000..7e5021f7 --- /dev/null +++ b/tests/bank_default.asm @@ -0,0 +1,20 @@ +; ::: + +#d8 1, 2, 3, 4 ; = 0x01020304 + +; ::: + +#d8 1, 2, 3, 4 +#bankdef a_new_bank {} ; error: default bank + +; ::: + +#res 4 +#bankdef a_new_bank {} ; error: default bank + +; ::: + +x = 0x25 +label: +#bankdef a_new_bank {} +; = 0x \ No newline at end of file diff --git a/web/customasm.gc.wasm b/web/customasm.gc.wasm index 654e5a96..59306336 100644 Binary files a/web/customasm.gc.wasm and b/web/customasm.gc.wasm differ