ASCII to C64 Screen Codes In DASM Assembler

I'm learning assembly for the 6502 micro via a C64 emulator. Currently trying to output strings to the screen. Here is my code:

    processor 6502
    org $1000

    ldx #$00    ;using x register as column counter
    lda message,x;load a with x bit from message
    sta $0400,x ;store this bit in row 0 col 0 address
    inx         ;x++
    cpx #$05    ;is x >= 5?
    bne print   ;if not x >= 5, loop again
    rts         ;return from program

message dc "HELLO"
hexmsg dc $08,$05,$0c,$0c,$0f

Because my editor (notepad++ on win 10) uses ascii-like char-codes, the "HELLO" in message is bits 48 45 4C 4C 4F. This gives the following output in the top left corner of the screen: enter image description here

This is correct I guess, by looking at the commodore screen codes table here.

If I change line 6 to lda hexmsg,x then I get exactly what I'm after, the word HELLO.

I'm not yet very familiar with DASM assembler and having trouble finding complete documentation of it (if it exists). Most tutorials I've found just have you declare message .byte "HELLO" or something similar and it just works because the assembler they are using auto-converts the ascii-like text string to a commodore string automatically, but DASM doesn't seem to do that.

Does anyone know a way I can either get DASM to do this, or recommend another way to simply type strings into the assembler rather than manually typing my strings as a bunch of hex data?


  • Here is patched version of DASM aseembler.

    You can use SCRU and SCRL directives to convert ASCII->Screencode conversion.

    label SCRU  "string"
    label SCRL  "string"

    SCRU is for making uppercase text even if entered lowercase. SCRL keeps casing.