1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-16 21:07:56 +00:00
kickc/src/test/ref/ternary-1.asm

33 lines
623 B
NASM
Raw Normal View History

// Tests the ternary operator
// Commodore 64 PRG executable file
.file [name="ternary-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.segment Code
main: {
.label SCREEN = $400
ldx #0
__b1:
2020-02-23 08:44:36 +00:00
// i<5?'a':'b'
cpx #5
bcc __b2
lda #'b'
jmp __b3
__b2:
// i<5?'a':'b'
lda #'a'
__b3:
2020-02-23 08:44:36 +00:00
// SCREEN[i] = i<5?'a':'b'
sta SCREEN,x
2020-02-23 08:44:36 +00:00
// for( byte i: 0..9)
inx
cpx #$a
bne __b1
2020-02-23 08:44:36 +00:00
// }
rts
}