; sample assembly routine in 6502 assembly (works on VIC-20, Commodore 64, Commodore 128, probably most PETS) MESSAGE .asc "Hello, world!": .byte 0 ; message to print BSOUT = $ffd2 ; Commodore 8-bit kernal: output character to stdout VECTOR = $fb lda MESSAGE sta VECTOR+1 ldy #0 ; initialise loop registers tya - lda (VECTOR),y ; load a character from MESSAGE into accumulator beq + ; if zero, message is done clc ; clear carry (used as error flag) jsr BSOUT ; perform the output bcs + ; abort if error iny ; increment character count bne - ; loop back unless rolled over + rts ; return to caller