2019-02-17 23:12:29 +00:00
|
|
|
// Arrays / strings allocated inline destroy functions (because they are allocated where the call enters.
|
|
|
|
// The following places the text at the start of the main-function - and JSR's straight into the text - not the code.
|
2020-12-21 07:57:41 +00:00
|
|
|
// Commodore 64 PRG executable file
|
|
|
|
.file [name="inlinearrayproblem.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
|
2017-11-27 22:55:39 +00:00
|
|
|
:BasicUpstart(main)
|
2018-01-31 20:27:22 +00:00
|
|
|
.label SCREEN = $400
|
|
|
|
.label SCREEN2 = $400+$28
|
2020-12-21 07:57:41 +00:00
|
|
|
.segment Code
|
2017-11-27 22:55:39 +00:00
|
|
|
main: {
|
|
|
|
ldx #0
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2020-02-23 08:44:36 +00:00
|
|
|
// SCREEN[i] = txt[i]
|
2017-11-27 22:55:39 +00:00
|
|
|
lda txt,x
|
|
|
|
sta SCREEN,x
|
2020-02-23 08:44:36 +00:00
|
|
|
// SCREEN2[i] = data[i]
|
2017-11-27 22:55:39 +00:00
|
|
|
lda data,x
|
|
|
|
sta SCREEN2,x
|
2020-02-23 08:44:36 +00:00
|
|
|
// for( byte i : 0..3)
|
2017-11-27 22:55:39 +00:00
|
|
|
inx
|
|
|
|
cpx #4
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b1
|
2020-02-23 08:44:36 +00:00
|
|
|
// }
|
2017-11-27 22:55:39 +00:00
|
|
|
rts
|
2020-12-21 07:57:41 +00:00
|
|
|
.segment Data
|
2017-11-27 22:55:39 +00:00
|
|
|
txt: .text "qwe"
|
|
|
|
data: .byte 1, 2, 3
|
|
|
|
}
|