diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFormat.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFormat.java index 075fc77e0..48ca0547b 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFormat.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFormat.java @@ -66,7 +66,7 @@ public class AsmFormat { // No cast needed return getAsmConstant(program, operand, outerPrecedence, codeScope); } else { - return "$ff & " + getAsmConstant(program, operand, Operator.BOOL_AND.getPrecedence(), codeScope); + return getAsmConstant(program, new ConstantBinary(new ConstantInteger((long)0xff), Operator.BOOL_AND, operand), outerPrecedence, codeScope); } } else if(Operator.CAST_WORD.equals(operator) || Operator.CAST_SWORD.equals(operator) || Operator.CAST_PTRBY.equals(operator)) { SymbolType operandType = SymbolTypeInference.inferType(program.getScope(), operand); @@ -74,7 +74,7 @@ public class AsmFormat { // No cast needed return getAsmConstant(program, operand, outerPrecedence, codeScope); } else { - return "$ffff & " + getAsmConstant(program, operand, Operator.BOOL_AND.getPrecedence(), codeScope); + return getAsmConstant(program, new ConstantBinary(new ConstantInteger((long)0xffff), Operator.BOOL_AND, operand), outerPrecedence, codeScope); } } else if(Operator.CAST_DWORD.equals(operator) || Operator.CAST_SDWORD.equals(operator)) { SymbolType operandType = SymbolTypeInference.inferType(program.getScope(), operand); @@ -82,7 +82,7 @@ public class AsmFormat { // No cast needed return getAsmConstant(program, operand, outerPrecedence, codeScope); } else { - return "$ffffffff & " + getAsmConstant(program, operand, Operator.BOOL_AND.getPrecedence(), codeScope); + return getAsmConstant(program, new ConstantBinary(new ConstantInteger((long)0xffffffff), Operator.BOOL_AND, operand), outerPrecedence, codeScope); } } else if(Operator.LOWBYTE.equals(operator)) { SymbolType operandType = SymbolTypeInference.inferType(program.getScope(), operand); @@ -91,7 +91,7 @@ public class AsmFormat { } else if(SymbolType.isWord(operandType) || SymbolType.isSWord(operandType) || operandType instanceof SymbolTypePointer) { return "<" + getAsmConstant(program, operand, outerPrecedence, codeScope); } else if(SymbolType.isDWord(operandType) || SymbolType.isSDWord(operandType)) { - return getAsmConstant(program, operand, outerPrecedence, codeScope) + "&$ffff"; + return getAsmConstant(program, new ConstantBinary(operand, Operator.BOOL_AND, new ConstantInteger((long)0xffff)), outerPrecedence, codeScope); } else { throw new CompileError("Unhandled type "+operand); } @@ -102,14 +102,14 @@ public class AsmFormat { } else if(SymbolType.isWord(operandType) || SymbolType.isSWord(operandType) || operandType instanceof SymbolTypePointer) { return ">" + getAsmConstant(program, operand, outerPrecedence, codeScope); } else if(SymbolType.isDWord(operandType) || SymbolType.isSDWord(operandType)) { - return getAsmConstant(program, operand, outerPrecedence, codeScope) + ">>16"; + return getAsmConstant(program, new ConstantBinary(operand, Operator.SHIFT_RIGHT, new ConstantInteger((long)16)), outerPrecedence, codeScope); } else { throw new CompileError("Unhandled type "+operand); } } else if(Operator.INCREMENT.equals(operator)) { - return getAsmConstant(program, operand, Operator.PLUS.getPrecedence(), codeScope) + "+1"; + return getAsmConstant(program, new ConstantBinary(operand, Operator.PLUS, new ConstantInteger((long)1)), outerPrecedence, codeScope); } else if(Operator.DECREMENT.equals(operator)) { - return getAsmConstant(program, operand, Operator.PLUS.getPrecedence(), codeScope) + "-1"; + return getAsmConstant(program, new ConstantBinary(operand, Operator.MINUS, new ConstantInteger((long)1)), outerPrecedence, codeScope); } else { return operator.getOperator() + getAsmConstant(program, operand, operator.getPrecedence(), codeScope); diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.asm b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.asm index 20b828a76..6353c1fb8 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.asm @@ -18,7 +18,7 @@ main: { sta FGCOL lda #BMM|DEN|RSEL|3 sta D011 - lda #$ff & ($ffff & SCREEN/$40|$ffff & BITMAP/$400) + lda #$ff&(($ffff&SCREEN)/$40|($ffff&BITMAP)/$400) sta D018 jsr init_screen jsr init_plot_tables diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log index 66edc9e1c..9a031e4ee 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-bresenham.log @@ -4288,7 +4288,7 @@ main: { lda #BMM|DEN|RSEL|3 sta D011 //SEG12 [7] *((const byte*) D018#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) BITMAP#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #$ff & ($ffff & SCREEN/$40|$ffff & BITMAP/$400) + lda #$ff&(($ffff&SCREEN)/$40|($ffff&BITMAP)/$400) sta D018 //SEG13 [8] call init_screen param-assignment [ ] ( main:2 [ ] ) //SEG14 [180] phi from main to init_screen [phi:main->init_screen] @@ -5639,7 +5639,7 @@ main: { lda #BMM|DEN|RSEL|3 sta D011 //SEG12 [7] *((const byte*) D018#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) BITMAP#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #$ff & ($ffff & SCREEN/$40|$ffff & BITMAP/$400) + lda #$ff&(($ffff&SCREEN)/$40|($ffff&BITMAP)/$400) sta D018 //SEG13 [8] call init_screen param-assignment [ ] ( main:2 [ ] ) //SEG14 [180] phi from main to init_screen [phi:main->init_screen] @@ -7070,7 +7070,7 @@ main: { lda #BMM|DEN|RSEL|3 sta D011 //SEG12 [7] *((const byte*) D018#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) BITMAP#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #$ff & ($ffff & SCREEN/$40|$ffff & BITMAP/$400) + lda #$ff&(($ffff&SCREEN)/$40|($ffff&BITMAP)/$400) sta D018 //SEG13 [8] call init_screen param-assignment [ ] ( main:2 [ ] ) //SEG14 [180] phi from main to init_screen [phi:main->init_screen] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.asm b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.asm index 5933406dc..1dd17964b 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.asm @@ -19,7 +19,7 @@ main: { sta FGCOL lda #BMM|DEN|RSEL|3 sta D011 - lda #$ff & ($ffff & SCREEN/$40|$ffff & BITMAP/$400) + lda #$ff&(($ffff&SCREEN)/$40|($ffff&BITMAP)/$400) sta D018 jsr init_screen jsr init_plot_tables diff --git a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log index b24375471..807a14e0c 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/bitmap-plotter.log @@ -1783,7 +1783,7 @@ main: { lda #BMM|DEN|RSEL|3 sta D011 //SEG12 [7] *((const byte*) D018#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) BITMAP#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #$ff & ($ffff & SCREEN/$40|$ffff & BITMAP/$400) + lda #$ff&(($ffff&SCREEN)/$40|($ffff&BITMAP)/$400) sta D018 //SEG13 [8] call init_screen param-assignment [ ] ( main:2 [ ] ) //SEG14 [63] phi from main to init_screen [phi:main->init_screen] @@ -2321,7 +2321,7 @@ main: { lda #BMM|DEN|RSEL|3 sta D011 //SEG12 [7] *((const byte*) D018#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) BITMAP#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #$ff & ($ffff & SCREEN/$40|$ffff & BITMAP/$400) + lda #$ff&(($ffff&SCREEN)/$40|($ffff&BITMAP)/$400) sta D018 //SEG13 [8] call init_screen param-assignment [ ] ( main:2 [ ] ) //SEG14 [63] phi from main to init_screen [phi:main->init_screen] @@ -2912,7 +2912,7 @@ main: { lda #BMM|DEN|RSEL|3 sta D011 //SEG12 [7] *((const byte*) D018#0) ← ((byte))((word))(const byte*) SCREEN#0/(byte/signed byte/word/signed word/dword/signed dword) 64|((word))(const byte*) BITMAP#0/(word/signed word/dword/signed dword) 1024 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #$ff & ($ffff & SCREEN/$40|$ffff & BITMAP/$400) + lda #$ff&(($ffff&SCREEN)/$40|($ffff&BITMAP)/$400) sta D018 //SEG13 [8] call init_screen param-assignment [ ] ( main:2 [ ] ) //SEG14 [63] phi from main to init_screen [phi:main->init_screen] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/cast-precedence-problem.asm b/src/test/java/dk/camelot64/kickc/test/ref/cast-precedence-problem.asm index 7c3f42e12..de555ab33 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/cast-precedence-problem.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/cast-precedence-problem.asm @@ -10,7 +10,7 @@ main: { .const sumw = min+max .const sumb = min+max .const midb = (sumb>>1)+1 - .const midw = $ff & sumw>>1+1 + .const midw = ($ff&sumw>>1)+1 lda #midw sta SCREEN+0 lda #midb diff --git a/src/test/java/dk/camelot64/kickc/test/ref/cast-precedence-problem.log b/src/test/java/dk/camelot64/kickc/test/ref/cast-precedence-problem.log index 9f7e578d9..d930d02ae 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/cast-precedence-problem.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/cast-precedence-problem.log @@ -346,7 +346,7 @@ main: { .const sumw = min+max .const sumb = min+max .const midb = (sumb>>1)+1 - .const midw = $ff & sumw>>1+1 + .const midw = ($ff&sumw>>1)+1 //SEG9 [4] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 0) ← (const byte) main::midw#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 lda #midw sta SCREEN+0 @@ -421,7 +421,7 @@ main: { .const sumw = min+max .const sumb = min+max .const midb = (sumb>>1)+1 - .const midw = $ff & sumw>>1+1 + .const midw = ($ff&sumw>>1)+1 //SEG9 [4] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 0) ← (const byte) main::midw#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 lda #midw sta SCREEN+0 @@ -520,7 +520,7 @@ main: { .const sumw = min+max .const sumb = min+max .const midb = (sumb>>1)+1 - .const midw = $ff & sumw>>1+1 + .const midw = ($ff&sumw>>1)+1 //SEG9 [4] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 0) ← (const byte) main::midw#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 lda #midw sta SCREEN+0 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/constants.asm b/src/test/java/dk/camelot64/kickc/test/ref/constants.asm index 81344548e..e8a7d33f2 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/constants.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/constants.asm @@ -20,7 +20,7 @@ test_sbytes: { .const bb = 0 .const bc = bb+2 .const bd = bc-4 - .const bf = $ff & -$7f-$7f + .const bf = $ff&-$7f-$7f .const be = -bd lda #0 sta assert_sbyte.c diff --git a/src/test/java/dk/camelot64/kickc/test/ref/constants.log b/src/test/java/dk/camelot64/kickc/test/ref/constants.log index 7ab5aff88..4d6b08683 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/constants.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/constants.log @@ -2564,7 +2564,7 @@ test_sbytes: { .const bb = 0 .const bc = bb+2 .const bd = bc-4 - .const bf = $ff & -$7f-$7f + .const bf = $ff&-$7f-$7f .const be = -bd //SEG23 [12] call assert_sbyte param-assignment [ line_cursor#1 ] ( main:2::test_sbytes:9 [ line_cursor#1 ] ) //SEG24 [22] phi from test_sbytes to assert_sbyte [phi:test_sbytes->assert_sbyte] @@ -3202,7 +3202,7 @@ test_sbytes: { .const bb = 0 .const bc = bb+2 .const bd = bc-4 - .const bf = $ff & -$7f-$7f + .const bf = $ff&-$7f-$7f .const be = -bd //SEG23 [12] call assert_sbyte param-assignment [ line_cursor#1 ] ( main:2::test_sbytes:9 [ line_cursor#1 ] ) //SEG24 [22] phi from test_sbytes to assert_sbyte [phi:test_sbytes->assert_sbyte] @@ -3966,7 +3966,7 @@ test_sbytes: { .const bb = 0 .const bc = bb+2 .const bd = bc-4 - .const bf = $ff & -$7f-$7f + .const bf = $ff&-$7f-$7f .const be = -bd //SEG23 [12] call assert_sbyte param-assignment [ line_cursor#1 ] ( main:2::test_sbytes:9 [ line_cursor#1 ] ) //SEG24 [22] phi from test_sbytes to assert_sbyte [phi:test_sbytes->assert_sbyte] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/signed-words.asm b/src/test/java/dk/camelot64/kickc/test/ref/signed-words.asm index a60704614..e6a5a1d40 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/signed-words.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/signed-words.asm @@ -183,7 +183,7 @@ init: { sta SPRITES_YPOS+0 lda #WHITE sta SPRITES_COLS+0 - lda #$ff & SPRITE/$40 + lda #$ff&SPRITE/$40 sta SPRITES_PTR+0 lda #init::@1] b1_from_init: @@ -2325,7 +2325,7 @@ init: { lda #WHITE sta SPRITES_COLS+0 //SEG82 [40] *((const byte*) SPRITES_PTR#0+(byte/signed byte/word/signed word/dword/signed dword) 0) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64 [ ] ( main:2::init:5 [ ] ) -- _deref_pbuc1=vbuc2 - lda #$ff & SPRITE/$40 + lda #$ff&SPRITE/$40 sta SPRITES_PTR+0 //SEG83 [41] phi from init to init::@1 [phi:init->init::@1] b1_from_init: @@ -2828,7 +2828,7 @@ init: { lda #WHITE sta SPRITES_COLS+0 //SEG82 [40] *((const byte*) SPRITES_PTR#0+(byte/signed byte/word/signed word/dword/signed dword) 0) ← ((byte))(const byte*) SPRITE#0/(byte/signed byte/word/signed word/dword/signed dword) 64 [ ] ( main:2::init:5 [ ] ) -- _deref_pbuc1=vbuc2 - lda #$ff & SPRITE/$40 + lda #$ff&SPRITE/$40 sta SPRITES_PTR+0 //SEG83 [41] phi from init to init::@1 [phi:init->init::@1] //SEG84 [41] phi (byte*) init::sc#2 = (const byte*) SCREEN#0 [phi:init->init::@1#0] -- pbuz1=pbuc1 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.asm b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.asm index 7f70c7d9d..7ec6a7e75 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.asm @@ -539,7 +539,7 @@ place_sprites: { lda #$3c sta spr_x ldy #0 - lda #$ff & sprites/$40 + lda #$ff&sprites/$40 sta spr_id b1: lda spr_id diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log index 5fd8bf8ee..3af2bff52 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinus-sprites.log @@ -7706,7 +7706,7 @@ place_sprites: { lda #0 sta j //SEG460 [218] phi (byte) place_sprites::spr_id#2 = ((byte))(const byte*) sprites#0/(byte/signed byte/word/signed word/dword/signed dword) 64 [phi:place_sprites->place_sprites::@1#4] -- vbuz1=vbuc1 - lda #$ff & sprites/$40 + lda #$ff&sprites/$40 sta spr_id jmp b1 //SEG461 [218] phi from place_sprites::@1 to place_sprites::@1 [phi:place_sprites::@1->place_sprites::@1] @@ -9384,7 +9384,7 @@ place_sprites: { //SEG459 [218] phi (byte) place_sprites::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:place_sprites->place_sprites::@1#3] -- vbuyy=vbuc1 ldy #0 //SEG460 [218] phi (byte) place_sprites::spr_id#2 = ((byte))(const byte*) sprites#0/(byte/signed byte/word/signed word/dword/signed dword) 64 [phi:place_sprites->place_sprites::@1#4] -- vbuz1=vbuc1 - lda #$ff & sprites/$40 + lda #$ff&sprites/$40 sta spr_id jmp b1 //SEG461 [218] phi from place_sprites::@1 to place_sprites::@1 [phi:place_sprites::@1->place_sprites::@1] @@ -11112,7 +11112,7 @@ place_sprites: { //SEG459 [218] phi (byte) place_sprites::j#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:place_sprites->place_sprites::@1#3] -- vbuyy=vbuc1 ldy #0 //SEG460 [218] phi (byte) place_sprites::spr_id#2 = ((byte))(const byte*) sprites#0/(byte/signed byte/word/signed word/dword/signed dword) 64 [phi:place_sprites->place_sprites::@1#4] -- vbuz1=vbuc1 - lda #$ff & sprites/$40 + lda #$ff&sprites/$40 sta spr_id //SEG461 [218] phi from place_sprites::@1 to place_sprites::@1 [phi:place_sprites::@1->place_sprites::@1] //SEG462 [218] phi (byte) place_sprites::col#2 = (byte) place_sprites::col#1 [phi:place_sprites::@1->place_sprites::@1#0] -- register_copy diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen16.asm b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen16.asm index 30a0573a1..beee391fd 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen16.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen16.asm @@ -488,9 +488,9 @@ div32u16u: { sta divr16u.divisor lda #>main.wavelength sta divr16u.divisor+1 - lda #>16 + lda #>$10 sta divr16u.dividend - lda #>PI2_u4f28>>16 + lda #>PI2_u4f28>>$10 sta divr16u.dividend+1 lda #<0 sta divr16u.rem diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen16.log b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen16.log index d9631dfd4..cbd213178 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen16.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen16.log @@ -6614,9 +6614,9 @@ div32u16u: { lda #>main.wavelength sta divr16u.divisor+1 //SEG269 [142] phi (word) divr16u::dividend#5 = >(const dword) PI2_u4f28#0 [phi:div32u16u->divr16u#1] -- vwuz1=vwuc1 - lda #>16 + lda #>$10 sta divr16u.dividend - lda #>PI2_u4f28>>16 + lda #>PI2_u4f28>>$10 sta divr16u.dividend+1 //SEG270 [142] phi (word) divr16u::rem#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:div32u16u->divr16u#2] -- vwuz1=vbuc1 lda #<0 @@ -8023,9 +8023,9 @@ div32u16u: { lda #>main.wavelength sta divr16u.divisor+1 //SEG269 [142] phi (word) divr16u::dividend#5 = >(const dword) PI2_u4f28#0 [phi:div32u16u->divr16u#1] -- vwuz1=vwuc1 - lda #>16 + lda #>$10 sta divr16u.dividend - lda #>PI2_u4f28>>16 + lda #>PI2_u4f28>>$10 sta divr16u.dividend+1 //SEG270 [142] phi (word) divr16u::rem#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:div32u16u->divr16u#2] -- vwuz1=vbuc1 lda #<0 @@ -9444,9 +9444,9 @@ div32u16u: { lda #>main.wavelength sta divr16u.divisor+1 //SEG269 [142] phi (word) divr16u::dividend#5 = >(const dword) PI2_u4f28#0 [phi:div32u16u->divr16u#1] -- vwuz1=vwuc1 - lda #>16 + lda #>$10 sta divr16u.dividend - lda #>PI2_u4f28>>16 + lda #>PI2_u4f28>>$10 sta divr16u.dividend+1 //SEG270 [142] phi (word) divr16u::rem#10 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:div32u16u->divr16u#2] -- vwuz1=vbuc1 lda #<0 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.asm b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.asm index 253d9c607..6726efac9 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.asm @@ -490,9 +490,9 @@ div32u16u: { sta divr16u.divisor lda #>main.wavelength sta divr16u.divisor+1 - lda #>16 + lda #>$10 sta divr16u.dividend - lda #>PI2_u4f28>>16 + lda #>PI2_u4f28>>$10 sta divr16u.dividend+1 lda #<0 sta divr16u.rem diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.log b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.log index becc3381e..cb63b4f81 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinusgen8b.log @@ -8046,9 +8046,9 @@ div32u16u: { lda #>main.wavelength sta divr16u.divisor+1 //SEG265 [144] phi (word) divr16u::dividend#6 = >(const dword) PI2_u4f28#0 [phi:div32u16u->divr16u#1] -- vwuz1=vwuc1 - lda #>16 + lda #>$10 sta divr16u.dividend - lda #>PI2_u4f28>>16 + lda #>PI2_u4f28>>$10 sta divr16u.dividend+1 //SEG266 [144] phi (word) divr16u::rem#11 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:div32u16u->divr16u#2] -- vwuz1=vbuc1 lda #<0 @@ -10178,9 +10178,9 @@ div32u16u: { lda #>main.wavelength sta divr16u.divisor+1 //SEG265 [144] phi (word) divr16u::dividend#6 = >(const dword) PI2_u4f28#0 [phi:div32u16u->divr16u#1] -- vwuz1=vwuc1 - lda #>16 + lda #>$10 sta divr16u.dividend - lda #>PI2_u4f28>>16 + lda #>PI2_u4f28>>$10 sta divr16u.dividend+1 //SEG266 [144] phi (word) divr16u::rem#11 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:div32u16u->divr16u#2] -- vwuz1=vbuc1 lda #<0 @@ -12310,9 +12310,9 @@ div32u16u: { lda #>main.wavelength sta divr16u.divisor+1 //SEG265 [144] phi (word) divr16u::dividend#6 = >(const dword) PI2_u4f28#0 [phi:div32u16u->divr16u#1] -- vwuz1=vwuc1 - lda #>16 + lda #>$10 sta divr16u.dividend - lda #>PI2_u4f28>>16 + lda #>PI2_u4f28>>$10 sta divr16u.dividend+1 //SEG266 [144] phi (word) divr16u::rem#11 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:div32u16u->divr16u#2] -- vwuz1=vbuc1 lda #<0 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.asm b/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.asm index 77761a187..0d3aba1a3 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.asm @@ -20,7 +20,7 @@ sin8u_table: { .const max = $ff .label amplitude = max-min .const sum = min+max - .const mid = $ff & (sum>>1)+1 + .const mid = $ff&(sum>>1)+1 .label step = $12 .label sinx = $11 .label sinx_sc = $f diff --git a/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.log b/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.log index 5b12a509d..666af32c0 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/sinusgenscale8.log @@ -7064,7 +7064,7 @@ sin8u_table: { .const max = $ff .label amplitude = max-min .const sum = min+max - .const mid = $ff & (sum>>1)+1 + .const mid = $ff&(sum>>1)+1 .label _20 = $39 .label step = $30 .label sinx = $33 @@ -8763,7 +8763,7 @@ sin8u_table: { .const max = $ff .label amplitude = max-min .const sum = min+max - .const mid = $ff & (sum>>1)+1 + .const mid = $ff&(sum>>1)+1 .label step = $12 .label sinx = $11 .label sinx_sc = $f @@ -10667,7 +10667,7 @@ sin8u_table: { .const max = $ff .label amplitude = max-min .const sum = min+max - .const mid = $ff & (sum>>1)+1 + .const mid = $ff&(sum>>1)+1 .label step = $12 .label sinx = $11 .label sinx_sc = $f diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-lohiconst.asm b/src/test/java/dk/camelot64/kickc/test/ref/test-lohiconst.asm index cdd9c1245..2c09788b1 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-lohiconst.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-lohiconst.asm @@ -5,9 +5,9 @@ jsr main main: { .label SCREEN = $400 - lda #>PI_u4f28>>16 + lda #>PI_u4f28>>$10 sta SCREEN+0 - lda #>16 + lda #>$10 sta SCREEN+1 lda #>PI_u4f28&$ffff sta SCREEN+2 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-lohiconst.log b/src/test/java/dk/camelot64/kickc/test/ref/test-lohiconst.log index b46ad1bef..ee469755f 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-lohiconst.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-lohiconst.log @@ -241,10 +241,10 @@ bend: main: { .label SCREEN = $400 //SEG9 [4] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 0) ← >>(const dword) PI_u4f28#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #>PI_u4f28>>16 + lda #>PI_u4f28>>$10 sta SCREEN+0 //SEG10 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← <>(const dword) PI_u4f28#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #>16 + lda #>$10 sta SCREEN+1 //SEG11 [6] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← ><(const dword) PI_u4f28#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 lda #>PI_u4f28&$ffff @@ -297,10 +297,10 @@ bend: main: { .label SCREEN = $400 //SEG9 [4] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 0) ← >>(const dword) PI_u4f28#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #>PI_u4f28>>16 + lda #>PI_u4f28>>$10 sta SCREEN+0 //SEG10 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← <>(const dword) PI_u4f28#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #>16 + lda #>$10 sta SCREEN+1 //SEG11 [6] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← ><(const dword) PI_u4f28#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 lda #>PI_u4f28&$ffff @@ -362,10 +362,10 @@ Score: 36 main: { .label SCREEN = $400 //SEG9 [4] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 0) ← >>(const dword) PI_u4f28#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #>PI_u4f28>>16 + lda #>PI_u4f28>>$10 sta SCREEN+0 //SEG10 [5] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← <>(const dword) PI_u4f28#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 - lda #>16 + lda #>$10 sta SCREEN+1 //SEG11 [6] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← ><(const dword) PI_u4f28#0 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2 lda #>PI_u4f28&$ffff