2019-04-20 23:22:14 +00:00
|
|
|
// Tests a word-array with 128+ elements
|
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
|
|
|
.const SIZEOF_WORD = 2
|
|
|
|
main: {
|
|
|
|
.label SCREEN = $400
|
2019-11-03 23:39:09 +00:00
|
|
|
.label __0 = 2
|
2020-04-19 09:05:54 +00:00
|
|
|
.label __1 = 2
|
2019-09-29 21:13:37 +00:00
|
|
|
.label __3 = 4
|
2020-04-19 09:05:54 +00:00
|
|
|
.label __6 = 2
|
|
|
|
.label __7 = 4
|
|
|
|
.label __8 = 4
|
2019-04-20 23:22:14 +00:00
|
|
|
ldx #0
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2020-04-19 09:05:54 +00:00
|
|
|
// ((word)i)*0x100
|
2019-04-20 23:22:14 +00:00
|
|
|
txa
|
2020-04-19 09:05:54 +00:00
|
|
|
sta.z __6
|
2019-04-20 23:22:14 +00:00
|
|
|
lda #0
|
2020-04-19 09:05:54 +00:00
|
|
|
sta.z __6+1
|
|
|
|
lda.z __0
|
2019-11-03 23:39:09 +00:00
|
|
|
sta.z __0+1
|
2019-07-15 21:45:52 +00:00
|
|
|
lda #0
|
2020-04-19 09:05:54 +00:00
|
|
|
sta.z __0
|
2020-02-23 08:44:36 +00:00
|
|
|
// ((word)i)*0x100+i
|
2019-04-20 23:22:14 +00:00
|
|
|
txa
|
|
|
|
clc
|
2020-04-19 09:05:54 +00:00
|
|
|
adc.z __1
|
|
|
|
sta.z __1
|
2019-04-20 23:22:14 +00:00
|
|
|
bcc !+
|
2020-04-19 09:05:54 +00:00
|
|
|
inc.z __1+1
|
2019-04-20 23:22:14 +00:00
|
|
|
!:
|
2020-02-23 08:44:36 +00:00
|
|
|
// words[(word)i] = ((word)i)*0x100+i
|
2020-04-19 09:05:54 +00:00
|
|
|
txa
|
|
|
|
sta.z __7
|
|
|
|
lda #0
|
|
|
|
sta.z __7+1
|
|
|
|
asl.z __3
|
|
|
|
rol.z __3+1
|
2019-04-20 23:22:14 +00:00
|
|
|
clc
|
2019-11-03 23:39:09 +00:00
|
|
|
lda.z __8
|
2019-04-20 23:22:14 +00:00
|
|
|
adc #<words
|
2019-11-03 23:39:09 +00:00
|
|
|
sta.z __8
|
|
|
|
lda.z __8+1
|
2019-04-20 23:22:14 +00:00
|
|
|
adc #>words
|
2019-11-03 23:39:09 +00:00
|
|
|
sta.z __8+1
|
2019-04-20 23:22:14 +00:00
|
|
|
ldy #0
|
2020-04-19 09:05:54 +00:00
|
|
|
lda.z __1
|
2019-11-03 23:39:09 +00:00
|
|
|
sta (__8),y
|
2019-04-20 23:22:14 +00:00
|
|
|
iny
|
2020-04-19 09:05:54 +00:00
|
|
|
lda.z __1+1
|
2019-11-03 23:39:09 +00:00
|
|
|
sta (__8),y
|
2020-02-23 08:44:36 +00:00
|
|
|
// for(byte i: 0..0xff)
|
2019-04-20 23:22:14 +00:00
|
|
|
inx
|
|
|
|
cpx #0
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1
|
2020-02-23 08:44:36 +00:00
|
|
|
// SCREEN[0] = words[(word)255]
|
2019-04-20 23:22:14 +00:00
|
|
|
lda words+$ff*SIZEOF_WORD
|
|
|
|
sta SCREEN
|
|
|
|
lda words+$ff*SIZEOF_WORD+1
|
|
|
|
sta SCREEN+1
|
2020-02-23 08:44:36 +00:00
|
|
|
// }
|
2019-04-20 23:22:14 +00:00
|
|
|
rts
|
|
|
|
}
|
|
|
|
words: .fill 2*$100, 0
|