2019-06-02 22:44:46 +00:00
|
|
|
// Tests using integer conditions in && and || operator
|
|
|
|
// This should produce '01010101', '00110011', '00010001', '01110111' at the top of the screen
|
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
|
|
|
.label SCREEN = $400
|
|
|
|
main: {
|
2019-11-03 16:05:55 +00:00
|
|
|
.label __4 = 2
|
|
|
|
.label __5 = 3
|
|
|
|
.label __8 = 4
|
|
|
|
.label __9 = 5
|
2019-06-02 22:44:46 +00:00
|
|
|
ldx #0
|
|
|
|
ldy #0
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2020-02-23 08:44:36 +00:00
|
|
|
// i&1
|
2019-06-02 22:44:46 +00:00
|
|
|
tya
|
|
|
|
and #1
|
2020-02-23 08:44:36 +00:00
|
|
|
// if(i&1)
|
2019-06-02 22:44:46 +00:00
|
|
|
cmp #0
|
2019-09-29 21:13:37 +00:00
|
|
|
beq __b2
|
2020-02-23 08:44:36 +00:00
|
|
|
// (SCREEN+40*0)[idx] = '+'
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #'+'
|
|
|
|
sta SCREEN,x
|
2019-09-29 21:13:37 +00:00
|
|
|
__b2:
|
2020-02-23 08:44:36 +00:00
|
|
|
// i&2
|
2019-06-02 22:44:46 +00:00
|
|
|
tya
|
|
|
|
and #2
|
2020-02-23 08:44:36 +00:00
|
|
|
// if(i&2)
|
2019-06-02 22:44:46 +00:00
|
|
|
cmp #0
|
2019-09-29 21:13:37 +00:00
|
|
|
beq __b3
|
2020-02-23 08:44:36 +00:00
|
|
|
// (SCREEN+40*1)[idx] = '+'
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #'+'
|
|
|
|
sta SCREEN+$28*1,x
|
2019-09-29 21:13:37 +00:00
|
|
|
__b3:
|
2020-02-23 08:44:36 +00:00
|
|
|
// i&1
|
2019-06-02 22:44:46 +00:00
|
|
|
tya
|
|
|
|
and #1
|
2019-11-03 16:05:55 +00:00
|
|
|
sta.z __4
|
2020-02-23 08:44:36 +00:00
|
|
|
// i&2
|
2019-06-02 22:44:46 +00:00
|
|
|
tya
|
|
|
|
and #2
|
2019-11-03 16:05:55 +00:00
|
|
|
sta.z __5
|
2020-02-23 08:44:36 +00:00
|
|
|
// if(i&1 && i&2)
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #0
|
2019-11-03 16:05:55 +00:00
|
|
|
cmp.z __4
|
2019-09-29 21:13:37 +00:00
|
|
|
beq __b4
|
2019-11-03 16:05:55 +00:00
|
|
|
cmp.z __5
|
2019-09-29 21:13:37 +00:00
|
|
|
beq __b4
|
2020-02-23 08:44:36 +00:00
|
|
|
// (SCREEN+40*2)[idx] = '+'
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #'+'
|
|
|
|
sta SCREEN+$28*2,x
|
2019-09-29 21:13:37 +00:00
|
|
|
__b4:
|
2020-02-23 08:44:36 +00:00
|
|
|
// i&1
|
2019-06-02 22:44:46 +00:00
|
|
|
tya
|
|
|
|
and #1
|
2019-11-03 16:05:55 +00:00
|
|
|
sta.z __8
|
2020-02-23 08:44:36 +00:00
|
|
|
// i&2
|
2019-06-02 22:44:46 +00:00
|
|
|
tya
|
|
|
|
and #2
|
2019-11-03 16:05:55 +00:00
|
|
|
sta.z __9
|
2020-02-23 08:44:36 +00:00
|
|
|
// if(i&1 || i&2)
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #0
|
2019-11-03 16:05:55 +00:00
|
|
|
cmp.z __8
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b9
|
2019-11-03 16:05:55 +00:00
|
|
|
cmp.z __9
|
2019-09-29 21:13:37 +00:00
|
|
|
beq __b5
|
|
|
|
__b9:
|
2020-02-23 08:44:36 +00:00
|
|
|
// (SCREEN+40*3)[idx] = '+'
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #'+'
|
|
|
|
sta SCREEN+$28*3,x
|
2019-09-29 21:13:37 +00:00
|
|
|
__b5:
|
2020-02-23 08:44:36 +00:00
|
|
|
// idx++;
|
2019-06-02 22:44:46 +00:00
|
|
|
inx
|
2020-02-23 08:44:36 +00:00
|
|
|
// for( byte i:0..7)
|
2019-06-02 22:44:46 +00:00
|
|
|
iny
|
|
|
|
cpy #8
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1
|
2020-02-23 08:44:36 +00:00
|
|
|
// }
|
2019-06-02 22:44:46 +00:00
|
|
|
rts
|
|
|
|
}
|