; ============================================================= ; hello-world.asm - minimal C64 assembly program (ca65) ; ; c64 run examples/hello-world.asm ; c64 test examples/hello-world.asm -Until done -Expect "HELLO, WORLD!" ; ; Built with cc65's BASIC stub (10 SYS 2061): RUN starts at `start`. ; ============================================================= CINT = $FF81 ; Kernal: initialize screen editor (clears screen) CHROUT = $FFD2 ; Kernal: output character (BSOUT) .segment "CODE" start: jsr CINT ldx #0 ; X = index into message loop: lda msg,x ; load character beq done ; zero byte = end of message jsr CHROUT ; print it inx bne loop ; (X wraps at 256; the message is short) done: rts ; back to BASIC .segment "RODATA" ; ca65 converts strings to PETSCII: write lower case to get the upper-case ; letters the C64 shows by default. msg: .byte "hello, world!", $0D, 0