comparison lwasm/main.c @ 366:433dbc18fb41

Make byte overflow detection for 8 bit immediate not fail with COM operator This is a horrible hack. Add a quick and dirty context to expression parsing so that it knows whether an 8 bit or 16 bit complement is required. The 8 bit complement will just discard anything above bit 7. When returning an operator back with lwasm_whichop(), the result will still be "COM" which should allow other things to keep working as they already do. This does prevent byte overflows when the complement operator is used, however, and since those were introduced, there were problems building Nitros9 among other things. This fix allows Nitros9 to build again.
author William Astle <lost@l-w.ca>
date Tue, 02 Jun 2015 20:58:14 -0600
parents 3f8abaac214c
children c6d2a1f54e0c
comparison
equal deleted inserted replaced
365:3f8abaac214c 366:433dbc18fb41
291 /* initialize assembler state */ 291 /* initialize assembler state */
292 asmstate.include_list = lw_stringlist_create(); 292 asmstate.include_list = lw_stringlist_create();
293 asmstate.input_files = lw_stringlist_create(); 293 asmstate.input_files = lw_stringlist_create();
294 asmstate.nextcontext = 1; 294 asmstate.nextcontext = 1;
295 asmstate.target = TARGET_6309; 295 asmstate.target = TARGET_6309;
296 asmstate.exprwidth = 16;
296 297
297 /* parse command line arguments */ 298 /* parse command line arguments */
298 lw_cmdline_parse(&cmdline_parser, argc, argv, 0, 0, &asmstate); 299 lw_cmdline_parse(&cmdline_parser, argc, argv, 0, 0, &asmstate);
299 300
300 if (!asmstate.output_file) 301 if (!asmstate.output_file)