diff --git a/docs/AllPOs.txt b/docs/AllPOs.txt index 3d175d2..0e0fbf1 100644 --- a/docs/AllPOs.txt +++ b/docs/AllPOs.txt @@ -361,7 +361,7 @@ Examples: .backgroundcolor = 0 ; some local symbol !zone LinkedList_End ; you know what to imagine here... } - .backgroundcolor = 3 ; => "Symbol already defined." + .backgroundcolor = 3 ; -> "Symbol already defined." Call: !symbollist FILENAME @@ -388,11 +388,11 @@ Parameters: CONDITION: Any formula the value parser accepts, but it must be solvable even in the first pass. BLOCK: A block of assembler statements. Examples: ; Choose word according to "country" symbol: - !if country = uk { + !if country == uk { !text "Grey" - } else if country = fr { + } else if country == fr { !text "Gris" - } else if country = de { + } else if country == de { !text "Grau" } else { !text "Gray" @@ -435,7 +435,7 @@ Examples: ; this was taken from <6502/std.a>: ; if the following code gets included several times, ; only assemble it at the first location: !ifndef my_label {my_label} ; only define if undefined - !if * = my_label { + !if * == my_label { ; imagine some code here... ; this block will only be assembled at the ; first location where it is included. all @@ -582,7 +582,7 @@ Parameters: KEYWORD: Either "until" or "while" (without quotes). BLOCK: A block of assembler statements. Examples: ; a loop with conditions at both start and end !set a = 0 ; init loop counter - !do while loop_flag = TRUE { + !do while loop_flag == TRUE { lda #a sta label + a !set a = a + 1 @@ -595,10 +595,10 @@ Examples: ; a loop with conditions at both start and end !do { !wo * + base } while * < base + 345 ; a never ending loop - this will cause an error - !do while 3 < 4 { nop } until 3 = 4 + !do while 3 < 4 { nop } until 3 == 4 ; an empty loop - this will hang ACME - !do until 3 = 4 { } while 3 < 4 + !do until 3 == 4 { } while 3 < 4 Call: !while [CONDITION] { BLOCK } @@ -973,7 +973,7 @@ Parameters: KEYWORD: Currently valid keywords are: undocumented opcodes See "docs/cputypes/all.txt" for more info. BLOCK: A block of assembler statements. -Examples: !if cputype = $65c02 { +Examples: !if cputype == $65c02 { !cpu 65c02 { ; temporarily allow 65c02 stuff stz .todelete } diff --git a/docs/Errors.txt b/docs/Errors.txt index f6f6260..0a6e0f7 100644 --- a/docs/Errors.txt +++ b/docs/Errors.txt @@ -61,9 +61,6 @@ Bug in ACME, code follows A situation has been encountered implying there is a bug in ACME. See the last section in this file. -C-style "==" comparison detected. - To check for equality, use a single '=' character instead. - Converted to integer for binary logic operator. Applying binary logic to float values does not make much sense, therefore floats will be converted to integer in such cases. diff --git a/docs/Floats.txt b/docs/Floats.txt index e235a28..e8d9015 100644 --- a/docs/Floats.txt +++ b/docs/Floats.txt @@ -41,7 +41,7 @@ the only way to enter this value is by writing "1.0 * 10.0 ^ 20.0". Examples: !byte 1 / 2 * 2 ; gives 0 (integer maths) - !byte 1 / 2 * 2.0 ; gives 0 (1/2 => 0 in integer maths, + !byte 1 / 2 * 2.0 ; gives 0 (1/2 -> 0 in integer maths, ; float usage comes too late) !byte 1 / 2.0 * 2 ; gives 1 (FP in effect) !byte 1 / 2.0 * 2.0 ; gives 1 (FP in effect) diff --git a/docs/Illegals.txt b/docs/Illegals.txt index 9072f6d..c79c568 100644 --- a/docs/Illegals.txt +++ b/docs/Illegals.txt @@ -141,5 +141,5 @@ For more information about what these opcodes do, see these documents: "No More Secrets - NMOS 6510 Unintended Opcodes" -Download it from https://csdb.dk/release/?id=185341 +Download it from https://csdb.dk/release/?id=198357 or ask google for the latest version. diff --git a/docs/QuickRef.txt b/docs/QuickRef.txt index 4727255..dce9c86 100644 --- a/docs/QuickRef.txt +++ b/docs/QuickRef.txt @@ -423,7 +423,7 @@ Priority Example Meaning Alias Note 6 v >= w higher or equal 6 v > w higher than 5 v != w not equal <>, >< *3 - 4 v = w equal *3 + 4 v == w equal = *3 3 v & w bit-wise AND AND 2 bit-wise exclusive OR XOR 1 v | w bit-wise OR OR diff --git a/examples/ddrv.a b/examples/ddrv.a index 3e97676..9304ac3 100644 --- a/examples/ddrv.a +++ b/examples/ddrv.a @@ -1,4 +1,4 @@ -;ACME 0.95 +;ACME 0.97 ;!sl "ddrv.l" ; Name DuoDriver ; Purpose Input driver for mouse and joystick @@ -82,7 +82,7 @@ ; Locations to store button states, $ff = pressed, $00 = not pressed. ; Mouse uses both buttons, joystick only uses "LeftButton". ; Location to store pointer's current character coordinates. -!if SYSTEM = 64 { +!if SYSTEM == 64 { LeftButton = $a4 RightButton = $a5 CharX = $b3 @@ -90,7 +90,7 @@ tapebuf = $0340 spr_ptrs = 2040 } -!if SYSTEM = 128 { +!if SYSTEM == 128 { LeftButton = $fa RightButton = $ff CharX = $9b @@ -160,7 +160,7 @@ Init lda sys_iirq sta sys_iirq stx sys_iirq + 1 plp -!if SYSTEM = 128 { +!if SYSTEM == 128 { lda mmu_cr tay and #$fe ; activate I/O chips @@ -170,10 +170,10 @@ Init lda sys_iirq ; Init mouse buttons lda #$11 sta cia1_prb -!if SYSTEM = 128 { +!if SYSTEM == 128 { sty mmu_cr } -!if SYSTEM = 64 { +!if SYSTEM == 64 { ; Copy sprites to tape buffer ldx #127 - lda Sprites, x @@ -579,7 +579,7 @@ ResetMM tay ; Set Y to zero. ; In the c128 version, we skip memory until we reach $0e00 - this is ; where the sprites are stored by default. -!if SYSTEM = 128 { +!if SYSTEM == 128 { !align $ffff, $e00, $0 } diff --git a/src/alu.c b/src/alu.c index 6363781..bf9a0f2 100644 --- a/src/alu.c +++ b/src/alu.c @@ -8,8 +8,7 @@ // 31 Jul 2009 Changed ASR again, just to be on the safe side. // 14 Jan 2014 Changed associativity of "power-of" operator, // so a^b^c now means a^(b^c). -// 7 May 2014 C-style "==" operators are now recognized (but -// give a warning). +// 7 May 2014 C-style "==" operators are now recognized. // 31 May 2014 Added "0b" binary number prefix as alternative to "%". // 28 Apr 2015 Added symbol name output to "value not defined" error. // 1 Feb 2019 Prepared to make "honor leading zeroes" optionally (now done) @@ -1124,10 +1123,12 @@ static void expect_dyadic_operator(struct expression *expression) case '=': // is equal op = &ops_equals; - // if it's "==", accept but warn + // atm, accept both "=" and "==". in future, prefer "=="! if (GetByte() == '=') { - Throw_first_pass_warning("C-style \"==\" comparison detected."); - goto get_byte_and_push_dyadic; + //Throw_first_pass_warning("C-style \"==\" comparison detected."); REMOVE! + GetByte(); // eat second '=' character + } else { + //Throw_first_pass_warning("old-style \"=\" comparison detected, please use \"==\" instead."); ACTIVATE! } goto push_dyadic_op; diff --git a/src/version.h b/src/version.h index c3056cc..20052c3 100644 --- a/src/version.h +++ b/src/version.h @@ -9,7 +9,7 @@ #define RELEASE "0.97" // update before release FIXME #define CODENAME "Zem" // update before release -#define CHANGE_DATE "28 Jan" // update before release FIXME +#define CHANGE_DATE "31 Jan" // update before release FIXME #define CHANGE_YEAR "2021" // update before release //#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/" #define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME diff --git a/testing/math1.a b/testing/math1.a index 9dd5b41..1f5e2ae 100644 --- a/testing/math1.a +++ b/testing/math1.a @@ -1,4 +1,4 @@ -;ACME 0.96.5 +;ACME 0.97 ; "assert" macro !macro a @r { !if @r != 1 { @@ -13,27 +13,27 @@ abcdef = $abcdef ; literals - +a 255 = $ff - +a 255 = 0xFF - +a 255 = %#1#1#1#1 - +a 255 = 0b1111#### - +a 255 = &377 - +a 33 = '!' + +a 255 == $ff + +a 255 == 0xFF + +a 255 == %#1#1#1#1 + +a 255 == 0b1111#### + +a 255 == &377 + +a 33 == '!' ; test monadic operators - +a NOT 1 = -2 - +a -three = -3 - +a abcdef = $cd - +a ^abcdef = $ab - +a addr(abcdef) = abcdef - +a int(abcdef) = abcdef - +a float(three) = three - +a three = float(three) + +a NOT 1 == -2 + +a -three == -3 + +a abcdef == $cd + +a ^abcdef == $ab + +a addr(abcdef) == abcdef + +a int(abcdef) == abcdef + +a float(three) == three + +a three == float(three) +a float(fp) != int(fp) +a int(fp) != float(fp) - +a float(three) = int(three) - +a int(three) = float(three) + +a float(three) == int(three) + +a int(three) == float(three) +a sin(3.14) > 0 +a cos(0.1) > 0.9 +a tan(3.1415 / 2) > 1 @@ -42,20 +42,20 @@ +a arctan(1) > 0.78 ; test dyadic operators - +a three^five = 3*3*3*3*3 - +a three*five = 15 - +a 15 / 2 = 7 - +a 15.0 / 2 = 7.5 - +a 15.0 DIV 2.0 = 7 - +a 17 % 3 = 2 - +a 3 << 3 = 24 - +a -5 >> 2 = -2 - +a 24 >> 3 = 3 - +a -1 >> 3 = -1 - +a 24 >>> 3 = 3 - +a five + three = 8 - +a five - three = 2 - +a 2*3 = 1+5 + +a three^five == 3*3*3*3*3 + +a three*five == 15 + +a 15 / 2 == 7 + +a 15.0 / 2 == 7.5 + +a 15.0 DIV 2.0 == 7 + +a 17 % 3 == 2 + +a 3 << 3 == 24 + +a -5 >> 2 == -2 + +a 24 >> 3 == 3 + +a -1 >> 3 == -1 + +a 24 >>> 3 == 3 + +a five + three == 8 + +a five - three == 2 + +a 2*3 == 1+5 +a 2<=3 +a 2<=2 +a 2<3 @@ -63,152 +63,152 @@ +a 3>=2 +a 3>2 +a 2!=3 - +a (abcdef & $a0c0e0) = $a0c0e0 - +a (abcdef | $ff0001) = $ffcdef -; +a ($aa eor $55) = $ff - +a ($aa xor $55) = $ff + +a (abcdef & $a0c0e0) == $a0c0e0 + +a (abcdef | $ff0001) == $ffcdef +; +a ($aa eor $55) == $ff + +a ($aa xor $55) == $ff ; priorities - +a 3 + 4 * 5 = 23 - +a 4 * 5 + 3 = 23 + +a 3 + 4 * 5 == 23 + +a 4 * 5 + 3 == 23 +a 4.1 * 5.1 + 3.1 > 23.1 - +a (15 or 3 xor 5) = (15 or (3 xor 5)) + +a (15 or 3 xor 5) == (15 or (3 xor 5)) +a (15 or 3 xor 5) != ((15 or 3) xor 5) - +a (15 xor 3 and 5) = (15 xor (3 and 5)) + +a (15 xor 3 and 5) == (15 xor (3 and 5)) +a (15 xor 3 and 5) != ((15 xor 3) and 5) - +a (5 and 3 = 3) = (5 and (3 = 3)) - +a (5 and 3 = 3) != ((5 and 3) = 3) + +a (5 and 3 == 3) == (5 and (3 == 3)) + +a (5 and 3 == 3) != ((5 and 3) == 3) - +a (1 = 2 != 0) = (1 = (2 != 0)) - +a (1 = 2 != 0) != ((1 = 2) != 0) + +a (1 == 2 != 0) == (1 == (2 != 0)) + +a (1 == 2 != 0) != ((1 == 2) != 0) - +a (0 != 3 < 2) = (0 != (3 < 2)) + +a (0 != 3 < 2) == (0 != (3 < 2)) +a (0 != 3 < 2) != ((0 != 3) < 2) ; < and > comparisons have the same priority, so this actually checks left-associativity: - +a (3 <= 3 > 0) = ((3 <= 3) > 0) - +a (3 <= 3 > 0) != (3 <= (3 > 0)) + +a (3 <= 3 > 0) == ((3 <= 3) > 0) + +a (3 <= 3 > 0) != (3 <= (3 > 0)) - +a (<257 > 1) = ((<257) > 1) + +a (<257 > 1) == ((<257) > 1) +a (<257 > 1) != (<(257 > 1)) - +a (<256 >> 4) = (<(256 >> 4)) + +a (<256 >> 4) == (<(256 >> 4)) +a (<256 >> 4) != ((<256) >> 4) ; shifts have the same priority, so this actually checks left-associativity: - +a (16 >>> 2 >> 1) = ((16 >>> 2) >> 1) - +a (16 >>> 2 >> 1) != (16 >>> (2 >> 1)) - +a (16 >> 2 << 1) = ((16 >> 2) << 1) - +a (16 >> 2 << 1) != (16 >> (2 << 1)) - +a (8 << 4 >>> 2) = ((8 << 4) >>> 2) - +a (8 << 4 >>> 2) != (8 << (4 >>> 2)) + +a (16 >>> 2 >> 1) == ((16 >>> 2) >> 1) + +a (16 >>> 2 >> 1) != (16 >>> (2 >> 1)) + +a (16 >> 2 << 1) == ((16 >> 2) << 1) + +a (16 >> 2 << 1) != (16 >> (2 << 1)) + +a (8 << 4 >>> 2) == ((8 << 4) >>> 2) + +a (8 << 4 >>> 2) != (8 << (4 >>> 2)) - +a (3 >> 1 + 5) = (3 >> (1 + 5)) + +a (3 >> 1 + 5) == (3 >> (1 + 5)) +a (3 >> 1 + 5) != ((3 >> 1) + 5) ; + and - have the same priority, so this actually checks left-associativity: - +a (3 - 5 + 7) = ((3 - 5) + 7) - +a (3 - 5 + 7) != (3 - (5 + 7)) + +a (3 - 5 + 7) == ((3 - 5) + 7) + +a (3 - 5 + 7) != (3 - (5 + 7)) ; test left-associativity - +a 11-5-3 = 3 + +a 11-5-3 == 3 +a 11-5-3 != 9 - +a (3 + 5 * 7) = (3 + (5 * 7)) + +a (3 + 5 * 7) == (3 + (5 * 7)) +a (3 + 5 * 7) != ((3 + 5) * 7) ; *, /, DIV and MOD have the same priority, so this actually checks left-associativity: - +a (7 * 5 MOD 7) = ((7 * 5) MOD 7) - +a (7 * 5 MOD 7) != (7 * (5 MOD 7)) + +a (7 * 5 MOD 7) == ((7 * 5) MOD 7) + +a (7 * 5 MOD 7) != (7 * (5 MOD 7)) - +a (-14 + 5) = ((-14) + 5) + +a (-14 + 5) == ((-14) + 5) +a (-14 + 5) != (-(14 + 5)) - +a (-3^2) = -(3^2) + +a (-3^2) == -(3^2) +a (-3^2) != (-3)^2 ; test right-associativity - +a 2^3^4 = 2^(3^4) + +a 2^3^4 == 2^(3^4) +a 2^3^4 != (2^3)^4 - +a NOT 3 ^ 5 = ((NOT 3) ^ 5) - +a NOT 3 ^ 5 != (NOT (3 ^ 5)) + +a NOT 3 ^ 5 == ((NOT 3) ^ 5) + +a NOT 3 ^ 5 != (NOT (3 ^ 5)) - +a int(3 + 4) + .8 = (int(3 + 4) + .8) + +a int(3 + 4) + .8 == (int(3 + 4) + .8) +a int(3 + 4) + .8 != int((3 + 4) + .8) - +a 3*(4+5)+7 = (3*(4+5))+7 + +a 3*(4+5)+7 == (3*(4+5))+7 +a 3*(4+5)+7 != 3*((4+5)+7) ; test dyadics with different arg types ; int/int - +a 3 ^ 2 = 9 - +a 3 * 2 = 6 - +a 6 / 2 = 3 - +a 5 DIV 2 = 2 - +a 3 + 2 = 5 - +a 6 - 4 = 2 + +a 3 ^ 2 == 9 + +a 3 * 2 == 6 + +a 6 / 2 == 3 + +a 5 DIV 2 == 2 + +a 3 + 2 == 5 + +a 6 - 4 == 2 +a 2 <= 3 +a 2 < 3 +a 3 >= 2 +a 3 > 2 +a 2 != 3 - +a 2 = 2 - +a 5 MOD 2 = 1 - +a 5 >>> 1 = 2 - +a (5 & 1) = 1 - +a (5 | 2) = 7 -; +a (5 EOR 2) = 7 - +a (5 XOR 2) = 7 - +a 5 << 2 = 20 - +a 5 >> 2 = 1 + +a 2 == 2 + +a 5 MOD 2 == 1 + +a 5 >>> 1 == 2 + +a (5 & 1) == 1 + +a (5 | 2) == 7 +; +a (5 EOR 2) == 7 + +a (5 XOR 2) == 7 + +a 5 << 2 == 20 + +a 5 >> 2 == 1 ; int/float - +a 3 ^ 2.0 = 9 - +a 3 * 2.0 = 6 - +a 6 / 2.0 = 3 - +a 5 DIV 2.0 = 2 - +a 3 + 2.0 = 5 - +a 6 - 4.0 = 2 + +a 3 ^ 2.0 == 9 + +a 3 * 2.0 == 6 + +a 6 / 2.0 == 3 + +a 5 DIV 2.0 == 2 + +a 3 + 2.0 == 5 + +a 6 - 4.0 == 2 +a 2 <= 3.0 +a 2 < 3.0 +a 3 >= 2.0 +a 3 > 2.0 +a 2 != 3.0 - +a 2 = 2.0 - +a 5 MOD 2.0 = 1 - +a 5 << 2.0 = 20 - +a 5 >> 2.0 = 1 + +a 2 == 2.0 + +a 5 MOD 2.0 == 1 + +a 5 << 2.0 == 20 + +a 5 >> 2.0 == 1 ; float/int - +a 3.0 ^ 2 = 9 - +a 3.0 * 2 = 6 - +a 6.0 / 2 = 3 - +a 5.0 DIV 2 = 2 - +a 3.0 + 2 = 5 - +a 6.0 - 4 = 2 + +a 3.0 ^ 2 == 9 + +a 3.0 * 2 == 6 + +a 6.0 / 2 == 3 + +a 5.0 DIV 2 == 2 + +a 3.0 + 2 == 5 + +a 6.0 - 4 == 2 +a 2.0 <= 3 +a 2.0 < 3 +a 3.0 >= 2 +a 3.0 > 2 +a 2.0 != 3 - +a 2.0 = 2 - +a 5.0 MOD 2 = 1 - +a 5.0 << 2 = 20 - +a 5.0 >> 2 = 1.25 + +a 2.0 == 2 + +a 5.0 MOD 2 == 1 + +a 5.0 << 2 == 20 + +a 5.0 >> 2 == 1.25 ; float/float - +a 3.0 ^ 2.0 = 9 - +a 3.0 * 2.0 = 6 - +a 6.0 / 2.0 = 3 - +a 5.0 DIV 2.0 = 2 - +a 3.0 + 2.0 = 5 - +a 6.0 - 4.0 = 2 + +a 3.0 ^ 2.0 == 9 + +a 3.0 * 2.0 == 6 + +a 6.0 / 2.0 == 3 + +a 5.0 DIV 2.0 == 2 + +a 3.0 + 2.0 == 5 + +a 6.0 - 4.0 == 2 +a 2.0 <= 3.0 +a 2.0 < 3.0 +a 3.0 >= 2.0 +a 3.0 > 2.0 +a 2.0 != 3.0 - +a 2.0 = 2.0 - +a 5.0 MOD 2.0 = 1 - +a 5.0 << 2.0 = 20 - +a 5.0 >> 2.0 = 1.25 + +a 2.0 == 2.0 + +a 5.0 MOD 2.0 == 1 + +a 5.0 << 2.0 == 20 + +a 5.0 >> 2.0 == 1.25