Search code examples
assemblypic18

Ways to display numbers in assembly language


In the following code below I am not sure what the D'93' and D'122' mean. The only time I have used assembly in the past hexadecimal numbers or binary numbers have been used. What does this notation mean and how can I convert into something I can understand so I can check the math by hand?

#include <p18F452.inc>
SUM     EQU 0x10
        ORG 0x00
        GOTO START
        ORG 0x20
START:  MOVLW D'93'
        MOVWF SUM
        MOVLW D'122'
        ADDWF SUM,W
        BNC SAVE
        SETF WREG
SAVE:   MOVWF SUM
        SLEEP
        END

Solution

  • The D stands for decimal. By default unqualified numbers are interpreted as hexadecimal unless overridden by the RADIX or LIST directives.

    Qualifiers/prefixes used by MPASM:

    • B'10' for binary
    • O'10' for octal
    • D'10' for decimal (can also be written as .10)
    • H'10' for hexadecimal (can also be written as 0x10)
    • A'a' for ASCII (can also be written as 'a')