4.7. Char Values

Char values, or characters, are used like this:

        lda #'H'
        sta $0400
        lda #'i'
        sta $0401

        lda #"?!#".charAt(1)
        sta $0402

        .byte 'H','e','l','l','o',' '
        .text "World"+'!'

In the above example, chars are used in two ways. In the first examples their numeric representation are used as arguments to the lda commands and in the final example, '!'s string representation is appended to the "World" string.

Char values is a subclass of number values, which means that it has all the functions that are placed on the number values, so you can do stuff like.

        lda #’H’+1 // Same as lda #’I’
        sta $0400
        lda #’A’+1 // Same as lda #’B’
        sta $0401
        lda #’L’+1 // Same as lda #’M’
        sta $0402