This example can be compiled with ACME.
In order to print a string, each character of the string needs to be copied into the A register followed by calling the CHROUT KERNAL API.
; Start of BASIC program *=$0801 ; BASIC "run" line !byte $0C,$08,$0A,$00,$9E,$20,$32,$30,$36,$34,$00,$00,$00 ; Start of actual program *=$0810 CHROUT=$FFD2 ; KERNAL API call to print character in register A ldx #0 ; X register used to index string loop: lda .mystring, x ; Load character from string into A register beq end ; If the character is 0, jump to end label jsr CHROUT ; Call KERNAL API to print char in A register inx ; Increment X register jmp loop ; Jump back to loop label to get next character end: rts ; Return to caller ; zero-terminated string containing a newline at the end (char# 13) .mystring !pet "hello, world!!",13,0
For a more in-depth walkthrough of the code, have a look at Hello World on Commander X16