mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-27 09:31:18 +00:00
Fixed const casting problem
This commit is contained in:
parent
979cb91eeb
commit
f212c55c02
@ -78,7 +78,7 @@ public class AsmFormat {
|
||||
}
|
||||
} else if(Operators.CAST_WORD.equals(operator) || Operators.CAST_SWORD.equals(operator) || Operators.CAST_PTRBY.equals(operator)) {
|
||||
SymbolType operandType = SymbolTypeInference.inferType(program.getScope(), operand);
|
||||
if(SymbolType.isWord(operandType) || SymbolType.isSWord(operandType)) {
|
||||
if(SymbolType.isWord(operandType) || SymbolType.isSWord(operandType) || SymbolType.isByte(operandType) || SymbolType.isSByte(operandType) || operandType instanceof SymbolTypePointer) {
|
||||
// No cast needed
|
||||
return getAsmConstant(program, operand, outerPrecedence, codeScope);
|
||||
} else {
|
||||
|
@ -17,14 +17,8 @@ public class Operator {
|
||||
this.asmOperator = asmOperator;
|
||||
}
|
||||
|
||||
// Constant Evaluation / Calculation (ParseTreeConstantEvaluator / Pass2ConstantIdentification / ConstantValueCalculator)
|
||||
|
||||
// Type Inference (SymbolTypeInference)
|
||||
|
||||
// Constant ASM formatting (AsmFormat)
|
||||
|
||||
|
||||
|
||||
public String getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ main: {
|
||||
sta FGCOL
|
||||
lda #BMM|DEN|RSEL|3
|
||||
sta D011
|
||||
lda #($ffff&SCREEN)/$40|($ffff&BITMAP)/$400
|
||||
lda #SCREEN/$40|BITMAP/$400
|
||||
sta D018
|
||||
jsr init_screen
|
||||
jsr init_plot_tables
|
||||
|
@ -4290,7 +4290,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 #($ffff&SCREEN)/$40|($ffff&BITMAP)/$400
|
||||
lda #SCREEN/$40|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]
|
||||
@ -5641,7 +5641,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 #($ffff&SCREEN)/$40|($ffff&BITMAP)/$400
|
||||
lda #SCREEN/$40|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]
|
||||
@ -7072,7 +7072,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 #($ffff&SCREEN)/$40|($ffff&BITMAP)/$400
|
||||
lda #SCREEN/$40|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]
|
||||
|
@ -19,7 +19,7 @@ main: {
|
||||
sta FGCOL
|
||||
lda #BMM|DEN|RSEL|3
|
||||
sta D011
|
||||
lda #($ffff&SCREEN)/$40|($ffff&BITMAP)/$400
|
||||
lda #SCREEN/$40|BITMAP/$400
|
||||
sta D018
|
||||
jsr init_screen
|
||||
jsr init_plot_tables
|
||||
|
@ -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 #($ffff&SCREEN)/$40|($ffff&BITMAP)/$400
|
||||
lda #SCREEN/$40|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 #($ffff&SCREEN)/$40|($ffff&BITMAP)/$400
|
||||
lda #SCREEN/$40|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 #($ffff&SCREEN)/$40|($ffff&BITMAP)/$400
|
||||
lda #SCREEN/$40|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]
|
||||
|
@ -19,7 +19,7 @@ sin8u_table: {
|
||||
.const min = $a
|
||||
.const max = $ff
|
||||
.label amplitude = max-min
|
||||
.const sum = ($ffff&min)+max
|
||||
.const sum = min+max
|
||||
.const mid = (sum>>1)+1
|
||||
.label step = $12
|
||||
.label sinx = $11
|
||||
|
@ -7071,7 +7071,7 @@ sin8u_table: {
|
||||
.const min = $a
|
||||
.const max = $ff
|
||||
.label amplitude = max-min
|
||||
.const sum = ($ffff&min)+max
|
||||
.const sum = min+max
|
||||
.const mid = (sum>>1)+1
|
||||
.label _21 = $39
|
||||
.label step = $30
|
||||
@ -8770,7 +8770,7 @@ sin8u_table: {
|
||||
.const min = $a
|
||||
.const max = $ff
|
||||
.label amplitude = max-min
|
||||
.const sum = ($ffff&min)+max
|
||||
.const sum = min+max
|
||||
.const mid = (sum>>1)+1
|
||||
.label step = $12
|
||||
.label sinx = $11
|
||||
@ -10674,7 +10674,7 @@ sin8u_table: {
|
||||
.const min = $a
|
||||
.const max = $ff
|
||||
.label amplitude = max-min
|
||||
.const sum = ($ffff&min)+max
|
||||
.const sum = min+max
|
||||
.const mid = (sum>>1)+1
|
||||
.label step = $12
|
||||
.label sinx = $11
|
||||
|
Loading…
Reference in New Issue
Block a user