2019-06-02 22:44:46 +00:00
|
|
|
// Tests using integer conditions in if()
|
|
|
|
// This should produce '0 0 0' at the top of the screen
|
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
|
|
|
.label SCREEN = $400
|
|
|
|
main: {
|
|
|
|
.label i1 = 2
|
|
|
|
lda #'0'
|
|
|
|
sta SCREEN
|
|
|
|
lda #' '
|
|
|
|
sta SCREEN+1
|
2019-08-25 20:21:56 +00:00
|
|
|
ldy #2
|
|
|
|
ldx #0
|
|
|
|
// loop byte
|
|
|
|
b3:
|
|
|
|
cpx #0
|
|
|
|
bne b4
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #'0'
|
2019-08-25 20:21:56 +00:00
|
|
|
sta SCREEN,y
|
2019-08-07 11:22:05 +00:00
|
|
|
iny
|
2019-08-25 20:21:56 +00:00
|
|
|
b4:
|
|
|
|
inx
|
|
|
|
cpx #3
|
2019-06-02 22:44:46 +00:00
|
|
|
bne b3
|
|
|
|
lda #' '
|
2019-08-25 20:21:56 +00:00
|
|
|
sta SCREEN,y
|
|
|
|
iny
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #<0
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z i1
|
|
|
|
sta.z i1+1
|
2019-08-25 20:21:56 +00:00
|
|
|
// loop word
|
|
|
|
b7:
|
|
|
|
lda.z i1+1
|
|
|
|
cmp #>0
|
|
|
|
bne b8
|
|
|
|
lda.z i1
|
|
|
|
cmp #<0
|
|
|
|
bne b8
|
2019-06-02 22:44:46 +00:00
|
|
|
lda #'0'
|
2019-08-25 20:21:56 +00:00
|
|
|
sta SCREEN,y
|
|
|
|
iny
|
2019-06-02 22:44:46 +00:00
|
|
|
b8:
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z i1
|
2019-06-02 22:44:46 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z i1+1
|
2019-06-02 22:44:46 +00:00
|
|
|
!:
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z i1+1
|
2019-06-02 22:44:46 +00:00
|
|
|
cmp #>3
|
|
|
|
bne b7
|
2019-08-07 19:00:19 +00:00
|
|
|
lda.z i1
|
2019-06-02 22:44:46 +00:00
|
|
|
cmp #<3
|
|
|
|
bne b7
|
|
|
|
rts
|
|
|
|
}
|