2019-02-17 23:12:29 +00:00
|
|
|
// Inline Strings in method calls are automatically converted to local constant variables byte[] st = "..."; - generating an ASM .text).
|
2017-11-29 20:31:20 +00:00
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
|
|
|
.label screen = 2
|
|
|
|
main: {
|
2020-02-23 08:44:36 +00:00
|
|
|
// print(msg1)
|
2017-11-29 20:31:20 +00:00
|
|
|
lda #<$400
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z screen
|
2017-11-29 20:31:20 +00:00
|
|
|
lda #>$400
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z screen+1
|
2017-11-29 20:31:20 +00:00
|
|
|
lda #<msg1
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print.msg
|
2017-11-29 20:31:20 +00:00
|
|
|
lda #>msg1
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print.msg+1
|
2017-11-29 20:31:20 +00:00
|
|
|
jsr print
|
2020-02-23 08:44:36 +00:00
|
|
|
// print(msg2)
|
2017-11-29 20:31:20 +00:00
|
|
|
lda #<msg2
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print.msg
|
2017-11-29 20:31:20 +00:00
|
|
|
lda #>msg2
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print.msg+1
|
2017-11-29 20:31:20 +00:00
|
|
|
jsr print
|
2020-02-23 08:44:36 +00:00
|
|
|
// print("message 3 ")
|
2017-11-29 20:31:20 +00:00
|
|
|
lda #<msg
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print.msg
|
2017-11-29 20:31:20 +00:00
|
|
|
lda #>msg
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z print.msg+1
|
2017-11-29 20:31:20 +00:00
|
|
|
jsr print
|
2020-02-23 08:44:36 +00:00
|
|
|
// }
|
2017-11-29 20:31:20 +00:00
|
|
|
rts
|
2019-08-07 17:36:19 +00:00
|
|
|
msg2: .text "message 2 "
|
|
|
|
.byte 0
|
2019-11-03 16:05:55 +00:00
|
|
|
msg: .text "message 3 "
|
|
|
|
.byte 0
|
2017-11-29 20:31:20 +00:00
|
|
|
}
|
2019-12-26 08:51:41 +00:00
|
|
|
// print(byte* zp(4) msg)
|
2017-11-29 20:31:20 +00:00
|
|
|
print: {
|
|
|
|
.label msg = 4
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2020-02-23 08:44:36 +00:00
|
|
|
// while(*msg)
|
2017-11-29 20:31:20 +00:00
|
|
|
ldy #0
|
|
|
|
lda (msg),y
|
2019-08-07 17:48:56 +00:00
|
|
|
cmp #0
|
2019-09-29 21:13:37 +00:00
|
|
|
bne __b2
|
2020-02-23 08:44:36 +00:00
|
|
|
// }
|
2017-11-29 20:31:20 +00:00
|
|
|
rts
|
2019-09-29 21:13:37 +00:00
|
|
|
__b2:
|
2020-02-23 08:44:36 +00:00
|
|
|
// *(screen++) = *(msg++)
|
2017-11-29 20:31:20 +00:00
|
|
|
ldy #0
|
|
|
|
lda (msg),y
|
|
|
|
sta (screen),y
|
2020-02-23 08:44:36 +00:00
|
|
|
// *(screen++) = *(msg++);
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z screen
|
2017-11-29 20:31:20 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z screen+1
|
2017-11-29 20:31:20 +00:00
|
|
|
!:
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z msg
|
2017-11-29 20:31:20 +00:00
|
|
|
bne !+
|
2019-08-07 19:00:19 +00:00
|
|
|
inc.z msg+1
|
2017-11-29 20:31:20 +00:00
|
|
|
!:
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __b1
|
2017-11-29 20:31:20 +00:00
|
|
|
}
|
2019-08-07 17:36:19 +00:00
|
|
|
msg1: .text "message 1 "
|
|
|
|
.byte 0
|