1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-29 03:56:15 +00:00
kickc/src/test/ref/cast-precedence-problem.asm

35 lines
742 B
NASM
Raw Normal View History

2019-02-17 23:12:29 +00:00
// Tests that casting inside constants in the output handles precedence between cast and + correctly - should generate the following KA-expression ($ff & sumw>>1)+1
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
main: {
.label SCREEN = $400
.const min = $a
.const max = $c8
.label BGCOL = $d021
.const sumw = min+max
.const sumb = min+max
.const midw = (sumw>>1)+1
2019-10-20 15:06:17 +00:00
.const midb = (sumb>>1)+1
2020-02-23 08:44:36 +00:00
// SCREEN[0] = midw
lda #midw
sta SCREEN
2020-02-23 08:44:36 +00:00
// SCREEN[1] = midb
lda #midb
sta SCREEN+1
2020-02-23 08:44:36 +00:00
// if(SCREEN[0]==SCREEN[1])
lda SCREEN
cmp SCREEN+1
beq __b1
2020-02-23 08:44:36 +00:00
// *BGCOL = 2
lda #2
sta BGCOL
2020-02-23 08:44:36 +00:00
// }
rts
__b1:
2020-02-23 08:44:36 +00:00
// *BGCOL = 5
lda #5
sta BGCOL
2019-04-02 06:28:13 +00:00
rts
}