# HG changeset patch # User William Astle # Date 1682266334 21600 # Node ID 02080e77386f96d15ba6d3ef0c4b21a89936ac7a # Parent bb9fe2bd4894011b1a1af75f50dbc93849ad617a Make negative integers parse correctly diff -r bb9fe2bd4894 -r 02080e77386f src/lwbasic.s --- a/src/lwbasic.s Sat Apr 22 20:06:05 2023 -0600 +++ b/src/lwbasic.s Sun Apr 23 10:12:14 2023 -0600 @@ -1719,9 +1719,11 @@ bra eval_number1 ; go do the parsing eval_number0 jsr nextchar ; fetch next input beq eval_numberr ; brif end of expression - bail -eval_number1 cmpa #'- ; negative? +eval_number1 cmpa #'- ; negative (ascii sign)? + beq eval_number3 ; brif so + cmpa #tok_minus ; negative (operator negative)? bne eval_number2 ; brif not - com val0.sign ; invert sign +eval_number3 com val0.sign ; invert sign bra eval_number0 ; deal with next input eval_number2 cmpa #'+ ; unary +? beq eval_number0 ; brif so - skip it @@ -1783,8 +1785,9 @@ subd val0.int+2 std val0.int+2 ldd zero - subd val0.int - std val0.int + sbcb val0.int+1 + sbca val0.int + std val0.int eval_numberr0 rts eval_float jmp SNERROR ; we don't handle floating point yet ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;