Code Warrior Error Message: Error A13003 Value is truncated by one byte

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Code Warrior Error Message: Error A13003 Value is truncated by one byte

1,907 Views
norticum
Contributor I
Hello Guys!

We work at this time on a MC9S08QG8 Demo Board and try to make some settings in the SOPT1 register.

We use following source code:

_Startup:
            LDHX   #RAMEnd+1        ; initialize the stack pointer
            TXS
            CLI                     ; enable interrupts
            mov #%00000011,SOPT1
            mov #%00001100,$0023     ;Rx/Tx enable
            mov #%01000001 ,$0021

At the compile process we get an error for the red marked line. We use following MC9S08QG8.inc file.

;*** SOPT1 - System Options Register 1; 0x00001802 ***
SOPT1:              equ    $00001802                                ;*** SOPT1 - System Options Register 1; 0x00001802 ***
; bit numbers for usage in BCLR, BSET, BRCLR and BRSET
SOPT1_RSTPE:        equ    0                                         ; RESET Pin Enable
SOPT1_BKGDPE:       equ    1                                         ; Background Debug Mode Pin Enable
SOPT1_STOPE:        equ    5                                         ; Stop Mode Enable
SOPT1_COPT:         equ    6                                         ; COP Watchdog Timeout
SOPT1_COPE:         equ    7                                         ; COP Watchdog Enable
; bit position masks
mSOPT1_RSTPE:       equ    %00000001
mSOPT1_BKGDPE:      equ    %00000010
mSOPT1_STOPE:       equ    %00100000
mSOPT1_COPT:        equ    %01000000
mSOPT1_COPE:        equ    %10000000

We try all possible different syntax without success.  Maybe someone can help us.

Best regards,

norticum
Labels (1)
0 Kudos
3 Replies

526 Views
JimDon
Senior Contributor III
Because MOV can only mov to page 0. It only has an 8 bit address field DIR address mode.

Code:
;
            LDA   #%00000011            STA   SOPT1

 You should download: HCS08RMV1.pdf

Direct Addressing Mode (DIR)
This addressing mode is used to access operands located in direct
address space ($0000 through $00FF). This is a more efficient
addressing mode than extended addressing because the upper 8 bits of
the address are implied rather than being explicitly provided in the
instruction. This saves a byte of program space and the bus cycle that
would have been needed to fetch this byte.
The programmer does not use any special syntax to choose this mode.
Rather, the assembler evaluates the label or expression in the operand
field and automatically chooses direct addressing mode if the resulting
address is in the range $0000 through $00FF. During execution, the
CPU gets the low byte of the direct address from the operand byte that
follows the opcode, appends a high byte of $00, and uses this 16-bit
address ($00xx) to access the intended operand.
Most of the I/O and control registers are located in the first 64 or
128 bytes of memory (a few rarely used registers are located in high
memory at $18xx). Some of the on-chip RAM is also located in the direct
page to allow frequently accessed variables to be located there so direct
addressing can be used. After reset, the stack pointer points at $00FF
and it is recommended that you change SP to point at the top of RAM
instead, to make the RAM below $00FF available for direct addressed
variables.



0 Kudos

526 Views
norticum
Contributor I

That`s It !!
Many thanks

norticum

0 Kudos

526 Views
JimDon
Senior Contributor III
Did you find that document?

It is the guide to asm programming. The appendix fully documents all the instructions.
A must have if you are doing asm programming.

I can also recommend HCS08 Unleashed: Designer's Guide To the HCS08 Microcontrollers

It does cover asm programming.


0 Kudos